blob: 4dbd0ece3af6b371f6a02577f7cf452e2fb88fcc [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 64-bit inequality comparisons in which the second operand is a constant.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Check comparisons with 0.
6define double @f1(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +00007; CHECK-LABEL: f1:
Richard Sandiforde1d9f002013-05-29 11:58:52 +00008; CHECK: cgijlh %r2, 0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00009; CHECK: ldr %f0, %f2
10; CHECK: br %r14
11 %cond = icmp ne i64 %i1, 0
12 %res = select i1 %cond, double %a, double %b
13 ret double %res
14}
15
Richard Sandiforde1d9f002013-05-29 11:58:52 +000016; Check the high end of the CGIJ range.
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000017define double @f2(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000018; CHECK-LABEL: f2:
Richard Sandiforde1d9f002013-05-29 11:58:52 +000019; CHECK: cgijlh %r2, 127
20; CHECK: ldr %f0, %f2
21; CHECK: br %r14
22 %cond = icmp ne i64 %i1, 127
23 %res = select i1 %cond, double %a, double %b
24 ret double %res
25}
26
27; Check the next value up, which must use CGHI instead.
28define double @f3(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000029; CHECK-LABEL: f3:
Richard Sandiforde1d9f002013-05-29 11:58:52 +000030; CHECK: cghi %r2, 128
31; CHECK-NEXT: jlh
32; CHECK: ldr %f0, %f2
33; CHECK: br %r14
34 %cond = icmp ne i64 %i1, 128
35 %res = select i1 %cond, double %a, double %b
36 ret double %res
37}
38
39; Check the high end of the CGHI range.
40define double @f4(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000041; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000042; CHECK: cghi %r2, 32767
Richard Sandiford586f4172013-05-21 08:53:17 +000043; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000044; CHECK: ldr %f0, %f2
45; CHECK: br %r14
46 %cond = icmp ne i64 %i1, 32767
47 %res = select i1 %cond, double %a, double %b
48 ret double %res
49}
50
51; Check the next value up, which must use CGFI.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000052define double @f5(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000053; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000054; CHECK: cgfi %r2, 32768
Richard Sandiford586f4172013-05-21 08:53:17 +000055; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000056; CHECK: ldr %f0, %f2
57; CHECK: br %r14
58 %cond = icmp ne i64 %i1, 32768
59 %res = select i1 %cond, double %a, double %b
60 ret double %res
61}
62
63; Check the high end of the CGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000064define double @f6(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000065; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000066; CHECK: cgfi %r2, 2147483647
Richard Sandiford586f4172013-05-21 08:53:17 +000067; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000068; CHECK: ldr %f0, %f2
69; CHECK: br %r14
70 %cond = icmp ne i64 %i1, 2147483647
71 %res = select i1 %cond, double %a, double %b
72 ret double %res
73}
74
75; Check the next value up, which should use CLGFI instead.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000076define double @f7(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000077; CHECK-LABEL: f7:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000078; CHECK: clgfi %r2, 2147483648
Richard Sandiford586f4172013-05-21 08:53:17 +000079; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000080; CHECK: ldr %f0, %f2
81; CHECK: br %r14
82 %cond = icmp ne i64 %i1, 2147483648
83 %res = select i1 %cond, double %a, double %b
84 ret double %res
85}
86
87; Check the high end of the CLGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000088define double @f8(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000089; CHECK-LABEL: f8:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000090; CHECK: clgfi %r2, 4294967295
Richard Sandiford586f4172013-05-21 08:53:17 +000091; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000092; CHECK: ldr %f0, %f2
93; CHECK: br %r14
94 %cond = icmp ne i64 %i1, 4294967295
95 %res = select i1 %cond, double %a, double %b
96 ret double %res
97}
98
99; Check the next value up, which must use a register comparison.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000100define double @f9(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000101; CHECK-LABEL: f9:
Richard Sandiford0fb90ab2013-05-28 10:41:11 +0000102; CHECK: cgrjlh %r2,
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000103; CHECK: ldr %f0, %f2
104; CHECK: br %r14
105 %cond = icmp ne i64 %i1, 4294967296
106 %res = select i1 %cond, double %a, double %b
107 ret double %res
108}
109
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000110; Check the high end of the negative CGIJ range.
111define double @f10(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000112; CHECK-LABEL: f10:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000113; CHECK: cgijlh %r2, -1
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000114; CHECK: ldr %f0, %f2
115; CHECK: br %r14
116 %cond = icmp ne i64 %i1, -1
117 %res = select i1 %cond, double %a, double %b
118 ret double %res
119}
120
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000121; Check the low end of the CGIJ range.
122define double @f11(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000123; CHECK-LABEL: f11:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000124; CHECK: cgijlh %r2, -128
125; CHECK: ldr %f0, %f2
126; CHECK: br %r14
127 %cond = icmp ne i64 %i1, -128
128 %res = select i1 %cond, double %a, double %b
129 ret double %res
130}
131
132; Check the next value down, which must use CGHI instead.
133define double @f12(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000134; CHECK-LABEL: f12:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000135; CHECK: cghi %r2, -129
136; CHECK-NEXT: jlh
137; CHECK: ldr %f0, %f2
138; CHECK: br %r14
139 %cond = icmp ne i64 %i1, -129
140 %res = select i1 %cond, double %a, double %b
141 ret double %res
142}
143
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000144; Check the low end of the CGHI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000145define double @f13(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000146; CHECK-LABEL: f13:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000147; CHECK: cghi %r2, -32768
Richard Sandiford586f4172013-05-21 08:53:17 +0000148; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000149; CHECK: ldr %f0, %f2
150; CHECK: br %r14
151 %cond = icmp ne i64 %i1, -32768
152 %res = select i1 %cond, double %a, double %b
153 ret double %res
154}
155
156; Check the next value down, which must use CGFI instead.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000157define double @f14(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000158; CHECK-LABEL: f14:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000159; CHECK: cgfi %r2, -32769
Richard Sandiford586f4172013-05-21 08:53:17 +0000160; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000161; CHECK: ldr %f0, %f2
162; CHECK: br %r14
163 %cond = icmp ne i64 %i1, -32769
164 %res = select i1 %cond, double %a, double %b
165 ret double %res
166}
167
168; Check the low end of the CGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000169define double @f15(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000170; CHECK-LABEL: f15:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000171; CHECK: cgfi %r2, -2147483648
Richard Sandiford586f4172013-05-21 08:53:17 +0000172; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000173; CHECK: ldr %f0, %f2
174; CHECK: br %r14
175 %cond = icmp ne i64 %i1, -2147483648
176 %res = select i1 %cond, double %a, double %b
177 ret double %res
178}
179
180; Check the next value down, which must use register comparison.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000181define double @f16(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000182; CHECK-LABEL: f16:
Richard Sandiford0fb90ab2013-05-28 10:41:11 +0000183; CHECK: cgrjlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000184; CHECK: ldr %f0, %f2
185; CHECK: br %r14
186 %cond = icmp ne i64 %i1, -2147483649
187 %res = select i1 %cond, double %a, double %b
188 ret double %res
189}