• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -instcombine < %s | FileCheck %s
2
3define 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
12define 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
20define 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
28define 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
36define 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
44define 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
53define 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