llvm.org GIT mirror llvm / 0460af3
[InstSimplify] add tests for fcmp with known-never-nan operands; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362742 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 3 months ago
1 changed file(s) with 46 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
254254 ret <2 x i1> %r
255255 }
256256
257 define i1 @UIToFP_is_positive_or_zero(i32 %x) {
258 ; CHECK-LABEL: @UIToFP_is_positive_or_zero(
259 ; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
260 ; CHECK-NEXT: [[R:%.*]] = fcmp oge float [[A]], 0.000000e+00
261 ; CHECK-NEXT: ret i1 [[R]]
262 ;
263 %a = uitofp i32 %x to float
264 %r = fcmp oge float %a, 0.000000e+00
265 ret i1 %r
266 }
267
268 define <2 x i1> @UIToFP_is_positive_or_zero_vec(<2 x i32> %x) {
269 ; CHECK-LABEL: @UIToFP_is_positive_or_zero_vec(
270 ; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
271 ; CHECK-NEXT: [[R:%.*]] = fcmp oge <2 x float> [[A]], zeroinitializer
272 ; CHECK-NEXT: ret <2 x i1> [[R]]
273 ;
274 %a = uitofp <2 x i32> %x to <2 x float>
275 %r = fcmp oge <2 x float> %a, zeroinitializer
276 ret <2 x i1> %r
277 }
278
257279 define i1 @UIToFP_nnan_is_positive_or_zero(i32 %x) {
258280 ; CHECK-LABEL: @UIToFP_nnan_is_positive_or_zero(
259281 ; CHECK-NEXT: ret i1 true
328350
329351 define i1 @fabs_nnan_is_positive_or_zero(double %x) {
330352 ; CHECK-LABEL: @fabs_nnan_is_positive_or_zero(
353 ; CHECK-NEXT: [[FABS:%.*]] = tail call nnan double @llvm.fabs.f64(double [[X:%.*]])
354 ; CHECK-NEXT: [[CMP:%.*]] = fcmp oge double [[FABS]], 0.000000e+00
355 ; CHECK-NEXT: ret i1 [[CMP]]
356 ;
357 %fabs = tail call nnan double @llvm.fabs.f64(double %x)
358 %cmp = fcmp oge double %fabs, 0.0
359 ret i1 %cmp
360 }
361
362 define <2 x i1> @fabs_nnan_is_positive_or_zero_vec(<2 x double> %x) {
363 ; CHECK-LABEL: @fabs_nnan_is_positive_or_zero_vec(
364 ; CHECK-NEXT: [[FABS:%.*]] = tail call nnan <2 x double> @llvm.fabs.v2f64(<2 x double> [[X:%.*]])
365 ; CHECK-NEXT: [[CMP:%.*]] = fcmp oge <2 x double> [[FABS]], zeroinitializer
366 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
367 ;
368 %fabs = tail call nnan <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
369 %cmp = fcmp oge <2 x double> %fabs, zeroinitializer
370 ret <2 x i1> %cmp
371 }
372
373 define i1 @fabs_fcmp-nnan_is_positive_or_zero(double %x) {
374 ; CHECK-LABEL: @fabs_fcmp-nnan_is_positive_or_zero(
331375 ; CHECK-NEXT: ret i1 true
332376 ;
333377 %fabs = tail call double @llvm.fabs.f64(double %x)
335379 ret i1 %cmp
336380 }
337381
338 define <2 x i1> @fabs_nnan_is_positive_or_zero_vec(<2 x double> %x) {
339 ; CHECK-LABEL: @fabs_nnan_is_positive_or_zero_vec(
382 define <2 x i1> @fabs_fcmp-nnan_is_positive_or_zero_vec(<2 x double> %x) {
383 ; CHECK-LABEL: @fabs_fcmp-nnan_is_positive_or_zero_vec(
340384 ; CHECK-NEXT: ret <2 x i1>
341385 ;
342386 %fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)