Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 281040 (PR8603) - [4.3/4.4] s?addl pattern doesn't work on alpha
Summary: [4.3/4.4] s?addl pattern doesn't work on alpha
Status: RESOLVED FIXED
Alias: PR8603
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: Alpha Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/PR8603
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-10 21:37 UTC by Matt Turner
Modified: 2009-10-17 21:38 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to enable s?addl and s?subl patterns (enable-s4addl-pattern.patch,719 bytes, patch)
2009-08-10 21:39 UTC, Matt Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Turner gentoo-dev 2009-08-10 21:37:42 UTC
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.
Comment 1 Matt Turner gentoo-dev 2009-08-10 21:39:10 UTC
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.
Comment 2 Mark Loeser (RETIRED) gentoo-dev 2009-08-11 00:03:50 UTC
Until upstream says this is the right way to do it, I'm not adding it.  Please get them to accept the patch first.
Comment 3 Matt Turner gentoo-dev 2009-08-11 18:18:07 UTC
Patch accepted. See http://gcc.gnu.org/viewcvs?view=rev&revision=150654

Reopening.
Comment 4 Matt Turner gentoo-dev 2009-10-16 18:03:15 UTC
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.
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2009-10-17 20:36:17 UTC
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".
Comment 6 SpanKY gentoo-dev 2009-10-17 21:32:59 UTC
if response times arent good enough for you, become a developer and resolve the issue yourself
Comment 7 Mark Loeser (RETIRED) gentoo-dev 2009-10-17 21:38:04 UTC
4.4.2 is now in the tree.  I'm not going to touch 4.3.* again if I don't have to.