This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/60473] optimization after shift sub-optimal
- From: "marmoo1024 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Mar 2014 08:35:56 +0000
- Subject: [Bug rtl-optimization/60473] optimization after shift sub-optimal
- Auto-submitted: auto-generated
- References: <bug-60473-4 at http dot gcc dot gnu dot org/bugzilla/>
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