Patchwork [RS6000] Fix rs6000_adjust_atomic_subword in little-endian mode

login
register
mail settings
Submitter Anton Blanchard
Date June 11, 2013, 1:42 a.m.
Message ID <20130611114240.4816ac6e@kryten>
Download mbox | patch
Permalink /patch/250434/
State New
Headers show

Comments

Anton Blanchard - June 11, 2013, 1:42 a.m.
Fixes gcc/testsuite/gcc.dg/sync-2.c

	* config/rs6000/rs6000.c (rs6000_adjust_atomic_subword): Calculate
	correct shift value in little-endian mode.
David Edelsohn - June 11, 2013, 3:31 a.m.
On Mon, Jun 10, 2013 at 9:42 PM, Anton Blanchard <anton@samba.org> wrote:
> Fixes gcc/testsuite/gcc.dg/sync-2.c
>
>         * config/rs6000/rs6000.c (rs6000_adjust_atomic_subword): Calculate
>         correct shift value in little-endian mode.

Okay.

Thanks, David

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -17314,8 +17314,9 @@  rs6000_adjust_atomic_subword (rtx orig_mem, rtx *pshift, rtx *pmask)
   shift = gen_reg_rtx (SImode);
   addr = gen_lowpart (SImode, addr);
   emit_insn (gen_rlwinm (shift, addr, GEN_INT (3), GEN_INT (shift_mask)));
-  shift = expand_simple_binop (SImode, XOR, shift, GEN_INT (shift_mask),
-			       shift, 1, OPTAB_LIB_WIDEN);
+  if (WORDS_BIG_ENDIAN)
+    shift = expand_simple_binop (SImode, XOR, shift, GEN_INT (shift_mask),
+			         shift, 1, OPTAB_LIB_WIDEN);
   *pshift = shift;
 
   /* Mask for insertion.  */