llvm.org GIT mirror llvm / b98edf7
[ValueTracking] add tests for fmin/fmax; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345777 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 10 months ago
1 changed file(s) with 176 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
146146 "}\n");
147147 // But this should be, because we've ignored signed zeroes.
148148 expectPattern({SPF_FMINNUM, SPNB_RETURNS_OTHER, true});
149 }
150
151 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero1) {
152 parseAssembly(
153 "define float @test(float %a) {\n"
154 " %1 = fcmp olt float -0.0, %a\n"
155 " %A = select i1 %1, float 0.0, float %a\n"
156 " ret float %A\n"
157 "}\n");
158 // FIXME: The sign of zero doesn't matter in fcmp.
159 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
160 }
161
162 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero2) {
163 parseAssembly(
164 "define float @test(float %a) {\n"
165 " %1 = fcmp ogt float %a, -0.0\n"
166 " %A = select i1 %1, float 0.0, float %a\n"
167 " ret float %A\n"
168 "}\n");
169 // FIXME: The sign of zero doesn't matter in fcmp.
170 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
171 }
172
173 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero3) {
174 parseAssembly(
175 "define float @test(float %a) {\n"
176 " %1 = fcmp olt float 0.0, %a\n"
177 " %A = select i1 %1, float -0.0, float %a\n"
178 " ret float %A\n"
179 "}\n");
180 // FIXME: The sign of zero doesn't matter in fcmp.
181 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
182 }
183
184 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero4) {
185 parseAssembly(
186 "define float @test(float %a) {\n"
187 " %1 = fcmp ogt float %a, 0.0\n"
188 " %A = select i1 %1, float -0.0, float %a\n"
189 " ret float %A\n"
190 "}\n");
191 // FIXME: The sign of zero doesn't matter in fcmp.
192 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
193 }
194
195 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero5) {
196 parseAssembly(
197 "define float @test(float %a) {\n"
198 " %1 = fcmp ogt float -0.0, %a\n"
199 " %A = select i1 %1, float %a, float 0.0\n"
200 " ret float %A\n"
201 "}\n");
202 // FIXME: The sign of zero doesn't matter in fcmp.
203 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
204 }
205
206 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero6) {
207 parseAssembly(
208 "define float @test(float %a) {\n"
209 " %1 = fcmp olt float %a, -0.0\n"
210 " %A = select i1 %1, float %a, float 0.0\n"
211 " ret float %A\n"
212 "}\n");
213 // FIXME: The sign of zero doesn't matter in fcmp.
214 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
215 }
216
217 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero7) {
218 parseAssembly(
219 "define float @test(float %a) {\n"
220 " %1 = fcmp ogt float 0.0, %a\n"
221 " %A = select i1 %1, float %a, float -0.0\n"
222 " ret float %A\n"
223 "}\n");
224 // FIXME: The sign of zero doesn't matter in fcmp.
225 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
226 }
227
228 TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero8) {
229 parseAssembly(
230 "define float @test(float %a) {\n"
231 " %1 = fcmp olt float %a, 0.0\n"
232 " %A = select i1 %1, float %a, float -0.0\n"
233 " ret float %A\n"
234 "}\n");
235 // FIXME: The sign of zero doesn't matter in fcmp.
236 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
237 }
238
239 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero1) {
240 parseAssembly(
241 "define float @test(float %a) {\n"
242 " %1 = fcmp ogt float -0.0, %a\n"
243 " %A = select i1 %1, float 0.0, float %a\n"
244 " ret float %A\n"
245 "}\n");
246 // FIXME: The sign of zero doesn't matter in fcmp.
247 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
248 }
249
250 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero2) {
251 parseAssembly(
252 "define float @test(float %a) {\n"
253 " %1 = fcmp olt float %a, -0.0\n"
254 " %A = select i1 %1, float 0.0, float %a\n"
255 " ret float %A\n"
256 "}\n");
257 // FIXME: The sign of zero doesn't matter in fcmp.
258 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
259 }
260
261 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero3) {
262 parseAssembly(
263 "define float @test(float %a) {\n"
264 " %1 = fcmp ogt float 0.0, %a\n"
265 " %A = select i1 %1, float -0.0, float %a\n"
266 " ret float %A\n"
267 "}\n");
268 // FIXME: The sign of zero doesn't matter in fcmp.
269 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
270 }
271
272 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero4) {
273 parseAssembly(
274 "define float @test(float %a) {\n"
275 " %1 = fcmp olt float %a, 0.0\n"
276 " %A = select i1 %1, float -0.0, float %a\n"
277 " ret float %A\n"
278 "}\n");
279 // FIXME: The sign of zero doesn't matter in fcmp.
280 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
281 }
282
283 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero5) {
284 parseAssembly(
285 "define float @test(float %a) {\n"
286 " %1 = fcmp olt float -0.0, %a\n"
287 " %A = select i1 %1, float %a, float 0.0\n"
288 " ret float %A\n"
289 "}\n");
290 // FIXME: The sign of zero doesn't matter in fcmp.
291 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
292 }
293
294 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero6) {
295 parseAssembly(
296 "define float @test(float %a) {\n"
297 " %1 = fcmp ogt float %a, -0.0\n"
298 " %A = select i1 %1, float %a, float 0.0\n"
299 " ret float %A\n"
300 "}\n");
301 // FIXME: The sign of zero doesn't matter in fcmp.
302 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
303 }
304
305 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero7) {
306 parseAssembly(
307 "define float @test(float %a) {\n"
308 " %1 = fcmp olt float 0.0, %a\n"
309 " %A = select i1 %1, float %a, float -0.0\n"
310 " ret float %A\n"
311 "}\n");
312 // FIXME: The sign of zero doesn't matter in fcmp.
313 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
314 }
315
316 TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero8) {
317 parseAssembly(
318 "define float @test(float %a) {\n"
319 " %1 = fcmp ogt float %a, 0.0\n"
320 " %A = select i1 %1, float %a, float -0.0\n"
321 " ret float %A\n"
322 "}\n");
323 // FIXME: The sign of zero doesn't matter in fcmp.
324 expectPattern({SPF_UNKNOWN, SPNB_NA, false});
149325 }
150326
151327 TEST_F(MatchSelectPatternTest, VectorFMinimum) {