1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -run-pass=prologepilog -simplify-mir -verify-machineinstrs %s -o - | FileCheck %s
4 # Test that prologepilog works for each of the LDNT1/STNT1 instructions for stack-based objects.
7 define void @testcase_positive_offset() uwtable {
8 %dummy = alloca <vscale x 2 x i64>, align 8
9 %object = alloca <vscale x 2 x i64>, align 8
10 ; Reads from %object at offset 7 * readsize
13 define void @testcase_negative_offset() uwtable {
14 %dummy = alloca <vscale x 2 x i64>, align 8
15 %object = alloca <vscale x 2 x i64>, align 8
16 ; Reads from %object at offset -8 * readsize
20 define void @testcase_positive_offset_out_of_range() uwtable {
21 %dummy = alloca <vscale x 2 x i64>, align 8
22 %object = alloca <vscale x 2 x i64>, align 8
23 ; Reads from %object at offset 8 * readsize
26 define void @testcase_negative_offset_out_of_range() uwtable {
27 %dummy = alloca <vscale x 2 x i64>, align 8
28 %object = alloca <vscale x 2 x i64>, align 8
29 ; Reads from %object at offset -9 * readsize
34 name: testcase_positive_offset
35 tracksRegLiveness: true
37 - { id: 0, name: dummy, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
38 - { id: 1, name: object, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
43 ; CHECK-LABEL: name: testcase_positive_offset
46 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -16 :: (store (s64) into %stack.2)
47 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
48 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w29, -16
49 ; CHECK-NEXT: $sp = frame-setup ADDVL_XXI $sp, -4
50 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0x2e, 0x00, 0x1e, 0x22
51 ; CHECK-NEXT: renamable $z0 = LDNT1B_ZRI renamable $p0, $sp, 7 :: (load (s8) from %ir.object, align 2)
52 ; CHECK-NEXT: renamable $z0 = LDNT1H_ZRI renamable $p0, $sp, 7 :: (load (s16) from %ir.object)
53 ; CHECK-NEXT: renamable $z0 = LDNT1W_ZRI renamable $p0, $sp, 7 :: (load (s32) from %ir.object, align 8)
54 ; CHECK-NEXT: renamable $z0 = LDNT1D_ZRI renamable $p0, $sp, 7 :: (load (s64) from %ir.object)
55 ; CHECK-NEXT: STNT1B_ZRI renamable $z0, renamable $p0, $sp, 7 :: (store (s8) into %ir.object, align 8)
56 ; CHECK-NEXT: STNT1H_ZRI renamable $z0, renamable $p0, $sp, 7 :: (store (s16) into %ir.object, align 8)
57 ; CHECK-NEXT: STNT1W_ZRI renamable $z0, renamable $p0, $sp, 7 :: (store (s32) into %ir.object, align 8)
58 ; CHECK-NEXT: STNT1D_ZRI renamable $z0, renamable $p0, $sp, 7 :: (store (s64) into %ir.object)
59 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 4
60 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $wsp, 16
61 ; CHECK-NEXT: early-clobber $sp, $fp = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.2)
62 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0
63 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w29
64 ; CHECK-NEXT: RET_ReallyLR implicit $z0
65 renamable $z0 = LDNT1B_ZRI renamable $p0, %stack.1.object, 7 :: (load 1 from %ir.object, align 2)
66 renamable $z0 = LDNT1H_ZRI renamable $p0, %stack.1.object, 7 :: (load 2 from %ir.object, align 2)
67 renamable $z0 = LDNT1W_ZRI renamable $p0, %stack.1.object, 7 :: (load 4 from %ir.object, align 8)
68 renamable $z0 = LDNT1D_ZRI renamable $p0, %stack.1.object, 7 :: (load 8 from %ir.object, align 8)
69 STNT1B_ZRI renamable $z0, renamable $p0, %stack.1.object, 7 :: (store 1 into %ir.object, align 8)
70 STNT1H_ZRI renamable $z0, renamable $p0, %stack.1.object, 7 :: (store 2 into %ir.object, align 8)
71 STNT1W_ZRI renamable $z0, renamable $p0, %stack.1.object, 7 :: (store 4 into %ir.object, align 8)
72 STNT1D_ZRI renamable $z0, renamable $p0, %stack.1.object, 7 :: (store 8 into %ir.object, align 8)
73 RET_ReallyLR implicit $z0
77 name: testcase_negative_offset
78 tracksRegLiveness: true
80 - { id: 0, name: dummy, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
81 - { id: 1, name: object, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
86 ; CHECK-LABEL: name: testcase_negative_offset
89 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -16 :: (store (s64) into %stack.2)
90 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
91 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w29, -16
92 ; CHECK-NEXT: $sp = frame-setup ADDVL_XXI $sp, -4
93 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0x2e, 0x00, 0x1e, 0x22
94 ; CHECK-NEXT: renamable $z0 = LDNT1B_ZRI renamable $p0, $sp, -8 :: (load (s8) from %ir.object, align 2)
95 ; CHECK-NEXT: renamable $z0 = LDNT1H_ZRI renamable $p0, $sp, -8 :: (load (s16) from %ir.object)
96 ; CHECK-NEXT: renamable $z0 = LDNT1W_ZRI renamable $p0, $sp, -8 :: (load (s32) from %ir.object)
97 ; CHECK-NEXT: renamable $z0 = LDNT1D_ZRI renamable $p0, $sp, -8 :: (load (s64) from %ir.object)
98 ; CHECK-NEXT: STNT1B_ZRI renamable $z0, renamable $p0, $sp, -8 :: (store (s8) into %ir.object, align 8)
99 ; CHECK-NEXT: STNT1H_ZRI renamable $z0, renamable $p0, $sp, -8 :: (store (s16) into %ir.object, align 8)
100 ; CHECK-NEXT: STNT1W_ZRI renamable $z0, renamable $p0, $sp, -8 :: (store (s32) into %ir.object, align 8)
101 ; CHECK-NEXT: STNT1D_ZRI renamable $z0, renamable $p0, $sp, -8 :: (store (s64) into %ir.object)
102 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 4
103 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $wsp, 16
104 ; CHECK-NEXT: early-clobber $sp, $fp = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.2)
105 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0
106 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w29
107 ; CHECK-NEXT: RET_ReallyLR implicit $z0
108 renamable $z0 = LDNT1B_ZRI renamable $p0, %stack.1.object, -8 :: (load 1 from %ir.object, align 2)
109 renamable $z0 = LDNT1H_ZRI renamable $p0, %stack.1.object, -8 :: (load 2 from %ir.object, align 2)
110 renamable $z0 = LDNT1W_ZRI renamable $p0, %stack.1.object, -8 :: (load 4 from %ir.object, align 4)
111 renamable $z0 = LDNT1D_ZRI renamable $p0, %stack.1.object, -8 :: (load 8 from %ir.object, align 8)
112 STNT1B_ZRI renamable $z0, renamable $p0, %stack.1.object, -8 :: (store 1 into %ir.object, align 8)
113 STNT1H_ZRI renamable $z0, renamable $p0, %stack.1.object, -8 :: (store 2 into %ir.object, align 8)
114 STNT1W_ZRI renamable $z0, renamable $p0, %stack.1.object, -8 :: (store 4 into %ir.object, align 8)
115 STNT1D_ZRI renamable $z0, renamable $p0, %stack.1.object, -8 :: (store 8 into %ir.object, align 8)
116 RET_ReallyLR implicit $z0
120 name: testcase_positive_offset_out_of_range
121 tracksRegLiveness: true
123 - { id: 0, name: dummy, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
124 - { id: 1, name: object, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
129 ; CHECK-LABEL: name: testcase_positive_offset_out_of_range
130 ; CHECK: liveins: $p0
132 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -16 :: (store (s64) into %stack.2)
133 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
134 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w29, -16
135 ; CHECK-NEXT: $sp = frame-setup ADDVL_XXI $sp, -4
136 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0x2e, 0x00, 0x1e, 0x22
137 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
138 ; CHECK-NEXT: renamable $z0 = LDNT1B_ZRI renamable $p0, killed $x8, 7 :: (load (s8) from %ir.object, align 2)
139 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
140 ; CHECK-NEXT: renamable $z0 = LDNT1H_ZRI renamable $p0, killed $x8, 7 :: (load (s16) from %ir.object)
141 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
142 ; CHECK-NEXT: renamable $z0 = LDNT1W_ZRI renamable $p0, killed $x8, 7 :: (load (s32) from %ir.object)
143 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
144 ; CHECK-NEXT: renamable $z0 = LDNT1D_ZRI renamable $p0, killed $x8, 7 :: (load (s64) from %ir.object)
145 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
146 ; CHECK-NEXT: STNT1B_ZRI renamable $z0, renamable $p0, killed $x8, 7 :: (store (s8) into %ir.object, align 8)
147 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
148 ; CHECK-NEXT: STNT1H_ZRI renamable $z0, renamable $p0, killed $x8, 7 :: (store (s16) into %ir.object, align 8)
149 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
150 ; CHECK-NEXT: STNT1W_ZRI renamable $z0, renamable $p0, killed $x8, 7 :: (store (s32) into %ir.object, align 8)
151 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 1
152 ; CHECK-NEXT: STNT1D_ZRI renamable $z0, renamable $p0, killed $x8, 7 :: (store (s64) into %ir.object)
153 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 4
154 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $wsp, 16
155 ; CHECK-NEXT: early-clobber $sp, $fp = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.2)
156 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0
157 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w29
158 ; CHECK-NEXT: RET_ReallyLR implicit $z0
159 renamable $z0 = LDNT1B_ZRI renamable $p0, %stack.1.object, 8 :: (load 1 from %ir.object, align 2)
160 renamable $z0 = LDNT1H_ZRI renamable $p0, %stack.1.object, 8 :: (load 2 from %ir.object, align 2)
161 renamable $z0 = LDNT1W_ZRI renamable $p0, %stack.1.object, 8 :: (load 4 from %ir.object, align 4)
162 renamable $z0 = LDNT1D_ZRI renamable $p0, %stack.1.object, 8 :: (load 8 from %ir.object, align 8)
163 STNT1B_ZRI renamable $z0, renamable $p0, %stack.1.object, 8 :: (store 1 into %ir.object, align 8)
164 STNT1H_ZRI renamable $z0, renamable $p0, %stack.1.object, 8 :: (store 2 into %ir.object, align 8)
165 STNT1W_ZRI renamable $z0, renamable $p0, %stack.1.object, 8 :: (store 4 into %ir.object, align 8)
166 STNT1D_ZRI renamable $z0, renamable $p0, %stack.1.object, 8 :: (store 8 into %ir.object, align 8)
167 RET_ReallyLR implicit $z0
171 name: testcase_negative_offset_out_of_range
172 tracksRegLiveness: true
174 - { id: 0, name: dummy, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
175 - { id: 1, name: object, type: default, offset: 0, size: 32, alignment: 16, stack-id: scalable-vector }
180 ; CHECK-LABEL: name: testcase_negative_offset_out_of_range
181 ; CHECK: liveins: $p0
183 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -16 :: (store (s64) into %stack.2)
184 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
185 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w29, -16
186 ; CHECK-NEXT: $sp = frame-setup ADDVL_XXI $sp, -4
187 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0x2e, 0x00, 0x1e, 0x22
188 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
189 ; CHECK-NEXT: renamable $z0 = LDNT1B_ZRI renamable $p0, killed $x8, -8 :: (load (s8) from %ir.object, align 2)
190 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
191 ; CHECK-NEXT: renamable $z0 = LDNT1H_ZRI renamable $p0, killed $x8, -8 :: (load (s16) from %ir.object)
192 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
193 ; CHECK-NEXT: renamable $z0 = LDNT1W_ZRI renamable $p0, killed $x8, -8 :: (load (s32) from %ir.object)
194 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
195 ; CHECK-NEXT: renamable $z0 = LDNT1D_ZRI renamable $p0, killed $x8, -8 :: (load (s64) from %ir.object)
196 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
197 ; CHECK-NEXT: STNT1B_ZRI renamable $z0, renamable $p0, killed $x8, -8 :: (store (s8) into %ir.object, align 8)
198 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
199 ; CHECK-NEXT: STNT1H_ZRI renamable $z0, renamable $p0, killed $x8, -8 :: (store (s16) into %ir.object, align 8)
200 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
201 ; CHECK-NEXT: STNT1W_ZRI renamable $z0, renamable $p0, killed $x8, -8 :: (store (s32) into %ir.object, align 8)
202 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -1
203 ; CHECK-NEXT: STNT1D_ZRI renamable $z0, renamable $p0, killed $x8, -8 :: (store (s64) into %ir.object)
204 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 4
205 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $wsp, 16
206 ; CHECK-NEXT: early-clobber $sp, $fp = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.2)
207 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0
208 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w29
209 ; CHECK-NEXT: RET_ReallyLR implicit $z0
210 renamable $z0 = LDNT1B_ZRI renamable $p0, %stack.1.object, -9 :: (load 1 from %ir.object, align 2)
211 renamable $z0 = LDNT1H_ZRI renamable $p0, %stack.1.object, -9 :: (load 2 from %ir.object, align 2)
212 renamable $z0 = LDNT1W_ZRI renamable $p0, %stack.1.object, -9 :: (load 4 from %ir.object, align 4)
213 renamable $z0 = LDNT1D_ZRI renamable $p0, %stack.1.object, -9 :: (load 8 from %ir.object, align 8)
214 STNT1B_ZRI renamable $z0, renamable $p0, %stack.1.object, -9 :: (store 1 into %ir.object, align 8)
215 STNT1H_ZRI renamable $z0, renamable $p0, %stack.1.object, -9 :: (store 2 into %ir.object, align 8)
216 STNT1W_ZRI renamable $z0, renamable $p0, %stack.1.object, -9 :: (store 4 into %ir.object, align 8)
217 STNT1D_ZRI renamable $z0, renamable $p0, %stack.1.object, -9 :: (store 8 into %ir.object, align 8)
218 RET_ReallyLR implicit $z0