[llvm] [X86][SSE] Improve ISD::FP_TO_*INT_SAT vector lowering (PR #199416)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 19:52:56 PDT 2026


================
@@ -1545,6 +1550,10 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
     setOperationPromotedToType(ISD::STRICT_FP_TO_UINT, MVT::v8i16, MVT::v8i32);
     setOperationAction(ISD::FP_TO_SINT,                MVT::v8i32, Custom);
     setOperationAction(ISD::FP_TO_UINT,                MVT::v8i32, Custom);
+    if (!Subtarget.hasAVX10_2()) {
+      setOperationAction(ISD::FP_TO_SINT_SAT, MVT::v8i32, Custom);
+      setOperationAction(ISD::FP_TO_UINT_SAT, MVT::v8i32, Custom);
+    }
----------------
Panadulek wrote:

@phoebewang 

As i undestand:

if (Subtarget.hasAVX10_2())  which is in 325 line mark ISD::FP_TO_UINT_SAT  and ISD::FP_TO_SINT_SAT mark as legal

if (!Subtarget.useSoftFloat() && Subtarget.hasAVX())  which is in 1492 line. ISD::FP_TO_UINT_SAT  and ISD::FP_TO_SINT_SAT mark as custom  

So avx and avx512 override mark from avx10_2. Which force to use our custom approach instead of the avx10_2 instructions. So it will make regression for avx10_2. Do i understand correctly (some tests failed after remove !Subtarget.hasAVX10_2()). 


I suggest to move block for avx10_2 after the avx512 or keep condition  !Subtarget.hasAVX10_2(). What do you think 

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


More information about the llvm-commits mailing list