]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Disable gathers for znver3 for vectors with 2 or 4 elements
authorJan Hubicka <jh@suse.cz>
Tue, 29 Mar 2022 11:59:14 +0000 (13:59 +0200)
committerJan Hubicka <jh@suse.cz>
Tue, 29 Mar 2022 11:59:14 +0000 (13:59 +0200)
gcc/ChangeLog:

2022-03-28  Jan Hubicka  <hubicka@ucw.cz>

* config/i386/i386-builtins.cc (ix86_vectorize_builtin_gather): Test
TARGET_USE_GATHER_2PARTS and TARGET_USE_GATHER_4PARTS.
* config/i386/i386.h (TARGET_USE_GATHER_2PARTS): New macro.
(TARGET_USE_GATHER_4PARTS): New macro.
* config/i386/x86-tune.def (X86_TUNE_USE_GATHER_2PARTS): New tune
(X86_TUNE_USE_GATHER_4PARTS): New tune

gcc/config/i386/i386-builtins.cc
gcc/config/i386/i386.h
gcc/config/i386/x86-tune.def

index 2570501ae7e6d029e4a0e3e2b6ce74023aa3d3cd..8c6d0fe96315e10cf73b4917c2470b114c870e3f 100644 (file)
@@ -1785,7 +1785,12 @@ ix86_vectorize_builtin_gather (const_tree mem_vectype,
   bool si;
   enum ix86_builtins code;
 
-  if (! TARGET_AVX2 || !TARGET_USE_GATHER)
+  if (! TARGET_AVX2
+      || (known_eq (TYPE_VECTOR_SUBPARTS (mem_vectype), 2u)
+         ? !TARGET_USE_GATHER_2PARTS
+         : (known_eq (TYPE_VECTOR_SUBPARTS (mem_vectype), 4u)
+            ? !TARGET_USE_GATHER_4PARTS
+            : !TARGET_USE_GATHER)))
     return NULL_TREE;
 
   if ((TREE_CODE (index_type) != INTEGER_TYPE
index b92955177fe9458a9ebc847935fe8b2653828469..363082ba47b3a10091876035f9e6fc966abc2df2 100644 (file)
@@ -390,6 +390,10 @@ extern unsigned char ix86_tune_features[X86_TUNE_LAST];
        ix86_tune_features[X86_TUNE_SLOW_PSHUFB]
 #define TARGET_AVOID_4BYTE_PREFIXES \
        ix86_tune_features[X86_TUNE_AVOID_4BYTE_PREFIXES]
+#define TARGET_USE_GATHER_2PARTS \
+       ix86_tune_features[X86_TUNE_USE_GATHER_2PARTS]
+#define TARGET_USE_GATHER_4PARTS \
+       ix86_tune_features[X86_TUNE_USE_GATHER_4PARTS]
 #define TARGET_USE_GATHER \
        ix86_tune_features[X86_TUNE_USE_GATHER]
 #define TARGET_FUSE_CMP_AND_BRANCH_32 \
index 82ca0ae63acd5d3811e01bf259a0af511dfc7fe2..d983e2f6213f8b54f32ae854145bc25e8da73abd 100644 (file)
@@ -464,7 +464,18 @@ DEF_TUNE (X86_TUNE_AVOID_4BYTE_PREFIXES, "avoid_4byte_prefixes",
          m_SILVERMONT | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE
          | m_INTEL)
 
-/* X86_TUNE_USE_GATHER: Use gather instructions.  */
+/* X86_TUNE_USE_GATHER_2PARTS: Use gather instructions for vectors with 2
+   elements.  */
+DEF_TUNE (X86_TUNE_USE_GATHER_2PARTS, "use_gather_2parts",
+         ~(m_ZNVER1 | m_ZNVER2 | m_ZNVER3 | m_ALDERLAKE | m_GENERIC))
+
+/* X86_TUNE_USE_GATHER_4PARTS: Use gather instructions for vectors with 4
+   elements.  */
+DEF_TUNE (X86_TUNE_USE_GATHER_4PARTS, "use_gather_4parts",
+         ~(m_ZNVER1 | m_ZNVER2 | m_ZNVER3 | m_ALDERLAKE | m_GENERIC))
+
+/* X86_TUNE_USE_GATHER: Use gather instructions for vectors with 8 or more
+   elements.  */
 DEF_TUNE (X86_TUNE_USE_GATHER, "use_gather",
          ~(m_ZNVER1 | m_ZNVER2 | m_ALDERLAKE | m_GENERIC))