1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2 # RUN: llc --run-pass=aarch64-ldst-opt %s -o - | FileCheck %s
4 target triple = "aarch64-unknown-linux"
6 define i32 @f(i32 %x) {
17 tracksRegLiveness: true
19 - { reg: '$w0', virtual-reg: '' }
25 isCalleeSavedInfoValid: true
28 - { id: 0, name: '', type: spill-slot, offset: -24, size: 8, alignment: 8,
29 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
30 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
31 - { id: 1, name: '', type: spill-slot, offset: -32, size: 8, alignment: 8,
32 stack-id: default, callee-saved-register: '$fp', callee-saved-restored: true,
33 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
36 debugValueSubstitutions: []
42 liveins: $w0, $lr, $x0
44 ; Test an SP update is merged forwards into a load instruction,
45 ; because an access to the load destination reg prevents merging backwards.
47 ; CHECK-LABEL: name: f
48 ; CHECK: liveins: $w0, $lr, $x0
50 ; CHECK-NEXT: $x1 = ADDXri $x0, 1, 0
51 ; CHECK-NEXT: early-clobber $sp, $x0 = frame-setup LDRXpre $sp, -32
52 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 32
53 ; CHECK-NEXT: frame-setup STRXui killed $fp, $sp, 0 :: (store (s64) into %stack.1)
54 ; CHECK-NEXT: frame-setup STRXui killed $x1, $sp, 1
55 ; CHECK-NEXT: frame-setup STRXui killed $lr, $sp, 2 :: (store (s64) into %stack.0)
56 ; CHECK-NEXT: $fp = frame-setup ADDXri $sp, 0, 0
57 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa $w29, 32
58 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w30, -8
59 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w29, -16
60 ; CHECK-NEXT: renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
61 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w0
62 ; CHECK-NEXT: $w0 = nsw ADDWri killed renamable $w0, 1, 0
63 ; CHECK-NEXT: $fp = frame-destroy LDRXui $sp, 0 :: (load (s64) from %stack.1)
64 ; CHECK-NEXT: $lr = frame-destroy LDRXui $sp, 2 :: (load (s64) from %stack.0)
65 ; CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 32, 0
66 ; CHECK-NEXT: RET undef $lr, implicit $w0
67 $sp = frame-setup SUBXri $sp, 32, 0
68 frame-setup CFI_INSTRUCTION def_cfa_offset 32
69 $x1 = ADDXri $x0, 1, 0
70 $x0 = frame-setup LDRXui $sp, 0
71 frame-setup STRXui killed $fp, $sp, 0 :: (store (s64) into %stack.1)
72 frame-setup STRXui killed $x1, $sp, 1
73 frame-setup STRXui killed $lr, $sp, 2 :: (store (s64) into %stack.0)
74 $fp = frame-setup ADDXri $sp, 0, 0
75 frame-setup CFI_INSTRUCTION def_cfa $w29, 32
76 frame-setup CFI_INSTRUCTION offset $w30, -8
77 frame-setup CFI_INSTRUCTION offset $w29, -16
78 renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
79 BL @g, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w0
80 $w0 = nsw ADDWri killed renamable $w0, 1, 0
81 $fp = frame-destroy LDRXui $sp, 0 :: (load (s64) from %stack.1)
82 $lr = frame-destroy LDRXui $sp, 2 :: (load (s64) from %stack.0)
83 $sp = frame-destroy ADDXri $sp, 32, 0
84 RET undef $lr, implicit $w0