From 3d233d5d4d82e8d3c6dfd39367dfaf9587c2107b Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 1 Apr 2019 14:56:37 +0000 Subject: [PATCH] [AArch64] Add v8.5-a Memory Tagging STZGM instruction This instruction writes a block of allocation tags and stores zero to the associated data locations. It differs from STGM by 1 bit and has the same arguments. The specification can be found here: https://developer.arm.com/docs/ddi0596/c Differential Revision: https://reviews.llvm.org/D60065 llvm-svn: 357397 --- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 4 ++++ llvm/test/MC/AArch64/armv8.5a-mte-error.s | 23 +++++++++++++++++++ llvm/test/MC/AArch64/armv8.5a-mte.s | 14 +++++++++++ .../MC/Disassembler/AArch64/armv8.5a-mte.txt | 12 ++++++++++ 4 files changed, 53 insertions(+) diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index 347f0104c35b..ee496fa5d438 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -1261,6 +1261,10 @@ def LDGM : MemTagVector<1, "ldgm", "\t$Rt, [$Rn]", def STGM : MemTagVector<0, "stgm", "\t$Rt, [$Rn]", (outs), (ins GPR64:$Rt, GPR64sp:$Rn)>; +def STZGM : MemTagVector<0, "stzgm", "\t$Rt, [$Rn]", + (outs), (ins GPR64:$Rt, GPR64sp:$Rn)> { + let Inst{23} = 0; +} defm STG : MemTagStore<0b00, "stg">; defm STZG : MemTagStore<0b01, "stzg">; diff --git a/llvm/test/MC/AArch64/armv8.5a-mte-error.s b/llvm/test/MC/AArch64/armv8.5a-mte-error.s index d9af3ba265b9..94d310884e9e 100644 --- a/llvm/test/MC/AArch64/armv8.5a-mte-error.s +++ b/llvm/test/MC/AArch64/armv8.5a-mte-error.s @@ -858,3 +858,26 @@ stgm x0, [#1] // CHECK-NEXT: stgm #1, [x1] // CHECK: invalid operand for instruction // CHECK-NEXT: stgm x0, [#1] + +stzgm +stzgm x0 +stzgm sp, [x0] +stzgm w0, [x0] +stzgm x0, [w0] +stzgm #1, [x1] +stzgm x0, [#1] + +// CHECK: too few operands for instruction +// CHECK-NEXT: stzgm +// CHECK: too few operands for instruction +// CHECK-NEXT: stzgm x0 +// CHECK: invalid operand for instruction +// CHECK-NEXT: stzgm sp, [x0] +// CHECK: invalid operand for instruction +// CHECK-NEXT: stzgm w0, [x0] +// CHECK: invalid operand for instruction +// CHECK-NEXT: stzgm x0, [w0] +// CHECK: invalid operand for instruction +// CHECK-NEXT: stzgm #1, [x1] +// CHECK: invalid operand for instruction +// CHECK-NEXT: stzgm x0, [#1] diff --git a/llvm/test/MC/AArch64/armv8.5a-mte.s b/llvm/test/MC/AArch64/armv8.5a-mte.s index bd0d99e37a93..176ac5fabd2c 100644 --- a/llvm/test/MC/AArch64/armv8.5a-mte.s +++ b/llvm/test/MC/AArch64/armv8.5a-mte.s @@ -542,6 +542,7 @@ ldgm xzr, [x2] // CHECK: ldgm x1, [sp] // encoding: [0xe1,0x03,0xe0,0xd9] // CHECK: ldgm xzr, [x2] // encoding: [0x5f,0x00,0xe0,0xd9] +// NOMTE: instruction requires: mte // NOMTE: instruction requires: mte // NOMTE: instruction requires: mte @@ -555,3 +556,16 @@ stgm xzr, [x2] // NOMTE: instruction requires: mte // NOMTE: instruction requires: mte +// NOMTE: instruction requires: mte + +stzgm x0, [x1] +stzgm x1, [sp] +stzgm xzr, [x2] + +// CHECK: stzgm x0, [x1] // encoding: [0x20,0x00,0x20,0xd9] +// CHECK: stzgm x1, [sp] // encoding: [0xe1,0x03,0x20,0xd9] +// CHECK: stzgm xzr, [x2] // encoding: [0x5f,0x00,0x20,0xd9] + +// NOMTE: instruction requires: mte +// NOMTE: instruction requires: mte +// NOMTE: instruction requires: mte diff --git a/llvm/test/MC/Disassembler/AArch64/armv8.5a-mte.txt b/llvm/test/MC/Disassembler/AArch64/armv8.5a-mte.txt index 4cded66f40c1..a32829e207b1 100644 --- a/llvm/test/MC/Disassembler/AArch64/armv8.5a-mte.txt +++ b/llvm/test/MC/Disassembler/AArch64/armv8.5a-mte.txt @@ -407,6 +407,9 @@ [0x20,0x00,0xa0,0xd9] [0xe1,0x03,0xa0,0xd9] [0x5f,0x00,0xa0,0xd9] +[0x20,0x00,0x20,0xd9] +[0xe1,0x03,0x20,0xd9] +[0x5f,0x00,0x20,0xd9] # CHECK: ldgm x0, [x1] # CHECK: ldgm x1, [sp] @@ -414,6 +417,9 @@ # CHECK: stgm x0, [x1] # CHECK: stgm x1, [sp] # CHECK: stgm xzr, [x2] +# CHECK: stzgm x0, [x1] +# CHECK: stzgm x1, [sp] +# CHECK: stzgm xzr, [x2] # NOMTE: warning: invalid instruction encoding # NOMTE-NEXT: [0x20,0x00,0xe0,0xd9] @@ -427,6 +433,12 @@ # NOMTE-NEXT: [0xe1,0x03,0xa0,0xd9] # NOMTE: warning: invalid instruction encoding # NOMTE-NEXT: [0x5f,0x00,0xa0,0xd9] +# NOMTE: warning: invalid instruction encoding +# NOMTE-NEXT: [0x20,0x00,0x20,0xd9] +# NOMTE: warning: invalid instruction encoding +# NOMTE-NEXT: [0xe1,0x03,0x20,0xd9] +# NOMTE: warning: invalid instruction encoding +# NOMTE-NEXT: [0x5f,0x00,0x20,0xd9] [0x60,0x76,0x08,0xd5] [0x81,0x76,0x08,0xd5]