rs6000-p8swap.c (rtx_is_swappable_p): Don't swap vpmsumd.
authorWilliam Schmidt <wschmidt@gcc.gnu.org>
Tue, 1 Oct 2019 14:27:44 +0000 (14:27 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Tue, 1 Oct 2019 14:27:44 +0000 (14:27 +0000)
[gcc]

2019-10-01  Bill Schmidt  <wschmidt@linux.ibm.com>

* config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Don't swap
vpmsumd.

[gcc/testsuite]

2019-10-01  Bill Schmidt  <wschmdit@linux.ibm.com>

* gcc.target/powerpc/pr91275.c: New.

From-SVN: r276410

gcc/ChangeLog
gcc/config/rs6000/rs6000-p8swap.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr91275.c [new file with mode: 0644]

index c32bf8460114eca56b4344ca79cfa529dab2259a..b671ae61e4677c0508aca5f871351ea970a78e8f 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-01  Bill Schmidt  <wschmidt@linux.ibm.com>
+
+       * config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Don't swap
+       vpmsumd.
+
 2019-10-01  Ilya Leoshkevich  <iii@linux.ibm.com>
 
        PR target/77918
index c3b9831550302c4b62eb4b4263db870858052aff..d30e5dec980fb888b993c7c01cdf6e79bcf767a2 100644 (file)
@@ -791,6 +791,11 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
          case UNSPEC_REDUC_PLUS:
          case UNSPEC_REDUC:
            return 1;
+         case UNSPEC_VPMSUM:
+           /* vpmsumd is not swappable, but vpmsum[bhw] are.  */
+           if (GET_MODE (op) == V2DImode)
+             return 0;
+           break;
          }
       }
 
index 4f876e543eae7eb438bb126e5b228cf5284e6d7c..995e1cb59f58b2f5e81ca0d047269d4bfb568d70 100644 (file)
@@ -1,3 +1,7 @@
+2019-10-01  Bill Schmidt  <wschmdit@linux.ibm.com>
+
+       * gcc.target/powerpc/pr91275.c: New.
+
 2019-10-01  Alexandre Oliva <oliva@adacore.com>
 
        * gcc.dg/torture/pr41094.c: Introduce intermediate variable.
diff --git a/gcc/testsuite/gcc.target/powerpc/pr91275.c b/gcc/testsuite/gcc.target/powerpc/pr91275.c
new file mode 100644 (file)
index 0000000..b23d75b
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test that we generate vpmsumd correctly without a swap error.  */
+
+/* { dg-do run { target { p8vector_hw } } } */
+/* { dg-options "-O2 -std=gnu11" } */
+
+#include <altivec.h>
+
+int main() {
+
+  const unsigned long long r0l = 0x8e7dfceac070e3a0;
+  vector unsigned long long r0 = (vector unsigned long long) {r0l, 0}, v;
+  const vector unsigned long long pd
+    = (vector unsigned long) {0xc2LLU << 56, 0};
+
+  v = __builtin_crypto_vpmsumd ((vector unsigned long long) {r0[0], 0}, pd);
+
+  if (v[0] != 0x4000000000000000 || v[1] != 0x65bd7ab605a4a8ff)
+    __builtin_abort ();
+
+  return 0;
+}