[llvm] [AArch64] Extend usage of `XAR` instruction for fixed-length operations (PR #139460)

Rajveer Singh Bharadwaj via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 05:00:39 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:
----------------
Rajveer100 wrote:

Ah, right. Just so I understood clearly, v2i32->v2i64 should be fine but v4i16->v2i64 and v8i8->v2i64 would be incorrect?

Treating them like the types you suggest would be correct because here we expand rather than them getting squeezed to smaller number of elements?

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


More information about the llvm-commits mailing list