1# RUN: llc -o - %s -mtriple=aarch64-- -mattr=+arith-bcc-fusion -run-pass postmisched | FileCheck %s --check-prefixes=CHECK,FUSION
2# RUN: llc -o - %s -mtriple=aarch64-- -mattr=-arith-bcc-fusion -run-pass postmisched | FileCheck %s --check-prefixes=CHECK,NOFUSION
3# Make sure the last instruction is correctly macro-fused when scheduling
4# top-down (post-ra).
5---
6# CHECK-LABEL: name: fuse_last
7# CHECK: $x1 = LDRXui $x0, 0
8# NOFUSION: $xzr = SUBSXri killed $x2, 0, 0, implicit-def $nzcv
9# CHECK: STRXui killed $x0, killed $x1, 0
10# FUSION: $xzr = SUBSXri killed $x2, 0, 0, implicit-def $nzcv
11# CHECK: Bcc 1, %bb.1, implicit killed $nzcv
12name: fuse_last
13tracksRegLiveness: true
14body: |
15  bb.0:
16    liveins: $x0, $x2
17
18    $x1 = LDRXui $x0, 0
19    ; There is latency between these two instructions tempting the scheduler to
20    ; move the SUBSXri in between them. However doing so breaks macro fusion.
21    STRXui $x0, $x1, 0
22
23    $xzr = SUBSXri $x2, 0, 0, implicit-def $nzcv
24    Bcc 1, %bb.1, implicit killed $nzcv
25
26  bb.1:
27    RET_ReallyLR implicit undef $x0
28...
29