[Bug target/54087] __atomic_fetch_add does not use xadd instruction
drepper.fsp+rhbz at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 19 14:46:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54087
Ulrich Drepper <drepper.fsp+rhbz at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |drepper.fsp+rhbz at gmail dot com
--- Comment #11 from Ulrich Drepper <drepper.fsp+rhbz at gmail dot com> ---
Yes, although there still in an oddity. The code from comment #3 is compiled
as:
0000000000000000 <a>:
0: ba fb ff ff ff mov $0xfffffffb,%edx
5: 89 d0 mov %edx,%eax
7: f0 0f c1 05 00 00 00 lock xadd %eax,0x0(%rip) # f <a+0xf>
e: 00
b: R_X86_64_PC32 v-0x4
f: 01 d0 add %edx,%eax
11: c3 retq
12: 66 66 66 66 66 2e 0f data32 data32 data32 data32 nopw
%cs:0x0(%rax,%rax,1)
19: 1f 84 00 00 00 00 00
0000000000000020 <b>:
20: b8 fb ff ff ff mov $0xfffffffb,%eax
25: f0 0f c1 05 00 00 00 lock xadd %eax,0x0(%rip) # 2d <b+0xd>
2c: 00
29: R_X86_64_PC32 v-0x4
2d: 83 e8 05 sub $0x5,%eax
30: c3 retq
There is no reason for the difference. In both cases the latter sequence
should be generated.
More information about the Gcc-bugs
mailing list