1 ; RUN: opt -S -instcombine < %s | FileCheck %s 2 3 define i1 @test1(float %x, float %y) nounwind { 4 %ext1 = fpext float %x to double 5 %ext2 = fpext float %y to double 6 %cmp = fcmp ogt double %ext1, %ext2 7 ret i1 %cmp 8 ; CHECK: @test1 9 ; CHECK-NEXT: fcmp ogt float %x, %y 10 } 11 12 define i1 @test2(float %a) nounwind { 13 %ext = fpext float %a to double 14 %cmp = fcmp ogt double %ext, 1.000000e+00 15 ret i1 %cmp 16 ; CHECK: @test2 17 ; CHECK-NEXT: fcmp ogt float %a, 1.0 18 } 19 20 define i1 @test3(float %a) nounwind { 21 %ext = fpext float %a to double 22 %cmp = fcmp ogt double %ext, 0x3FF0000000000001 ; more precision than float. 23 ret i1 %cmp 24 ; CHECK: @test3 25 ; CHECK-NEXT: fpext float %a to double 26 } 27 28 define i1 @test4(float %a) nounwind { 29 %ext = fpext float %a to double 30 %cmp = fcmp ogt double %ext, 0x36A0000000000000 ; denormal in float. 31 ret i1 %cmp 32 ; CHECK: @test4 33 ; CHECK-NEXT: fpext float %a to double 34 } 35 36 define i1 @test5(float %a) nounwind { 37 %neg = fsub float -0.000000e+00, %a 38 %cmp = fcmp ogt float %neg, 1.000000e+00 39 ret i1 %cmp 40 ; CHECK: @test5 41 ; CHECK-NEXT: fcmp olt float %a, -1.0 42 } 43 44 define i1 @test6(float %x, float %y) nounwind { 45 %neg1 = fsub float -0.000000e+00, %x 46 %neg2 = fsub float -0.000000e+00, %y 47 %cmp = fcmp olt float %neg1, %neg2 48 ret i1 %cmp 49 ; CHECK: @test6 50 ; CHECK-NEXT: fcmp ogt float %x, %y 51 } 52 53 define i1 @test7(float %x) nounwind readnone ssp noredzone { 54 %ext = fpext float %x to ppc_fp128 55 %cmp = fcmp ogt ppc_fp128 %ext, 0xM00000000000000000000000000000000 56 ret i1 %cmp 57 ; Can't convert ppc_fp128 58 ; CHECK: @test7 59 ; CHECK-NEXT: fpext float %x to ppc_fp128 60 } 61 62 define float @test8(float %x) nounwind readnone optsize ssp { 63 %conv = fpext float %x to double 64 %cmp = fcmp olt double %conv, 0.000000e+00 65 %conv1 = zext i1 %cmp to i32 66 %conv2 = sitofp i32 %conv1 to float 67 ret float %conv2 68 ; Float comparison to zero shouldn't cast to double. 69 ; CHECK: @test8 70 ; CHECK-NEXT: fcmp olt float %x, 0.000000e+00 71 } 72