[Bug c/82940] New: Suboptimal code for (a & 0x7f) | (b & 0x80) on powerpc
christophe.leroy@c-s.fr
gcc-bugzilla@gcc.gnu.org
Fri Nov 10 15:39:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82940
Bug ID: 82940
Summary: Suboptimal code for (a & 0x7f) | (b & 0x80) on powerpc
Product: gcc
Version: 5.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: christophe.leroy@c-s.fr
Target Milestone: ---
unsigned char g(unsigned char t[], unsigned char v)
{
return (t[v & 0x7f] & 0x7f) | (v & 0x80);
}
00000008 <g>:
8: 54 89 06 7e clrlwi r9,r4,25
c: 7c 63 48 ae lbzx r3,r3,r9
10: 54 84 00 30 rlwinm r4,r4,0,0,24
14: 54 63 06 7e clrlwi r3,r3,25
18: 7c 63 23 78 or r3,r3,r4
1c: 4e 80 00 20 blr
I would expect
00000008 <g>:
8: 54 89 06 7e clrlwi r9,r4,25
c: 7c 63 48 ae lbzx r3,r3,r9
10: 54 84 00 30 rlwimi r3,r4,0,24,24
14: 4e 80 00 20 blr
More information about the Gcc-bugs
mailing list