• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -o - %s -mcpu=cyclone | FileCheck %s
2target triple = "arm64-apple-ios"
3
4declare void @foobar(i32 %v0, i32 %v1)
5
6; Make sure sub is scheduled in front of cbnz
7; CHECK-LABEL: test_sub_cbz:
8; CHECK: add w[[ADDRES:[0-9]+]], w1, #7
9; CHECK: sub w[[SUBRES:[0-9]+]], w0, #13
10; CHECK-NEXT: cbnz w[[SUBRES]], [[SKIPBLOCK:LBB[0-9_]+]]
11; CHECK: mov x0, x[[ADDRES]]
12; CHECK: mov x1, x[[SUBRES]]
13; CHECK: bl _foobar
14; CHECK: [[SKIPBLOCK]]:
15; CHECK: mov x0, x[[SUBRES]]
16; CHECK: mov x1, x[[ADDRES]]
17; CHECK: bl _foobar
18define void @test_sub_cbz(i32 %a0, i32 %a1) {
19entry:
20  ; except for the fusion opportunity the sub/add should be equal so the
21  ; scheduler would leave them in source order if it weren't for the scheduling
22  %v0 = sub i32 %a0, 13
23  %cond = icmp eq i32 %v0, 0
24  %v1 = add i32 %a1, 7
25  br i1 %cond, label %if, label %exit
26
27if:
28  call void @foobar(i32 %v1, i32 %v0)
29  br label %exit
30
31exit:
32  call void @foobar(i32 %v0, i32 %v1)
33  ret void
34}
35