@@ -67,10 +67,10 @@ define float @clamp_float_fast_ordered_nonstrict_minmax(float %x) {
67
67
; (X < C1) ? C1 : MIN(X, C2)
68
68
define float @clamp_float_fast_unordered_strict_maxmin (float %x ) {
69
69
; CHECK-LABEL: @clamp_float_fast_unordered_strict_maxmin(
70
- ; CHECK-NEXT: [[CMP2_INV :%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
71
- ; CHECK-NEXT: [[MIN :%.*]] = select fast i1 [[CMP2_INV ]], float 2.550000e+02, float [[X]]
72
- ; CHECK-NEXT: [[R1 :%.*]] = call fast float @llvm.maxnum.f32(float [[MIN ]], float 1.000000e+00)
73
- ; CHECK-NEXT: ret float [[R1 ]]
70
+ ; CHECK-NEXT: [[MIN :%.*]] = call fast float @llvm.minnum.f32( float [[X:%.*]], float 2.550000e+02)
71
+ ; CHECK-NEXT: [[CMP1 :%.*]] = fcmp fast ult float [[X ]], 1.000000e+00
72
+ ; CHECK-NEXT: [[R :%.*]] = select i1 [[CMP1 ]], float 1.000000e+00, float [[MIN]]
73
+ ; CHECK-NEXT: ret float [[R ]]
74
74
;
75
75
%cmp2 = fcmp fast ult float %x , 255 .0
76
76
%min = select i1 %cmp2 , float %x , float 255 .0
@@ -82,10 +82,10 @@ define float @clamp_float_fast_unordered_strict_maxmin(float %x) {
82
82
; (X <= C1) ? C1 : MIN(X, C2)
83
83
define float @clamp_float_fast_unordered_nonstrict_maxmin (float %x ) {
84
84
; CHECK-LABEL: @clamp_float_fast_unordered_nonstrict_maxmin(
85
- ; CHECK-NEXT: [[CMP2_INV :%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
86
- ; CHECK-NEXT: [[MIN :%.*]] = select fast i1 [[CMP2_INV ]], float 2.550000e+02, float [[X]]
87
- ; CHECK-NEXT: [[R1 :%.*]] = call fast float @llvm.maxnum.f32(float [[MIN ]], float 1.000000e+00)
88
- ; CHECK-NEXT: ret float [[R1 ]]
85
+ ; CHECK-NEXT: [[MIN :%.*]] = call fast float @llvm.minnum.f32( float [[X:%.*]], float 2.550000e+02)
86
+ ; CHECK-NEXT: [[CMP1 :%.*]] = fcmp fast ule float [[X ]], 1.000000e+00
87
+ ; CHECK-NEXT: [[R :%.*]] = select i1 [[CMP1 ]], float 1.000000e+00, float [[MIN]]
88
+ ; CHECK-NEXT: ret float [[R ]]
89
89
;
90
90
%cmp2 = fcmp fast ult float %x , 255 .0
91
91
%min = select i1 %cmp2 , float %x , float 255 .0
@@ -97,10 +97,10 @@ define float @clamp_float_fast_unordered_nonstrict_maxmin(float %x) {
97
97
; (X > C1) ? C1 : MAX(X, C2)
98
98
define float @clamp_float_fast_unordered_strict_minmax (float %x ) {
99
99
; CHECK-LABEL: @clamp_float_fast_unordered_strict_minmax(
100
- ; CHECK-NEXT: [[CMP2_INV :%.*]] = fcmp fast ole float [[X:%.*]], 1.000000e+00
101
- ; CHECK-NEXT: [[MAX :%.*]] = select fast i1 [[CMP2_INV ]], float 1.000000e+00, float [[X]]
102
- ; CHECK-NEXT: [[R1 :%.*]] = call fast float @llvm.minnum.f32(float [[MAX ]], float 2.550000e+02)
103
- ; CHECK-NEXT: ret float [[R1 ]]
100
+ ; CHECK-NEXT: [[MAX :%.*]] = call fast float @llvm.maxnum.f32( float [[X:%.*]], float 1.000000e+00)
101
+ ; CHECK-NEXT: [[CMP1 :%.*]] = fcmp fast ugt float [[X ]], 2.550000e+02
102
+ ; CHECK-NEXT: [[R :%.*]] = select i1 [[CMP1 ]], float 2.550000e+02, float [[MAX]]
103
+ ; CHECK-NEXT: ret float [[R ]]
104
104
;
105
105
%cmp2 = fcmp fast ugt float %x , 1 .0
106
106
%max = select i1 %cmp2 , float %x , float 1 .0
@@ -112,10 +112,10 @@ define float @clamp_float_fast_unordered_strict_minmax(float %x) {
112
112
; (X >= C1) ? C1 : MAX(X, C2)
113
113
define float @clamp_float_fast_unordered_nonstrict_minmax (float %x ) {
114
114
; CHECK-LABEL: @clamp_float_fast_unordered_nonstrict_minmax(
115
- ; CHECK-NEXT: [[CMP2_INV :%.*]] = fcmp fast ole float [[X:%.*]], 1.000000e+00
116
- ; CHECK-NEXT: [[MAX :%.*]] = select fast i1 [[CMP2_INV ]], float 1.000000e+00, float [[X]]
117
- ; CHECK-NEXT: [[R1 :%.*]] = call fast float @llvm.minnum.f32(float [[MAX ]], float 2.550000e+02)
118
- ; CHECK-NEXT: ret float [[R1 ]]
115
+ ; CHECK-NEXT: [[MAX :%.*]] = call fast float @llvm.maxnum.f32( float [[X:%.*]], float 1.000000e+00)
116
+ ; CHECK-NEXT: [[CMP1 :%.*]] = fcmp fast uge float [[X ]], 2.550000e+02
117
+ ; CHECK-NEXT: [[R :%.*]] = select i1 [[CMP1 ]], float 2.550000e+02, float [[MAX]]
118
+ ; CHECK-NEXT: ret float [[R ]]
119
119
;
120
120
%cmp2 = fcmp fast ugt float %x , 1 .0
121
121
%max = select i1 %cmp2 , float %x , float 1 .0
@@ -127,13 +127,12 @@ define float @clamp_float_fast_unordered_nonstrict_minmax(float %x) {
127
127
; Some more checks with fast
128
128
129
129
; (X > 1.0) ? min(x, 255.0) : 1.0
130
- ; That did not match because select was in inverse order.
131
130
define float @clamp_test_1 (float %x ) {
132
131
; CHECK-LABEL: @clamp_test_1(
133
- ; CHECK-NEXT: [[INNER_CMP_INV :%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
134
- ; CHECK-NEXT: [[INNER_SEL :%.*]] = select fast i1 [[INNER_CMP_INV ]], float 2.550000e+02, float [[X]]
135
- ; CHECK-NEXT: [[R1 :%.*]] = call fast float @llvm.maxnum.f32( float [[INNER_SEL]], float 1.000000e+00)
136
- ; CHECK-NEXT: ret float [[R1 ]]
132
+ ; CHECK-NEXT: [[INNER_SEL :%.*]] = call fast float @llvm.minnum.f32( float [[X:%.*]], float 2.550000e+02)
133
+ ; CHECK-NEXT: [[OUTER_CMP :%.*]] = fcmp fast ugt float [[X ]], 1.000000e+00
134
+ ; CHECK-NEXT: [[R :%.*]] = select i1 [[OUTER_CMP]], float [[INNER_SEL]], float 1.000000e+00
135
+ ; CHECK-NEXT: ret float [[R ]]
137
136
;
138
137
%inner_cmp = fcmp fast ult float %x , 255 .0
139
138
%inner_sel = select i1 %inner_cmp , float %x , float 255 .0
@@ -147,8 +146,7 @@ define float @clamp_test_1(float %x) {
147
146
; Like @clamp_test_1 but HighConst < LowConst
148
147
define float @clamp_negative_wrong_const (float %x ) {
149
148
; CHECK-LABEL: @clamp_negative_wrong_const(
150
- ; CHECK-NEXT: [[INNER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
151
- ; CHECK-NEXT: [[INNER_SEL:%.*]] = select fast i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
149
+ ; CHECK-NEXT: [[INNER_SEL:%.*]] = call fast float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02)
152
150
; CHECK-NEXT: [[OUTER_CMP:%.*]] = fcmp fast ugt float [[X]], 5.120000e+02
153
151
; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[INNER_SEL]], float 5.120000e+02
154
152
; CHECK-NEXT: ret float [[R]]
@@ -163,8 +161,7 @@ define float @clamp_negative_wrong_const(float %x) {
163
161
; Like @clamp_test_1 but both are min
164
162
define float @clamp_negative_same_op (float %x ) {
165
163
; CHECK-LABEL: @clamp_negative_same_op(
166
- ; CHECK-NEXT: [[INNER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
167
- ; CHECK-NEXT: [[INNER_SEL:%.*]] = select fast i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
164
+ ; CHECK-NEXT: [[INNER_SEL:%.*]] = call fast float @llvm.minnum.f32(float [[X:%.*]], float 2.550000e+02)
168
165
; CHECK-NEXT: [[OUTER_CMP:%.*]] = fcmp fast ult float [[X]], 1.000000e+00
169
166
; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[INNER_SEL]], float 1.000000e+00
170
167
; CHECK-NEXT: ret float [[R]]
0 commit comments