1; Test BRCTH.
2
3; RUN: llc < %s -verify-machineinstrs -mtriple=s390x-linux-gnu -mcpu=z196 \
4; RUN:   -no-integrated-as -disable-block-placement | FileCheck %s
5
6; Test a loop that should be converted into dbr form and then use BRCTH.
7define void @f2(i32 *%src, i32 *%dest) {
8; CHECK-LABEL: f2:
9; CHECK: blah [[REG:%r[0-5]]]
10; CHECK: [[LABEL:\.[^:]*]]:{{.*}} %loop
11; CHECK: brcth [[REG]], [[LABEL]]
12; CHECK: br %r14
13entry:
14  ; Force upper bound into a high register in order to encourage the
15  ; register allocator to use a high register for the count variable.
16  %top = call i32 asm sideeffect "blah $0", "=h"()
17  br label %loop
18
19loop:
20  %count = phi i32 [ 0, %entry ], [ %next, %loop.next ]
21  %next = add i32 %count, 1
22  %val = load volatile i32, i32 *%src
23  %cmp = icmp eq i32 %val, 0
24  br i1 %cmp, label %loop.next, label %loop.store
25
26loop.store:
27  %add = add i32 %val, 1
28  store volatile i32 %add, i32 *%dest
29  br label %loop.next
30
31loop.next:
32  %cont = icmp ne i32 %next, %top
33  br i1 %cont, label %loop, label %exit
34
35exit:
36  ret void
37}
38
39