]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
MASK_AVX256_SPLIT_UNALIGNED_STORE/LOAD should be cleared in opts->x_target_flags...
authorliuhongt <hongtao.liu@intel.com>
Fri, 16 Apr 2021 03:29:10 +0000 (11:29 +0800)
committerliuhongt <hongtao.liu@intel.com>
Fri, 23 Apr 2021 01:19:03 +0000 (09:19 +0800)
gcc/ChangeLog:

PR target/100093
* config/i386/i386-options.c (ix86_option_override_internal):
Clear MASK_AVX256_SPLIT_UNALIGNED_LOAD/STORE in x_target_flags
when X86_TUNE_AVX256_UNALIGNED_LOAD/STORE_OPTIMAL is enabled
by target attribute.

gcc/testsuite/ChangeLog:

PR target/100093
* gcc.target/i386/pr100093.c: New test.

gcc/config/i386/i386-options.c
gcc/testsuite/gcc.target/i386/pr100093.c [new file with mode: 0644]

index 2a12228d195ee859d8a3928e015991e2b98de250..2f3d40ca202c618db63168175bc71620bec6adff 100644 (file)
@@ -2618,9 +2618,16 @@ ix86_option_override_internal (bool main_args_p,
   if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL]
       && !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_LOAD))
     opts->x_target_flags |= MASK_AVX256_SPLIT_UNALIGNED_LOAD;
+  else if (!main_args_p
+          && ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL])
+    opts->x_target_flags &= ~MASK_AVX256_SPLIT_UNALIGNED_LOAD;
+
   if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL]
       && !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_STORE))
     opts->x_target_flags |= MASK_AVX256_SPLIT_UNALIGNED_STORE;
+  else if (!main_args_p
+          && ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL])
+    opts->x_target_flags &= ~MASK_AVX256_SPLIT_UNALIGNED_STORE;
 
   /* Enable 128-bit AVX instruction generation
      for the auto-vectorizer.  */
diff --git a/gcc/testsuite/gcc.target/i386/pr100093.c b/gcc/testsuite/gcc.target/i386/pr100093.c
new file mode 100644 (file)
index 0000000..f32a4bc
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR target/100093  */
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=znver1" } */
+/* { dg-final { scan-assembler-not "vextractf128" } } */
+
+__attribute__((target("tune=skylake-avx512")))
+void fill_avx2(double *__restrict__ data, int n, double value)
+{
+    for (int i = 0; i < n * 16; i++) {
+        data[i] = value;
+    }
+}