[llvm] [AArch64][SVE] Use SVE for scalar FP converts in streaming[-compatible] functions (1/n) (PR #118505)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 07:23:52 PST 2024
================
@@ -18989,13 +18989,75 @@ static SDValue performVectorCompareAndMaskUnaryOpCombine(SDNode *N,
return SDValue();
}
+/// Tries to replace scalar FP <-> INT conversions with SVE in streaming
+/// functions, this can help to reduce the number of fmovs to/from GPRs.
+static SDValue
+tryToReplaceScalarFPConversionWithSVE(SDNode *N, SelectionDAG &DAG,
+ const AArch64Subtarget *Subtarget) {
+ if (N->isStrictFPOpcode())
+ return SDValue();
+
+ if (!Subtarget->isSVEorStreamingSVEAvailable() ||
+ (!Subtarget->isStreaming() && !Subtarget->isStreamingCompatible()))
+ return SDValue();
+
+ auto isSupportedType = [](EVT VT) {
+ if (!VT.isSimple())
+ return false;
+ // There are SVE instructions that can convert to/from all pairs of these
+ // int and float types. Note: We don't bother with i8 or i16 as those are
+ // illegal types for scalars.
+ return is_contained({MVT::i32, MVT::i64, MVT::f16, MVT::f32, MVT::f64},
+ VT.getSimpleVT().SimpleTy);
+ };
----------------
paulwalker-arm wrote:
By making this a post legalisation combine you likely don't need the lambda and can instead use `is_contained` in place.
https://github.com/llvm/llvm-project/pull/118505
More information about the llvm-commits
mailing list