1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
; RUN: llc < %s -mtriple=x86_64-linux-gnu -o - | FileCheck %s
; This test checks that only a single jae gets generated in the final code
; for lowering the CMOV pseudos that get created for this IR. The tricky part
; of this test is that it tests the special PHI operand rewriting code in
; X86TargetLowering::EmitLoweredSelect.
;
; CHECK-LABEL: foo1:
; CHECK: jae
; CHECK-NOT: jae
define double @foo1(float %p1, double %p2, double %p3) nounwind {
entry:
%c1 = fcmp oge float %p1, 0.000000e+00
%d0 = fadd double %p2, 1.25e0
%d1 = fadd double %p3, 1.25e0
%d2 = select i1 %c1, double %d0, double %d1
%d3 = select i1 %c1, double %d2, double %p2
%d4 = select i1 %c1, double %d3, double %p3
%d5 = fsub double %d2, %d3
%d6 = fadd double %d5, %d4
ret double %d6
}
; This test checks that only a single jae gets generated in the final code
; for lowering the CMOV pseudos that get created for this IR. The tricky part
; of this test is that it tests the special PHI operand rewriting code in
; X86TargetLowering::EmitLoweredSelect.
;
; CHECK-LABEL: foo2:
; CHECK: jae
; CHECK-NOT: jae
define double @foo2(float %p1, double %p2, double %p3) nounwind {
entry:
%c1 = fcmp oge float %p1, 0.000000e+00
%d0 = fadd double %p2, 1.25e0
%d1 = fadd double %p3, 1.25e0
%d2 = select i1 %c1, double %d0, double %d1
%d3 = select i1 %c1, double %p2, double %d2
%d4 = select i1 %c1, double %p3, double %d3
%d5 = fsub double %d2, %d3
%d6 = fadd double %d5, %d4
ret double %d6
}
; This test checks that only a single js gets generated in the final code
; for lowering the CMOV pseudos that get created for this IR. The tricky part
; of this test is that it tests the special PHI operand rewriting code in
; X86TargetLowering::EmitLoweredSelect. It also tests to make sure all
; the operands of the resulting instructions are from the proper places.
;
; CHECK-LABEL: foo3:
; CHECK: js
; CHECK-NOT: js
; CHECK-LABEL: # %bb.1:
; CHECK-DAG: movapd %xmm2, %xmm1
; CHECK-DAG: movapd %xmm2, %xmm0
; CHECK-LABEL:.LBB2_2:
; CHECK: divsd %xmm1, %xmm0
; CHECK: ret
define double @foo3(i32 %p1, double %p2, double %p3,
double %p4, double %p5) nounwind {
entry:
%c1 = icmp slt i32 %p1, 0
%d2 = select i1 %c1, double %p2, double %p3
%d3 = select i1 %c1, double %p3, double %p4
%d4 = select i1 %c1, double %d2, double %d3
%d5 = fdiv double %d4, %d3
ret double %d5
}
; This test checks that only a single js gets generated in the final code
; for lowering the CMOV pseudos that get created for this IR. The tricky part
; of this test is that it tests the special PHI operand rewriting code in
; X86TargetLowering::EmitLoweredSelect. It also tests to make sure all
; the operands of the resulting instructions are from the proper places
; when the "opposite condition" handling code in the compiler is used.
; This should be the same code as foo3 above, because we use the opposite
; condition code in the second two selects, but we also swap the operands
; of the selects to give the same actual computation.
;
; CHECK-LABEL: foo4:
; CHECK: js
; CHECK-NOT: js
; CHECK-LABEL: # %bb.1:
; CHECK-DAG: movapd %xmm2, %xmm1
; CHECK-DAG: movapd %xmm2, %xmm0
; CHECK-LABEL:.LBB3_2:
; CHECK: divsd %xmm1, %xmm0
; CHECK: ret
define double @foo4(i32 %p1, double %p2, double %p3,
double %p4, double %p5) nounwind {
entry:
%c1 = icmp slt i32 %p1, 0
%d2 = select i1 %c1, double %p2, double %p3
%c2 = icmp sge i32 %p1, 0
%d3 = select i1 %c2, double %p4, double %p3
%d4 = select i1 %c2, double %d3, double %d2
%d5 = fdiv double %d4, %d3
ret double %d5
}
; This test checks that only a single jae gets generated in the final code
; for lowering the CMOV pseudos that get created for this IR. The tricky part
; of this test is that it tests the special code in CodeGenPrepare.
;
; CHECK-LABEL: foo5:
; CHECK: jae
; CHECK-NOT: jae
define double @foo5(float %p1, double %p2, double %p3) nounwind {
entry:
%c1 = fcmp oge float %p1, 0.000000e+00
%d0 = fadd double %p2, 1.25e0
%d1 = fadd double %p3, 1.25e0
%d2 = select i1 %c1, double %d0, double %d1, !prof !0
%d3 = select i1 %c1, double %d2, double %p2, !prof !0
%d4 = select i1 %c1, double %d3, double %p3, !prof !0
%d5 = fsub double %d2, %d3
%d6 = fadd double %d5, %d4
ret double %d6
}
; We should expand select instructions into 3 conditional branches as their
; condtions are different.
;
; CHECK-LABEL: foo6:
; CHECK: jae
; CHECK: jae
; CHECK: jae
define double @foo6(float %p1, double %p2, double %p3) nounwind {
entry:
%c1 = fcmp oge float %p1, 0.000000e+00
%c2 = fcmp oge float %p1, 1.000000e+00
%c3 = fcmp oge float %p1, 2.000000e+00
%d0 = fadd double %p2, 1.25e0
%d1 = fadd double %p3, 1.25e0
%d2 = select i1 %c1, double %d0, double %d1, !prof !0
%d3 = select i1 %c2, double %d2, double %p2, !prof !0
%d4 = select i1 %c3, double %d3, double %p3, !prof !0
%d5 = fsub double %d2, %d3
%d6 = fadd double %d5, %d4
ret double %d6
}
!0 = !{!"branch_weights", i32 1, i32 2000}
|