Skip to content

Commit

Permalink
[AArch64][v8.5A] Add speculation barriers SSBB and PSSBB
Browse files Browse the repository at this point in the history
This adds two new barrier instructions which can be used to restrict
speculative execution of load instructions.

Patch by Pablo Barrio!

Differential revision: https://reviews.llvm.org/D52483

llvm-svn: 343229
  • Loading branch information
ostannard committed Sep 27, 2018
1 parent c3f50ff commit a4f68bf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.td
Expand Up @@ -650,6 +650,8 @@ def SB : SimpleSystemI<0, (ins), "sb", "">, Sched<[]> {

def : InstAlias<"clrex", (CLREX 0xf)>;
def : InstAlias<"isb", (ISB 0xf)>;
def : InstAlias<"ssbb", (DSB 0)>;
def : InstAlias<"pssbb", (DSB 4)>;

def MRS : MRSI;
def MSR : MSRI;
Expand Down
4 changes: 3 additions & 1 deletion llvm/test/MC/AArch64/basic-a64-instructions.s
Expand Up @@ -3482,6 +3482,7 @@ _func:
// CHECK: clrex // encoding: [0x5f,0x3f,0x03,0xd5]

dsb #0
dsb #4
dsb #12
dsb #15
dsb oshld
Expand All @@ -3496,7 +3497,8 @@ _func:
dsb ld
dsb st
dsb sy
// CHECK: dsb #0 // encoding: [0x9f,0x30,0x03,0xd5]
// CHECK: ssbb // encoding: [0x9f,0x30,0x03,0xd5]
// CHECK: pssbb // encoding: [0x9f,0x34,0x03,0xd5]
// CHECK: dsb #12 // encoding: [0x9f,0x3c,0x03,0xd5]
// CHECK: dsb sy // encoding: [0x9f,0x3f,0x03,0xd5]
// CHECK: dsb oshld // encoding: [0x9f,0x31,0x03,0xd5]
Expand Down
@@ -1,4 +1,9 @@
// RUN: llvm-mc -triple aarch64-none-linux-gnu -show-encoding < %s | FileCheck %s

csdb
csdb
ssbb
pssbb

// CHECK: csdb // encoding: [0x9f,0x22,0x03,0xd5]
// CHECK: ssbb // encoding: [0x9f,0x30,0x03,0xd5]
// CHECK: pssbb // encoding: [0x9f,0x34,0x03,0xd5]
2 changes: 0 additions & 2 deletions llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt
Expand Up @@ -3048,7 +3048,6 @@
0x5f 0x37 0x3 0xd5
0x5f 0x3f 0x3 0xd5

# CHECK: dsb #0
# CHECK: dsb #12
# CHECK: dsb sy
# CHECK: dsb oshld
Expand All @@ -3063,7 +3062,6 @@
# CHECK: dsb ld
# CHECK: dsb st
# CHECK: dsb sy
0x9f 0x30 0x3 0xd5
0x9f 0x3c 0x3 0xd5
0x9f 0x3f 0x3 0xd5
0x9f 0x31 0x3 0xd5
Expand Down
@@ -1,4 +1,9 @@
# RUN: llvm-mc -triple aarch64-none-linux-gnu --disassemble < %s | FileCheck %s

[0x9f,0x22,0x03,0xd5]
# CHECK: csdb
[0x9f,0x30,0x03,0xd5]
[0x9f,0x34,0x03,0xd5]

# CHECK: csdb
# CHECK-NEXT: ssbb
# CHECK-NEXT: pssbb

0 comments on commit a4f68bf

Please sign in to comment.