The s?addl and s?subl patterns don't work,as shown below, and cause an extra instruction to be generated. Test case: UP1500 gcc-tests # cat s_addl.c int f(int x, int y) { return 4 * x + y; } int g(int x) { return 3 * x; } Results with unpatched gcc-4.3.x UP1500 gcc-tests # gcc-unpatched -O3 -mcpu=ev67 -c s_addl.c UP1500 gcc-tests # objdump -d s_addl.o s_addl.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 <f>: 0: 40 04 11 42 s4addq a0,a1,v0 4: 00 00 e0 43 sextl v0,v0 <-- unnecessary 8: 01 80 fa 6b ret c: 00 00 fe 2f unop 0000000000000010 <g>: 10: 60 05 10 42 s4subq a0,a0,v0 14: 00 00 e0 43 sextl v0,v0 <-- unnecessary 18: 01 80 fa 6b ret 1c: 00 00 fe 2f unop Results with patched gcc-4.3.x UP1500 gcc-tests # gcc-patched -O3 -mcpu=ev67 -c s_addl.c UP1500 gcc-tests # objdump -d s_addl.o s_addl.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 <f>: 0: 40 00 11 42 s4addl a0,a1,v0 4: 01 80 fa 6b ret 8: 1f 04 ff 47 nop c: 00 00 fe 2f unop 0000000000000010 <g>: 10: 60 01 10 42 s4subl a0,a0,v0 14: 01 80 fa 6b ret 18: 1f 04 ff 47 nop 1c: 00 00 fe 2f unop Results with Compaq C compiler (what we're trying to replicate) UP1500 gcc-tests # ccc -fast -host -c s_addl.c UP1500 gcc-tests # objdump -d s_addl.o s_addl.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 <f>: 0: 40 00 11 42 s4addl a0,a1,v0 4: 01 80 fa 6b ret 8: 00 00 fe 2f unop c: 00 00 fe 2f unop 0000000000000010 <g>: 10: 60 01 10 42 s4subl a0,a0,v0 14: 01 80 fa 6b ret The patch is trivial and cannot hurt anything. Please add to gcc-4.3.x and gcc-4.4.x.
Created attachment 200873 [details, diff] Patch to enable s?addl and s?subl patterns I have tested the patch on gcc-4.3.4 and gcc-4.4.1.
Until upstream says this is the right way to do it, I'm not adding it. Please get them to accept the patch first.
Patch accepted. See http://gcc.gnu.org/viewcvs?view=rev&revision=150654 Reopening.
Ping. I know you're busy and all, but how were you able to respond within hours of the initial report and close the bug but can't follow up in more than two months when I provide what you request? I don't mean to sound impatient or harsh. I just don't understand.
being a missed optimization that's been around since 3.2, it doesn't exactly scream to the top of the priority list. ;) it's fixed in 4.4.2 which was released 2 days ago, and 4.3.5 which should be released "shortly".
if response times arent good enough for you, become a developer and resolve the issue yourself
4.4.2 is now in the tree. I'm not going to touch 4.3.* again if I don't have to.