1 ; Test conditional sibling calls.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
7 @fun_a = global ptr null;
8 @fun_b = global ptr null;
9 @fun_c = global ptr null;
11 ; Check a conditional sibling call.
12 define void @f1(i32 %val1, i32 %val2) {
14 ; CHECK: crbl %r2, %r3, 0(%r1)
16 %fun_a = load volatile ptr, ptr @fun_a;
17 %cond = icmp slt i32 %val1, %val2;
18 br i1 %cond, label %a, label %b;
21 tail call void %fun_a()
29 ; Check a conditional sibling call when there are two possibilities.
30 define void @f2(i32 %val1, i32 %val2) {
32 ; CHECK: crbl %r2, %r3, 0(%r1)
34 %fun_a = load volatile ptr, ptr @fun_a;
35 %fun_b = load volatile ptr, ptr @fun_b;
36 %cond = icmp slt i32 %val1, %val2;
37 br i1 %cond, label %a, label %b;
40 tail call void %fun_a()
44 tail call void %fun_b()
48 ; Check a conditional sibling call with an argument - not supported.
49 define void @f3(i32 %val1, i32 %val2) {
51 ; CHECK: crjhe %r2, %r3
54 %fun_c = load volatile ptr, ptr @fun_c;
55 %cond = icmp slt i32 %val1, %val2;
56 br i1 %cond, label %a, label %b;
59 tail call void %fun_c(i32 1)
67 ; Check a conditional sibling call - unsigned compare.
68 define void @f4(i32 %val1, i32 %val2) {
70 ; CHECK: clrbl %r2, %r3, 0(%r1)
72 %fun_a = load volatile ptr, ptr @fun_a;
73 %cond = icmp ult i32 %val1, %val2;
74 br i1 %cond, label %a, label %b;
77 tail call void %fun_a()
85 ; Check a conditional sibling call - 64-bit compare.
86 define void @f5(i64 %val1, i64 %val2) {
88 ; CHECK: cgrbl %r2, %r3, 0(%r1)
90 %fun_a = load volatile ptr, ptr @fun_a;
91 %cond = icmp slt i64 %val1, %val2;
92 br i1 %cond, label %a, label %b;
95 tail call void %fun_a()
103 ; Check a conditional sibling call - unsigned 64-bit compare.
104 define void @f6(i64 %val1, i64 %val2) {
106 ; CHECK: clgrbl %r2, %r3, 0(%r1)
108 %fun_a = load volatile ptr, ptr @fun_a;
109 %cond = icmp ult i64 %val1, %val2;
110 br i1 %cond, label %a, label %b;
113 tail call void %fun_a()
117 store i32 1, ptr@var;
121 ; Check a conditional sibling call - less-equal compare.
122 define void @f7(i32 %val1, i32 %val2) {
124 ; CHECK: crble %r2, %r3, 0(%r1)
126 %fun_a = load volatile ptr, ptr @fun_a;
127 %cond = icmp sle i32 %val1, %val2;
128 br i1 %cond, label %a, label %b;
131 tail call void %fun_a()
135 store i32 1, ptr@var;
139 ; Check a conditional sibling call - high compare.
140 define void @f8(i32 %val1, i32 %val2) {
142 ; CHECK: crbh %r2, %r3, 0(%r1)
144 %fun_a = load volatile ptr, ptr @fun_a;
145 %cond = icmp sgt i32 %val1, %val2;
146 br i1 %cond, label %a, label %b;
149 tail call void %fun_a()
153 store i32 1, ptr@var;
157 ; Check a conditional sibling call - high-equal compare.
158 define void @f9(i32 %val1, i32 %val2) {
160 ; CHECK: crbhe %r2, %r3, 0(%r1)
162 %fun_a = load volatile ptr, ptr @fun_a;
163 %cond = icmp sge i32 %val1, %val2;
164 br i1 %cond, label %a, label %b;
167 tail call void %fun_a()
171 store i32 1, ptr@var;
175 ; Check a conditional sibling call - equal compare.
176 define void @f10(i32 %val1, i32 %val2) {
178 ; CHECK: crbe %r2, %r3, 0(%r1)
180 %fun_a = load volatile ptr, ptr @fun_a;
181 %cond = icmp eq i32 %val1, %val2;
182 br i1 %cond, label %a, label %b;
185 tail call void %fun_a()
189 store i32 1, ptr@var;
193 ; Check a conditional sibling call - unequal compare.
194 define void @f11(i32 %val1, i32 %val2) {
196 ; CHECK: crblh %r2, %r3, 0(%r1)
198 %fun_a = load volatile ptr, ptr @fun_a;
199 %cond = icmp ne i32 %val1, %val2;
200 br i1 %cond, label %a, label %b;
203 tail call void %fun_a()
207 store i32 1, ptr@var;
211 ; Check a conditional sibling call - immediate slt.
212 define void @f12(i32 %val1) {
214 ; CHECK: cible %r2, 4, 0(%r1)
216 %fun_a = load volatile ptr, ptr @fun_a;
217 %cond = icmp slt i32 %val1, 5;
218 br i1 %cond, label %a, label %b;
221 tail call void %fun_a()
225 store i32 1, ptr@var;
229 ; Check a conditional sibling call - immediate sle.
230 define void @f13(i32 %val1) {
232 ; CHECK: cible %r2, 5, 0(%r1)
234 %fun_a = load volatile ptr, ptr @fun_a;
235 %cond = icmp sle i32 %val1, 5;
236 br i1 %cond, label %a, label %b;
239 tail call void %fun_a()
243 store i32 1, ptr@var;
247 ; Check a conditional sibling call - immediate sgt.
248 define void @f14(i32 %val1) {
250 ; CHECK: cibhe %r2, 6, 0(%r1)
252 %fun_a = load volatile ptr, ptr @fun_a;
253 %cond = icmp sgt i32 %val1, 5;
254 br i1 %cond, label %a, label %b;
257 tail call void %fun_a()
261 store i32 1, ptr@var;
265 ; Check a conditional sibling call - immediate sge.
266 define void @f15(i32 %val1) {
268 ; CHECK: cibhe %r2, 5, 0(%r1)
270 %fun_a = load volatile ptr, ptr @fun_a;
271 %cond = icmp sge i32 %val1, 5;
272 br i1 %cond, label %a, label %b;
275 tail call void %fun_a()
279 store i32 1, ptr@var;
283 ; Check a conditional sibling call - immediate eq.
284 define void @f16(i32 %val1) {
286 ; CHECK: cibe %r2, 5, 0(%r1)
288 %fun_a = load volatile ptr, ptr @fun_a;
289 %cond = icmp eq i32 %val1, 5;
290 br i1 %cond, label %a, label %b;
293 tail call void %fun_a()
297 store i32 1, ptr@var;
301 ; Check a conditional sibling call - immediate ne.
302 define void @f17(i32 %val1) {
304 ; CHECK: ciblh %r2, 5, 0(%r1)
306 %fun_a = load volatile ptr, ptr @fun_a;
307 %cond = icmp ne i32 %val1, 5;
308 br i1 %cond, label %a, label %b;
311 tail call void %fun_a()
315 store i32 1, ptr@var;
319 ; Check a conditional sibling call - immediate ult.
320 define void @f18(i32 %val1) {
322 ; CHECK: clible %r2, 4, 0(%r1)
324 %fun_a = load volatile ptr, ptr @fun_a;
325 %cond = icmp ult i32 %val1, 5;
326 br i1 %cond, label %a, label %b;
329 tail call void %fun_a()
333 store i32 1, ptr@var;
337 ; Check a conditional sibling call - immediate 64-bit slt.
338 define void @f19(i64 %val1) {
340 ; CHECK: cgible %r2, 4, 0(%r1)
342 %fun_a = load volatile ptr, ptr @fun_a;
343 %cond = icmp slt i64 %val1, 5;
344 br i1 %cond, label %a, label %b;
347 tail call void %fun_a()
351 store i32 1, ptr@var;
355 ; Check a conditional sibling call - immediate 64-bit ult.
356 define void @f20(i64 %val1) {
358 ; CHECK: clgible %r2, 4, 0(%r1)
360 %fun_a = load volatile ptr, ptr @fun_a;
361 %cond = icmp ult i64 %val1, 5;
362 br i1 %cond, label %a, label %b;
365 tail call void %fun_a()
369 store i32 1, ptr@var;
373 ; Check a conditional sibling call to an argument - will fail due to
375 define void @f21(i32 %val1, i32 %val2, ptr %fun) {
377 ; CHECK: crjhe %r2, %r3
378 ; CHECK: lgr %r1, %r4
381 %cond = icmp slt i32 %val1, %val2;
382 br i1 %cond, label %a, label %b;
385 tail call void %fun()
389 store i32 1, ptr@var;
393 ; Check a conditional sibling call - float olt compare.
394 define void @f22(float %val1, float %val2) {
396 ; CHECK: cebr %f0, %f2
399 %fun_a = load volatile ptr, ptr @fun_a;
400 %cond = fcmp olt float %val1, %val2;
401 br i1 %cond, label %a, label %b;
404 tail call void %fun_a()
408 store i32 1, ptr@var;
412 ; Check a conditional sibling call - float ult compare.
413 define void @f23(float %val1, float %val2) {
415 ; CHECK: cebr %f0, %f2
418 %fun_a = load volatile ptr, ptr @fun_a;
419 %cond = fcmp ult float %val1, %val2;
420 br i1 %cond, label %a, label %b;
423 tail call void %fun_a()
427 store i32 1, ptr@var;
431 ; Check a conditional sibling call - float ord compare.
432 define void @f24(float %val1, float %val2) {
434 ; CHECK: cebr %f0, %f2
437 %fun_a = load volatile ptr, ptr @fun_a;
438 %cond = fcmp ord float %val1, %val2;
439 br i1 %cond, label %a, label %b;
442 tail call void %fun_a()
446 store i32 1, ptr@var;
450 ; Check a conditional sibling call - float uno compare.
451 define void @f25(float %val1, float %val2) {
453 ; CHECK: cebr %f0, %f2
457 %fun_a = load volatile ptr, ptr @fun_a;
458 %cond = fcmp uno float %val1, %val2;
459 br i1 %cond, label %a, label %b;
462 tail call void %fun_a()
466 store i32 1, ptr@var;