[llvm] [PowerPC] set libcall lowering for fp setcc ops on SPE boards (PR #153238)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 09:29:41 PDT 2025


================
@@ -550,8 +550,22 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
     setOperationAction(ISD::UINT_TO_FP, MVT::i32, Legal);
 
     // SPE supports signaling compare of f32/f64.
-    setOperationAction(ISD::STRICT_FSETCCS, MVT::f32, Legal);
-    setOperationAction(ISD::STRICT_FSETCCS, MVT::f64, Legal);
+    // But it doesn't comply IEEE-754 rules for comparing
+    // special values like NaNs, Infs.
+    if (!getTargetMachine().Options.NoNaNsFPMath) {
+      setOperationAction(ISD::SETCC, MVT::f32, Custom);
----------------
RolandF77 wrote:

I think it would be better to handle this in CodeGen/SelectionDAG/LegalizeDAG.cpp. The situation of an operation or type that can not be easily handled by a target is not unusual. llc has a whole legalization system to handle such things, parameterized by targets and target hooks. The soften routine being called comes from the CodeGen legalization system. Doing things there allows code sharing.

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


More information about the llvm-commits mailing list