blob: c74135a5d3931fd1803fc3320b8fbb229b48e1cf [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 64-bit signed 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: cgijl %r2, 0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00009; CHECK: ldr %f0, %f2
10; CHECK: br %r14
11 %cond = icmp slt i64 %i1, 0
12 %res = select i1 %cond, double %a, double %b
13 ret double %res
14}
15
16; Check comparisons with 1.
17define double @f2(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000018; CHECK-LABEL: f2:
Richard Sandiforda0757082013-08-01 10:29:45 +000019; CHECK: cgijle %r2, 0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000020; CHECK: ldr %f0, %f2
21; CHECK: br %r14
22 %cond = icmp slt i64 %i1, 1
23 %res = select i1 %cond, double %a, double %b
24 ret double %res
25}
26
Richard Sandiforde1d9f002013-05-29 11:58:52 +000027; Check the high end of the CGIJ range.
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000028define 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: cgijl %r2, 127
31; CHECK: ldr %f0, %f2
32; CHECK: br %r14
33 %cond = icmp slt i64 %i1, 127
34 %res = select i1 %cond, double %a, double %b
35 ret double %res
36}
37
38; Check the next value up, which must use CGHI instead.
39define double @f4(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000040; CHECK-LABEL: f4:
Richard Sandiforde1d9f002013-05-29 11:58:52 +000041; CHECK: cghi %r2, 128
42; CHECK-NEXT: jl
43; CHECK: ldr %f0, %f2
44; CHECK: br %r14
45 %cond = icmp slt i64 %i1, 128
46 %res = select i1 %cond, double %a, double %b
47 ret double %res
48}
49
50; Check the high end of the CGHI range.
51define double @f5(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000052; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000053; CHECK: cghi %r2, 32767
Richard Sandiford586f4172013-05-21 08:53:17 +000054; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000055; CHECK: ldr %f0, %f2
56; CHECK: br %r14
57 %cond = icmp slt i64 %i1, 32767
58 %res = select i1 %cond, double %a, double %b
59 ret double %res
60}
61
62; Check the next value up, which must use CGFI.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000063define double @f6(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000064; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000065; CHECK: cgfi %r2, 32768
Richard Sandiford586f4172013-05-21 08:53:17 +000066; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000067; CHECK: ldr %f0, %f2
68; CHECK: br %r14
69 %cond = icmp slt i64 %i1, 32768
70 %res = select i1 %cond, double %a, double %b
71 ret double %res
72}
73
74; Check the high end of the CGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000075define double @f7(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000076; CHECK-LABEL: f7:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000077; CHECK: cgfi %r2, 2147483647
Richard Sandiford586f4172013-05-21 08:53:17 +000078; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000079; CHECK: ldr %f0, %f2
80; CHECK: br %r14
81 %cond = icmp slt i64 %i1, 2147483647
82 %res = select i1 %cond, double %a, double %b
83 ret double %res
84}
85
86; Check the next value up, which must use register comparison.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000087define double @f8(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000088; CHECK-LABEL: f8:
Richard Sandiford0fb90ab2013-05-28 10:41:11 +000089; CHECK: cgrjl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000090; CHECK: ldr %f0, %f2
91; CHECK: br %r14
92 %cond = icmp slt i64 %i1, 2147483648
93 %res = select i1 %cond, double %a, double %b
94 ret double %res
95}
96
Richard Sandiforde1d9f002013-05-29 11:58:52 +000097; Check the high end of the negative CGIJ range.
98define double @f9(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000099; CHECK-LABEL: f9:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000100; CHECK: cgijl %r2, -1
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000101; CHECK: ldr %f0, %f2
102; CHECK: br %r14
103 %cond = icmp slt i64 %i1, -1
104 %res = select i1 %cond, double %a, double %b
105 ret double %res
106}
107
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000108; Check the low end of the CGIJ range.
109define double @f10(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000110; CHECK-LABEL: f10:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000111; CHECK: cgijl %r2, -128
112; CHECK: ldr %f0, %f2
113; CHECK: br %r14
114 %cond = icmp slt i64 %i1, -128
115 %res = select i1 %cond, double %a, double %b
116 ret double %res
117}
118
119; Check the next value down, which must use CGHI instead.
120define double @f11(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000121; CHECK-LABEL: f11:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000122; CHECK: cghi %r2, -129
123; CHECK-NEXT: jl
124; CHECK: ldr %f0, %f2
125; CHECK: br %r14
126 %cond = icmp slt i64 %i1, -129
127 %res = select i1 %cond, double %a, double %b
128 ret double %res
129}
130
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000131; Check the low end of the CGHI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000132define double @f12(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000133; CHECK-LABEL: f12:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000134; CHECK: cghi %r2, -32768
Richard Sandiford586f4172013-05-21 08:53:17 +0000135; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000136; CHECK: ldr %f0, %f2
137; CHECK: br %r14
138 %cond = icmp slt i64 %i1, -32768
139 %res = select i1 %cond, double %a, double %b
140 ret double %res
141}
142
143; Check the next value down, which must use CGFI instead.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000144define double @f13(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000145; CHECK-LABEL: f13:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000146; CHECK: cgfi %r2, -32769
Richard Sandiford586f4172013-05-21 08:53:17 +0000147; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000148; CHECK: ldr %f0, %f2
149; CHECK: br %r14
150 %cond = icmp slt i64 %i1, -32769
151 %res = select i1 %cond, double %a, double %b
152 ret double %res
153}
154
155; Check the low end of the CGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000156define double @f14(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000157; CHECK-LABEL: f14:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000158; CHECK: cgfi %r2, -2147483648
Richard Sandiford586f4172013-05-21 08:53:17 +0000159; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000160; CHECK: ldr %f0, %f2
161; CHECK: br %r14
162 %cond = icmp slt i64 %i1, -2147483648
163 %res = select i1 %cond, double %a, double %b
164 ret double %res
165}
166
167; Check the next value down, which must use register comparison.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000168define double @f15(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000169; CHECK-LABEL: f15:
Richard Sandiford0fb90ab2013-05-28 10:41:11 +0000170; CHECK: cgrjl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000171; CHECK: ldr %f0, %f2
172; CHECK: br %r14
173 %cond = icmp slt i64 %i1, -2147483649
174 %res = select i1 %cond, double %a, double %b
175 ret double %res
176}