[llvm] [AArch64][SDAG] Enable +sme2p2/+sve2p2 lowering for compressstore (PR #218624)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 02:30:49 PDT 2026


================
@@ -334,13 +334,20 @@ class AArch64TTIImpl final : public BasicTTIImplBase<AArch64TTIImpl> {
   }
 
   bool isElementTypeLegalForCompressStore(Type *Ty) const {
-    return Ty->isFloatTy() || Ty->isDoubleTy() || Ty->isIntegerTy(32) ||
+    // For streaming SME2p2, only consider 8bit or 16bit Scalar types.
+    if ((ST->isStreamingSVEAvailable() && ST->hasSME2p2()))
+      return Ty->isIntegerTy(8) || Ty->getScalarSizeInBits() == 16;
+
+    return ((ST->hasSVE2p2() || ST->hasSME2p2()) &&
+            (Ty->isIntegerTy(8) || Ty->getScalarSizeInBits() == 16)) ||
+           Ty->isFloatTy() || Ty->isDoubleTy() || Ty->isIntegerTy(32) ||
            Ty->isIntegerTy(64);
----------------
MacDue wrote:

This function should mirror the ISEL lowering:

```
// 32-bit and 64-bit element types are legal if we have SVE (or streaming SVE and SME2p2).
if (Ty->getScalarSizeInBits() == 32 || Ty->getScalarSizeInBits() == 64) 
  return true;

if (ST->hasSVE2p2() || ST->hasSME2p2()) 
  return Ty->isIntegerTy(8) || Ty->getScalarSizeInBits() == 16;

return false;
```

We don't need to check `isSVEorStreamingSVEAvailable` again (that's handled by the `isLegalMaskedCompressStore` function).

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


More information about the llvm-commits mailing list