This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/54087] __atomic_fetch_add does not use xadd instruction
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Jul 2012 19:21:02 +0000
- Subject: [Bug target/54087] __atomic_fetch_add does not use xadd instruction
- Auto-submitted: auto-generated
- References: <bug-54087-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54087
--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> 2012-07-24 19:21:02 UTC ---
Use __atomic_add_fetch and __atomic_fetch_sub in the testcase, and you will
get:
0000000000000000 <f1>:
0: 89 f8 mov %edi,%eax
2: f0 0f c1 05 00 00 00 lock xadd %eax,0x0(%rip) # a <f1+0xa>
9: 00
a: 01 f8 add %edi,%eax
c: 85 c0 test %eax,%eax
e: 0f 94 c0 sete %al
11: 0f b6 c0 movzbl %al,%eax
14: c3 retq
0000000000000020 <f2>:
20: 89 f8 mov %edi,%eax
22: f0 0f c1 05 00 00 00 lock xadd %eax,0x0(%rip) # 2a <f2+0xa>
29: 00
2a: 39 f8 cmp %edi,%eax
2c: 0f 94 c0 sete %al
2f: 0f b6 c0 movzbl %al,%eax
32: c3 retq