[llvm] [AArch64] Expand vector ops when NEON and SVE are unavailable. (PR #90833)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 06:05:22 PDT 2024


================
@@ -1328,6 +1349,24 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
     // FADDP custom lowering
     for (MVT VT : { MVT::v16f16, MVT::v8f32, MVT::v4f64 })
       setOperationAction(ISD::FADD, VT, Custom);
+  } else {
----------------
sdesmalen-arm wrote:

> Alternatively should this be `else if (!Subtarget->useSVEForFixedLengthVectors())`? Just thinking there's several instances of "set everything to Expand" going on.

In practice this is not equivalent, because there are things missing from `addTypeForFixedLengthSVE`. For example, the loop that sets truncating-store actions:

```
MVT InnerVT = VT.changeVectorElementType(MVT::i8);
while (InnerVT != VT) {
  setTruncStoreAction(VT, InnerVT, Default);
  ...
  InnerVT = InnerVT.changeVectorElementType(
      MVT::getIntegerVT(2 * InnerVT.getScalarSizeInBits()));
}
```

misses out on truncating store from `v4i16` -> `v4i1`, which we'd want to `Expand`.

If we'd set it to `Default (Custom)` lowering, then it would try to lower it with SVE operations because the check `useSVEForFixedLengthVectorVT` is based on `MVT::v4i16`, not the `MVT::v4i1`, and the resulting truncating store would fail to select.

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


More information about the llvm-commits mailing list