[llvm] [SPIRV] Lower G_FMINIMUMNUM/G_FMAXIMUMNUM to OpenCL extended inst fmin/fmax (PR #153550)

Victor Lomuller via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 04:20:42 PDT 2025


================
@@ -737,9 +737,11 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg,
 
   case TargetOpcode::G_FMINNUM:
   case TargetOpcode::G_FMINIMUM:
+  case TargetOpcode::G_FMINIMUMNUM:
----------------
Naghasan wrote:

Something isn't right on how this whole thing is handled:

If both operand are NaNs, behaviour should match
If one is NaN, `fminimumnum` and ocl returns the other operand but glsl can return either operand, the other 2 llvm intrinsic have different behaviour if it is sNaN or qNan.

Behaviour with -0 / 0 isn't set for ocl as well.

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


More information about the llvm-commits mailing list