1 ; Test 64-bit equality 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 eq i64 %i1, 0
12 %res = select i1 %cond, double %a, double %b
16 ; Check the high end of the CGIJ range.
17 define double @f2(double %a, double %b, i64 %i1) {
19 ; CHECK: cgije %r2, 127
22 %cond = icmp eq i64 %i1, 127
23 %res = select i1 %cond, double %a, double %b
27 ; Check the next value up, which must use CGHI instead.
28 define double @f3(double %a, double %b, i64 %i1) {
30 ; CHECK: cghi %r2, 128
34 %cond = icmp eq i64 %i1, 128
35 %res = select i1 %cond, double %a, double %b
39 ; Check the high end of the CGHI range.
40 define double @f4(double %a, double %b, i64 %i1) {
42 ; CHECK: cghi %r2, 32767
46 %cond = icmp eq i64 %i1, 32767
47 %res = select i1 %cond, double %a, double %b
51 ; Check the next value up, which must use CGFI.
52 define double @f5(double %a, double %b, i64 %i1) {
54 ; CHECK: cgfi %r2, 32768
58 %cond = icmp eq i64 %i1, 32768
59 %res = select i1 %cond, double %a, double %b
63 ; Check the high end of the CGFI range.
64 define double @f6(double %a, double %b, i64 %i1) {
66 ; CHECK: cgfi %r2, 2147483647
70 %cond = icmp eq i64 %i1, 2147483647
71 %res = select i1 %cond, double %a, double %b
75 ; Check the next value up, which should use CLGFI instead.
76 define double @f7(double %a, double %b, i64 %i1) {
78 ; CHECK: clgfi %r2, 2147483648
82 %cond = icmp eq i64 %i1, 2147483648
83 %res = select i1 %cond, double %a, double %b
87 ; Check the high end of the CLGFI range.
88 define double @f8(double %a, double %b, i64 %i1) {
90 ; CHECK: clgfi %r2, 4294967295
94 %cond = icmp eq i64 %i1, 4294967295
95 %res = select i1 %cond, double %a, double %b
99 ; Check the next value up, which must use a register comparison.
100 define double @f9(double %a, double %b, i64 %i1) {
103 ; CHECK: ldr %f0, %f2
105 %cond = icmp eq i64 %i1, 4294967296
106 %res = select i1 %cond, double %a, double %b
110 ; Check the high end of the negative CGIJ range.
111 define double @f10(double %a, double %b, i64 %i1) {
113 ; CHECK: cgije %r2, -1
114 ; CHECK: ldr %f0, %f2
116 %cond = icmp eq i64 %i1, -1
117 %res = select i1 %cond, double %a, double %b
121 ; Check the low end of the CGIJ range.
122 define double @f11(double %a, double %b, i64 %i1) {
124 ; CHECK: cgije %r2, -128
125 ; CHECK: ldr %f0, %f2
127 %cond = icmp eq i64 %i1, -128
128 %res = select i1 %cond, double %a, double %b
132 ; Check the next value down, which must use CGHI instead.
133 define double @f12(double %a, double %b, i64 %i1) {
135 ; CHECK: cghi %r2, -129
137 ; CHECK: ldr %f0, %f2
139 %cond = icmp eq i64 %i1, -129
140 %res = select i1 %cond, double %a, double %b
144 ; Check the low end of the CGHI range.
145 define double @f13(double %a, double %b, i64 %i1) {
147 ; CHECK: cghi %r2, -32768
149 ; CHECK: ldr %f0, %f2
151 %cond = icmp eq i64 %i1, -32768
152 %res = select i1 %cond, double %a, double %b
156 ; Check the next value down, which must use CGFI instead.
157 define double @f14(double %a, double %b, i64 %i1) {
159 ; CHECK: cgfi %r2, -32769
161 ; CHECK: ldr %f0, %f2
163 %cond = icmp eq i64 %i1, -32769
164 %res = select i1 %cond, double %a, double %b
168 ; Check the low end of the CGFI range.
169 define double @f15(double %a, double %b, i64 %i1) {
171 ; CHECK: cgfi %r2, -2147483648
173 ; CHECK: ldr %f0, %f2
175 %cond = icmp eq i64 %i1, -2147483648
176 %res = select i1 %cond, double %a, double %b
180 ; Check the next value down, which must use register comparison.
181 define double @f16(double %a, double %b, i64 %i1) {
184 ; CHECK: ldr %f0, %f2
186 %cond = icmp eq i64 %i1, -2147483649
187 %res = select i1 %cond, double %a, double %b