This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/34653] New: unnecessary REX prefix
- From: "dean at arctic dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jan 2008 19:07:27 -0000
- Subject: [Bug target/34653] New: unnecessary REX prefix
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
for this code:
extern unsigned long table[];
unsigned long foo(unsigned char *p) {
unsigned long long tag = *p;
return table[tag >> 4];
}
gcc generates:
0000000000000000 <foo>:
0: 0f b6 07 movzbl (%rdi),%eax
3: 48 c1 e8 04 shr $0x4,%rax
7: 48 8b 04 c5 00 00 00 mov 0x0(,%rax,8),%rax
e: 00
b: R_X86_64_32S table
f: c3 retq
that "shr $0x4,%rax" would be better as "shr $0x4,%eax" because it produces the
same result (due to dominating movzbl) and it's one byte shorter which favours
both space and the narrow decoder on the core2.
thanks
-dean
/home/odo/gcc/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/home/odo/gcc --disable-multilib
--disable-biarch x86_64-unknown-linux-gnu --enable-languages=c
Thread model: posix
gcc version 4.3.0 20071128 (experimental) (GCC)
--
Summary: unnecessary REX prefix
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dean at arctic dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34653