Blame SOURCES/gcc48-pr72717.patch

b89248
2016-12-13  Michael Meissner  <meissner@linux.vnet.ibm.com>
b89248
b89248
	Backport from mainline
b89248
	2016-12-07  Michael Meissner  <meissner@linux.vnet.ibm.com>
b89248
b89248
	PR target/72717
b89248
	* config/rs6000/rs6000.c (rs6000_expand_vector_init): If the
b89248
	V2DImode elements are SUBREG's convert the result into DImode
b89248
	rather than failing in emit_move_insn.
b89248
b89248
--- gcc/testsuite/gcc.target/powerpc/pr72717.c	(nonexistent)
b89248
+++ gcc/testsuite/gcc.target/powerpc/pr72717.c	(revision 243626)
b89248
@@ -0,0 +1,18 @@
b89248
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
b89248
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
b89248
+/* { dg-require-effective-target powerpc_p8vector_ok } */
b89248
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
b89248
+/* { dg-options "-mcpu=power8 -O2" } */
b89248
+
b89248
+typedef long V __attribute__((__vector_size__(32)));
b89248
+
b89248
+extern void foo (V *, V*);
b89248
+
b89248
+/* This test generated an failure in emit_move_insn.  */
b89248
+
b89248
+void
b89248
+foo(V *p, V *q)
b89248
+{
b89248
+  V v = *q;
b89248
+  *p = v << v[0];
b89248
+}
b89248
--- gcc/config/rs6000/rs6000.c	(revision 243625)
b89248
+++ gcc/config/rs6000/rs6000.c	(revision 243626)
b89248
@@ -6667,25 +6667,43 @@
b89248
   /* Double word values on VSX can use xxpermdi or lxvdsx.  */
b89248
   if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode))
b89248
     {
b89248
-      rtx op0 = XVECEXP (vals, 0, 0);
b89248
-      rtx op1 = XVECEXP (vals, 0, 1);
b89248
+      rtx op[2];
b89248
+      size_t i;
b89248
+      size_t num_elements = (all_same) ? 1 : 2;
b89248
+      for (i = 0; i < num_elements; i++)
b89248
+	{
b89248
+	  op[i] = XVECEXP (vals, 0, i);
b89248
+	  /* Just in case there is a SUBREG with a smaller mode, do a
b89248
+	     conversion.  */
b89248
+	  if (GET_MODE (op[i]) != inner_mode)
b89248
+	    {
b89248
+	      rtx tmp = gen_reg_rtx (inner_mode);
b89248
+	      convert_move (tmp, op[i], 0);
b89248
+	      op[i] = tmp;
b89248
+	    }
b89248
+	  /* Allow load with splat double word.  */
b89248
+	  else if (MEM_P (op[i]))
b89248
+	    {
b89248
+	      if (!all_same)
b89248
+		op[i] = force_reg (inner_mode, op[i]);
b89248
+	    }
b89248
+	  else if (!REG_P (op[i]))
b89248
+	    op[i] = force_reg (inner_mode, op[i]);
b89248
+	}
b89248
+
b89248
       if (all_same)
b89248
 	{
b89248
-	  if (!MEM_P (op0) && !REG_P (op0))
b89248
-	    op0 = force_reg (inner_mode, op0);
b89248
 	  if (mode == V2DFmode)
b89248
-	    emit_insn (gen_vsx_splat_v2df (target, op0));
b89248
+	    emit_insn (gen_vsx_splat_v2df (target, op[0]));
b89248
 	  else
b89248
-	    emit_insn (gen_vsx_splat_v2di (target, op0));
b89248
+	    emit_insn (gen_vsx_splat_v2di (target, op[0]));
b89248
 	}
b89248
       else
b89248
 	{
b89248
-	  op0 = force_reg (inner_mode, op0);
b89248
-	  op1 = force_reg (inner_mode, op1);
b89248
 	  if (mode == V2DFmode)
b89248
-	    emit_insn (gen_vsx_concat_v2df (target, op0, op1));
b89248
+	    emit_insn (gen_vsx_concat_v2df (target, op[0], op[1]));
b89248
 	  else
b89248
-	    emit_insn (gen_vsx_concat_v2di (target, op0, op1));
b89248
+	    emit_insn (gen_vsx_concat_v2di (target, op[0], op[1]));
b89248
 	}
b89248
       return;
b89248
     }