Blame SOURCES/gcc48-pr72863.patch

22033d
2016-08-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
22033d
22033d
	Backport from mainline (minus test for POWER9 support)
22033d
	2016-08-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
22033d
22033d
	PR target/72863
22033d
	* vsx.md (vsx_load_<mode>): For P8LE, emit swaps at expand time.
22033d
	(vsx_store_<mode>): Likewise.
22033d
22033d
	* gcc.target/powerpc/pr72863.c: New test.
22033d
22033d
--- gcc/config/rs6000/vsx.md	(revision 239761)
22033d
+++ gcc/config/rs6000/vsx.md	(revision 239762)
22033d
@@ -716,13 +716,27 @@ (define_expand "vsx_load_<mode>"
22033d
   [(set (match_operand:VSX_M 0 "vsx_register_operand" "")
22033d
 	(match_operand:VSX_M 1 "memory_operand" ""))]
22033d
   "VECTOR_MEM_VSX_P (<MODE>mode)"
22033d
-  "")
22033d
+{
22033d
+  /* Expand to swaps if needed, prior to swap optimization.  */
22033d
+  if (!BYTES_BIG_ENDIAN)
22033d
+    {
22033d
+      rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
22033d
+      DONE;
22033d
+    }
22033d
+})
22033d
 
22033d
 (define_expand "vsx_store_<mode>"
22033d
   [(set (match_operand:VSX_M 0 "memory_operand" "")
22033d
 	(match_operand:VSX_M 1 "vsx_register_operand" ""))]
22033d
   "VECTOR_MEM_VSX_P (<MODE>mode)"
22033d
-  "")
22033d
+{
22033d
+  /* Expand to swaps if needed, prior to swap optimization.  */
22033d
+  if (!BYTES_BIG_ENDIAN)
22033d
+    {
22033d
+      rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
22033d
+      DONE;
22033d
+    }
22033d
+})
22033d
 
22033d
 
22033d
 ;; VSX vector floating point arithmetic instructions.  The VSX scalar
22033d
--- gcc/testsuite/gcc.target/powerpc/pr72863.c	(nonexistent)
22033d
+++ gcc/testsuite/gcc.target/powerpc/pr72863.c	(revision 239762)
22033d
@@ -0,0 +1,27 @@
22033d
+/* { dg-do compile { target { powerpc64le-*-* } } } */
22033d
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
22033d
+/* { dg-options "-mcpu=power8 -O3" } */
22033d
+/* { dg-final { scan-assembler "lxvd2x" } } */
22033d
+/* { dg-final { scan-assembler "stxvd2x" } } */
22033d
+/* { dg-final { scan-assembler-not "xxpermdi" } } */
22033d
+
22033d
+#include <altivec.h>
22033d
+
22033d
+extern unsigned char *src, *dst;
22033d
+
22033d
+void b(void)
22033d
+{
22033d
+  int i;
22033d
+
22033d
+  unsigned char *s8 = src;
22033d
+  unsigned char *d8 = dst;
22033d
+
22033d
+  for (i = 0; i < 100; i++) {
22033d
+    vector unsigned char vs = vec_vsx_ld(0, s8);
22033d
+    vector unsigned char vd = vec_vsx_ld(0, d8);
22033d
+    vector unsigned char vr = vec_xor(vs, vd);
22033d
+    vec_vsx_st(vr, 0, d8);
22033d
+    s8 += 16;
22033d
+    d8 += 16;
22033d
+  }
22033d
+}