This change was unrelated to r239170.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239176
91177308-0d34-0410-b5e6-
96231b3b80d8
#if defined(__i386__) || defined(__x86_64__)
static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__))
_interlockedbittestandset(long volatile *__BitBase, long __BitPos) {
- long __OldVal = __atomic_fetch_or(__BitBase, 1 << __BitPos, 5);
- return (__OldVal >> __BitPos) & 1;
+ unsigned char __Res;
+ __asm__ ("xor %0, %0\n"
+ "lock bts %2, %1\n"
+ "setc %0\n"
+ : "=r" (__Res), "+m"(*__BitBase)
+ : "Ir"(__BitPos));
+ return __Res;
}
#endif
#ifdef __x86_64__