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