[Bug rtl-optimization/60473] optimization after shift sub-optimal
marmoo1024 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 10 08:36:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60473
--- Comment #1 from Martin <marmoo1024 at gmail dot com> ---
After some checking I've found that the problem is with the binary OR operator.
Addition doesn't have a problem but or does. Here are my results.
unsigned long long **_rdtsc_64 () {
unsigned long long h,l;
asm volatile ("rdtsc" : "=a" (l), "=d" (h) );
return **;
}
x1_rdtsc_64():
rdtsc ; return l + h*(0x100000000LLU)
salq $32, %rdx
addq %rdx, %rax
ret
x2_rdtsc_64():
rdtsc ; return l | h*(0x100000000LLU)
salq $32, %rdx
orq %rax, %rdx
movq %rdx, %rax
ret
x3_rdtsc_64():
rdtsc ; return l + (h<<32)
salq $32, %rdx
addq %rdx, %rax
ret
x4_rdtsc_64():
rdtsc ; return l | (h<<32)
salq $32, %rdx
orq %rax, %rdx
movq %rdx, %rax
ret
More information about the Gcc-bugs
mailing list