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

Erik Enikeev via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 7 07:09:51 PST 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);
----------------
Varnike wrote:

@RolandF77, sorry for delay. 

Maybe it would be better to mark such ops as `LibCall` and implement corresponding lowering for `SETCC`/`STRICT_FSETCC*`, for example in the same way it is done for `FP_TO_SINT`? Current implementation of custom lowering for `SETCC` tries to legalize comparison by inverting/switching cc or by expanding it to `SELECT_CC`. Changing this will likely affect other targets. Also in our case, we would rather have these ops lowered to a libcall immediately, since we shouldn't use existing spe comparison instructions anyway.

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


More information about the llvm-commits mailing list