]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/72863 (Powerpc64le: redundant swaps when using vec_vsx_ld/st)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Thu, 25 Aug 2016 16:12:23 +0000 (16:12 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Thu, 25 Aug 2016 16:12:23 +0000 (16:12 +0000)
[gcc]

2016-08-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

Backport from mainline (minus test for POWER9 support)
2016-08-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

PR target/72863
* vsx.md (vsx_load_<mode>): For P8LE, emit swaps at expand time.
(vsx_store_<mode>): Likewise.

[gcc/testsuite]

2016-08-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

Backport from mainline
2016-08-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

PR target/72863
* gcc.target/powerpc/pr72863.c: New test.

From-SVN: r239762

gcc/ChangeLog
gcc/config/rs6000/vsx.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr72863.c [new file with mode: 0644]

index 624ad2813e1886937b9b84f0db5cd96402513148..f525d87ab41df1dbecd283636af125efbf4c09bf 100644 (file)
@@ -1,3 +1,12 @@
+2016-08-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline (minus test for POWER9 support)
+       2016-08-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR target/72863
+       * vsx.md (vsx_load_<mode>): For P8LE, emit swaps at expand time.
+       (vsx_store_<mode>): Likewise.
+
 2016-08-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        Backport from mainline
index c112b10c9c65965cca22f400a3c534f15b8e4462..a689c2b71e704edaa9e68bdd0c2771bcdb1c74ea 100644 (file)
   [(set (match_operand:VSX_M 0 "vsx_register_operand" "")
        (match_operand:VSX_M 1 "memory_operand" ""))]
   "VECTOR_MEM_VSX_P (<MODE>mode)"
-  "")
+{
+  /* Expand to swaps if needed, prior to swap optimization.  */
+  if (!BYTES_BIG_ENDIAN)
+    {
+      rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
+      DONE;
+    }
+})
 
 (define_expand "vsx_store_<mode>"
   [(set (match_operand:VSX_M 0 "memory_operand" "")
        (match_operand:VSX_M 1 "vsx_register_operand" ""))]
   "VECTOR_MEM_VSX_P (<MODE>mode)"
-  "")
+{
+  /* Expand to swaps if needed, prior to swap optimization.  */
+  if (!BYTES_BIG_ENDIAN)
+    {
+      rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
+      DONE;
+    }
+})
 
 \f
 ;; VSX vector floating point arithmetic instructions.  The VSX scalar
index 5391528e2439b21abb0702266b85ad358257ea15..3e455222321915b4b238b4fcac6ccc07e791db16 100644 (file)
@@ -1,3 +1,11 @@
+2016-08-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2016-08-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR target/72863
+       * gcc.target/powerpc/pr72863.c: New test.
+
 2016-08-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.target/powerpc/pr72863.c b/gcc/testsuite/gcc.target/powerpc/pr72863.c
new file mode 100644 (file)
index 0000000..26328f2
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3" } */
+/* { dg-final { scan-assembler "lxvd2x" } } */
+/* { dg-final { scan-assembler "stxvd2x" } } */
+/* { dg-final { scan-assembler-not "xxpermdi" } } */
+
+#include <altivec.h>
+
+extern unsigned char *src, *dst;
+
+void b(void)
+{
+  int i;
+
+  unsigned char *s8 = src;
+  unsigned char *d8 = dst;
+
+  for (i = 0; i < 100; i++) {
+    vector unsigned char vs = vec_vsx_ld(0, s8);
+    vector unsigned char vd = vec_vsx_ld(0, d8);
+    vector unsigned char vr = vec_xor(vs, vd);
+    vec_vsx_st(vr, 0, d8);
+    s8 += 16;
+    d8 += 16;
+  }
+}