[WinEH] Disallow cyclic unwinds
[oota-llvm.git] / test / CodeGen / SystemZ / branch-08.ll
1 ; Test SystemZInstrInfo::AnalyzeBranch and SystemZInstrInfo::InsertBranch.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5 declare void @foo() noreturn
6
7 ; Check a case where a separate branch is needed and where the original
8 ; order should be reversed.
9 define 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
16 entry:
17   %b = load i32 , i32 *%bptr
18   %cmp = icmp ult i32 %a, %b
19   br i1 %cmp, label %callit, label %return
20
21 callit:
22   call void @foo()
23   unreachable
24
25 return:
26   ret i32 1
27 }
28
29 ; Same again with a fused compare and branch.
30 define 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
36 entry:
37   %cmp = icmp eq i32 %a, 0
38   br i1 %cmp, label %callit, label %return
39
40 callit:
41   call void @foo()
42   unreachable
43
44 return:
45   ret i32 1
46 }