]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Refactor mgather/mscatter implementation.
authorliuhongt <hongtao.liu@intel.com>
Tue, 25 Nov 2025 05:33:46 +0000 (21:33 -0800)
committerliuhongt <hongtao.liu@intel.com>
Thu, 27 Nov 2025 05:46:12 +0000 (21:46 -0800)
Current implementation is an alias to -mtune-crtl=(Alias(mtune-ctrl=,
use_gather, ^use_gather)), and maybe override by another -mtune-crtl=
.i.e -mgather -mscatter will only enable mscatter

The patch fixes the issue.

gcc/ChangeLog:

* config/i386/i386-options.cc (set_ix86_tune_features): Set
gather/scatter tune if OPTION_SET_P.
* config/i386/i386.opt: Refactor mgather/mscatter.

gcc/config/i386/i386-options.cc
gcc/config/i386/i386.opt

index ba598a817f304e1048b251b6a30e1940f8df0156..35064d83a007d0504ff549cd3b5fc903bb3d9873 100644 (file)
@@ -1837,6 +1837,21 @@ set_ix86_tune_features (struct gcc_options *opts,
     }
 
   parse_mtune_ctrl_str (opts, dump);
+
+  /* mgather/mscatter option would overwrite -mtune-crtl option.  */
+  if (OPTION_SET_P (ix86_use_gather))
+    {
+      ix86_tune_features[X86_TUNE_USE_GATHER_2PARTS] = ix86_use_gather;
+      ix86_tune_features[X86_TUNE_USE_GATHER_4PARTS] = ix86_use_gather;
+      ix86_tune_features[X86_TUNE_USE_GATHER_8PARTS] = ix86_use_gather;
+    }
+
+  if (OPTION_SET_P (ix86_use_scatter))
+    {
+      ix86_tune_features[X86_TUNE_USE_SCATTER_2PARTS] = ix86_use_scatter;
+      ix86_tune_features[X86_TUNE_USE_SCATTER_4PARTS] = ix86_use_scatter;
+      ix86_tune_features[X86_TUNE_USE_SCATTER_8PARTS] = ix86_use_scatter;
+    }
 }
 
 
index 84494502345186fa0cafee5826f7d9fffcf5824f..c0093ef124365f992aa0077f793a2185ad5c9f4c 100644 (file)
@@ -1290,11 +1290,11 @@ Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and
 SM4 built-in functions and code generation.
 
 mgather
-Target Alias(mtune-ctrl=, use_gather, ^use_gather)
+Target Var(ix86_use_gather) Init(0) Optimization.
 Enable vectorization for gather instruction.
 
 mscatter
-Target Alias(mtune-ctrl=, use_scatter, ^use_scatter)
+Target Var(ix86_use_scatter) Init(0) Optimization
 Enable vectorization for scatter instruction.
 
 mapxf