Blame SOURCES/gcc48-pr72863.patch

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