1; Test all condition-code masks that are relevant for signed integer
2; comparisons, in cases where a separate branch is better than COMPARE
3; AND BRANCH.
4;
5; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6
7define void @f1(i32 *%src, i32 %target) {
8; CHECK-LABEL: f1:
9; CHECK: .cfi_startproc
10; CHECK: .L[[LABEL:.*]]:
11; CHECK: c %r3, 0(%r2)
12; CHECK-NEXT: je .L[[LABEL]]
13  br label %loop
14loop:
15  %val = load volatile i32, i32 *%src
16  %cond = icmp eq i32 %target, %val
17  br i1 %cond, label %loop, label %exit
18exit:
19  ret void
20}
21
22define void @f2(i32 *%src, i32 %target) {
23; CHECK-LABEL: f2:
24; CHECK: .cfi_startproc
25; CHECK: .L[[LABEL:.*]]:
26; CHECK: c %r3, 0(%r2)
27; CHECK-NEXT: jlh .L[[LABEL]]
28  br label %loop
29loop:
30  %val = load volatile i32, i32 *%src
31  %cond = icmp ne i32 %target, %val
32  br i1 %cond, label %loop, label %exit
33exit:
34  ret void
35}
36
37define void @f3(i32 *%src, i32 %target) {
38; CHECK-LABEL: f3:
39; CHECK: .cfi_startproc
40; CHECK: .L[[LABEL:.*]]:
41; CHECK: c %r3, 0(%r2)
42; CHECK-NEXT: jle .L[[LABEL]]
43  br label %loop
44loop:
45  %val = load volatile i32, i32 *%src
46  %cond = icmp sle i32 %target, %val
47  br i1 %cond, label %loop, label %exit
48exit:
49  ret void
50}
51
52define void @f4(i32 *%src, i32 %target) {
53; CHECK-LABEL: f4:
54; CHECK: .cfi_startproc
55; CHECK: .L[[LABEL:.*]]:
56; CHECK: c %r3, 0(%r2)
57; CHECK-NEXT: jl .L[[LABEL]]
58  br label %loop
59loop:
60  %val = load volatile i32, i32 *%src
61  %cond = icmp slt i32 %target, %val
62  br i1 %cond, label %loop, label %exit
63exit:
64  ret void
65}
66
67define void @f5(i32 *%src, i32 %target) {
68; CHECK-LABEL: f5:
69; CHECK: .cfi_startproc
70; CHECK: .L[[LABEL:.*]]:
71; CHECK: c %r3, 0(%r2)
72; CHECK-NEXT: jh .L[[LABEL]]
73  br label %loop
74loop:
75  %val = load volatile i32, i32 *%src
76  %cond = icmp sgt i32 %target, %val
77  br i1 %cond, label %loop, label %exit
78exit:
79  ret void
80}
81
82define void @f6(i32 *%src, i32 %target) {
83; CHECK-LABEL: f6:
84; CHECK: .cfi_startproc
85; CHECK: .L[[LABEL:.*]]:
86; CHECK: c %r3, 0(%r2)
87; CHECK-NEXT: jhe .L[[LABEL]]
88  br label %loop
89loop:
90  %val = load volatile i32, i32 *%src
91  %cond = icmp sge i32 %target, %val
92  br i1 %cond, label %loop, label %exit
93exit:
94  ret void
95}
96