Index: llvm/lib/Target/AArch64/AArch64SystemOperands.td =================================================================== --- llvm/lib/Target/AArch64/AArch64SystemOperands.td +++ llvm/lib/Target/AArch64/AArch64SystemOperands.td @@ -1460,6 +1460,27 @@ def : ROSysReg<"GMID_EL1", 0b11, 0b001, 0b0000, 0b0000, 0b100>; } // HasMTE +// Embedded Trace Extension R/W System registers +// Name Op0 Op1 CRn CRm Op2 +def : RWSysReg<"TRCRSR", 0b10, 0b001, 0b0000, 0b1010, 0b000>; // Resources Status Register +// TRCEXTINSELR0 has the same encoding as ETM TRCEXTINSELR +def : RWSysReg<"TRCEXTINSELR0", 0b10, 0b001, 0b0000, 0b1000, 0b100>; // External Input Select Register 0 +def : RWSysReg<"TRCEXTINSELR1", 0b10, 0b001, 0b0000, 0b1001, 0b100>; // External Input Select Register 1 +def : RWSysReg<"TRCEXTINSELR2", 0b10, 0b001, 0b0000, 0b1010, 0b100>; // External Input Select Register 2 +def : RWSysReg<"TRCEXTINSELR3", 0b10, 0b001, 0b0000, 0b1011, 0b100>; // External Input Select Register 3 + +// Trace Buffer Extension System registers +class TRBE_RWSysReg Op2> : RWSysReg; +class TRBE_ROSysReg Op2> : ROSysReg; +// Name Op2 +def : TRBE_RWSysReg<"TRBLIMITR_EL1", 0b000>; // Trace Buffer Limit Address Register +def : TRBE_RWSysReg<"TRBPTR_EL1", 0b001>; // Trace Buffer Write Pointer Register +def : TRBE_RWSysReg<"TRBBASER_EL1", 0b010>; // Trace Buffer Base Address Register +def : TRBE_RWSysReg<"TRBSR_EL1", 0b011>; // Trace Buffer Status/syndrome Register +def : TRBE_RWSysReg<"TRBMAR_EL1", 0b100>; // Trace Buffer Memory Attribute Register +def : TRBE_RWSysReg<"TRBTRG_EL1", 0b110>; // Trace Buffer Trigger Counter Register +def : TRBE_ROSysReg<"TRBIDR_EL1", 0b111>; // Trace Buffer ID Register + // Cyclone specific system registers // Op0 Op1 CRn CRm Op2 let Requires = [{ {AArch64::ProcCyclone} }] in Index: llvm/test/MC/AArch64/ete-sysregs.s =================================================================== --- /dev/null +++ llvm/test/MC/AArch64/ete-sysregs.s @@ -0,0 +1,33 @@ +// ETE System registers +// +// RUN: llvm-mc -triple aarch64 -show-encoding < %s | FileCheck %s + +// Read from system register +mrs x0, TRCRSR +mrs x0, TRCEXTINSELR +mrs x0, TRCEXTINSELR0 +mrs x0, TRCEXTINSELR1 +mrs x0, TRCEXTINSELR2 +mrs x0, TRCEXTINSELR3 + +// CHECK: mrs x0, TRCRSR // encoding: [0x00,0x0a,0x31,0xd5] +// CHECK: mrs x0, TRCEXTINSELR // encoding: [0x80,0x08,0x31,0xd5] +// CHECK: mrs x0, TRCEXTINSELR // encoding: [0x80,0x08,0x31,0xd5] +// CHECK: mrs x0, TRCEXTINSELR1 // encoding: [0x80,0x09,0x31,0xd5] +// CHECK: mrs x0, TRCEXTINSELR2 // encoding: [0x80,0x0a,0x31,0xd5] +// CHECK: mrs x0, TRCEXTINSELR3 // encoding: [0x80,0x0b,0x31,0xd5] + +// Write to system register +msr TRCRSR, x0 +msr TRCEXTINSELR, x0 +msr TRCEXTINSELR0, x0 +msr TRCEXTINSELR1, x0 +msr TRCEXTINSELR2, x0 +msr TRCEXTINSELR3, x0 + +// CHECK: msr TRCRSR, x0 // encoding: [0x00,0x0a,0x11,0xd5] +// CHECK: msr TRCEXTINSELR, x0 // encoding: [0x80,0x08,0x11,0xd5] +// CHECK: msr TRCEXTINSELR, x0 // encoding: [0x80,0x08,0x11,0xd5] +// CHECK: msr TRCEXTINSELR1, x0 // encoding: [0x80,0x09,0x11,0xd5] +// CHECK: msr TRCEXTINSELR2, x0 // encoding: [0x80,0x0a,0x11,0xd5] +// CHECK: msr TRCEXTINSELR3, x0 // encoding: [0x80,0x0b,0x11,0xd5] Index: llvm/test/MC/AArch64/trbe-sysreg-diag.s =================================================================== --- /dev/null +++ llvm/test/MC/AArch64/trbe-sysreg-diag.s @@ -0,0 +1,9 @@ +// TRBE RO System register +// +// RUN: not llvm-mc -triple aarch64 -show-encoding < %s 2>&1 | FileCheck %s + +// Write to system register +msr TRBIDR_EL1, x0 + +// CHECK: expected writable system register or pstate +// CHECK-NEXT: msr TRBIDR_EL1, x0 Index: llvm/test/MC/AArch64/trbe-sysreg.s =================================================================== --- /dev/null +++ llvm/test/MC/AArch64/trbe-sysreg.s @@ -0,0 +1,35 @@ +// TRBE System registers +// +// RUN: llvm-mc -triple aarch64 -show-encoding < %s | FileCheck %s + +// Read from system register +mrs x0, TRBLIMITR_EL1 +mrs x0, TRBPTR_EL1 +mrs x0, TRBBASER_EL1 +mrs x0, TRBSR_EL1 +mrs x0, TRBMAR_EL1 +mrs x0, TRBTRG_EL1 +mrs x0, TRBIDR_EL1 + +// CHECK: mrs x0, TRBLIMITR_EL1 // encoding: [0x00,0x9b,0x38,0xd5] +// CHECK: mrs x0, TRBPTR_EL1 // encoding: [0x20,0x9b,0x38,0xd5] +// CHECK: mrs x0, TRBBASER_EL1 // encoding: [0x40,0x9b,0x38,0xd5] +// CHECK: mrs x0, TRBSR_EL1 // encoding: [0x60,0x9b,0x38,0xd5] +// CHECK: mrs x0, TRBMAR_EL1 // encoding: [0x80,0x9b,0x38,0xd5] +// CHECK: mrs x0, TRBTRG_EL1 // encoding: [0xc0,0x9b,0x38,0xd5] +// CHECK: mrs x0, TRBIDR_EL1 // encoding: [0xe0,0x9b,0x38,0xd5] + +// Write to system register +msr TRBLIMITR_EL1, x0 +msr TRBPTR_EL1, x0 +msr TRBBASER_EL1, x0 +msr TRBSR_EL1, x0 +msr TRBMAR_EL1, x0 +msr TRBTRG_EL1, x0 + +// CHECK: msr TRBLIMITR_EL1, x0 // encoding: [0x00,0x9b,0x18,0xd5] +// CHECK: msr TRBPTR_EL1, x0 // encoding: [0x20,0x9b,0x18,0xd5] +// CHECK: msr TRBBASER_EL1, x0 // encoding: [0x40,0x9b,0x18,0xd5] +// CHECK: msr TRBSR_EL1, x0 // encoding: [0x60,0x9b,0x18,0xd5] +// CHECK: msr TRBMAR_EL1, x0 // encoding: [0x80,0x9b,0x18,0xd5] +// CHECK: msr TRBTRG_EL1, x0 // encoding: [0xc0,0x9b,0x18,0xd5] Index: llvm/test/MC/Disassembler/AArch64/ete.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/AArch64/ete.txt @@ -0,0 +1,36 @@ +# ETE System registers +# +# RUN: llvm-mc -triple aarch64 -disassemble < %s | FileCheck %s + +# Read from system register +[0x00,0x0a,0x31,0xd5] +# CHECK: mrs x0, TRCRSR + +[0x80,0x08,0x31,0xd5] +# CHECK: mrs x0, TRCEXTINSELR + +[0x80,0x09,0x31,0xd5] +# CHECK: mrs x0, TRCEXTINSELR1 + +[0x80,0x0a,0x31,0xd5] +# CHECK: mrs x0, TRCEXTINSELR2 + +[0x80,0x0b,0x31,0xd5] +# CHECK: mrs x0, TRCEXTINSELR3 + + +# Write to system register +[0x00,0x0a,0x11,0xd5] +# CHECK: msr TRCRSR, x0 + +[0x80,0x08,0x11,0xd5] +# CHECK: msr TRCEXTINSELR, x0 + +[0x80,0x09,0x11,0xd5] +# CHECK: msr TRCEXTINSELR1, x0 + +[0x80,0x0a,0x11,0xd5] +# CHECK: msr TRCEXTINSELR2, x0 + +[0x80,0x0b,0x11,0xd5] +# CHECK: msr TRCEXTINSELR3, x0 Index: llvm/test/MC/Disassembler/AArch64/trbe.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/AArch64/trbe.txt @@ -0,0 +1,35 @@ +# TRBE System registers +# +# RUN: llvm-mc -triple aarch64 -disassemble < %s | FileCheck %s + +# Read from system register +[0x00,0x9b,0x38,0xd5] +[0x20,0x9b,0x38,0xd5] +[0x40,0x9b,0x38,0xd5] +[0x60,0x9b,0x38,0xd5] +[0x80,0x9b,0x38,0xd5] +[0xc0,0x9b,0x38,0xd5] +[0xe0,0x9b,0x38,0xd5] + +# CHECK: mrs x0, TRBLIMITR_EL1 +# CHECK: mrs x0, TRBPTR_EL1 +# CHECK: mrs x0, TRBBASER_EL1 +# CHECK: mrs x0, TRBSR_EL1 +# CHECK: mrs x0, TRBMAR_EL1 +# CHECK: mrs x0, TRBTRG_EL1 +# CHECK: mrs x0, TRBIDR_EL1 + +# Write to system register +[0x00,0x9b,0x18,0xd5] +[0x20,0x9b,0x18,0xd5] +[0x40,0x9b,0x18,0xd5] +[0x60,0x9b,0x18,0xd5] +[0x80,0x9b,0x18,0xd5] +[0xc0,0x9b,0x18,0xd5] + +# CHECK: msr TRBLIMITR_EL1, x0 +# CHECK: msr TRBPTR_EL1, x0 +# CHECK: msr TRBBASER_EL1, x0 +# CHECK: msr TRBSR_EL1, x0 +# CHECK: msr TRBMAR_EL1, x0 +# CHECK: msr TRBTRG_EL1, x0