[Bug rtl-optimization/48877] Inline asm for rdtsc generates silly code
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 5 06:52:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48877
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.05.05 06:50:18
CC| |jakub at gcc dot gnu.org,
| |vmakarov at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-05 06:50:18 UTC ---
If you use return __builtin_ia32_rdtsc (); instead, both 4.6 and 4.7 generate:
rdtsc
salq $32, %rdx
orq %rdx, %rax
ret
Current GCC trunk generates:
#APP
# 7 "pr48877.c" 1
rdtsc
# 0 "" 2
#NO_APP
salq $32, %rdx
orq %rax, %rdx
movq %rdx, %rax
ret
for the asm testcase, which isn't as bad as 4.6, but isn't perfect. What
matters for IRA is which pseudo is LHS/RHS1 and which is RHS2 on the orq insn,
for the builtin version LHS/RHS1 is the pseudo set by the unspecv with "=a"
constraint, for the asm version it is the LHS from the shift insn.
More information about the Gcc-bugs
mailing list