55; (X < C1) ? C1 : MIN(X, C2) 
66define  float  @clamp_float_fast_ordered_strict_maxmin (float  %x ) {
77; CHECK-LABEL: @clamp_float_fast_ordered_strict_maxmin( 
8- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp fast olt float [[X:%.*]], 2.550000e+02 
9- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
10- ; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp fast oge float [[MIN]], 1.000000e+00 
11- ; CHECK-NEXT:    [[R1:%.*]] = select nnan ninf i1 [[DOTINV]], float [[MIN]], float 1.000000e+00 
8+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
9+ ; CHECK-NEXT:    [[CMP1:%.*]] = fcmp fast olt float [[X]], 1.000000e+00 
10+ ; CHECK-NEXT:    [[R1:%.*]] = select i1 [[CMP1]], float 1.000000e+00, float [[MIN]] 
1211; CHECK-NEXT:    ret float [[R1]] 
1312; 
1413  %cmp2  = fcmp  fast olt  float  %x , 255 .0 
@@ -21,10 +20,9 @@ define float @clamp_float_fast_ordered_strict_maxmin(float %x) {
2120; (X <= C1) ? C1 : MIN(X, C2) 
2221define  float  @clamp_float_fast_ordered_nonstrict_maxmin (float  %x ) {
2322; CHECK-LABEL: @clamp_float_fast_ordered_nonstrict_maxmin( 
24- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp fast olt float [[X:%.*]], 2.550000e+02 
25- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
26- ; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp fast oge float [[MIN]], 1.000000e+00 
27- ; CHECK-NEXT:    [[R1:%.*]] = select nnan ninf i1 [[DOTINV]], float [[MIN]], float 1.000000e+00 
23+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
24+ ; CHECK-NEXT:    [[CMP1:%.*]] = fcmp fast ole float [[X]], 1.000000e+00 
25+ ; CHECK-NEXT:    [[R1:%.*]] = select i1 [[CMP1]], float 1.000000e+00, float [[MIN]] 
2826; CHECK-NEXT:    ret float [[R1]] 
2927; 
3028  %cmp2  = fcmp  fast olt  float  %x , 255 .0 
@@ -37,10 +35,9 @@ define float @clamp_float_fast_ordered_nonstrict_maxmin(float %x) {
3735; (X > C1) ? C1 : MAX(X, C2) 
3836define  float  @clamp_float_fast_ordered_strict_minmax (float  %x ) {
3937; CHECK-LABEL: @clamp_float_fast_ordered_strict_minmax( 
40- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp fast ogt float [[X:%.*]], 1.000000e+00 
41- ; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00 
42- ; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp fast ole float [[MAX]], 2.550000e+02 
43- ; CHECK-NEXT:    [[R1:%.*]] = select nnan ninf i1 [[DOTINV]], float [[MAX]], float 2.550000e+02 
38+ ; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00) 
39+ ; CHECK-NEXT:    [[CMP1:%.*]] = fcmp fast ogt float [[X]], 2.550000e+02 
40+ ; CHECK-NEXT:    [[R1:%.*]] = select i1 [[CMP1]], float 2.550000e+02, float [[MAX]] 
4441; CHECK-NEXT:    ret float [[R1]] 
4542; 
4643  %cmp2  = fcmp  fast ogt  float  %x , 1 .0 
@@ -53,10 +50,9 @@ define float @clamp_float_fast_ordered_strict_minmax(float %x) {
5350; (X >= C1) ? C1 : MAX(X, C2) 
5451define  float  @clamp_float_fast_ordered_nonstrict_minmax (float  %x ) {
5552; CHECK-LABEL: @clamp_float_fast_ordered_nonstrict_minmax( 
56- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp fast ogt float [[X:%.*]], 1.000000e+00 
57- ; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00 
58- ; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp fast ole float [[MAX]], 2.550000e+02 
59- ; CHECK-NEXT:    [[R1:%.*]] = select nnan ninf i1 [[DOTINV]], float [[MAX]], float 2.550000e+02 
53+ ; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00) 
54+ ; CHECK-NEXT:    [[CMP1:%.*]] = fcmp fast oge float [[X]], 2.550000e+02 
55+ ; CHECK-NEXT:    [[R1:%.*]] = select i1 [[CMP1]], float 2.550000e+02, float [[MAX]] 
6056; CHECK-NEXT:    ret float [[R1]] 
6157; 
6258  %cmp2  = fcmp  fast ogt  float  %x , 1 .0 
@@ -191,8 +187,7 @@ define float @clamp_negative_same_op(float %x) {
191187; First, check that we don't do bad things in the presence of signed zeros 
192188define  float  @clamp_float_with_zero1 (float  %x ) {
193189; CHECK-LABEL: @clamp_float_with_zero1( 
194- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp fast olt float [[X:%.*]], 2.550000e+02 
195- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
190+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
196191; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ole float [[X]], 0.000000e+00 
197192; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 0.000000e+00, float [[MIN]] 
198193; CHECK-NEXT:    ret float [[R]] 
@@ -206,8 +201,7 @@ define float @clamp_float_with_zero1(float %x) {
206201
207202define  float  @clamp_float_with_zero2 (float  %x ) {
208203; CHECK-LABEL: @clamp_float_with_zero2( 
209- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp fast olt float [[X:%.*]], 2.550000e+02 
210- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
204+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
211205; CHECK-NEXT:    [[CMP1:%.*]] = fcmp olt float [[X]], 0.000000e+00 
212206; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 0.000000e+00, float [[MIN]] 
213207; CHECK-NEXT:    ret float [[R]] 
@@ -228,8 +222,7 @@ define float @clamp_float_with_zero2(float %x) {
228222; (X < C1) ? C1 : MIN(X, C2) 
229223define  float  @clamp_float_ordered_strict_maxmin1 (float  %x ) {
230224; CHECK-LABEL: @clamp_float_ordered_strict_maxmin1( 
231- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp olt float [[X:%.*]], 2.550000e+02 
232- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
225+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
233226; CHECK-NEXT:    [[CMP1:%.*]] = fcmp olt float [[X]], 1.000000e+00 
234227; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 1.000000e+00, float [[MIN]] 
235228; CHECK-NEXT:    ret float [[R]] 
@@ -259,8 +252,7 @@ define float @clamp_float_ordered_strict_maxmin2(float %x) {
259252; (X <= C1) ? C1 : MIN(X, C2) 
260253define  float  @clamp_float_ordered_nonstrict_maxmin1 (float  %x ) {
261254; CHECK-LABEL: @clamp_float_ordered_nonstrict_maxmin1( 
262- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp olt float [[X:%.*]], 2.550000e+02 
263- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
255+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
264256; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ole float [[X]], 1.000000e+00 
265257; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 1.000000e+00, float [[MIN]] 
266258; CHECK-NEXT:    ret float [[R]] 
@@ -290,8 +282,7 @@ define float @clamp_float_ordered_nonstrict_maxmin2(float %x) {
290282; (X > C1) ? C1 : MAX(X, C2) 
291283define  float  @clamp_float_ordered_strict_minmax1 (float  %x ) {
292284; CHECK-LABEL: @clamp_float_ordered_strict_minmax1( 
293- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp ogt float [[X:%.*]], 1.000000e+00 
294- ; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00 
285+ ; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00) 
295286; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ogt float [[X]], 2.550000e+02 
296287; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 2.550000e+02, float [[MAX]] 
297288; CHECK-NEXT:    ret float [[R]] 
@@ -321,8 +312,7 @@ define float @clamp_float_ordered_strict_minmax2(float %x) {
321312; (X >= C1) ? C1 : MAX(X, C2) 
322313define  float  @clamp_float_ordered_nonstrict_minmax1 (float  %x ) {
323314; CHECK-LABEL: @clamp_float_ordered_nonstrict_minmax1( 
324- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp ogt float [[X:%.*]], 1.000000e+00 
325- ; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00 
315+ ; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00) 
326316; CHECK-NEXT:    [[CMP1:%.*]] = fcmp oge float [[X]], 2.550000e+02 
327317; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 2.550000e+02, float [[MAX]] 
328318; CHECK-NEXT:    ret float [[R]] 
@@ -355,8 +345,7 @@ define float @clamp_float_ordered_nonstrict_minmax2(float %x) {
355345; (X < C1) ? C1 : MIN(X, C2) 
356346define  float  @clamp_float_unordered_strict_maxmin1 (float  %x ) {
357347; CHECK-LABEL: @clamp_float_unordered_strict_maxmin1( 
358- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp olt float [[X:%.*]], 2.550000e+02 
359- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
348+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
360349; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ult float [[X]], 1.000000e+00 
361350; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 1.000000e+00, float [[MIN]] 
362351; CHECK-NEXT:    ret float [[R]] 
@@ -386,8 +375,7 @@ define float @clamp_float_unordered_strict_maxmin2(float %x) {
386375; (X <= C1) ? C1 : MIN(X, C2) 
387376define  float  @clamp_float_unordered_nonstrict_maxmin1 (float  %x ) {
388377; CHECK-LABEL: @clamp_float_unordered_nonstrict_maxmin1( 
389- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp olt float [[X:%.*]], 2.550000e+02 
390- ; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02 
378+ ; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
391379; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ule float [[X]], 1.000000e+00 
392380; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 1.000000e+00, float [[MIN]] 
393381; CHECK-NEXT:    ret float [[R]] 
@@ -417,8 +405,7 @@ define float @clamp_float_unordered_nonstrict_maxmin2(float %x) {
417405; (X > C1) ? C1 : MAX(X, C2) 
418406define  float  @clamp_float_unordered_strict_minmax1 (float  %x ) {
419407; CHECK-LABEL: @clamp_float_unordered_strict_minmax1( 
420- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp ogt float [[X:%.*]], 1.000000e+00 
421- ; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00 
408+ ; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00) 
422409; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ugt float [[X]], 2.550000e+02 
423410; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 2.550000e+02, float [[MAX]] 
424411; CHECK-NEXT:    ret float [[R]] 
@@ -448,8 +435,7 @@ define float @clamp_float_unordered_strict_minmax2(float %x) {
448435; (X >= C1) ? C1 : MAX(X, C2) 
449436define  float  @clamp_float_unordered_nonstrict_minmax1 (float  %x ) {
450437; CHECK-LABEL: @clamp_float_unordered_nonstrict_minmax1( 
451- ; CHECK-NEXT:    [[CMP2:%.*]] = fcmp ogt float [[X:%.*]], 1.000000e+00 
452- ; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00 
438+ ; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 1.000000e+00) 
453439; CHECK-NEXT:    [[CMP1:%.*]] = fcmp uge float [[X]], 2.550000e+02 
454440; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMP1]], float 2.550000e+02, float [[MAX]] 
455441; CHECK-NEXT:    ret float [[R]] 
@@ -527,8 +513,7 @@ define float @mixed_clamp_to_float_1(i32 %x) {
527513
528514define  i32  @mixed_clamp_to_i32_1 (float  %x ) {
529515; CHECK-LABEL: @mixed_clamp_to_i32_1( 
530- ; CHECK-NEXT:    [[FLOAT_MIN_CMP:%.*]] = fcmp ogt float [[X:%.*]], 2.550000e+02 
531- ; CHECK-NEXT:    [[FLOAT_MIN:%.*]] = select i1 [[FLOAT_MIN_CMP]], float 2.550000e+02, float [[X]] 
516+ ; CHECK-NEXT:    [[FLOAT_MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
532517; CHECK-NEXT:    [[I32_MIN:%.*]] = fptosi float [[FLOAT_MIN]] to i32 
533518; CHECK-NEXT:    [[I32_X:%.*]] = fptosi float [[X]] to i32 
534519; CHECK-NEXT:    [[LO_CMP:%.*]] = icmp eq i32 [[I32_X]], 0 
@@ -561,8 +546,7 @@ define float @mixed_clamp_to_float_2(i32 %x) {
561546
562547define  i32  @mixed_clamp_to_i32_2 (float  %x ) {
563548; CHECK-LABEL: @mixed_clamp_to_i32_2( 
564- ; CHECK-NEXT:    [[FLOAT_MIN_CMP:%.*]] = fcmp ogt float [[X:%.*]], 2.550000e+02 
565- ; CHECK-NEXT:    [[FLOAT_MIN:%.*]] = select i1 [[FLOAT_MIN_CMP]], float 2.550000e+02, float [[X]] 
549+ ; CHECK-NEXT:    [[FLOAT_MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02) 
566550; CHECK-NEXT:    [[I32_MIN:%.*]] = fptosi float [[FLOAT_MIN]] to i32 
567551; CHECK-NEXT:    [[LO_CMP:%.*]] = fcmp olt float [[X]], 1.000000e+00 
568552; CHECK-NEXT:    [[R:%.*]] = select i1 [[LO_CMP]], i32 1, i32 [[I32_MIN]] 
0 commit comments