dev-libs/libatomic_ops: dropped ~x86-freebsd
[gentoo.git] / dev-libs / libatomic_ops / files / libatomic_ops-7.2_alpha4-x32.patch
1 http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=e3a384578f677c05d812d99c2c92aa13670bd06a
2
3 Upstream-Status: Pending
4
5 Remove the `q' suffix on x86-64 atomic instructions.
6
7 We don't need the `q' suffix on x86_64 atomic instructions for AO_t,
8 which is defined as "unsigned long".  "unsigned long" is 32bit for x32
9 and 64bit for x86-64. The register operand in x86-64 atomic instructions
10 is sufficient to properly determine the register size.
11
12 Received this patch from H.J. Lu <hjl.tools@gmail.com>
13 Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/02
14
15 --- a/src/atomic_ops/sysdeps/gcc/x86_64.h
16 +++ b/src/atomic_ops/sysdeps/gcc/x86_64.h
17 @@ -56,7 +56,7 @@ AO_fetch_and_add_full (volatile AO_t *p,
18  {
19    AO_t result;
20  
21 -  __asm__ __volatile__ ("lock; xaddq %0, %1" :
22 +  __asm__ __volatile__ ("lock; xadd %0, %1" :
23                          "=r" (result), "=m" (*p) : "0" (incr), "m" (*p)
24                          : "memory");
25    return result;
26 @@ -106,7 +106,7 @@ AO_int_fetch_and_add_full (volatile unsi
27  AO_INLINE void
28  AO_or_full (volatile AO_t *p, AO_t incr)
29  {
30 -  __asm__ __volatile__ ("lock; orq %1, %0" :
31 +  __asm__ __volatile__ ("lock; or %1, %0" :
32                          "=m" (*p) : "r" (incr), "m" (*p) : "memory");
33  }
34  
35 @@ -131,7 +131,7 @@ AO_compare_and_swap_full(volatile AO_t *
36                           AO_t old, AO_t new_val)
37  {
38    char result;
39 -  __asm__ __volatile__("lock; cmpxchgq %3, %0; setz %1"
40 +  __asm__ __volatile__("lock; cmpxchg %3, %0; setz %1"
41                         : "=m"(*addr), "=q"(result)
42                         : "m"(*addr), "r" (new_val), "a"(old) : "memory");
43    return (int) result;