mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[ARM] Armv8-R DFB instruction
Implement MC support for the Armv8-R 'Data Full Barrier' instruction. Differential Revision: https://reviews.llvm.org/D41430 llvm-svn: 321256
This commit is contained in:
parent
84005977e5
commit
2018a87d0b
@ -83,6 +83,9 @@ def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true",
|
||||
def FeatureV7Clrex : SubtargetFeature<"v7clrex", "HasV7Clrex", "true",
|
||||
"Has v7 clrex instruction">;
|
||||
|
||||
def FeatureDFB : SubtargetFeature<"dfb", "HasFullDataBarrier", "true",
|
||||
"Has full data barrier (dfb) instruction">;
|
||||
|
||||
def FeatureAcquireRelease : SubtargetFeature<"acquire-release",
|
||||
"HasAcquireRelease", "true",
|
||||
"Has v8 acquire/release (lda/ldaex "
|
||||
@ -617,6 +620,7 @@ def ARMv83a : Architecture<"armv8.3-a", "ARMv83a", [HasV8_3aOps,
|
||||
def ARMv8r : Architecture<"armv8-r", "ARMv8r", [HasV8Ops,
|
||||
FeatureRClass,
|
||||
FeatureDB,
|
||||
FeatureDFB,
|
||||
FeatureDSP,
|
||||
FeatureCRC,
|
||||
FeatureMP,
|
||||
|
@ -280,6 +280,9 @@ def HasDSP : Predicate<"Subtarget->hasDSP()">,
|
||||
def HasDB : Predicate<"Subtarget->hasDataBarrier()">,
|
||||
AssemblerPredicate<"FeatureDB",
|
||||
"data-barriers">;
|
||||
def HasDFB : Predicate<"Subtarget->hasFullDataBarrier()">,
|
||||
AssemblerPredicate<"FeatureDFB",
|
||||
"full-data-barrier">;
|
||||
def HasV7Clrex : Predicate<"Subtarget->hasV7Clrex()">,
|
||||
AssemblerPredicate<"FeatureV7Clrex",
|
||||
"v7 clrex">;
|
||||
@ -5850,6 +5853,8 @@ include "ARMInstrNEON.td"
|
||||
def : InstAlias<"dmb", (DMB 0xf), 0>, Requires<[IsARM, HasDB]>;
|
||||
def : InstAlias<"dsb", (DSB 0xf), 0>, Requires<[IsARM, HasDB]>;
|
||||
def : InstAlias<"isb", (ISB 0xf), 0>, Requires<[IsARM, HasDB]>;
|
||||
// Armv8-R 'Data Full Barrier'
|
||||
def : InstAlias<"dfb", (DSB 0xc), 1>, Requires<[IsARM, HasDFB]>;
|
||||
|
||||
// System instructions
|
||||
def : MnemonicAlias<"swi", "svc">;
|
||||
|
@ -4508,6 +4508,8 @@ def : t2InstAlias<"tst${p} $Rn, $Rm",
|
||||
def : InstAlias<"dmb${p}", (t2DMB 0xf, pred:$p), 0>, Requires<[HasDB]>;
|
||||
def : InstAlias<"dsb${p}", (t2DSB 0xf, pred:$p), 0>, Requires<[HasDB]>;
|
||||
def : InstAlias<"isb${p}", (t2ISB 0xf, pred:$p), 0>, Requires<[HasDB]>;
|
||||
// Armv8-R 'Data Full Barrier'
|
||||
def : InstAlias<"dfb${p}", (t2DSB 0xc, pred:$p), 1>, Requires<[HasDFB]>;
|
||||
|
||||
// Alias for LDR, LDRB, LDRH, LDRSB, and LDRSH without the ".w" optional
|
||||
// width specifier.
|
||||
|
@ -236,6 +236,10 @@ protected:
|
||||
/// instructions.
|
||||
bool HasDataBarrier = false;
|
||||
|
||||
/// HasFullDataBarrier - True if the subtarget supports DFB data barrier
|
||||
/// instruction.
|
||||
bool HasFullDataBarrier = false;
|
||||
|
||||
/// HasV7Clrex - True if the subtarget supports CLREX instructions
|
||||
bool HasV7Clrex = false;
|
||||
|
||||
@ -544,6 +548,7 @@ public:
|
||||
bool hasDivideInThumbMode() const { return HasHardwareDivideInThumb; }
|
||||
bool hasDivideInARMMode() const { return HasHardwareDivideInARM; }
|
||||
bool hasDataBarrier() const { return HasDataBarrier; }
|
||||
bool hasFullDataBarrier() const { return HasFullDataBarrier; }
|
||||
bool hasV7Clrex() const { return HasV7Clrex; }
|
||||
bool hasAcquireRelease() const { return HasAcquireRelease; }
|
||||
|
||||
|
@ -5581,11 +5581,11 @@ void ARMAsmParser::getMnemonicAcceptInfo(StringRef Mnemonic, StringRef FullInst,
|
||||
CanAcceptPredicationCode =
|
||||
Mnemonic != "cdp2" && Mnemonic != "clrex" && Mnemonic != "mcr2" &&
|
||||
Mnemonic != "mcrr2" && Mnemonic != "mrc2" && Mnemonic != "mrrc2" &&
|
||||
Mnemonic != "dmb" && Mnemonic != "dsb" && Mnemonic != "isb" &&
|
||||
Mnemonic != "pld" && Mnemonic != "pli" && Mnemonic != "pldw" &&
|
||||
Mnemonic != "ldc2" && Mnemonic != "ldc2l" && Mnemonic != "stc2" &&
|
||||
Mnemonic != "stc2l" && !Mnemonic.startswith("rfe") &&
|
||||
!Mnemonic.startswith("srs");
|
||||
Mnemonic != "dmb" && Mnemonic != "dfb" && Mnemonic != "dsb" &&
|
||||
Mnemonic != "isb" && Mnemonic != "pld" && Mnemonic != "pli" &&
|
||||
Mnemonic != "pldw" && Mnemonic != "ldc2" && Mnemonic != "ldc2l" &&
|
||||
Mnemonic != "stc2" && Mnemonic != "stc2l" &&
|
||||
!Mnemonic.startswith("rfe") && !Mnemonic.startswith("srs");
|
||||
} else if (isThumbOne()) {
|
||||
if (hasV6MOps())
|
||||
CanAcceptPredicationCode = Mnemonic != "movs";
|
||||
|
10
test/MC/ARM/dfb-neg.s
Normal file
10
test/MC/ARM/dfb-neg.s
Normal file
@ -0,0 +1,10 @@
|
||||
@ RUN: not llvm-mc -triple armv8-none-eabi -mcpu=cortex-r52 -mattr=-dfb -show-encoding < %s 2>&1 | FileCheck %s
|
||||
@ RUN: not llvm-mc -triple thumbv8-none-eabi -mcpu=cortex-r52 -mattr=-dfb -show-encoding < %s 2>&1 | FileCheck %s
|
||||
|
||||
dfb
|
||||
@ CHECK: error: instruction requires: full-data-barrier
|
||||
|
||||
dfb sy
|
||||
dfb #0
|
||||
@ CHECK: error: invalid instruction
|
||||
@ CHECK: error: invalid instruction
|
6
test/MC/ARM/dfb.s
Normal file
6
test/MC/ARM/dfb.s
Normal file
@ -0,0 +1,6 @@
|
||||
@ RUN: llvm-mc -triple armv8-none-eabi -mcpu=cortex-r52 -show-encoding < %s | FileCheck %s --check-prefix=CHECK-ARM
|
||||
@ RUN: llvm-mc -triple thumbv8-none-eabi -mcpu=cortex-r52 -show-encoding < %s | FileCheck %s --check-prefix=CHECK-THUMB
|
||||
|
||||
dfb
|
||||
@ CHECK-ARM: dfb @ encoding: [0x4c,0xf0,0x7f,0xf5]
|
||||
@ CHECK-THUMB: dfb @ encoding: [0xbf,0xf3,0x4c,0x8f]
|
6
test/MC/Disassembler/ARM/dfb-arm.txt
Normal file
6
test/MC/Disassembler/ARM/dfb-arm.txt
Normal file
@ -0,0 +1,6 @@
|
||||
# RUN: llvm-mc -disassemble -triple armv8-none-eabi -mcpu=cortex-r52 -show-encoding < %s | FileCheck %s --check-prefix=CHECK-DFB
|
||||
# RUN: llvm-mc -disassemble -triple armv8-none-eabi -mcpu=cortex-r52 -mattr=-dfb -show-encoding < %s | FileCheck %s --check-prefix=CHECK-NODFB
|
||||
|
||||
# CHECK-DFB: dfb @ encoding: [0x4c,0xf0,0x7f,0xf5]
|
||||
# CHECK-NODFB: dsb #0xc @ encoding: [0x4c,0xf0,0x7f,0xf5]
|
||||
[0x4c,0xf0,0x7f,0xf5]
|
6
test/MC/Disassembler/ARM/dfb-thumb.txt
Normal file
6
test/MC/Disassembler/ARM/dfb-thumb.txt
Normal file
@ -0,0 +1,6 @@
|
||||
# RUN: llvm-mc -disassemble -triple thumbv8-none-eabi -mcpu=cortex-r52 -show-encoding < %s | FileCheck %s --check-prefix=CHECK-DFB
|
||||
# RUN: llvm-mc -disassemble -triple thumbv8-none-eabi -mcpu=cortex-r52 -mattr=-dfb -show-encoding < %s | FileCheck %s --check-prefix=CHECK-NODFB
|
||||
|
||||
# CHECK-DFB: dfb @ encoding: [0xbf,0xf3,0x4c,0x8f]
|
||||
# CHECK-NODFB: dsb #0xc @ encoding: [0xbf,0xf3,0x4c,0x8f]
|
||||
[0xbf,0xf3,0x4c,0x8f]
|
Loading…
Reference in New Issue
Block a user