Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / aarch64-cortex-a53-843419-nopatch.s
blob4f34ea26da7f8b82f85f7d44bfec40f1f5d6980d
1 // REQUIRES: aarch64
2 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
3 // RUN: ld.lld -fix-cortex-a53-843419 -verbose -t %t.o -o /dev/null | FileCheck %s
4 // Test cases for Cortex-A53 Erratum 843419 that we don't expect to recognize
5 // as needing a patch as one or more of the conditions isn't satisfied.
6 // See ARM-EPM-048406 Cortex_A53_MPCore_Software_Developers_Errata_Notice.pdf
7 // for full erratum details.
8 // In Summary
9 // 1.)
10 // ADRP (0xff8 or 0xffc)
11 // 2.)
12 // - load or store single register or either integer or vector registers
13 // - STP or STNP of either vector or vector registers
14 // - Advanced SIMD ST1 store instruction
15 // Must not write Rn
16 // 3.) optional instruction, can't be a branch, must not write Rn, may read Rn
17 // 4.) A load or store instruction from the Load/Store register unsigned
18 // immediate class using Rn as the base register
20 // Expect no patches detected.
21 // CHECK-NOT: detected cortex-a53-843419 erratum sequence
23 // erratum sequence but adrp (address & 0xfff) is not 0xff8 or 0xffc
24 .section .text.01, "ax", %progbits
25 .balign 4096
26 .globl t3_0_ldr
27 .type t3_ff8_ldr, %function
28 t3_0_ldr:
29 adrp x0, dat
30 ldr x1, [x1, #0]
31 ldr x0, [x0, :got_lo12:dat]
32 ret
34 .section .text.02, "ax", %progbits
35 .balign 4096
36 .globl t3_ff4_ldr
37 .space 4096 - 12
38 .type t3_ff4_ldr, %function
39 t3_ff4_ldr:
40 adrp x0, dat
41 ldr x1, [x1, #0]
42 ldr x0, [x0, :got_lo12:dat]
43 ret
45 // Close matches for erratum sequence, with adrp at correct address but
46 // instruction 2 is a load or store but not one that matches the erratum
47 // conditions, but with a similar encoding to an instruction that does.
49 // ldp is not part of sequence, although stp is.
50 .section .text.03, "ax", %progbits
51 .balign 4096
52 .globl t3_ff8_ldp
53 .type t3_ff8_ldp, %function
54 .space 4096 - 8
55 t3_ff8_ldp:
56 adrp x16, dat
57 ldp x1,x2, [x3, #0]
58 ldr x13, [x16, :got_lo12:dat]
59 ret
61 // st2 is not part of sequence although st1 is.
62 .section .text.04, "ax", %progbits
63 .balign 4096
64 .globl t3_ffc_st2
65 .type t3_ffc_st2, %function
66 .space 4096 - 4
67 t3_ffc_st2:
68 adrp x16, dat
69 st2 { v0.16b, v1.16b }, [x1]
70 ldr x13, [x16, :got_lo12:dat]
71 ret
73 // st3 is not part of sequence although st1 is.
74 .section .text.05, "ax", %progbits
75 .balign 4096
76 .globl t3_ffc_st3
77 .type t3_ffc_st3, %function
78 .space 4096 - 4
79 t3_ffc_st3:
80 adrp x16, dat
81 st3 { v0.16b, v1.16b, v2.16b }, [x1], x2
82 ldr x13, [x16, :got_lo12:dat]
83 ret
85 // ld1 is not part of sequence although st1 is.
86 .section .text.06, "ax", %progbits
87 .balign 4096
88 .globl t3_ffc_ld2
89 .type t3_ffc_st3, %function
90 .space 4096 - 4
91 t3_ffc_ld1:
92 adrp x16, dat
93 ld1 { v0.16b }, [x2], x3
94 ldr x13, [x16, :got_lo12:dat]
95 ret
97 // ldnp is not part of sequence although stnp is.
98 .section .text.07, "ax", %progbits
99 .balign 4096
100 .globl t4_ff8_ldnp
101 .type t4_ff8_ldnp, %function
102 .space 4096 - 8
103 t4_ff8_ldnp:
104 adrp x7, dat
105 ldnp x1,x2, [x3, #0]
107 ldr x10, [x7, :got_lo12:dat]
110 // Close match for erratum sequence, with adrp at correct address but
111 // instruction 2 writes to Rn, with Rn as either destination or as the
112 // transfer register but with writeback.
114 // ldr instruction writes to Rn
115 .section .text.08, "ax", %progbits
116 .balign 4096
117 .globl t3_ff8_ldr
118 .type t3_ff8_ldr, %function
119 .space 4096 - 8
120 t3_ff8_ldr:
121 adrp x0, dat
122 ldr x0, [x1, #0]
123 ldr x0, [x0, :got_lo12:dat]
126 // str instruction writes to Rn via writeback (pre index)
127 .section .text.09, "ax", %progbits
128 .balign 4096
129 .globl t3_ff8_str
130 .type t3_ff8_str, %function
131 .space 4096 - 8
132 t3_ff8_str:
133 adrp x0, dat
134 str x1, [x0, #4]!
135 ldr x0, [x0, :got_lo12:dat]
138 // ldr instruction writes to Rn via writeback (post index)
139 .section .text.09, "ax", %progbits
140 .balign 4096
141 .globl t3_ffc_ldr
142 .type t3_ffc_ldr, %function
143 .space 4096 - 8
144 t3_ffc_ldr:
145 adrp x0, dat
146 ldr x1, [x0], 0x8
147 ldr x0, [x0, :got_lo12:dat]
150 // stp writes to Rn via writeback (pre index)
151 .section .text.10, "ax", %progbits
152 .balign 4096
153 .globl t4_ffc_stppre
154 .type t4_ffc_stppre, %function
155 .space 4096 - 4
156 t4_ffc_stppre:
157 adrp x16, dat
158 stp x1,x2, [x16, #16]!
159 mul x3, x16, x16
160 ldr x14, [x16, #8]
163 // stp writes to Rn via writeback (post index)
164 .section .text.11, "ax", %progbits
165 .balign 4096
166 .globl t4_ff8_stppost
167 .type t4_ff8_stppost, %function
168 .space 4096 - 8
169 t4_ff8_stppost:
170 adrp x16, dat
171 stp x1,x2, [x16], #16
172 mul x3, x16, x16
173 ldr x14, [x16, #8]
176 // st1 writes to Rn via writeback
177 .section .text.12, "ax", %progbits
178 .balign 4096
179 .globl t3_ff8_st1
180 .type t3_ff8_st1, %function
181 .space 4096 - 8
182 t3_ff8_st1:
183 adrp x16, dat
184 st1 { v0.16b}, [x16], x2
185 ldr x13, [x16, :got_lo12:dat]
188 // Close match for erratum sequence, but with optional instruction 3 a branch
190 // function call via immediate
191 .section .text.13, "ax", %progbits
192 .balign 4096
193 .globl t4_ffc_blimm
194 .type t4_ffc_blimm, %function
195 .space 4096 - 4
196 t4_ffc_blimm:
197 adrp x7, dat
198 stnp x1,x2, [x3, #0]
199 bl t4_ffc_blimm
200 ldr x10, [x7, :got_lo12:dat]
203 // function call via register
204 .section .text.14, "ax", %progbits
205 .balign 4096
206 .globl t4_ffc_blreg
207 .type t4_ffc_blreg, %function
208 .space 4096 - 4
209 t4_ffc_blreg:
210 adrp x7, dat
211 stnp x1,x2, [x3, #0]
212 blr x4
213 ldr x10, [x7, :got_lo12:dat]
216 // Unconditional branch immediate
217 .section .text.15, "ax", %progbits
218 .balign 4096
219 .globl t4_ffc_branchimm
220 .type t4_ffc_branchimm, %function
221 .space 4096 - 4
222 t4_ffc_branchimm:
223 adrp x7, dat
224 stnp x1,x2, [x3, #0]
225 b t4_ffc_branchimm
226 ldr x10, [x7, :got_lo12:dat]
229 // Unconditional branch register
230 .section .text.16, "ax", %progbits
231 .balign 4096
232 .globl t4_ffc_branchreg
233 .type t4_ffc_branchreg, %function
234 .space 4096 - 4
235 t4_ffc_branchreg:
236 adrp x7, dat
237 stnp x1,x2, [x3, #0]
238 br x4
239 ldr x10, [x7, :got_lo12:dat]
242 // Conditional branch
243 .section .text.17, "ax", %progbits
244 .balign 4096
245 .globl t4_ffc_branchcond
246 .type t4_ffc_branchcond, %function
247 .space 4096 - 4
248 t4_ffc_branchcond:
249 adrp x7, dat
250 stnp x1,x2, [x3, #0]
251 cbz x5, t4_ffc_branchcond
252 ldr x10, [x7, :got_lo12:dat]
255 // Conditional branch immediate
256 .section .text.18, "ax", %progbits
257 .balign 4096
258 .globl t4_ffc_branchcondimm
259 .type t4_ffc_branchcondimm, %function
260 .space 4096 - 4
261 t4_ffc_branchcondimm:
262 adrp x7, dat
263 stnp x1,x2, [x3, #0]
264 beq t4_ffc_branchcondimm
265 ldr x10, [x7, :got_lo12:dat]
268 // Bitpattern matches erratum sequence but either all or part of the sequence
269 // is in inline literal data
270 .section .text.19, "ax", %progbits
271 .balign 4096
272 .globl t3_ffc_ldrtraildata
273 .type t3_ff8_ldrtraildata, %function
274 .space 4096 - 8
275 t3_ff8_ldrtraildata:
276 adrp x0, dat
277 ldr x1, [x1, #0]
278 // 0xf9400000 = ldr x0, [x0]
279 .byte 0x00
280 .byte 0x00
281 .byte 0x40
282 .byte 0xf9
283 ldr x0, [x0, :got_lo12:dat]
286 .section .text.20, "ax", %progbits
287 .balign 4096
288 .globl t3_ffc_ldrpredata
289 .type t3_ff8_ldrpredata, %function
290 .space 4096 - 8
291 t3_ff8_ldrpredata:
292 // 0x90000000 = adrp x0, #0
293 .byte 0x00
294 .byte 0x00
295 .byte 0x00
296 .byte 0x90
297 ldr x1, [x1, #0]
298 ldr x0, [x0, :got_lo12:dat]
301 .section .text.21, "ax", %progbits
302 .balign 4096
303 .globl t3_ffc_ldralldata
304 .type t3_ff8_ldralldata, %function
305 .space 4096 - 8
306 t3_ff8_ldralldata:
307 // 0x90000000 = adrp x0, #0
308 .byte 0x00
309 .byte 0x00
310 .byte 0x00
311 .byte 0x90
312 // 0xf9400021 = ldr x1, [x1]
313 .byte 0x21
314 .byte 0x00
315 .byte 0x40
316 .byte 0xf9
317 // 0xf9400000 = ldr x0, [x0]
318 .byte 0x00
319 .byte 0x00
320 .byte 0x40
321 .byte 0xf9
325 .text
326 .globl _start
327 .type _start, %function
328 _start:
335 // Bitpattern matches erratum sequence but section is not executable
336 .data
337 .globl dat
338 dat: .word 0