llvm.org GIT mirror llvm / 4cca04f
[InstSimplify] add tests for fcmp with known-never-nan operands; NFC Opposite predicate for rL362742 / rL362879 / D62979 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362902 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 3 months ago
1 changed file(s) with 48 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
308308 ret <2 x i1> %r
309309 }
310310
311 ; No FMF are required for this transform.
312
313 define i1 @UIToFP_is_not_negative_or_nan(i32 %x) {
314 ; CHECK-LABEL: @UIToFP_is_not_negative_or_nan(
315 ; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
316 ; CHECK-NEXT: [[R:%.*]] = fcmp ult float [[A]], 0.000000e+00
317 ; CHECK-NEXT: ret i1 [[R]]
318 ;
319 %a = uitofp i32 %x to float
320 %r = fcmp ult float %a, 0.000000e+00
321 ret i1 %r
322 }
323
324 define <2 x i1> @UIToFP_is_not_negative_or_nan_vec(<2 x i32> %x) {
325 ; CHECK-LABEL: @UIToFP_is_not_negative_or_nan_vec(
326 ; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
327 ; CHECK-NEXT: [[R:%.*]] = fcmp ult <2 x float> [[A]], zeroinitializer
328 ; CHECK-NEXT: ret <2 x i1> [[R]]
329 ;
330 %a = uitofp <2 x i32> %x to <2 x float>
331 %r = fcmp ult <2 x float> %a, zeroinitializer
332 ret <2 x i1> %r
333 }
334
311335 define i1 @UIToFP_nnan_is_not_negative(i32 %x) {
312336 ; CHECK-LABEL: @UIToFP_nnan_is_not_negative(
313337 ; CHECK-NEXT: ret i1 false
400424
401425 define i1 @fabs_nnan_is_not_negative(double %x) {
402426 ; CHECK-LABEL: @fabs_nnan_is_not_negative(
427 ; CHECK-NEXT: [[FABS:%.*]] = tail call nnan double @llvm.fabs.f64(double [[X:%.*]])
428 ; CHECK-NEXT: [[CMP:%.*]] = fcmp ult double [[FABS]], 0.000000e+00
429 ; CHECK-NEXT: ret i1 [[CMP]]
430 ;
431 %fabs = tail call nnan double @llvm.fabs.f64(double %x)
432 %cmp = fcmp ult double %fabs, 0.0
433 ret i1 %cmp
434 }
435
436 define <2 x i1> @fabs_nnan_is_not_negative_vec(<2 x double> %x) {
437 ; CHECK-LABEL: @fabs_nnan_is_not_negative_vec(
438 ; CHECK-NEXT: [[FABS:%.*]] = tail call nnan <2 x double> @llvm.fabs.v2f64(<2 x double> [[X:%.*]])
439 ; CHECK-NEXT: [[CMP:%.*]] = fcmp ult <2 x double> [[FABS]], zeroinitializer
440 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
441 ;
442 %fabs = tail call nnan <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
443 %cmp = fcmp ult <2 x double> %fabs, zeroinitializer
444 ret <2 x i1> %cmp
445 }
446
447 define i1 @fabs_fcmp-nnan_is_not_negative(double %x) {
448 ; CHECK-LABEL: @fabs_fcmp-nnan_is_not_negative(
403449 ; CHECK-NEXT: ret i1 false
404450 ;
405451 %fabs = tail call double @llvm.fabs.f64(double %x)
407453 ret i1 %cmp
408454 }
409455
410 define <2 x i1> @fabs_nnan_is_not_negative_vec(<2 x double> %x) {
411 ; CHECK-LABEL: @fabs_nnan_is_not_negative_vec(
456 define <2 x i1> @fabs_fcmp-nnan_is_not_negative_vec(<2 x double> %x) {
457 ; CHECK-LABEL: @fabs_fcmp-nnan_is_not_negative_vec(
412458 ; CHECK-NEXT: ret <2 x i1> zeroinitializer
413459 ;
414460 %fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)