[llvm] [InstSimplify] Optimize maximumnum and minimumnum (PR #139581)
Lewis Crawford via llvm-commits
llvm-commits at lists.llvm.org
Tue May 13 06:32:33 PDT 2025
================
@@ -88,6 +152,23 @@ define float @test_minimum_const_inf(float %x) {
ret float %r
}
+define float @test_maximumnum_const_inf(float %x) {
+; CHECK-LABEL: @test_maximumnum_const_inf(
+; CHECK-NEXT: ret float 0x7FF0000000000000
+;
+ %r = call float @llvm.maximumnum.f32(float %x, float 0x7ff0000000000000)
+ ret float %r
+}
+
+define float @test_minimumnum_const_inf(float %x) {
+; CHECK-LABEL: @test_minimumnum_const_inf(
+; CHECK-NEXT: [[R:%.*]] = call float @llvm.minimumnum.f32(float [[X:%.*]], float 0x7FF0000000000000)
+; CHECK-NEXT: ret float [[R]]
+;
+ %r = call float @llvm.minimumnum.f32(float %x, float 0x7ff0000000000000)
+ ret float %r
+}
+
----------------
LewisCrawford wrote:
There was only 1 pre-existing test for vectors there before. I've added a new commit adding vector variants of all of these inf/max tests for all the intrinsics now.
https://github.com/llvm/llvm-project/pull/139581
More information about the llvm-commits
mailing list