Bug#161432: [Bug target/8603] [Alpha] s?addl pattern doesn't work
------- Comment #6 from mattst88 at gmail dot com 2009-08-11 02:38 -------
To show how worthwhile this trivial patch is -- the following table shows the
number of times s{4,8}{add,sub}l are used in building the Linux kernel
(2.6.31-rc5) with unpatched and patched gcc (4.3.4).
unpatched patched
s4addl 53 395
s8addl 79 132
s4subl 0 111
s8subl 0 35
This patch also causes gcc to produce exactly the same output as Compaq's C
compiler (this is a good thing!) for the two test cases given in the report.
For example --
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
Please add to gcc-4.3.x and gcc-4.4.x.
--
mattst88 at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mattst88 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8603
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
Reply to: