This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/54087] __atomic_fetch_add does not use xadd instruction


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]