Index: llvm/trunk/lib/Target/X86/X86InstrInfo.td =================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td +++ llvm/trunk/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()">; Index: llvm/trunk/lib/Target/X86/X86InstrSGX.td =================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSGX.td +++ llvm/trunk/lib/Target/X86/X86InstrSGX.td @@ -15,7 +15,7 @@ //===----------------------------------------------------------------------===// // 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; @@ -23,4 +23,8 @@ // 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: llvm/trunk/lib/Target/X86/X86Subtarget.h =================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h +++ llvm/trunk/lib/Target/X86/X86Subtarget.h @@ -644,6 +644,7 @@ bool hasRDPID() const { return HasRDPID; } bool hasWAITPKG() const { return HasWAITPKG; } bool hasPCONFIG() const { return HasPCONFIG; } + bool hasSGX() const { return HasSGX; } bool useRetpoline() const { return UseRetpoline; } bool useRetpolineExternalThunk() const { return UseRetpolineExternalThunk; } Index: llvm/trunk/test/MC/Disassembler/X86/x86-32.txt =================================================================== --- llvm/trunk/test/MC/Disassembler/X86/x86-32.txt +++ llvm/trunk/test/MC/Disassembler/X86/x86-32.txt @@ -874,3 +874,12 @@ #CHECK: pconfig 0x0f 0x01 0xc5 + +#CHECK: encls +0x0f 0x01 0xcf + +#CHECK: enclu +0x0f 0x01 0xd7 + +#CHECK: enclv +0x0f 0x01 0xc0 Index: llvm/trunk/test/MC/Disassembler/X86/x86-64.txt =================================================================== --- llvm/trunk/test/MC/Disassembler/X86/x86-64.txt +++ llvm/trunk/test/MC/Disassembler/X86/x86-64.txt @@ -567,3 +567,12 @@ #CHECK: pconfig 0x0f 0x01 0xc5 + +#CHECK: encls +0x0f 0x01 0xcf + +#CHECK: enclu +0x0f 0x01 0xd7 + +#CHECK: enclv +0x0f 0x01 0xc0 Index: llvm/trunk/test/MC/X86/SGX-32.s =================================================================== --- llvm/trunk/test/MC/X86/SGX-32.s +++ llvm/trunk/test/MC/X86/SGX-32.s @@ -1,10 +0,0 @@ -// RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s - -// CHECK: encls -// CHECK: encoding: [0x0f,0x01,0xcf] -encls - -// CHECK: enclu -// CHECK: encoding: [0x0f,0x01,0xd7] -enclu - Index: llvm/trunk/test/MC/X86/SGX-64.s =================================================================== --- llvm/trunk/test/MC/X86/SGX-64.s +++ llvm/trunk/test/MC/X86/SGX-64.s @@ -1,10 +0,0 @@ -// RUN: llvm-mc -triple x86_64-unknown-unknown --show-encoding %s | FileCheck %s - -// CHECK: encls -// CHECK: encoding: [0x0f,0x01,0xcf] -encls - -// CHECK: enclu -// CHECK: encoding: [0x0f,0x01,0xd7] -enclu - Index: llvm/trunk/test/MC/X86/sgx-encoding.s =================================================================== --- llvm/trunk/test/MC/X86/sgx-encoding.s +++ llvm/trunk/test/MC/X86/sgx-encoding.s @@ -1,9 +0,0 @@ -// RUN: llvm-mc -triple x86_64-unknown-unknown --show-encoding %s | FileCheck %s - -// CHECK: encls -// CHECK: encoding: [0x0f,0x01,0xcf] - encls - -// CHECK: enclu -// CHECK: encoding: [0x0f,0x01,0xd7] - enclu Index: llvm/trunk/test/MC/X86/x86-32-coverage.s =================================================================== --- llvm/trunk/test/MC/X86/x86-32-coverage.s +++ llvm/trunk/test/MC/X86/x86-32-coverage.s @@ -10796,3 +10796,15 @@ // CHECK: pconfig // CHECK: # encoding: [0x0f,0x01,0xc5] pconfig + +// 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: llvm/trunk/test/MC/X86/x86-64.s =================================================================== --- llvm/trunk/test/MC/X86/x86-64.s +++ llvm/trunk/test/MC/X86/x86-64.s @@ -1623,6 +1623,18 @@ // CHECK: # encoding: [0x0f,0x01,0xc5] pconfig +// CHECK: encls +// CHECK: encoding: [0x0f,0x01,0xcf] +encls + +// CHECK: enclu +// CHECK: encoding: [0x0f,0x01,0xd7] +enclu + +// CHECK: enclv +// CHECK: encoding: [0x0f,0x01,0xc0] +enclv + // __asm __volatile( // "pushf \n\t" // "popf \n\t"