blob: 9f83fc0937a7ab4d1d380258a701853b31219ac2 [file] [log] [blame]
// REQUIRES: aarch64
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
// RUN: ld.lld -fix-cortex-a53-843419 -verbose %t.o -o %t2 | FileCheck -check-prefix CHECK-PRINT %s
// Test cases for Cortex-A53 Erratum 843419
// See ARM-EPM-048406 Cortex_A53_MPCore_Software_Developers_Errata_Notice.pdf
// for full erratum details.
// In Summary
// 1.)
// ADRP (0xff8 or 0xffc)
// 2.)
// - load or store single register or either integer or vector registers
// - STP or STNP of either vector or vector registers
// - Advanced SIMD ST1 store instruction
// Must not write Rn
// 3.) optional instruction, can't be a branch, must not write Rn, may read Rn
// 4.) A load or store instruction from the Load/Store register unsigned
// immediate class using Rn as the base register
// Each section contains a sequence of instructions that should be recognized
// as erratum 843419. The test cases cover the major variations such as:
// adrp starts at 0xfff8 or 0xfffc
// Variations in instruction class for instruction 2
// Optional instruction 3 present or not
// Load or store for instruction 4.
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 21FF8 in unpatched output.
.section .text.01, "ax", %progbits
.balign 4096
.globl t3_ff8_ldr
.type t3_ff8_ldr, %function
.space 4096 - 8
t3_ff8_ldr:
adrp x0, dat1
ldr x1, [x1, #0]
ldr x0, [x0, :got_lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 23FF8 in unpatched output.
.section .text.02, "ax", %progbits
.balign 4096
.globl t3_ff8_ldrsimd
.type t3_ff8_ldrsimd, %function
.space 4096 - 8
t3_ff8_ldrsimd:
adrp x0, dat2
ldr s1, [x1, #0]
ldr x2, [x0, :got_lo12:dat2]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 25FFC in unpatched output.
.section .text.03, "ax", %progbits
.balign 4096
.globl t3_ffc_ldrpost
.type t3_ffc_ldrpost, %function
.space 4096 - 4
t3_ffc_ldrpost:
adrp x0, dat3
ldr s1, [x1], #8
ldr x3, [x0, :got_lo12:dat3]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 27FF8 in unpatched output.
.section .text.04, "ax", %progbits
.balign 4096
.globl t3_ff8_strpre
.type t3_ff8_strpre, %function
.space 4096 - 8
t3_ff8_strpre:
adrp x0, dat1
str s1, [x1, #8]!
ldr x2, [x0, :lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 29FFC in unpatched output.
.section .text.05, "ax", %progbits
.balign 4096
.globl t3_ffc_str
.type t3_ffc_str, %function
.space 4096 - 4
t3_ffc_str:
adrp x28, dat2
str x2, [x2, #0]
str x28, [x28, :lo12:dat2]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 2BFFC in unpatched output.
.section .text.06, "ax", %progbits
.balign 4096
.globl t3_ffc_strsimd
.type t3_ffc_strsimd, %function
.space 4096 - 4
t3_ffc_strsimd:
adrp x28, dat3
str w4, [x2, #0]
str x4, [x28, :lo12:dat3]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 2DFF8 in unpatched output.
.section .text.07, "ax", %progbits
.balign 4096
.globl t3_ff8_ldrunpriv
.type t3_ff8_ldrunpriv, %function
.space 4096 - 8
t3_ff8_ldrunpriv:
adrp x29, dat1
ldtrb w1, [x2, #0]
ldr x29, [x29, :got_lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 2FFFC in unpatched output.
.section .text.08, "ax", %progbits
.balign 4096
.globl t3_ffc_ldur
.type t3_ffc_ldur, %function
.space 4096 - 4
t3_ffc_ldur:
adrp x29, dat2
ldur w2, [x2, #4]
ldr x29, [x29, :got_lo12:dat2]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 31FFC in unpatched output.
.section .text.09, "ax", %progbits
.balign 4096
.globl t3_ffc_sturh
.type t3_ffc_sturh, %function
.space 4096 - 4
t3_ffc_sturh:
adrp x18, dat3
sturh w3, [x2, #4]
ldr x1, [x18, :got_lo12:dat3]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 33FF8 in unpatched output.
.section .text.10, "ax", %progbits
.balign 4096
.globl t3_ff8_literal
.type t3_ff8_literal, %function
.space 4096 - 8
t3_ff8_literal:
adrp x18, dat1
ldr x3, t3_ff8_literal
ldr x18, [x18, :lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 35FFC in unpatched output.
.section .text.11, "ax", %progbits
.balign 4096
.globl t3_ffc_register
.type t3_ffc_register, %function
.space 4096 - 4
t3_ffc_register:
adrp x15, dat2
ldr x3, [x2, x1]
ldr x10, [x15, :lo12:dat2]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 37FF8 in unpatched output.
.section .text.12, "ax", %progbits
.balign 4096
.globl t3_ff8_stp
.type t3_ff8_stp, %function
.space 4096 - 8
t3_ff8_stp:
adrp x16, dat3
stp x1,x2, [x3, #0]
ldr x13, [x16, :lo12:dat3]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 39FFC in unpatched output.
.section .text.13, "ax", %progbits
.balign 4096
.globl t3_ffc_stnp
.type t3_ffc_stnp, %function
.space 4096 - 4
t3_ffc_stnp:
adrp x7, dat1
stnp x1,x2, [x3, #0]
ldr x9, [x7, :lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 3BFFC in unpatched output.
.section .text.14, "ax", %progbits
.balign 4096
.globl t3_ffc_st1singlepost
.type t3_ffc_st1singlepost, %function
.space 4096 - 4
t3_ffc_st1singlepost:
adrp x23, dat2
st1 { v0.16b }, [x1], x2
ldr x22, [x23, :lo12:dat2]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 3DFF8 in unpatched output.
.section .text.15, "ax", %progbits
.balign 4096
.globl t3_ff8_st1multiple
.type t3_ff8_st1muliple, %function
.space 4096 - 8
t3_ff8_st1multiple:
adrp x23, dat3
st1 { v0.16b, v1.16b }, [x1]
ldr x24, [x23, :lo12:dat3]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 3FFF8 in unpatched output.
.section .text.16, "ax", %progbits
.balign 4096
.globl t4_ff8_ldr
.type t4_ff8_ldr, %function
.space 4096 - 8
t4_ff8_ldr:
adrp x0, dat1
ldr x1, [x1, #0]
add x2, x2, x0
ldr x2, [x0, :got_lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 41FFC in unpatched output.
.section .text.17, "ax", %progbits
.balign 4096
.globl t4_ffc_str
.type t4_ffc_str, %function
.space 4096 - 4
t4_ffc_str:
adrp x28, dat2
str x2, [x2, #0]
sub x0, x1, x2
str x27, [x28, :got_lo12:dat2]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 43FF8 in unpatched output.
.section .text.18, "ax", %progbits
.balign 4096
.globl t4_ff8_stp
.type t4_ff8_stp, %function
.space 4096 - 8
t4_ff8_stp:
adrp x16, dat3
stp x1,x2, [x3, #0]
mul x3, x16, x16
ldr x14, [x16, :got_lo12:dat3]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 45FF8 in unpatched output.
.section .text.19, "ax", %progbits
.balign 4096
.globl t4_ff8_stppre
.type t4_ff8_stppre, %function
.space 4096 - 8
t4_ff8_stppre:
adrp x16, dat1
stp x1,x2, [x3, #16]!
mul x3, x16, x16
ldr x14, [x16, #8]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 47FF8 in unpatched output.
.section .text.20, "ax", %progbits
.balign 4096
.globl t4_ff8_stppost
.type t4_ff8_stppost, %function
.space 4096 - 8
t4_ff8_stppost:
adrp x16, dat2
stp x1,x2, [x3], #16
mul x3, x16, x16
ldr x14, [x16, #8]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 49FFC in unpatched output.
.section .text.21, "ax", %progbits
.balign 4096
.globl t4_ffc_stpsimd
.type t4_ffc_stpsimd, %function
.space 4096 - 4
t4_ffc_stpsimd:
adrp x16, dat3
stp q1,q2, [x3, #0]
mul x3, x16, x16
ldr x14, [x16, #8]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 4BFFC in unpatched output.
.section .text.22, "ax", %progbits
.balign 4096
.globl t4_ffc_stnp
.type t4_ffc_stnp, %function
.space 4096 - 4
t4_ffc_stnp:
adrp x7, dat1
stnp x1,x2, [x3, #0]
nop
ldr x10, [x7, :got_lo12:dat1]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 4DFFC in unpatched output.
.section .text.23, "ax", %progbits
.balign 4096
.globl t4_ffc_st1
.type t4_ffc_st1, %function
.space 4096 - 4
t4_ffc_st1:
adrp x24, dat2
st1 { v0.16b }, [x1]
ldr x22, [x23, :got_lo12:dat2]
str x24, [x24, #32760]
ret
// CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 4FFF8 in unpatched output.
.section .text.24, "ax", %progbits
.balign 4096
.globl t3_ff8_ldr_once
.type t3_ff8_ldr_once, %function
.space 4096 - 8
t3_ff8_ldr_once:
adrp x0, dat3
st1 { v0.16b }, [x1], x2
ldr x1, [x0, #16]
ldr x2, [x0, #16]
ret
.text
.globl _start
.type _start, %function
_start:
ret
.data
.globl dat
.globl dat2
.globl dat3
dat1: .quad 1
dat2: .quad 2
dat3: .quad 3