]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/69907 (wrong code at -O3 on x86_64-linux-gnu)
authorRichard Biener <rguenther@suse.de>
Wed, 24 Feb 2016 08:27:25 +0000 (08:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 24 Feb 2016 08:27:25 +0000 (08:27 +0000)
2016-02-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69907
* tree-vect-stmts.c (vectorizable_load): Check for gaps at the
end of permutations for BB vectorization.

* gcc.dg/vect/bb-slp-pr69907.c: New testcase.
* gcc.dg/vect/bb-slp-34.c: XFAIL.
* gcc.dg/vect/bb-slp-pr68892.c: Likewise.

From-SVN: r233655

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/bb-slp-34.c
gcc/testsuite/gcc.dg/vect/bb-slp-pr68892.c
gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 405796963771cc24ed53c05ed0763ed3eabeab3b..dc87f1b5d64f5482a94b232ae8d3d8a8ed708c7f 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69907
+       * tree-vect-stmts.c (vectorizable_load): Check for gaps at the
+       end of permutations for BB vectorization.
+
 2016-02-24  Christian Bruel  <christian.bruel@st.com>
 
        * config/arm/arm-c.c (arm_option_override): Initialize
index beb802600078f76346ef099fcec1afe135005204..d716932e42f21f5483ecddc97323c366378b8612 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69907
+       * gcc.dg/vect/bb-slp-pr69907.c: New testcase.
+       * gcc.dg/vect/bb-slp-34.c: XFAIL.
+       * gcc.dg/vect/bb-slp-pr68892.c: Likewise.
+
 2016-02-24  Christian Bruel  <christian.bruel@st.com>
 
        * gcc.target/arm/pragma_cpp_fma.c: New test.
index c51c7706adcb010af71a0f5ba8e412ed382908e9..418f2b536c9907da4f4801d824772c3a813c87f1 100644 (file)
@@ -32,4 +32,5 @@ int main()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_perm } } } */
+/* ??? XFAILed because we access "excess" elements with the permutation.  */
+/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_perm xfail *-*-* } } } */
index ba51b76fdb92bb3826166fdc823027679eb5c48d..216883fc0c46fdcbf378dc55493cc21aa786f0a9 100644 (file)
@@ -13,5 +13,7 @@ void foo(void)
   b[3] = a[3][0];
 }
 
-/* { dg-final { scan-tree-dump "not profitable" "slp2" } } */
+/* ???  The profitability check is not reached because we give up on the
+   gaps we access earlier.  */
+/* { dg-final { scan-tree-dump "not profitable" "slp2" { xfail *-*-* } } } */
 /* { dg-final { scan-tree-dump-times "Basic block will be vectorized" 0 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c
new file mode 100644 (file)
index 0000000..9f1e71a
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+/* { dg-require-effective-target vect_unpack } */
+
+void foo(unsigned *p1, unsigned short *p2)
+{
+  int n;
+  for (n = 0; n < 320; n++)
+    p1[n] = p2[n * 2];
+}
+
+/* { dg-final { scan-tree-dump "BB vectorization with gaps at the end of a load is not supported" "slp1" } } */
index 1aade9e650c45a12a78724b931befd2f155b3e6d..9678d7c1615ec5869e5d2a64634fefc66664193c 100644 (file)
@@ -6395,6 +6395,19 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
        slp_perm = true;
 
       group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt));
+
+      /* ???  The following is overly pessimistic (as well as the loop
+         case above) in the case we can statically determine the excess
+        elements loaded are within the bounds of a decl that is accessed.
+        Likewise for BB vectorizations using masked loads is a possibility.  */
+      if (bb_vinfo && slp_perm && group_size % nunits != 0)
+       {
+         dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                          "BB vectorization with gaps at the end of a load "
+                          "is not supported\n");
+         return false;
+       }
+
       if (!slp
          && !PURE_SLP_STMT (stmt_info)
          && !STMT_VINFO_STRIDED_P (stmt_info))