https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77621

--- Comment #17 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to rguent...@suse.de from comment #16)

> At least you won't get called for the scalar loop copy and you have
> definite acccess to vectype.

Thanks for the hint, the following patch is effective as well:

--cut here--
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 60b81bb..9d72681 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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,6 +49645,11 @@ 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.  */
--cut here--

Reply via email to