1 ; Test 64-bit signed comparisons in which the second operand is a constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check comparisons with 0.
6 define double @f1(double %a, double %b, i64 %i1) {
11 %cond = icmp slt i64 %i1, 0
12 %tmp = select i1 %cond, double %a, double %b
13 %res = fadd double %tmp, 1.0
17 ; Check comparisons with 1.
18 define double @f2(double %a, double %b, i64 %i1) {
20 ; CHECK: cgijle %r2, 0
23 %cond = icmp slt i64 %i1, 1
24 %tmp = select i1 %cond, double %a, double %b
25 %res = fadd double %tmp, 1.0
29 ; Check the high end of the CGIJ range.
30 define double @f3(double %a, double %b, i64 %i1) {
32 ; CHECK: cgijl %r2, 127
35 %cond = icmp slt i64 %i1, 127
36 %tmp = select i1 %cond, double %a, double %b
37 %res = fadd double %tmp, 1.0
41 ; Check the next value up, which must use CGHI instead.
42 define double @f4(double %a, double %b, i64 %i1) {
44 ; CHECK: cghi %r2, 128
48 %cond = icmp slt i64 %i1, 128
49 %tmp = select i1 %cond, double %a, double %b
50 %res = fadd double %tmp, 1.0
54 ; Check the high end of the CGHI range.
55 define double @f5(double %a, double %b, i64 %i1) {
57 ; CHECK: cghi %r2, 32767
61 %cond = icmp slt i64 %i1, 32767
62 %tmp = select i1 %cond, double %a, double %b
63 %res = fadd double %tmp, 1.0
67 ; Check the next value up, which must use CGFI.
68 define double @f6(double %a, double %b, i64 %i1) {
70 ; CHECK: cgfi %r2, 32768
74 %cond = icmp slt i64 %i1, 32768
75 %tmp = select i1 %cond, double %a, double %b
76 %res = fadd double %tmp, 1.0
80 ; Check the high end of the CGFI range.
81 define double @f7(double %a, double %b, i64 %i1) {
83 ; CHECK: cgfi %r2, 2147483647
87 %cond = icmp slt i64 %i1, 2147483647
88 %tmp = select i1 %cond, double %a, double %b
89 %res = fadd double %tmp, 1.0
93 ; Check the next value up, which must use register comparison.
94 define double @f8(double %a, double %b, i64 %i1) {
99 %cond = icmp slt i64 %i1, 2147483648
100 %tmp = select i1 %cond, double %a, double %b
101 %res = fadd double %tmp, 1.0
105 ; Check the high end of the negative CGIJ range.
106 define double @f9(double %a, double %b, i64 %i1) {
108 ; CHECK: cgijl %r2, -1
109 ; CHECK: ldr %f0, %f2
111 %cond = icmp slt i64 %i1, -1
112 %tmp = select i1 %cond, double %a, double %b
113 %res = fadd double %tmp, 1.0
117 ; Check the low end of the CGIJ range.
118 define double @f10(double %a, double %b, i64 %i1) {
120 ; CHECK: cgijl %r2, -128
121 ; CHECK: ldr %f0, %f2
123 %cond = icmp slt i64 %i1, -128
124 %tmp = select i1 %cond, double %a, double %b
125 %res = fadd double %tmp, 1.0
129 ; Check the next value down, which must use CGHI instead.
130 define double @f11(double %a, double %b, i64 %i1) {
132 ; CHECK: cghi %r2, -129
134 ; CHECK: ldr %f0, %f2
136 %cond = icmp slt i64 %i1, -129
137 %tmp = select i1 %cond, double %a, double %b
138 %res = fadd double %tmp, 1.0
142 ; Check the low end of the CGHI range.
143 define double @f12(double %a, double %b, i64 %i1) {
145 ; CHECK: cghi %r2, -32768
147 ; CHECK: ldr %f0, %f2
149 %cond = icmp slt i64 %i1, -32768
150 %tmp = select i1 %cond, double %a, double %b
151 %res = fadd double %tmp, 1.0
155 ; Check the next value down, which must use CGFI instead.
156 define double @f13(double %a, double %b, i64 %i1) {
158 ; CHECK: cgfi %r2, -32769
160 ; CHECK: ldr %f0, %f2
162 %cond = icmp slt i64 %i1, -32769
163 %tmp = select i1 %cond, double %a, double %b
164 %res = fadd double %tmp, 1.0
168 ; Check the low end of the CGFI range.
169 define double @f14(double %a, double %b, i64 %i1) {
171 ; CHECK: cgfi %r2, -2147483648
173 ; CHECK: ldr %f0, %f2
175 %cond = icmp slt i64 %i1, -2147483648
176 %tmp = select i1 %cond, double %a, double %b
177 %res = fadd double %tmp, 1.0
181 ; Check the next value down, which must use register comparison.
182 define double @f15(double %a, double %b, i64 %i1) {
185 ; CHECK: ldr %f0, %f2
187 %cond = icmp slt i64 %i1, -2147483649
188 %tmp = select i1 %cond, double %a, double %b
189 %res = fadd double %tmp, 1.0