Home | History | Annotate | Download | only in SystemZ
      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 %b) {
     10 ; CHECK-LABEL: f1:
     11 ; CHECK: clr %r2, %r3
     12 ; CHECK: jl .L[[LABEL:.*]]
     13 ; CHECK: br %r14
     14 ; CHECK: .L[[LABEL]]:
     15 ; CHECK: brasl %r14, foo@PLT
     16 entry:
     17   %cmp = icmp ult i32 %a, %b
     18   br i1 %cmp, label %callit, label %return
     19 
     20 callit:
     21   call void @foo()
     22   unreachable
     23 
     24 return:
     25   ret i32 1
     26 }
     27 
     28 ; Same again with a fused compare and branch.
     29 define i32 @f2(i32 %a) {
     30 ; CHECK-LABEL: f2:
     31 ; CHECK: cije %r2, 0, .L[[LABEL:.*]]
     32 ; CHECK: br %r14
     33 ; CHECK: .L[[LABEL]]:
     34 ; CHECK: brasl %r14, foo@PLT
     35 entry:
     36   %cmp = icmp eq i32 %a, 0
     37   br i1 %cmp, label %callit, label %return
     38 
     39 callit:
     40   call void @foo()
     41   unreachable
     42 
     43 return:
     44   ret i32 1
     45 }
     46