[llvm] [AArch64] Enable using SVE2 bit-sel instructions with Neon types. (PR #146906)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 07:35:12 PDT 2025


================
@@ -5368,6 +5368,19 @@ multiclass sve2_int_bitwise_ternary_op<bits<3> opc, string asm,
   def : SVE_3_Op_Pat<nxv8i16, op, nxv8i16, nxv8i16, nxv8i16, !cast<Instruction>(NAME)>;
   def : SVE_3_Op_Pat<nxv4i32, op, nxv4i32, nxv4i32, nxv4i32, !cast<Instruction>(NAME)>;
   def : SVE_3_Op_Pat<nxv2i64, op, nxv2i64, nxv2i64, nxv2i64, !cast<Instruction>(NAME)>;
+
+  // Allow selecting SVE2 ternary ops with Neon types.
+  foreach VT = [nxv16i8, nxv8i16, nxv4i32, nxv2i64] in {
----------------
rj-jesus wrote:

Thanks - passing VT into the class sounds good to me. I did check previously that the Neon BCAX/EOR3 instructions were selected over the SVE ones when FEAT_SHA3 is available (due to the less restrictive register requirements, as you point out). Since they were, I didn't see a reason not to enable the SVE2 patterns for them too.

Would you rather I do as you suggested and only enable the patterns for BSL1N/BSL1N/NBSL, or perhaps add a runline such as
```
RUN: llc -mtriple=aarch64 -mattr=+sha3,+sve2 < %s | FileCheck --check-prefix=SHA3 %s
```
in `llvm/test/CodeGen/AArch64/bcax.ll` and `llvm/test/CodeGen/AArch64/eor3.ll` to ensure we select the SHA3 patterns even when SVE2 is available?

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


More information about the llvm-commits mailing list