[PATCH] D46436: [x86] Introduce the enclv instruction

Gabor Buella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 08:51:08 PDT 2018


GBuella created this revision.
GBuella added reviewers: craig.topper, zvi.
Herald added a subscriber: llvm-commits.

and use the -msgx flag as a requirement
for the SGX instructions.


Repository:
  rL LLVM

https://reviews.llvm.org/D46436

Files:
  lib/Target/X86/X86InstrInfo.td
  lib/Target/X86/X86InstrSGX.td
  lib/Target/X86/X86Subtarget.h
  test/MC/X86/sgx-encoding.s


Index: test/MC/X86/sgx-encoding.s
===================================================================
--- test/MC/X86/sgx-encoding.s
+++ test/MC/X86/sgx-encoding.s
@@ -1,9 +1,14 @@
 // RUN: llvm-mc -triple x86_64-unknown-unknown --show-encoding %s | FileCheck %s
+// RUN: llvm-mc -triple i386 --show-encoding %s | FileCheck %s
 
 // CHECK: encls
 // CHECK: encoding: [0x0f,0x01,0xcf]
 	encls
 
 // CHECK: enclu
 // CHECK: encoding: [0x0f,0x01,0xd7]
 	enclu
+
+// CHECK: enclv
+// CHECK: encoding: [0x0f,0x01,0xc0]
+	enclv
Index: lib/Target/X86/X86Subtarget.h
===================================================================
--- lib/Target/X86/X86Subtarget.h
+++ lib/Target/X86/X86Subtarget.h
@@ -640,6 +640,7 @@
   bool hasWBNOINVD() const { return HasWBNOINVD; }
   bool hasRDPID() const { return HasRDPID; }
   bool hasWAITPKG() const { return HasWAITPKG; }
+  bool hasSGX() const { return HasSGX; }
   bool useRetpoline() const { return UseRetpoline; }
   bool useRetpolineExternalThunk() const { return UseRetpolineExternalThunk; }
 
Index: lib/Target/X86/X86InstrSGX.td
===================================================================
--- lib/Target/X86/X86InstrSGX.td
+++ lib/Target/X86/X86InstrSGX.td
@@ -15,12 +15,16 @@
 //===----------------------------------------------------------------------===//
 // SGX instructions
 
-let SchedRW = [WriteSystem] in {
+let SchedRW = [WriteSystem], Predicates = [HasSGX] in {
 // ENCLS - Execute an Enclave System Function of Specified Leaf Number
 def ENCLS : I<0x01, MRM_CF, (outs), (ins),
              "encls", []>, TB;
 
 // ENCLU - Execute an Enclave User Function of Specified Leaf Number
 def ENCLU : I<0x01, MRM_D7, (outs), (ins),
              "enclu", []>, TB;
+
+// ENCLV - Execute an Enclave VMM Function of Specified Leaf Number
+def ENCLV : I<0x01, MRM_C0, (outs), (ins),
+             "enclv", []>, TB;
 } // SchedRW
Index: lib/Target/X86/X86InstrInfo.td
===================================================================
--- lib/Target/X86/X86InstrInfo.td
+++ lib/Target/X86/X86InstrInfo.td
@@ -881,6 +881,7 @@
 def HasRTM       : Predicate<"Subtarget->hasRTM()">;
 def HasADX       : Predicate<"Subtarget->hasADX()">;
 def HasSHA       : Predicate<"Subtarget->hasSHA()">;
+def HasSGX       : Predicate<"Subtarget->hasSGX()">;
 def HasPRFCHW    : Predicate<"Subtarget->hasPRFCHW()">;
 def HasRDSEED    : Predicate<"Subtarget->hasRDSEED()">;
 def HasSSEPrefetch : Predicate<"Subtarget->hasSSEPrefetch()">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46436.145206.patch
Type: text/x-patch
Size: 2477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/9ad748c6/attachment.bin>


More information about the llvm-commits mailing list