[llvm] [GlobalISel][AArch64] Legalize G_ADD, G_SUB, G_AND, G_OR, and G_XOR for SVE (PR #110561)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 00:37:19 PDT 2024


Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/110561 at github.com>


================
@@ -127,7 +128,37 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
       .clampNumElements(0, v2s64, v2s64)
       .moreElementsToNextPow2(0);
 
-  getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
+  auto &IntegerArithmeticActions =
+      getActionDefinitionsBuilder({G_ADD, G_SUB, G_AND, G_OR, G_XOR});
+  if (HasSVE)
+    IntegerArithmeticActions.legalFor({nxv16s8, nxv8s16, nxv4s32, nxv2s64});
----------------
davemgreen wrote:

It should be
```
getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
    .legalFor({s32, s64, v2s32, v2s64, v4s32, v4s16, v8s16, v16s8, v8s8})
    .legalFor(HasSVE, {nxv16s8, nxv8s16, nxv4s32, nxv2s64})
    ....
```
(You could make the argument that the HasSVE is unnecessary, as scalable-vectors are not supported without them and will just hit some failure elsewhere anyway. We might as well add it in though, now that we can without messing up the Definitions).

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


More information about the llvm-commits mailing list