1; Test all condition-code masks that are relevant for CLGRJ.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5declare i64 @foo()
6@g1 = global i16 0
7
8define void @f1(i64 %target) {
9; CHECK-LABEL: f1:
10; CHECK: .cfi_def_cfa_offset
11; CHECK: .L[[LABEL:.*]]:
12; CHECK: clgrjle %r2, {{%r[0-9]+}}, .L[[LABEL]]
13  br label %loop
14loop:
15  %val = call i64 @foo()
16  %cond = icmp ule i64 %val, %target
17  br i1 %cond, label %loop, label %exit
18exit:
19  ret void
20}
21
22define void @f2(i64 %target) {
23; CHECK-LABEL: f2:
24; CHECK: .cfi_def_cfa_offset
25; CHECK: .L[[LABEL:.*]]:
26; CHECK: clgrjl %r2, {{%r[0-9]+}}, .L[[LABEL]]
27  br label %loop
28loop:
29  %val = call i64 @foo()
30  %cond = icmp ult i64 %val, %target
31  br i1 %cond, label %loop, label %exit
32exit:
33  ret void
34}
35
36define void @f3(i64 %target) {
37; CHECK-LABEL: f3:
38; CHECK: .cfi_def_cfa_offset
39; CHECK: .L[[LABEL:.*]]:
40; CHECK: clgrjh %r2, {{%r[0-9]+}}, .L[[LABEL]]
41  br label %loop
42loop:
43  %val = call i64 @foo()
44  %cond = icmp ugt i64 %val, %target
45  br i1 %cond, label %loop, label %exit
46exit:
47  ret void
48}
49
50define void @f4(i64 %target) {
51; CHECK-LABEL: f4:
52; CHECK: .cfi_def_cfa_offset
53; CHECK: .L[[LABEL:.*]]:
54; CHECK: clgrjhe %r2, {{%r[0-9]+}}, .L[[LABEL]]
55  br label %loop
56loop:
57  %val = call i64 @foo()
58  %cond = icmp uge i64 %val, %target
59  br i1 %cond, label %loop, label %exit
60exit:
61  ret void
62}
63