[llvm] [AArch64] Extend usage of `XAR` instruction for fixed-length operations (PR #139460)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 04:50:01 PDT 2025
================
@@ -4606,7 +4606,36 @@ bool AArch64DAGToDAGISel::trySelectXAR(SDNode *N) {
return false;
}
- if (!Subtarget->hasSHA3())
+ // We have Neon SHA3 XAR operation for v2i64 but for types
+ // v4i32, v8i16, v16i8 we can use SVE operations when SVE2-SHA3
+ // is available.
+ EVT SVT;
+ switch (VT.getSimpleVT().SimpleTy) {
+ case MVT::v4i32:
+ SVT = MVT::nxv4i32;
+ break;
+ case MVT::v8i16:
+ SVT = MVT::nxv8i16;
+ break;
+ case MVT::v16i8:
+ SVT = MVT::nxv16i8;
+ break;
+ case MVT::v1i64:
+ case MVT::v2i32:
+ case MVT::v4i16:
+ case MVT::v8i8:
+ // Widen type to v2i64.
+ SVT = MVT::v2i64;
+ break;
+ default:
+ if (VT != MVT::v2i64)
----------------
davemgreen wrote:
Could v2i64 be combined into the v1i64 case so that they share the same code and the default is just return false? The v2i64 case could then be something like `SVT = Subtarget->hasSHA3() ? MVT::v2i64 : MVT::nxv2i64;` so it triggers in even more cases (when we have SVE2, but not SHA3).
https://github.com/llvm/llvm-project/pull/139460
More information about the llvm-commits
mailing list