Blame SOURCES/gcc48-pr69644.patch

13f101
2016-02-04  Jakub Jelinek  <jakub@redhat.com>
13f101
13f101
	Backported from mainline
13f101
	2016-02-03  Jakub Jelinek  <jakub@redhat.com>
13f101
13f101
	PR target/69644
13f101
	* config/rs6000/rs6000.c (rs6000_expand_atomic_compare_and_swap):
13f101
	Force oldval into register if it does not satisfy reg_or_short_operand
13f101
	predicate.  Fix up formatting.
13f101
13f101
	* gcc.dg/pr69644.c: New test.
13f101
13f101
--- gcc/config/rs6000/rs6000.c
13f101
+++ gcc/config/rs6000/rs6000.c
13f101
@@ -20263,6 +20263,9 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])
13f101
   else if (reg_overlap_mentioned_p (retval, oldval))
13f101
     oldval = copy_to_reg (oldval);
13f101
 
13f101
+  if (mode != TImode && !reg_or_short_operand (oldval, mode))
13f101
+    oldval = copy_to_mode_reg (mode, oldval);
13f101
+
13f101
   mem = rs6000_pre_atomic_barrier (mem, mod_s);
13f101
 
13f101
   label1 = NULL_RTX;
13f101
@@ -20277,10 +20280,8 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])
13f101
 
13f101
   x = retval;
13f101
   if (mask)
13f101
-    {
13f101
-      x = expand_simple_binop (SImode, AND, retval, mask,
13f101
-			       NULL_RTX, 1, OPTAB_LIB_WIDEN);
13f101
-    }
13f101
+    x = expand_simple_binop (SImode, AND, retval, mask,
13f101
+			     NULL_RTX, 1, OPTAB_LIB_WIDEN);
13f101
 
13f101
   cond = gen_reg_rtx (CCmode);
13f101
   /* If we have TImode, synthesize a comparison.  */
13f101
--- /dev/null
13f101
+++ gcc/testsuite/gcc.dg/pr69644.c
13f101
@@ -0,0 +1,11 @@
13f101
+/* PR target/69644 */
13f101
+/* { dg-do compile } */
13f101
+
13f101
+int
13f101
+main ()
13f101
+{
13f101
+  unsigned short x = 0x8000;
13f101
+  if (!__sync_bool_compare_and_swap (&x, 0x8000, 0) || x)
13f101
+    __builtin_abort ();
13f101
+  return 0;
13f101
+}