diff --git a/lib/Target/AArch64/AArch64InstrFormats.td b/lib/Target/AArch64/AArch64InstrFormats.td index 9a2d220f1e3..6df7970f4d8 100644 --- a/lib/Target/AArch64/AArch64InstrFormats.td +++ b/lib/Target/AArch64/AArch64InstrFormats.td @@ -1647,6 +1647,8 @@ class BaseAuthLoad { diff --git a/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp b/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp index d6db8860342..1ff4abb3405 100644 --- a/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp +++ b/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp @@ -146,6 +146,9 @@ static DecodeStatus DecodeExclusiveLdStInstruction(MCInst &Inst, uint32_t insn, static DecodeStatus DecodePairLdStInstruction(MCInst &Inst, uint32_t insn, uint64_t Address, const void *Decoder); +static DecodeStatus DecodeAuthLoadInstruction(MCInst &Inst, uint32_t insn, + uint64_t Address, + const void *Decoder); static DecodeStatus DecodeAddSubERegInstruction(MCInst &Inst, uint32_t insn, uint64_t Address, const void *Decoder); @@ -1501,6 +1504,39 @@ static DecodeStatus DecodePairLdStInstruction(MCInst &Inst, uint32_t insn, return Success; } +static DecodeStatus DecodeAuthLoadInstruction(MCInst &Inst, uint32_t insn, + uint64_t Addr, + const void *Decoder) { + unsigned Rt = fieldFromInstruction(insn, 0, 5); + unsigned Rn = fieldFromInstruction(insn, 5, 5); + uint64_t offset = fieldFromInstruction(insn, 22, 1) << 9 | + fieldFromInstruction(insn, 12, 9); + unsigned writeback = fieldFromInstruction(insn, 11, 1); + + switch (Inst.getOpcode()) { + default: + return Fail; + case AArch64::LDRAAwriteback: + case AArch64::LDRABwriteback: + DecodeGPR64spRegisterClass(Inst, Rn /* writeback register */, Addr, + Decoder); + break; + case AArch64::LDRAAindexed: + case AArch64::LDRABindexed: + break; + } + + DecodeGPR64RegisterClass(Inst, Rt, Addr, Decoder); + DecodeGPR64spRegisterClass(Inst, Rn, Addr, Decoder); + DecodeSImm<10>(Inst, offset, Addr, Decoder); + + if (writeback && Rt == Rn && Rn != 31) { + return SoftFail; + } + + return Success; +} + static DecodeStatus DecodeAddSubERegInstruction(MCInst &Inst, uint32_t insn, uint64_t Addr, const void *Decoder) { diff --git a/test/MC/Disassembler/AArch64/armv8.3a-signed-pointer.txt b/test/MC/Disassembler/AArch64/armv8.3a-signed-pointer.txt index 7215d086c69..110c6681cd7 100644 --- a/test/MC/Disassembler/AArch64/armv8.3a-signed-pointer.txt +++ b/test/MC/Disassembler/AArch64/armv8.3a-signed-pointer.txt @@ -1,4 +1,13 @@ -# RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.3a --disassemble < %s | FileCheck %s +# RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.3a --disassemble < %s 2>&1 | FileCheck %s + +# CHECK: warning: potentially undefined instruction encoding +# CHECK-NEXT: [0x00,0x0c,0x20,0xf8] +# CHECK: warning: potentially undefined instruction encoding +# CHECK-NEXT: [0x00,0x0c,0xa0,0xf8] +# CHECK: ldraa x0, [x0, #0]! +# CHECK: ldrab x0, [x0, #0]! +[0x00,0x0c,0x20,0xf8] +[0x00,0x0c,0xa0,0xf8] # CHECK: paciasp # CHECK: autiasp