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