[llvm] [X86][SSE] Improve ISD::FP_TO_*INT_SAT vector lowering (PR #199416)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 06:28:46 PDT 2026
================
@@ -22828,8 +22822,89 @@ X86TargetLowering::LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG) const {
SDValue Res = DAG.getNode(IsSigned ? X86ISD::CVTTP2IBS : X86ISD::CVTTP2IUBS,
dl, VecI16VT, Src);
return DAG.getNode(ISD::TRUNCATE, dl, DstVT, Res);
- }
+ } else if (DstVT == MVT::v4i32 && Subtarget.hasSSE2()) {
+ unsigned SatWidth = SatVT.getScalarSizeInBits();
+ assert(SatWidth <= 32 &&
+ "Expected saturation width no wider than result element");
+
+ if (SatWidth == 32) {
+ if (IsSigned) {
+ SDValue Cvt = DAG.getNode(ISD::FP_TO_SINT, dl, DstVT, Src);
----------------
RKSimon wrote:
Don't you have to use X86ISD::CVTTP2SI to guarantee this will be handled properly?
https://github.com/llvm/llvm-project/pull/199416
More information about the llvm-commits
mailing list