Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -1537,16 +1537,6 @@ def : TokenAlias<"IALL", "iall">;


// ARMv9.4-A Guarded Control Stack
class GCSNoOp<bits<3> op2, string mnemonic>
: SimpleSystemI<0, (ins), mnemonic, "">, Sched<[]> {
let Inst{20-8} = 0b0100001110111;
let Inst{7-5} = op2;
let Predicates = [HasGCS];
}
def GCSPUSHX : GCSNoOp<0b100, "gcspushx">;
def GCSPOPCX : GCSNoOp<0b101, "gcspopcx">;
def GCSPOPX : GCSNoOp<0b110, "gcspopx">;

class GCSRtIn<bits<3> op1, bits<3> op2, string mnemonic,
list<dag> pattern = []>
: RtSystemI<0, (outs), (ins GPR64:$Rt), mnemonic, "\t$Rt", pattern> {
Expand All @@ -1560,8 +1550,17 @@ class GCSRtIn<bits<3> op1, bits<3> op2, string mnemonic,

let mayStore = 1, mayLoad = 1 in
def GCSSS1 : GCSRtIn<0b011, 0b010, "gcsss1">;
let mayStore = 1 in

let mayStore = 1 in {
def GCSPUSHM : GCSRtIn<0b011, 0b000, "gcspushm">;
def GCSPUSHX : GCSRtIn<0b000, 0b100, "gcspushx">;
def GCSPOPCX : GCSRtIn<0b000, 0b101, "gcspopcx">;
def GCSPOPX : GCSRtIn<0b000, 0b110, "gcspopx">;
}

def GCSPUSHX_NoOp : InstAlias<"gcspushx", (GCSPUSHX XZR)>, Requires<[HasGCS]>; // Rt defaults to XZR if absent
def GCSPOPCX_NoOp : InstAlias<"gcspopcx", (GCSPOPCX XZR)>, Requires<[HasGCS]>; // Rt defaults to XZR if absent
def GCSPOPX_NoOp : InstAlias<"gcspopx", (GCSPOPX XZR)>, Requires<[HasGCS]>; // Rt defaults to XZR if absent

class GCSRtOut<bits<3> op1, bits<3> op2, string mnemonic,
list<dag> pattern = []>
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/MC/AArch64/armv9.4a-gcs.s
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,15 @@ gcspopcx
gcspopx
// CHECK: gcspopx // encoding: [0xdf,0x77,0x08,0xd5]
// ERROR-NO-GCS: [[@LINE-2]]:1: error: instruction requires: gcs

gcspushx x3
// CHECK: gcspushx x3 // encoding: [0x83,0x77,0x08,0xd5]
// ERROR-NO-GCS: [[@LINE-2]]:1: error: instruction requires: gcs

gcspopcx x3
// CHECK: gcspopcx x3 // encoding: [0xa3,0x77,0x08,0xd5]
// ERROR-NO-GCS: [[@LINE-2]]:1: error: instruction requires: gcs

gcspopx x3
// CHECK: gcspopx x3 // encoding: [0xc3,0x77,0x08,0xd5]
// ERROR-NO-GCS: [[@LINE-2]]:1: error: instruction requires: gcs
9 changes: 9 additions & 0 deletions llvm/test/MC/Disassembler/AArch64/armv9.4a-gcs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,12 @@

[0xdf,0x77,0x08,0xd5]
// CHECK: gcspopx

[0x83,0x77,0x08,0xd5]
// CHECK: gcspushx x3

[0xa3,0x77,0x08,0xd5]
// CHECK: gcspopcx x3

[0xc3,0x77,0x08,0xd5]
// CHECK: gcspopx x3
Loading