re PR tree-optimization/77621 (Internal compiler error for mtune=atom + msse2)
authorUros Bizjak <ubizjak@gmail.com>
Tue, 20 Sep 2016 17:36:03 +0000 (19:36 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 20 Sep 2016 17:36:03 +0000 (19:36 +0200)
PR target/77621
* config/i386/i386.c (ix86_preferred_simd_mode) <case DFmode>:
Don't return word_mode for !TARGET_VECTORIZE_DOUBLE.
(ix86_add_stmt_cost): Penalize DFmode vector operations
for !TARGET_VECTORIZE_DOUBLE.

testsuite/ChangeLog:

PR target/77621
* gcc.target/i386/pr77621.c: New test.
* gcc.target/i386/vect-double-2.c: Update scan-tree-dump-times
pattern, loop should vectorize with -mtune=atom.

From-SVN: r240277

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr77621.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-double-2.c

index ac7426515c3a8f965e3f27b5b2a30b4f05cc9aca..e92ad3866e4497527d45d48a7026fcab05a5a5a2 100644 (file)
@@ -1,3 +1,11 @@
+2016-09-20  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/77621
+       * config/i386/i386.c (ix86_preferred_simd_mode) <case DFmode>:
+       Don't return word_mode for !TARGET_VECTORIZE_DOUBLE.
+       (ix86_add_stmt_cost): Penalize DFmode vector operations
+       for !TARGET_VECTORIZE_DOUBLE.
+
 2016-09-20  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/invoke.texi (Warning Options): Simplify language.
index 60b81bbb8ab47f4a96bbd26dd86f1b8269777f91..ff057dc60f951587f9427b14f66ae42da9a3a836 100644 (file)
@@ -49554,9 +49554,7 @@ ix86_preferred_simd_mode (machine_mode mode)
        return V4SFmode;
 
     case DFmode:
-      if (!TARGET_VECTORIZE_DOUBLE)
-       return word_mode;
-      else if (TARGET_AVX512F)
+      if (TARGET_AVX512F)
        return V8DFmode;
       else if (TARGET_AVX && !TARGET_PREFER_AVX128)
        return V4DFmode;
@@ -49647,9 +49645,14 @@ ix86_add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
   tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
   int stmt_cost = ix86_builtin_vectorization_cost (kind, vectype, misalign);
 
+  /* Penalize DFmode vector operations for !TARGET_VECTORIZE_DOUBLE.  */
+  if (kind == vector_stmt && !TARGET_VECTORIZE_DOUBLE
+      && vectype && GET_MODE_INNER (TYPE_MODE (vectype)) == DFmode)
+    stmt_cost *= 5;  /* FIXME: The value here is arbitrary.  */
+
   /* Statements in an inner loop relative to the loop being
      vectorized are weighted more heavily.  The value here is
-      arbitrary and could potentially be improved with analysis.  */
+     arbitrary and could potentially be improved with analysis.  */
   if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
     count *= 50;  /* FIXME.  */
 
index d515fdf5bcf8b77327fd790765963c4d028516ff..89024bb89d0f6950f7a043b38e5cda45c10b0841 100644 (file)
@@ -1,3 +1,10 @@
+2016-09-20  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/77621
+       * gcc.target/i386/pr77621.c: New test.
+       * gcc.target/i386/vect-double-2.c: Update scan-tree-dump-times
+       pattern, loop should vectorize with -mtune=atom.
+
 2016-09-20  Maxim Ostapenko  <m.ostapenko@samsung.com>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/i386/pr77621.c b/gcc/testsuite/gcc.target/i386/pr77621.c
new file mode 100644 (file)
index 0000000..0de2ef3
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mtune=atom -msse2 -fdump-tree-vect-stats" } */
+
+void
+foo (double *x, int *y)
+{
+  int i;
+  for (i = 0; i < 8; i++)
+    x[i] -= y[i] * x[i + 1];
+}
+
+/* { dg-final { scan-tree-dump-not "Vectorized loops: 1" "vect" } } */
index b30d848c73d99639969e26fe1bc5a2b3d6aa73e4..f6a43749407eda56d25c8692043b0caa1305c9ed 100644 (file)
@@ -31,4 +31,4 @@ sse2_test (void)
     }
 }
 
-/* { dg-final { scan-tree-dump-not "vectorized 1 loops" "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorized loops: 1" 1 "vect" } } */