[clang] [llvm] [X86][AVX10.2] Support saturated converts (PR #102592)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 08:30:57 PDT 2024


================
@@ -324,7 +324,14 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
     }
   }
 
-  if (Subtarget.hasSSE2()) {
+  if (Subtarget.hasAVX10_2() || Subtarget.hasAVX10_2_512()) {
+    setOperationAction(ISD::FP_TO_UINT_SAT, MVT::i32, Legal);
+    setOperationAction(ISD::FP_TO_SINT_SAT, MVT::i32, Legal);
+    if (Subtarget.is64Bit()) {
+      setOperationAction(ISD::FP_TO_UINT_SAT, MVT::i64, Legal);
+      setOperationAction(ISD::FP_TO_SINT_SAT, MVT::i64, Legal);
+    }
+  } else if (Subtarget.hasSSE2()) {
----------------
phoebewang wrote:

We usually don't use `else if`, but put `if (Subtarget.hasAVX10_2())` after it to override.

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


More information about the cfe-commits mailing list