1 ; Test 64-bit inequality 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 ne i64 %i1, 0
12 %tmp = select i1 %cond, double %a, double %b
13 %res = fadd double %tmp, 1.0
17 ; Check the high end of the CGIJ range.
18 define double @f2(double %a, double %b, i64 %i1) {
20 ; CHECK: cgijlh %r2, 127
23 %cond = icmp ne i64 %i1, 127
24 %tmp = select i1 %cond, double %a, double %b
25 %res = fadd double %tmp, 1.0
29 ; Check the next value up, which must use CGHI instead.
30 define double @f3(double %a, double %b, i64 %i1) {
32 ; CHECK: cghi %r2, 128
36 %cond = icmp ne i64 %i1, 128
37 %tmp = select i1 %cond, double %a, double %b
38 %res = fadd double %tmp, 1.0
42 ; Check the high end of the CGHI range.
43 define double @f4(double %a, double %b, i64 %i1) {
45 ; CHECK: cghi %r2, 32767
49 %cond = icmp ne i64 %i1, 32767
50 %tmp = select i1 %cond, double %a, double %b
51 %res = fadd double %tmp, 1.0
55 ; Check the next value up, which must use CGFI.
56 define double @f5(double %a, double %b, i64 %i1) {
58 ; CHECK: cgfi %r2, 32768
62 %cond = icmp ne i64 %i1, 32768
63 %tmp = select i1 %cond, double %a, double %b
64 %res = fadd double %tmp, 1.0
68 ; Check the high end of the CGFI range.
69 define double @f6(double %a, double %b, i64 %i1) {
71 ; CHECK: cgfi %r2, 2147483647
75 %cond = icmp ne i64 %i1, 2147483647
76 %tmp = select i1 %cond, double %a, double %b
77 %res = fadd double %tmp, 1.0
81 ; Check the next value up, which should use CLGFI instead.
82 define double @f7(double %a, double %b, i64 %i1) {
84 ; CHECK: clgfi %r2, 2147483648
88 %cond = icmp ne i64 %i1, 2147483648
89 %tmp = select i1 %cond, double %a, double %b
90 %res = fadd double %tmp, 1.0
94 ; Check the high end of the CLGFI range.
95 define double @f8(double %a, double %b, i64 %i1) {
97 ; CHECK: clgfi %r2, 4294967295
101 %cond = icmp ne i64 %i1, 4294967295
102 %tmp = select i1 %cond, double %a, double %b
103 %res = fadd double %tmp, 1.0
107 ; Check the next value up, which must use a register comparison.
108 define double @f9(double %a, double %b, i64 %i1) {
111 ; CHECK: ldr %f0, %f2
113 %cond = icmp ne i64 %i1, 4294967296
114 %tmp = select i1 %cond, double %a, double %b
115 %res = fadd double %tmp, 1.0
119 ; Check the high end of the negative CGIJ range.
120 define double @f10(double %a, double %b, i64 %i1) {
122 ; CHECK: cgijlh %r2, -1
123 ; CHECK: ldr %f0, %f2
125 %cond = icmp ne i64 %i1, -1
126 %tmp = select i1 %cond, double %a, double %b
127 %res = fadd double %tmp, 1.0
131 ; Check the low end of the CGIJ range.
132 define double @f11(double %a, double %b, i64 %i1) {
134 ; CHECK: cgijlh %r2, -128
135 ; CHECK: ldr %f0, %f2
137 %cond = icmp ne i64 %i1, -128
138 %tmp = select i1 %cond, double %a, double %b
139 %res = fadd double %tmp, 1.0
143 ; Check the next value down, which must use CGHI instead.
144 define double @f12(double %a, double %b, i64 %i1) {
146 ; CHECK: cghi %r2, -129
148 ; CHECK: ldr %f0, %f2
150 %cond = icmp ne i64 %i1, -129
151 %tmp = select i1 %cond, double %a, double %b
152 %res = fadd double %tmp, 1.0
156 ; Check the low end of the CGHI range.
157 define double @f13(double %a, double %b, i64 %i1) {
159 ; CHECK: cghi %r2, -32768
161 ; CHECK: ldr %f0, %f2
163 %cond = icmp ne i64 %i1, -32768
164 %tmp = select i1 %cond, double %a, double %b
165 %res = fadd double %tmp, 1.0
169 ; Check the next value down, which must use CGFI instead.
170 define double @f14(double %a, double %b, i64 %i1) {
172 ; CHECK: cgfi %r2, -32769
174 ; CHECK: ldr %f0, %f2
176 %cond = icmp ne i64 %i1, -32769
177 %tmp = select i1 %cond, double %a, double %b
178 %res = fadd double %tmp, 1.0
182 ; Check the low end of the CGFI range.
183 define double @f15(double %a, double %b, i64 %i1) {
185 ; CHECK: cgfi %r2, -2147483648
187 ; CHECK: ldr %f0, %f2
189 %cond = icmp ne i64 %i1, -2147483648
190 %tmp = select i1 %cond, double %a, double %b
191 %res = fadd double %tmp, 1.0
195 ; Check the next value down, which must use register comparison.
196 define double @f16(double %a, double %b, i64 %i1) {
199 ; CHECK: ldr %f0, %f2
201 %cond = icmp ne i64 %i1, -2147483649
202 %tmp = select i1 %cond, double %a, double %b
203 %res = fadd double %tmp, 1.0