[Bug target/32803] New: -Os: shorter load immediates for x86_64
dean at arctic dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 18 06:44:00 GMT 2007
gcc currently uses "mov $imm32,reg" and "mov $imm64,reg" for loading non-zero
immediates... these cost 5 and 11 bytes resp. for space optimizations there
are shorter choices.
for immediates -128..127 the following generates 64-bit sign-extended results
in 3 bytes:
push $imm8
pop %rax
the following generates immediates 0..255 with only 4 bytes (so given the above
sequence it's useful for 128..255):
xor %eax,%eax
mov $X,%al
the following generates powers of 2 in only 7 bytes (worthwhile only for powers
of 2 above 31):
xor %eax,%eax
bts $N,%eax
-dean
--
Summary: -Os: shorter load immediates for x86_64
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=32803
More information about the Gcc-bugs
mailing list