mirror of git://gcc.gnu.org/git/gcc.git
Avoid misaligned atomic operations
Andrew Waterman <waterman@cs.berkeley.edu> * fop_n.c (libat_fetch_op): Align address to word boundary. (libat_op_fetch): Likewise. From-SVN: r219954
This commit is contained in:
parent
f81f49c180
commit
122a5d603b
|
|
@ -1,3 +1,8 @@
|
||||||
|
2015-01-21 Andrew Waterman <waterman@cs.berkeley.edu>
|
||||||
|
|
||||||
|
* fop_n.c (libat_fetch_op): Align address to word boundary.
|
||||||
|
(libat_op_fetch): Likewise.
|
||||||
|
|
||||||
2015-01-16 Ilya Verbin <ilya.verbin@intel.com>
|
2015-01-16 Ilya Verbin <ilya.verbin@intel.com>
|
||||||
|
|
||||||
PR testsuite/64605
|
PR testsuite/64605
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,9 @@ SIZE(C2(libat_fetch_,NAME)) (UTYPE *mptr, UTYPE opval, int smodel)
|
||||||
|
|
||||||
pre_barrier (smodel);
|
pre_barrier (smodel);
|
||||||
|
|
||||||
wptr = (UWORD *)mptr;
|
wptr = (UWORD *)((uintptr_t)mptr & -WORDSIZE);
|
||||||
shift = 0;
|
shift = (((uintptr_t)mptr % WORDSIZE) * CHAR_BIT) ^ SIZE(INVERT_MASK);
|
||||||
mask = -1;
|
mask = SIZE(MASK) << shift;
|
||||||
|
|
||||||
wopval = (UWORD)opval << shift;
|
wopval = (UWORD)opval << shift;
|
||||||
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
|
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
|
||||||
|
|
@ -136,9 +136,9 @@ SIZE(C3(libat_,NAME,_fetch)) (UTYPE *mptr, UTYPE opval, int smodel)
|
||||||
|
|
||||||
pre_barrier (smodel);
|
pre_barrier (smodel);
|
||||||
|
|
||||||
wptr = (UWORD *)mptr;
|
wptr = (UWORD *)((uintptr_t)mptr & -WORDSIZE);
|
||||||
shift = 0;
|
shift = (((uintptr_t)mptr % WORDSIZE) * CHAR_BIT) ^ SIZE(INVERT_MASK);
|
||||||
mask = -1;
|
mask = SIZE(MASK) << shift;
|
||||||
|
|
||||||
wopval = (UWORD)opval << shift;
|
wopval = (UWORD)opval << shift;
|
||||||
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
|
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue