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