diff options
| author | Oliver Stannard <oliver.stannard@arm.com> | 2018-09-27 13:39:06 +0000 |
|---|---|---|
| committer | Oliver Stannard <oliver.stannard@arm.com> | 2018-09-27 13:39:06 +0000 |
| commit | e481f1d95a42719a9d0fbb1b6d21424f3b6ba15d (patch) | |
| tree | c951ae85527313f3537a055ebd52c8492cb3a504 /llvm/lib | |
| parent | 0c05bdea2bc6e9acc1fb8455c01527e1cfe0e02a (diff) | |
| download | bcm5719-llvm-e481f1d95a42719a9d0fbb1b6d21424f3b6ba15d.tar.gz bcm5719-llvm-e481f1d95a42719a9d0fbb1b6d21424f3b6ba15d.zip | |
[AArch64][v8.5A] Add speculation barrier to AArch64 instruction set
This is a new barrier which limits speculative execution of the
instructions following it.
Patch by Pablo Barrio!
Differential revision: https://reviews.llvm.org/D52476
llvm-svn: 343211
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64.td | 5 | ||||
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstrInfo.td | 12 | ||||
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64Subtarget.h | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 67b475de65a..79bae03b4b8 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -211,6 +211,9 @@ def FeatureFRInt3264 : SubtargetFeature<"fptoint", "HasFRInt3264", "true", "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to " "an integer (in FP format) forcing it to fit into a 32- or 64-bit int" >; +def FeatureSpecCtrl : SubtargetFeature<"specctrl", "HasSpecCtrl", "true", + "Enable speculation control barrier" >; + //===----------------------------------------------------------------------===// // Architectures. // @@ -229,7 +232,7 @@ def HasV8_4aOps : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true", def HasV8_5aOps : SubtargetFeature< "v8.5a", "HasV8_5aOps", "true", "Support ARM v8.5a instructions", - [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264] + [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecCtrl] >; //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index d1daf6d7f76..310c1b60bf7 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -66,6 +66,8 @@ def HasAltNZCV : Predicate<"Subtarget->hasAlternativeNZCV()">, AssemblerPredicate<"FeatureAltFPCmp", "altnzcv">; def HasFRInt3264 : Predicate<"Subtarget->hasFRInt3264()">, AssemblerPredicate<"FeatureFRInt3264", "frint3264">; +def HasSpecCtrl : Predicate<"Subtarget->hasSpecCtrl()">, + AssemblerPredicate<"FeatureSpecCtrl", "specctrl">; def IsLE : Predicate<"Subtarget->isLittleEndian()">; def IsBE : Predicate<"!Subtarget->isLittleEndian()">; def UseAlternateSExtLoadCVTF32 @@ -627,9 +629,17 @@ def AXFLAG : PstateWriteSimple<(ins), "axflag", "">, Sched<[WriteSys]> { let Unpredictable{11-8} = 0b1111; let Inst{7-5} = 0b010; } - } // HasAltNZCV + +// Armv8.5-A speculation barrier +def SB : SimpleSystemI<0, (ins), "sb", "">, Sched<[]> { + let Inst{20-5} = 0b0001100110000111; + let Unpredictable{11-8} = 0b1111; + let Predicates = [HasSpecCtrl]; + let hasSideEffects = 1; +} + def : InstAlias<"clrex", (CLREX 0xf)>; def : InstAlias<"isb", (ISB 0xf)>; diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.h b/llvm/lib/Target/AArch64/AArch64Subtarget.h index fec338c1ab3..8df6e5a6570 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.h +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.h @@ -97,6 +97,7 @@ protected: // Armv8.5-A Extensions bool HasAlternativeNZCV = false; bool HasFRInt3264 = false; + bool HasSpecCtrl = false; // HasZeroCycleRegMove - Has zero-cycle register mov instructions. bool HasZeroCycleRegMove = false; @@ -312,6 +313,7 @@ public: bool hasAggressiveFMA() const { return HasAggressiveFMA; } bool hasAlternativeNZCV() const { return HasAlternativeNZCV; } bool hasFRInt3264() const { return HasFRInt3264; } + bool hasSpecCtrl() { return HasSpecCtrl; } bool isLittleEndian() const { return IsLittle; } |

