[llvm] r255644 - [x86] adding PKU feature flag
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 31 17:25:39 PST 2015
On Tue, Dec 15, 2015 at 5:35 AM, Asaf Badouh via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: abadouh
> Date: Tue Dec 15 07:35:29 2015
> New Revision: 255644
>
> URL: http://llvm.org/viewvc/llvm-project?rev=255644&view=rev
> Log:
> [x86] adding PKU feature flag
>
> the feature flag is essential for RDPKRU and WRPKRU instruction
> more about the instruction can be found in the SDM rev 56, vol 2 from
> http://www.intel.com/sdm
>
> Differential Revision: http://reviews.llvm.org/D15491
>
>
> Modified:
> llvm/trunk/lib/Support/Host.cpp
> llvm/trunk/lib/Target/X86/X86.td
> llvm/trunk/lib/Target/X86/X86InstrInfo.td
> llvm/trunk/lib/Target/X86/X86Subtarget.cpp
> llvm/trunk/lib/Target/X86/X86Subtarget.h
>
> Modified: llvm/trunk/lib/Support/Host.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=255644&r1=255643&r2=255644&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/Host.cpp (original)
> +++ llvm/trunk/lib/Support/Host.cpp Tue Dec 15 07:35:29 2015
> @@ -812,6 +812,8 @@ bool sys::getHostCPUFeatures(StringMap<b
> Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1);
> Features["adx"] = HasLeaf7 && ((EBX >> 19) & 1);
> Features["sha"] = HasLeaf7 && ((EBX >> 29) & 1);
> + // Enable protection keys
> + Features["pku"] = HasLeaf7 && ((ECX >> 4) & 1);
>
> // AVX512 is only supported if the OS supports the context save for it.
> Features["avx512f"] = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save;
>
> Modified: llvm/trunk/lib/Target/X86/X86.td
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=255644&r1=255643&r2=255644&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86.td (original)
> +++ llvm/trunk/lib/Target/X86/X86.td Tue Dec 15 07:35:29 2015
> @@ -134,6 +134,8 @@ def FeatureBWI : SubtargetFeature<"a
> def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
> "Enable AVX-512 Vector Length eXtensions",
> [FeatureAVX512]>;
> +def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
> + "Enable protection keys">;
> def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
> "Enable packed carry-less multiplication
> instructions",
> [FeatureSSE2]>;
> @@ -491,6 +493,7 @@ class SkylakeProc<string Name> : Process
> FeatureDQI,
> FeatureBWI,
> FeatureVLX,
> + FeaturePKU,
> FeatureCMPXCHG16B,
> FeatureSlowBTMem,
> FeaturePOPCNT,
>
> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=255644&r1=255643&r2=255644&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Dec 15 07:35:29 2015
> @@ -771,6 +771,7 @@ def HasVLX : Predicate<"Subtarget-
> def NoVLX : Predicate<"!Subtarget->hasVLX()">;
> def NoVLX_Or_NoBWI : Predicate<"!Subtarget->hasVLX() ||
> !Subtarget->hasBWI()">;
> def NoVLX_Or_NoDQI : Predicate<"!Subtarget->hasVLX() ||
> !Subtarget->hasDQI()">;
> +def PKU : Predicate<"!Subtarget->hasPKU()">;
>
Should that be HasPKU or NoPKU? I'm confused because its not named like any
of other flags and the predicate has an '!' in it.
>
> def HasPOPCNT : Predicate<"Subtarget->hasPOPCNT()">;
> def HasAES : Predicate<"Subtarget->hasAES()">;
>
> Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=255644&r1=255643&r2=255644&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Dec 15 07:35:29 2015
> @@ -270,6 +270,7 @@ void X86Subtarget::initializeEnvironment
> HasBWI = false;
> HasVLX = false;
> HasADX = false;
> + HasPKU = false;
> HasSHA = false;
> HasPRFCHW = false;
> HasRDSEED = false;
>
> Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=255644&r1=255643&r2=255644&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
> +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Dec 15 07:35:29 2015
> @@ -223,6 +223,9 @@ protected:
> /// Processor has AVX-512 Vector Length eXtenstions
> bool HasVLX;
>
> + /// Processor has PKU extenstions
> + bool HasPKU;
> +
> /// Processot supports MPX - Memory Protection Extensions
> bool HasMPX;
>
> @@ -398,6 +401,7 @@ public:
> bool hasDQI() const { return HasDQI; }
> bool hasBWI() const { return HasBWI; }
> bool hasVLX() const { return HasVLX; }
> + bool hasPKU() const { return HasPKU; }
> bool hasMPX() const { return HasMPX; }
>
> bool isAtom() const { return X86ProcFamily == IntelAtom; }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151231/1ffdf0f0/attachment.html>
More information about the llvm-commits
mailing list