[llvm] bae2401 - [InstCombine] Add regression tests for f[min][max]imum_num libcalls (#170695)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 5 02:54:56 PST 2025
Author: valadaptive
Date: 2025-12-05T11:54:52+01:00
New Revision: bae2401295bc04dd57354c79e22a0cf58fd3b86b
URL: https://github.com/llvm/llvm-project/commit/bae2401295bc04dd57354c79e22a0cf58fd3b86b
DIFF: https://github.com/llvm/llvm-project/commit/bae2401295bc04dd57354c79e22a0cf58fd3b86b.diff
LOG: [InstCombine] Add regression tests for f[min][max]imum_num libcalls (#170695)
Add tests corresponding to the existing fmin/fmax tests, as we'll later
begin optimizing these into intrinsics.
Added:
Modified:
llvm/test/Transforms/InstCombine/float-shrink-compare.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/float-shrink-compare.ll b/llvm/test/Transforms/InstCombine/float-shrink-compare.ll
index 77b6ed7c5abe8..46341cf3d346f 100644
--- a/llvm/test/Transforms/InstCombine/float-shrink-compare.ll
+++ b/llvm/test/Transforms/InstCombine/float-shrink-compare.ll
@@ -463,6 +463,40 @@ define i1 @test18(float %x, float %y, float %z) {
ret i1 %5
}
+define i1 @test_fminimum_num(float %x, float %y, float %z) {
+; CHECK-LABEL: @test_fminimum_num(
+; CHECK-NEXT: [[TMP1:%.*]] = fpext float [[X:%.*]] to double
+; CHECK-NEXT: [[TMP2:%.*]] = fpext float [[Y:%.*]] to double
+; CHECK-NEXT: [[TMP3:%.*]] = call double @fminimum_num(double [[TMP1]], double [[TMP2]]) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT: [[TMP4:%.*]] = fpext float [[Z:%.*]] to double
+; CHECK-NEXT: [[TMP5:%.*]] = fcmp oeq double [[TMP3]], [[TMP4]]
+; CHECK-NEXT: ret i1 [[TMP5]]
+;
+ %1 = fpext float %x to double
+ %2 = fpext float %y to double
+ %3 = call double @fminimum_num(double %1, double %2) nounwind
+ %4 = fpext float %z to double
+ %5 = fcmp oeq double %3, %4
+ ret i1 %5
+}
+
+define i1 @test_fmaximum_num(float %x, float %y, float %z) {
+; CHECK-LABEL: @test_fmaximum_num(
+; CHECK-NEXT: [[TMP1:%.*]] = fpext float [[X:%.*]] to double
+; CHECK-NEXT: [[TMP2:%.*]] = fpext float [[Y:%.*]] to double
+; CHECK-NEXT: [[TMP3:%.*]] = call double @fmaximum_num(double [[TMP1]], double [[TMP2]]) #[[ATTR3]]
+; CHECK-NEXT: [[TMP4:%.*]] = fpext float [[Z:%.*]] to double
+; CHECK-NEXT: [[TMP5:%.*]] = fcmp oeq double [[TMP3]], [[TMP4]]
+; CHECK-NEXT: ret i1 [[TMP5]]
+;
+ %1 = fpext float %x to double
+ %2 = fpext float %y to double
+ %3 = call double @fmaximum_num(double %1, double %2) nounwind
+ %4 = fpext float %z to double
+ %5 = fcmp oeq double %3, %4
+ ret i1 %5
+}
+
define i1 @test19(float %x, float %y, float %z) {
; CHECK-LABEL: @test19(
; CHECK-NEXT: [[COPYSIGNF:%.*]] = call float @copysignf(float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0:[0-9]+]]
@@ -518,6 +552,8 @@ declare double @roundeven(double) nounwind readnone
declare double @trunc(double) nounwind readnone
declare double @fmin(double, double) nounwind readnone
declare double @fmax(double, double) nounwind readnone
+declare double @fminimum_num(double, double) nounwind readnone
+declare double @fmaximum_num(double, double) nounwind readnone
declare double @llvm.fabs.f64(double) nounwind readnone
declare double @llvm.ceil.f64(double) nounwind readnone
More information about the llvm-commits
mailing list