1 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -o - | FileCheck %s
3 ; This test checks that only a single jae gets generated in the final code
4 ; for lowering the CMOV pseudos that get created for this IR. The tricky part
5 ; of this test is that it tests the special PHI operand rewriting code in
6 ; X86TargetLowering::EmitLoweredSelect.
11 define double @foo1(float %p1, double %p2, double %p3) nounwind {
13 %c1 = fcmp oge float %p1, 0.000000e+00
14 %d0 = fadd double %p2, 1.25e0
15 %d1 = fadd double %p3, 1.25e0
16 %d2 = select i1 %c1, double %d0, double %d1
17 %d3 = select i1 %c1, double %d2, double %p2
18 %d4 = select i1 %c1, double %d3, double %p3
19 %d5 = fsub double %d2, %d3
20 %d6 = fadd double %d5, %d4
24 ; This test checks that only a single jae gets generated in the final code
25 ; for lowering the CMOV pseudos that get created for this IR. The tricky part
26 ; of this test is that it tests the special PHI operand rewriting code in
27 ; X86TargetLowering::EmitLoweredSelect.
32 define double @foo2(float %p1, double %p2, double %p3) nounwind {
34 %c1 = fcmp oge float %p1, 0.000000e+00
35 %d0 = fadd double %p2, 1.25e0
36 %d1 = fadd double %p3, 1.25e0
37 %d2 = select i1 %c1, double %d0, double %d1
38 %d3 = select i1 %c1, double %p2, double %d2
39 %d4 = select i1 %c1, double %p3, double %d3
40 %d5 = fsub double %d2, %d3
41 %d6 = fadd double %d5, %d4
45 ; This test checks that only a single js gets generated in the final code
46 ; for lowering the CMOV pseudos that get created for this IR. The tricky part
47 ; of this test is that it tests the special PHI operand rewriting code in
48 ; X86TargetLowering::EmitLoweredSelect. It also tests to make sure all
49 ; the operands of the resulting instructions are from the proper places.
54 ; CHECK-LABEL: # BB#1:
55 ; CHECK-DAG: movapd %xmm2, %xmm1
56 ; CHECK-DAG: movapd %xmm2, %xmm0
57 ; CHECK-LABEL:.LBB2_2:
58 ; CHECK: divsd %xmm1, %xmm0
60 define double @foo3(i32 %p1, double %p2, double %p3,
61 double %p4, double %p5) nounwind {
63 %c1 = icmp slt i32 %p1, 0
64 %d2 = select i1 %c1, double %p2, double %p3
65 %d3 = select i1 %c1, double %p3, double %p4
66 %d4 = select i1 %c1, double %d2, double %d3
67 %d5 = fdiv double %d4, %d3
71 ; This test checks that only a single js gets generated in the final code
72 ; for lowering the CMOV pseudos that get created for this IR. The tricky part
73 ; of this test is that it tests the special PHI operand rewriting code in
74 ; X86TargetLowering::EmitLoweredSelect. It also tests to make sure all
75 ; the operands of the resulting instructions are from the proper places
76 ; when the "opposite condition" handling code in the compiler is used.
77 ; This should be the same code as foo3 above, because we use the opposite
78 ; condition code in the second two selects, but we also swap the operands
79 ; of the selects to give the same actual computation.
84 ; CHECK-LABEL: # BB#1:
85 ; CHECK-DAG: movapd %xmm2, %xmm1
86 ; CHECK-DAG: movapd %xmm2, %xmm0
87 ; CHECK-LABEL:.LBB3_2:
88 ; CHECK: divsd %xmm1, %xmm0
90 define double @foo4(i32 %p1, double %p2, double %p3,
91 double %p4, double %p5) nounwind {
93 %c1 = icmp slt i32 %p1, 0
94 %d2 = select i1 %c1, double %p2, double %p3
95 %c2 = icmp sge i32 %p1, 0
96 %d3 = select i1 %c2, double %p4, double %p3
97 %d4 = select i1 %c2, double %d3, double %d2
98 %d5 = fdiv double %d4, %d3