Commit 122a5d60 by Andrew Waterman Committed by Richard Henderson

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
parent f81f49c1
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) ...@@ -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) ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment