blob: d63aaa333889ab1be686bd9b3e3371934f14368e [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
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000012 %tmp = select i1 %cond, double %a, double %b
13 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000014 ret double %res
15}
16
Richard Sandiforde1d9f002013-05-29 11:58:52 +000017; Check the high end of the CGIJ range.
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000018define double @f2(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000019; CHECK-LABEL: f2:
Richard Sandiforde1d9f002013-05-29 11:58:52 +000020; CHECK: cgijlh %r2, 127
21; CHECK: ldr %f0, %f2
22; CHECK: br %r14
23 %cond = icmp ne i64 %i1, 127
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000024 %tmp = select i1 %cond, double %a, double %b
25 %res = fadd double %tmp, 1.0
Richard Sandiforde1d9f002013-05-29 11:58:52 +000026 ret double %res
27}
28
29; Check the next value up, which must use CGHI instead.
30define double @f3(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000031; CHECK-LABEL: f3:
Richard Sandiforde1d9f002013-05-29 11:58:52 +000032; CHECK: cghi %r2, 128
33; CHECK-NEXT: jlh
34; CHECK: ldr %f0, %f2
35; CHECK: br %r14
36 %cond = icmp ne i64 %i1, 128
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000037 %tmp = select i1 %cond, double %a, double %b
38 %res = fadd double %tmp, 1.0
Richard Sandiforde1d9f002013-05-29 11:58:52 +000039 ret double %res
40}
41
42; Check the high end of the CGHI range.
43define double @f4(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000044; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000045; CHECK: cghi %r2, 32767
Richard Sandiford586f4172013-05-21 08:53:17 +000046; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000047; CHECK: ldr %f0, %f2
48; CHECK: br %r14
49 %cond = icmp ne i64 %i1, 32767
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000050 %tmp = select i1 %cond, double %a, double %b
51 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000052 ret double %res
53}
54
55; Check the next value up, which must use CGFI.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000056define double @f5(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000057; CHECK-LABEL: f5:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000058; CHECK: cgfi %r2, 32768
Richard Sandiford586f4172013-05-21 08:53:17 +000059; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000060; CHECK: ldr %f0, %f2
61; CHECK: br %r14
62 %cond = icmp ne i64 %i1, 32768
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000063 %tmp = select i1 %cond, double %a, double %b
64 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000065 ret double %res
66}
67
68; Check the high end of the CGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000069define double @f6(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000070; CHECK-LABEL: f6:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000071; CHECK: cgfi %r2, 2147483647
Richard Sandiford586f4172013-05-21 08:53:17 +000072; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000073; CHECK: ldr %f0, %f2
74; CHECK: br %r14
75 %cond = icmp ne i64 %i1, 2147483647
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000076 %tmp = select i1 %cond, double %a, double %b
77 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000078 ret double %res
79}
80
81; Check the next value up, which should use CLGFI instead.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000082define double @f7(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000083; CHECK-LABEL: f7:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000084; CHECK: clgfi %r2, 2147483648
Richard Sandiford586f4172013-05-21 08:53:17 +000085; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000086; CHECK: ldr %f0, %f2
87; CHECK: br %r14
88 %cond = icmp ne i64 %i1, 2147483648
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000089 %tmp = select i1 %cond, double %a, double %b
90 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000091 ret double %res
92}
93
94; Check the high end of the CLGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +000095define double @f8(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000096; CHECK-LABEL: f8:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000097; CHECK: clgfi %r2, 4294967295
Richard Sandiford586f4172013-05-21 08:53:17 +000098; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000099; CHECK: ldr %f0, %f2
100; CHECK: br %r14
101 %cond = icmp ne i64 %i1, 4294967295
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000102 %tmp = select i1 %cond, double %a, double %b
103 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000104 ret double %res
105}
106
107; Check the next value up, which must use a register comparison.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000108define double @f9(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000109; CHECK-LABEL: f9:
Richard Sandiford0fb90ab2013-05-28 10:41:11 +0000110; CHECK: cgrjlh %r2,
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000111; CHECK: ldr %f0, %f2
112; CHECK: br %r14
113 %cond = icmp ne i64 %i1, 4294967296
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000114 %tmp = select i1 %cond, double %a, double %b
115 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000116 ret double %res
117}
118
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000119; Check the high end of the negative CGIJ range.
120define double @f10(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000121; CHECK-LABEL: f10:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000122; CHECK: cgijlh %r2, -1
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000123; CHECK: ldr %f0, %f2
124; CHECK: br %r14
125 %cond = icmp ne i64 %i1, -1
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000126 %tmp = select i1 %cond, double %a, double %b
127 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000128 ret double %res
129}
130
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000131; Check the low end of the CGIJ range.
132define double @f11(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000133; CHECK-LABEL: f11:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000134; CHECK: cgijlh %r2, -128
135; CHECK: ldr %f0, %f2
136; CHECK: br %r14
137 %cond = icmp ne i64 %i1, -128
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000138 %tmp = select i1 %cond, double %a, double %b
139 %res = fadd double %tmp, 1.0
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000140 ret double %res
141}
142
143; Check the next value down, which must use CGHI instead.
144define double @f12(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000145; CHECK-LABEL: f12:
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000146; CHECK: cghi %r2, -129
147; CHECK-NEXT: jlh
148; CHECK: ldr %f0, %f2
149; CHECK: br %r14
150 %cond = icmp ne i64 %i1, -129
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000151 %tmp = select i1 %cond, double %a, double %b
152 %res = fadd double %tmp, 1.0
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000153 ret double %res
154}
155
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000156; Check the low end of the CGHI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000157define double @f13(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000158; CHECK-LABEL: f13:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000159; CHECK: cghi %r2, -32768
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, -32768
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000164 %tmp = select i1 %cond, double %a, double %b
165 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000166 ret double %res
167}
168
169; Check the next value down, which must use CGFI instead.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000170define double @f14(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000171; CHECK-LABEL: f14:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000172; CHECK: cgfi %r2, -32769
Richard Sandiford586f4172013-05-21 08:53:17 +0000173; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000174; CHECK: ldr %f0, %f2
175; CHECK: br %r14
176 %cond = icmp ne i64 %i1, -32769
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000177 %tmp = select i1 %cond, double %a, double %b
178 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000179 ret double %res
180}
181
182; Check the low end of the CGFI range.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000183define double @f15(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000184; CHECK-LABEL: f15:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000185; CHECK: cgfi %r2, -2147483648
Richard Sandiford586f4172013-05-21 08:53:17 +0000186; CHECK-NEXT: jlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000187; CHECK: ldr %f0, %f2
188; CHECK: br %r14
189 %cond = icmp ne i64 %i1, -2147483648
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000190 %tmp = select i1 %cond, double %a, double %b
191 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000192 ret double %res
193}
194
195; Check the next value down, which must use register comparison.
Richard Sandiforde1d9f002013-05-29 11:58:52 +0000196define double @f16(double %a, double %b, i64 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +0000197; CHECK-LABEL: f16:
Richard Sandiford0fb90ab2013-05-28 10:41:11 +0000198; CHECK: cgrjlh
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000199; CHECK: ldr %f0, %f2
200; CHECK: br %r14
201 %cond = icmp ne i64 %i1, -2147483649
Ulrich Weigand2eb027d2016-04-07 16:11:44 +0000202 %tmp = select i1 %cond, double %a, double %b
203 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +0000204 ret double %res
205}