• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test SystemZInstrInfo::AnalyzeBranch and SystemZInstrInfo::InsertBranch.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5declare void @foo() noreturn
6
7; Check a case where a separate branch is needed and where the original
8; order should be reversed.
9define i32 @f1(i32 %a, i32 *%bptr) {
10; CHECK-LABEL: f1:
11; CHECK: cl %r2, 0(%r3)
12; CHECK: jl .L[[LABEL:.*]]
13; CHECK: br %r14
14; CHECK: .L[[LABEL]]:
15; CHECK: brasl %r14, foo@PLT
16entry:
17  %b = load i32 , i32 *%bptr
18  %cmp = icmp ult i32 %a, %b
19  br i1 %cmp, label %callit, label %return
20
21callit:
22  call void @foo()
23  unreachable
24
25return:
26  ret i32 1
27}
28
29; Same again with a fused compare and branch.
30define i32 @f2(i32 %a) {
31; CHECK-LABEL: f2:
32; CHECK: cije %r2, 0, .L[[LABEL:.*]]
33; CHECK: br %r14
34; CHECK: .L[[LABEL]]:
35; CHECK: brasl %r14, foo@PLT
36entry:
37  %cmp = icmp eq i32 %a, 0
38  br i1 %cmp, label %callit, label %return
39
40callit:
41  call void @foo()
42  unreachable
43
44return:
45  ret i32 1
46}
47