1 ; Test conditional sibling calls.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
7 declare void @fun_c(i32)
11 ; Check a conditional sibling call.
12 define void @f1(i32 %val1, i32 %val2) {
15 ; CHECK: jgl fun_a@PLT
17 %cond = icmp slt i32 %val1, %val2;
18 br i1 %cond, label %a, label %b;
21 tail call void @fun_a()
25 store i32 1, i32 *@var;
29 ; Check a conditional sibling call when there are two possibilities.
30 define void @f2(i32 %val1, i32 %val2) {
33 ; CHECK: jghe fun_b@PLT
35 %cond = icmp slt i32 %val1, %val2;
36 br i1 %cond, label %a, label %b;
39 tail call void @fun_a()
43 tail call void @fun_b()
47 ; Check a conditional sibling call with an argument - not supported.
48 define void @f3(i32 %val1, i32 %val2) {
50 ; CHECK: crjhe %r2, %r3
53 %cond = icmp slt i32 %val1, %val2;
54 br i1 %cond, label %a, label %b;
57 tail call void @fun_c(i32 1)
61 store i32 1, i32 *@var;
65 ; Check a conditional sibling call - unsigned compare.
66 define void @f4(i32 %val1, i32 %val2) {
69 ; CHECK: jgl fun_a@PLT
71 %cond = icmp ult i32 %val1, %val2;
72 br i1 %cond, label %a, label %b;
75 tail call void @fun_a()
79 store i32 1, i32 *@var;
83 ; Check a conditional sibling call - 64-bit compare.
84 define void @f5(i64 %val1, i64 %val2) {
87 ; CHECK: jgl fun_a@PLT
89 %cond = icmp slt i64 %val1, %val2;
90 br i1 %cond, label %a, label %b;
93 tail call void @fun_a()
97 store i32 1, i32 *@var;
101 ; Check a conditional sibling call - unsigned 64-bit compare.
102 define void @f6(i64 %val1, i64 %val2) {
104 ; CHECK: clgr %r2, %r3
105 ; CHECK: jgl fun_a@PLT
107 %cond = icmp ult i64 %val1, %val2;
108 br i1 %cond, label %a, label %b;
111 tail call void @fun_a()
115 store i32 1, i32 *@var;
119 ; Check a conditional sibling call - less-equal compare.
120 define void @f7(i32 %val1, i32 %val2) {
123 ; CHECK: jgle fun_a@PLT
125 %cond = icmp sle i32 %val1, %val2;
126 br i1 %cond, label %a, label %b;
129 tail call void @fun_a()
133 store i32 1, i32 *@var;
137 ; Check a conditional sibling call - high compare.
138 define void @f8(i32 %val1, i32 %val2) {
141 ; CHECK: jgh fun_a@PLT
143 %cond = icmp sgt i32 %val1, %val2;
144 br i1 %cond, label %a, label %b;
147 tail call void @fun_a()
151 store i32 1, i32 *@var;
155 ; Check a conditional sibling call - high-equal compare.
156 define void @f9(i32 %val1, i32 %val2) {
159 ; CHECK: jghe fun_a@PLT
161 %cond = icmp sge i32 %val1, %val2;
162 br i1 %cond, label %a, label %b;
165 tail call void @fun_a()
169 store i32 1, i32 *@var;
173 ; Check a conditional sibling call - equal compare.
174 define void @f10(i32 %val1, i32 %val2) {
177 ; CHECK: jge fun_a@PLT
179 %cond = icmp eq i32 %val1, %val2;
180 br i1 %cond, label %a, label %b;
183 tail call void @fun_a()
187 store i32 1, i32 *@var;
191 ; Check a conditional sibling call - unequal compare.
192 define void @f11(i32 %val1, i32 %val2) {
195 ; CHECK: jglh fun_a@PLT
197 %cond = icmp ne i32 %val1, %val2;
198 br i1 %cond, label %a, label %b;
201 tail call void @fun_a()
205 store i32 1, i32 *@var;
209 ; Check a conditional sibling call - immediate slt.
210 define void @f12(i32 %val1) {
213 ; CHECK: jgle fun_a@PLT
215 %cond = icmp slt i32 %val1, 5;
216 br i1 %cond, label %a, label %b;
219 tail call void @fun_a()
223 store i32 1, i32 *@var;
227 ; Check a conditional sibling call - immediate sle.
228 define void @f13(i32 %val1) {
231 ; CHECK: jgle fun_a@PLT
233 %cond = icmp sle i32 %val1, 5;
234 br i1 %cond, label %a, label %b;
237 tail call void @fun_a()
241 store i32 1, i32 *@var;
245 ; Check a conditional sibling call - immediate sgt.
246 define void @f14(i32 %val1) {
249 ; CHECK: jghe fun_a@PLT
251 %cond = icmp sgt i32 %val1, 5;
252 br i1 %cond, label %a, label %b;
255 tail call void @fun_a()
259 store i32 1, i32 *@var;
263 ; Check a conditional sibling call - immediate sge.
264 define void @f15(i32 %val1) {
267 ; CHECK: jghe fun_a@PLT
269 %cond = icmp sge i32 %val1, 5;
270 br i1 %cond, label %a, label %b;
273 tail call void @fun_a()
277 store i32 1, i32 *@var;
281 ; Check a conditional sibling call - immediate eq.
282 define void @f16(i32 %val1) {
285 ; CHECK: jge fun_a@PLT
287 %cond = icmp eq i32 %val1, 5;
288 br i1 %cond, label %a, label %b;
291 tail call void @fun_a()
295 store i32 1, i32 *@var;
299 ; Check a conditional sibling call - immediate ne.
300 define void @f17(i32 %val1) {
303 ; CHECK: jglh fun_a@PLT
305 %cond = icmp ne i32 %val1, 5;
306 br i1 %cond, label %a, label %b;
309 tail call void @fun_a()
313 store i32 1, i32 *@var;
317 ; Check a conditional sibling call - immediate ult.
318 define void @f18(i32 %val1) {
321 ; CHECK: jgle fun_a@PLT
323 %cond = icmp ult i32 %val1, 5;
324 br i1 %cond, label %a, label %b;
327 tail call void @fun_a()
331 store i32 1, i32 *@var;
335 ; Check a conditional sibling call - immediate 64-bit slt.
336 define void @f19(i64 %val1) {
339 ; CHECK: jgle fun_a@PLT
341 %cond = icmp slt i64 %val1, 5;
342 br i1 %cond, label %a, label %b;
345 tail call void @fun_a()
349 store i32 1, i32 *@var;
353 ; Check a conditional sibling call - immediate 64-bit ult.
354 define void @f20(i64 %val1) {
356 ; CHECK: clgfi %r2, 4
357 ; CHECK: jgle fun_a@PLT
359 %cond = icmp ult i64 %val1, 5;
360 br i1 %cond, label %a, label %b;
363 tail call void @fun_a()
367 store i32 1, i32 *@var;