[llvm] [SPIR-V] Legalize vector arithmetic and intrinsics for large vectors (PR #170668)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 12:23:36 PST 2025


================
@@ -172,9 +174,25 @@ SPIRVLegalizerInfo::SPIRVLegalizerInfo(const SPIRVSubtarget &ST) {
 
   for (auto Opc : getTypeFoldingSupportedOpcodes()) {
     if (Opc != G_EXTRACT_VECTOR_ELT)
-      getActionDefinitionsBuilder(Opc).custom();
+      getActionDefinitionsBuilder(Opc)
+          .customFor(allScalars)
+          .customFor(allowedVectorTypes)
+          .moreElementsToNextPow2(0)
+          .fewerElementsIf(vectorElementCountIsGreaterThan(0, MaxVectorSize),
+                           LegalizeMutations::changeElementCountTo(
+                               0, ElementCount::getFixed(MaxVectorSize)))
+          .custom();
   }
 
+  getActionDefinitionsBuilder(TargetOpcode::G_FMA)
----------------
farzonl wrote:

should we handle `G_STRICT_FMA`? Feels like it should be the same thing

https://github.com/llvm/llvm-project/pull/170668


More information about the llvm-commits mailing list