[llvm] [DAGCombiner] Improve FMin/FMax DAGCombines (PR #161352)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 3 12:16:04 PDT 2025
================
@@ -653,5 +653,29 @@ define float @test_maxnum_const_nan(float %x) {
ret float %r
}
+; nnan maxnum(X, -inf) -> X
+define float @test_maxnum_neg_inf_nnan(float %x) nounwind {
+; CHECK-LABEL: test_maxnum_neg_inf_nnan:
+; CHECK: # %bb.0:
+; CHECK-NEXT: retq
+ %r = call nnan float @llvm.maxnum.f32(float %x, float 0xfff0000000000000)
+ ret float %r
----------------
Artem-B wrote:
Would it make sense to swap input arguments, so we do generate some instruction to check for.
Implicitly relying on the fact that the first input and the return value live in the same register and therefore the function is a no-op makes it non-obvious what it is exactly that we are checking for.
I'd prefer to see a mov from a register or with an immediate argument which makes it clear which of the inputs we're returning.
https://github.com/llvm/llvm-project/pull/161352
More information about the llvm-commits
mailing list