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 %res = select i1 %cond, double %a, double %b
16 ; Check comparisons with 1.
17 define double @f2(double %a, double %b, i64 %i1) {
19 ; CHECK: cgijle %r2, 0
22 %cond = icmp slt i64 %i1, 1
23 %res = select i1 %cond, double %a, double %b
27 ; Check the high end of the CGIJ range.
28 define double @f3(double %a, double %b, i64 %i1) {
30 ; CHECK: cgijl %r2, 127
33 %cond = icmp slt i64 %i1, 127
34 %res = select i1 %cond, double %a, double %b
38 ; Check the next value up, which must use CGHI instead.
39 define double @f4(double %a, double %b, i64 %i1) {
41 ; CHECK: cghi %r2, 128
45 %cond = icmp slt i64 %i1, 128
46 %res = select i1 %cond, double %a, double %b
50 ; Check the high end of the CGHI range.
51 define double @f5(double %a, double %b, i64 %i1) {
53 ; CHECK: cghi %r2, 32767
57 %cond = icmp slt i64 %i1, 32767
58 %res = select i1 %cond, double %a, double %b
62 ; Check the next value up, which must use CGFI.
63 define double @f6(double %a, double %b, i64 %i1) {
65 ; CHECK: cgfi %r2, 32768
69 %cond = icmp slt i64 %i1, 32768
70 %res = select i1 %cond, double %a, double %b
74 ; Check the high end of the CGFI range.
75 define double @f7(double %a, double %b, i64 %i1) {
77 ; CHECK: cgfi %r2, 2147483647
81 %cond = icmp slt i64 %i1, 2147483647
82 %res = select i1 %cond, double %a, double %b
86 ; Check the next value up, which must use register comparison.
87 define double @f8(double %a, double %b, i64 %i1) {
92 %cond = icmp slt i64 %i1, 2147483648
93 %res = select i1 %cond, double %a, double %b
97 ; Check the high end of the negative CGIJ range.
98 define double @f9(double %a, double %b, i64 %i1) {
100 ; CHECK: cgijl %r2, -1
101 ; CHECK: ldr %f0, %f2
103 %cond = icmp slt i64 %i1, -1
104 %res = select i1 %cond, double %a, double %b
108 ; Check the low end of the CGIJ range.
109 define double @f10(double %a, double %b, i64 %i1) {
111 ; CHECK: cgijl %r2, -128
112 ; CHECK: ldr %f0, %f2
114 %cond = icmp slt i64 %i1, -128
115 %res = select i1 %cond, double %a, double %b
119 ; Check the next value down, which must use CGHI instead.
120 define double @f11(double %a, double %b, i64 %i1) {
122 ; CHECK: cghi %r2, -129
124 ; CHECK: ldr %f0, %f2
126 %cond = icmp slt i64 %i1, -129
127 %res = select i1 %cond, double %a, double %b
131 ; Check the low end of the CGHI range.
132 define double @f12(double %a, double %b, i64 %i1) {
134 ; CHECK: cghi %r2, -32768
136 ; CHECK: ldr %f0, %f2
138 %cond = icmp slt i64 %i1, -32768
139 %res = select i1 %cond, double %a, double %b
143 ; Check the next value down, which must use CGFI instead.
144 define double @f13(double %a, double %b, i64 %i1) {
146 ; CHECK: cgfi %r2, -32769
148 ; CHECK: ldr %f0, %f2
150 %cond = icmp slt i64 %i1, -32769
151 %res = select i1 %cond, double %a, double %b
155 ; Check the low end of the CGFI range.
156 define double @f14(double %a, double %b, i64 %i1) {
158 ; CHECK: cgfi %r2, -2147483648
160 ; CHECK: ldr %f0, %f2
162 %cond = icmp slt i64 %i1, -2147483648
163 %res = select i1 %cond, double %a, double %b
167 ; Check the next value down, which must use register comparison.
168 define double @f15(double %a, double %b, i64 %i1) {
171 ; CHECK: ldr %f0, %f2
173 %cond = icmp slt i64 %i1, -2147483649
174 %res = select i1 %cond, double %a, double %b