[llvm] [AArch64] Lower masked.expandload intrinsic using SVE2p2/SME2p2 EXPAND (PR #190999)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 09:49:22 PDT 2026


================
@@ -31763,12 +31678,42 @@ SDValue AArch64TargetLowering::LowerFixedLengthVectorMLoadToSVE(
       IsPassThruZeroOrUndef = true;
   }
 
-  SDValue NewLoad = DAG.getMaskedLoad(
-      ContainerVT, DL, Load->getChain(), Load->getBasePtr(), Load->getOffset(),
-      Mask, PassThru, Load->getMemoryVT(), Load->getMemOperand(),
-      Load->getAddressingMode(), Load->getExtensionType());
+  if (!Load->isExpandingLoad()) {
+    NewLoad =
+        DAG.getMaskedLoad(ContainerVT, DL, Load->getChain(), Load->getBasePtr(),
+                          Load->getOffset(), Mask, PassThru,
+                          Load->getMemoryVT(), Load->getMemOperand(),
+                          Load->getAddressingMode(), Load->getExtensionType());
+    Result = NewLoad;
+  } else {
+    // Fixed-length masked.expandload intrinsics should have been scalarised
+    // if the required features are not available to use expand.
+    assert(((Subtarget->hasSVE2p2() &&
+             (!Subtarget->isStreaming() || Subtarget->hasSMEFA64())) ||
+            Subtarget->hasSME2p2()) &&
+           "Expected SVE2p2 or SME2p2");
----------------
paulwalker-arm wrote:

```suggestion
    assert(((Subtarget->isSVEAvailable() && Subtarget->hasSVE2p2()) ||
            (Subtarget->isSVEorStreamingSVEAvailable() && Subtarget->hasSME2p2())) &&
           "Expected SVE2p2 or SME2p2");
```

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


More information about the llvm-commits mailing list