re PR target/80695 (gratuitous use of stxvx to store multiple pointers)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Thu, 11 May 2017 20:16:02 +0000 (20:16 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Thu, 11 May 2017 20:16:02 +0000 (20:16 +0000)
[gcc]

2017-05-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

PR target/80695
* config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost):
Account for direct move costs for vec_construct of integer
vectors.

[gcc/testsuite]

2017-05-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

PR target/80695
* gcc.target/powerpc/pr80695-p8.c: New file.
* gcc.target/powerpc/pr80695-p9.c: New file.

From-SVN: r247928

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr80695-p8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr80695-p9.c [new file with mode: 0644]

index 5db5505..24af7d1 100644 (file)
@@ -1,3 +1,10 @@
+2017-05-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR target/80695
+       * config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost):
+       Account for direct move costs for vec_construct of integer
+       vectors.
+
 2017-05-11  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/80706
index d55e552..292742a 100644 (file)
@@ -5850,8 +5850,20 @@ rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
        if (SCALAR_FLOAT_TYPE_P (elem_type)
            && TYPE_PRECISION (elem_type) == 32)
          return 5;
+       /* On POWER9, integer vector types are built up in GPRs and then
+          use a direct move (2 cycles).  For POWER8 this is even worse,
+          as we need two direct moves and a merge, and the direct moves
+          are five cycles.  */
+       else if (INTEGRAL_TYPE_P (elem_type))
+         {
+           if (TARGET_P9_VECTOR)
+             return TYPE_VECTOR_SUBPARTS (vectype) - 1 + 2;
+           else
+             return TYPE_VECTOR_SUBPARTS (vectype) - 1 + 11;
+         }
        else
-         return max (2, TYPE_VECTOR_SUBPARTS (vectype) - 1);
+         /* V2DFmode doesn't need a direct move.  */
+         return 2;
 
       default:
         gcc_unreachable ();
index 9fba93c..7fbf899 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR target/80695
+       * gcc.target/powerpc/pr80695-p8.c: New file.
+       * gcc.target/powerpc/pr80695-p9.c: New file.
+
 2017-05-11  Uros Bizjak  <ubizjak@gmail.com>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80695-p8.c b/gcc/testsuite/gcc.target/powerpc/pr80695-p8.c
new file mode 100644 (file)
index 0000000..165079a
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-options "-mcpu=power8 -O3 -fdump-tree-slp-details" } */
+
+/* PR80695: Verify cost model for vec_construct on POWER8.  */
+
+long a[10] __attribute__((aligned(16)));
+
+void foo (long i, long j, long k, long l)
+{
+  a[6] = i;
+  a[7] = j;
+  a[8] = k;
+  a[9] = l;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization is not profitable" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80695-p9.c b/gcc/testsuite/gcc.target/powerpc/pr80695-p9.c
new file mode 100644 (file)
index 0000000..a81f90a
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-options "-mcpu=power9 -O3 -fdump-tree-slp-details" } */
+
+/* PR80695: Verify cost model for vec_construct on POWER9.  */
+
+long a[10] __attribute__((aligned(16)));
+
+void foo (long i, long j, long k, long l)
+{
+  a[6] = i;
+  a[7] = j;
+  a[8] = k;
+  a[9] = l;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization is not profitable" 1 "slp2" } } */