Index: clang/include/clang/Basic/BuiltinsX86.def =================================================================== --- clang/include/clang/Basic/BuiltinsX86.def +++ clang/include/clang/Basic/BuiltinsX86.def @@ -1900,6 +1900,25 @@ TARGET_BUILTIN(__builtin_ia32_enqcmd, "Ucv*vC*", "n", "enqcmd") TARGET_BUILTIN(__builtin_ia32_enqcmds, "Ucv*vC*", "n", "enqcmd") +// KEY LOCKER +TARGET_BUILTIN(__builtin_ia32_loadiwkey, "vUiV2OiV2OiV2Oi", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_encodekey128, + "UiUiV2OiV2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_encodekey256, + "UiUiV2OiV2OiV2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_aesenc128kl, "UcV2Oi*V2OivC*", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_aesenc256kl, "UcV2Oi*V2OivC*", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_aesdec128kl, "UcV2Oi*V2OivC*", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_aesdec256kl, "UcV2Oi*V2OivC*", "nV:128:", "kl") +TARGET_BUILTIN(__builtin_ia32_aesencwide128kl, + "UcvC*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2OiV2OiV2OiV2OiV2OiV2OiV2OiV2Oi", "nV:128:", "kl,widekl") +TARGET_BUILTIN(__builtin_ia32_aesencwide256kl, + "UcvC*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2OiV2OiV2OiV2OiV2OiV2OiV2OiV2Oi", "nV:128:", "kl,widekl") +TARGET_BUILTIN(__builtin_ia32_aesdecwide128kl, + "UcvC*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2OiV2OiV2OiV2OiV2OiV2OiV2OiV2Oi", "nV:128:", "kl,widekl") +TARGET_BUILTIN(__builtin_ia32_aesdecwide256kl, + "UcvC*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2Oi*V2OiV2OiV2OiV2OiV2OiV2OiV2OiV2Oi", "nV:128:", "kl,widekl") + // SERIALIZE TARGET_BUILTIN(__builtin_ia32_serialize, "v", "n", "serialize") Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -3250,6 +3250,10 @@ def mno_invpcid : Flag<["-"], "mno-invpcid">, Group; def mgfni : Flag<["-"], "mgfni">, Group; def mno_gfni : Flag<["-"], "mno-gfni">, Group; +def mkl : Flag<["-"], "mkl">, Group; +def mno_kl : Flag<["-"], "mno-kl">, Group; +def mwidekl : Flag<["-"], "mwidekl">, Group; +def mno_widekl : Flag<["-"], "mno-widekl">, Group; def mlwp : Flag<["-"], "mlwp">, Group; def mno_lwp : Flag<["-"], "mno-lwp">, Group; def mlzcnt : Flag<["-"], "mlzcnt">, Group; Index: clang/lib/Basic/Targets/X86.h =================================================================== --- clang/lib/Basic/Targets/X86.h +++ clang/lib/Basic/Targets/X86.h @@ -127,6 +127,8 @@ bool HasPTWRITE = false; bool HasINVPCID = false; bool HasENQCMD = false; + bool HasKL = false; // For key locker + bool HasWIDEKL = false; // For wide key locker bool HasAMXTILE = false; bool HasAMXINT8 = false; bool HasAMXBF16 = false; Index: clang/lib/Basic/Targets/X86.cpp =================================================================== --- clang/lib/Basic/Targets/X86.cpp +++ clang/lib/Basic/Targets/X86.cpp @@ -276,6 +276,10 @@ HasCLDEMOTE = true; } else if (Feature == "+rdpid") { HasRDPID = true; + } else if (Feature == "+kl") { + HasKL = true; + } else if (Feature == "+widekl") { + HasWIDEKL = true; } else if (Feature == "+retpoline-external-thunk") { HasRetpolineExternalThunk = true; } else if (Feature == "+sahf") { @@ -678,6 +682,10 @@ Builder.defineMacro("__PREFETCHWT1__"); if (HasCLZERO) Builder.defineMacro("__CLZERO__"); + if (HasKL) + Builder.defineMacro("__KL__"); + if (HasWIDEKL) + Builder.defineMacro("__WIDEKL__"); if (HasRDPID) Builder.defineMacro("__RDPID__"); if (HasCLDEMOTE) @@ -833,6 +841,8 @@ .Case("fxsr", true) .Case("gfni", true) .Case("invpcid", true) + .Case("kl", true) + .Case("widekl", true) .Case("lwp", true) .Case("lzcnt", true) .Case("mmx", true) @@ -919,6 +929,8 @@ .Case("fxsr", HasFXSR) .Case("gfni", HasGFNI) .Case("invpcid", HasINVPCID) + .Case("kl", HasKL) + .Case("widekl", HasWIDEKL) .Case("lwp", HasLWP) .Case("lzcnt", HasLZCNT) .Case("mm3dnow", MMX3DNowLevel >= AMD3DNow) Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -14038,6 +14038,93 @@ case X86::BI__builtin_ia32_psubusb128: case X86::BI__builtin_ia32_psubusw128: return EmitX86BinaryIntrinsic(*this, Ops, Intrinsic::usub_sat); + case X86::BI__builtin_ia32_encodekey128: + case X86::BI__builtin_ia32_encodekey256: + case X86::BI__builtin_ia32_aesenc128kl: + case X86::BI__builtin_ia32_aesdec128kl: + case X86::BI__builtin_ia32_aesenc256kl: + case X86::BI__builtin_ia32_aesdec256kl: + case X86::BI__builtin_ia32_aesencwide128kl: + case X86::BI__builtin_ia32_aesdecwide128kl: + case X86::BI__builtin_ia32_aesencwide256kl: + case X86::BI__builtin_ia32_aesdecwide256kl: { + int FirstReturnOp; + int ResultCount; + SmallVector InOps; + unsigned ID; + + switch (BuiltinID) { + default: llvm_unreachable("Unsupported intrinsic!"); + case X86::BI__builtin_ia32_encodekey128: + ID = Intrinsic::x86_encodekey128; + InOps = {Ops[0], Ops[1]}; + FirstReturnOp = 2; + ResultCount = 6; + break; + case X86::BI__builtin_ia32_encodekey256: + ID = Intrinsic::x86_encodekey256; + InOps = {Ops[0], Ops[1], Ops[2]}; + FirstReturnOp = 3; + ResultCount = 7; + break; + case X86::BI__builtin_ia32_aesenc128kl: + case X86::BI__builtin_ia32_aesdec128kl: + case X86::BI__builtin_ia32_aesenc256kl: + case X86::BI__builtin_ia32_aesdec256kl: { + InOps = {Ops[1], Ops[2]}; + FirstReturnOp = 0; + ResultCount = 1; + switch (BuiltinID) { + case X86::BI__builtin_ia32_aesenc128kl: + ID = Intrinsic::x86_aesenc128kl; + break; + case X86::BI__builtin_ia32_aesdec128kl: + ID = Intrinsic::x86_aesdec128kl; + break; + case X86::BI__builtin_ia32_aesenc256kl: + ID = Intrinsic::x86_aesenc256kl; + break; + case X86::BI__builtin_ia32_aesdec256kl: + ID = Intrinsic::x86_aesdec256kl; + break; + } + break; + } + case X86::BI__builtin_ia32_aesencwide128kl: + case X86::BI__builtin_ia32_aesdecwide128kl: + case X86::BI__builtin_ia32_aesencwide256kl: + case X86::BI__builtin_ia32_aesdecwide256kl: { + InOps = {Ops[0], Ops[9], Ops[10], Ops[11], Ops[12], Ops[13], + Ops[14], Ops[15], Ops[16]}; + FirstReturnOp = 1; + ResultCount = 8; + switch (BuiltinID) { + case X86::BI__builtin_ia32_aesencwide128kl: + ID = Intrinsic::x86_aesencwide128kl; + break; + case X86::BI__builtin_ia32_aesdecwide128kl: + ID = Intrinsic::x86_aesdecwide128kl; + break; + case X86::BI__builtin_ia32_aesencwide256kl: + ID = Intrinsic::x86_aesencwide256kl; + break; + case X86::BI__builtin_ia32_aesdecwide256kl: + ID = Intrinsic::x86_aesdecwide256kl; + break; + } + break; + } + } + + Value *Call = Builder.CreateCall(CGM.getIntrinsic(ID), InOps); + + for (int i = 0; i < ResultCount; ++i) { + Builder.CreateDefaultAlignedStore(Builder.CreateExtractValue(Call, i + 1), + Ops[FirstReturnOp + i]); + } + + return Builder.CreateExtractValue(Call, 0); + } } } Index: clang/lib/Headers/CMakeLists.txt =================================================================== --- clang/lib/Headers/CMakeLists.txt +++ clang/lib/Headers/CMakeLists.txt @@ -72,6 +72,8 @@ inttypes.h invpcidintrin.h iso646.h + keylockerintrin.h + keylocker_wide_intrin.h limits.h lwpintrin.h lzcntintrin.h Index: clang/lib/Headers/immintrin.h =================================================================== --- clang/lib/Headers/immintrin.h +++ clang/lib/Headers/immintrin.h @@ -471,6 +471,16 @@ #include #endif +#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ + defined(__KL__) +#include +#endif + +#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ + defined(__WIDEKL__) +#include +#endif + #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ defined(__AMXTILE__) || defined(__AMXINT8__) || defined(__AMXBF16__) #include Index: clang/lib/Headers/keylocker_wide_intrin.h =================================================================== --- /dev/null +++ clang/lib/Headers/keylocker_wide_intrin.h @@ -0,0 +1,259 @@ +/*===-------------- keylocker_wide_intrin.h - KL_WIDE Intrinsics ------------=== + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __IMMINTRIN_H +#error "Never use directly; include instead." +#endif + +#ifndef _KEYLOCKERINTRIN_WIDE_H +#define _KEYLOCKERINTRIN_WIDE_H + +/* Define the default attributes for the functions in this file. */ +#define __DEFAULT_FN_ATTRS \ + __attribute__((__always_inline__, __nodebug__, __target__("kl,widekl"),\ + __min_vector_width__(128))) + +/// Encrypt __idata[0] to __idata[7] using 128-bit AES key indicated by handle +/// at __h and store each resultant block back from __odata to __odata+7. And +/// return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESENCWIDE128KL instructions. +/// +/// \operation +/// Handle := MEM[__h+383:__h] +/// IllegalHandle := ( HandleReservedBitSet (Handle[383:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[255:128] || +/// HandleKeyType (Handle[383:0]) != HANDLE_KEY_TYPE_AES128 ) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey) +/// IF Authentic == 0 +/// ZF := 1 +/// ELSE +/// FOR i := 0 to 7 +/// __odata[i] := AES128Encrypt (__idata[i], UnwrappedKey) +/// ENDFOR +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesencwide128kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) { + return __builtin_ia32_aesencwide128kl(__h, + __odata, + __odata + 1, + __odata + 2, + __odata + 3, + __odata + 4, + __odata + 5, + __odata + 6, + __odata + 7, + __idata[0], + __idata[1], + __idata[2], + __idata[3], + __idata[4], + __idata[5], + __idata[6], + __idata[7]); +} + +/// Encrypt __idata[0] to __idata[7] using 256-bit AES key indicated by handle +/// at __h and store each resultant block back from __odata to __odata+7. And +/// return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESENCWIDE256KL instructions. +/// +/// \operation +/// Handle[511:0] := MEM[__h+511:__h] +/// IllegalHandle := ( HandleReservedBitSet (Handle[511:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[255:128] || +/// HandleKeyType (Handle[511:0]) != HANDLE_KEY_TYPE_AES512 ) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey) +/// IF Authentic == 0 +/// ZF := 1 +/// ELSE +/// FOR i := 0 to 7 +/// __odata[i] := AES256Encrypt (__idata[i], UnwrappedKey) +/// ENDFOR +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesencwide256kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) { + return __builtin_ia32_aesencwide256kl(__h, + __odata, + __odata + 1, + __odata + 2, + __odata + 3, + __odata + 4, + __odata + 5, + __odata + 6, + __odata + 7, + __idata[0], + __idata[1], + __idata[2], + __idata[3], + __idata[4], + __idata[5], + __idata[6], + __idata[7]); +} + +/// Decrypt __idata[0] to __idata[7] using 128-bit AES key indicated by handle +/// at __h and store each resultant block back from __odata to __odata+7. And +/// return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESDECWIDE128KL instructions. +/// +/// \operation +/// Handle[383:0] := MEM[__h+383:__h] +/// IllegalHandle := ( HandleReservedBitSet (Handle[383:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[255:128] || +/// HandleKeyType (Handle) != HANDLE_KEY_TYPE_AES128 ) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey) +/// IF Authentic == 0 +/// ZF := 1 +/// ELSE +/// FOR i := 0 to 7 +/// __odata[i] := AES128Decrypt (__idata[i], UnwrappedKey) +/// ENDFOR +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesdecwide128kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) { + return __builtin_ia32_aesdecwide128kl(__h, + __odata, + __odata + 1, + __odata + 2, + __odata + 3, + __odata + 4, + __odata + 5, + __odata + 6, + __odata + 7, + __idata[0], + __idata[1], + __idata[2], + __idata[3], + __idata[4], + __idata[5], + __idata[6], + __idata[7]); +} + +/// Decrypt __idata[0] to __idata[7] using 256-bit AES key indicated by handle +/// at __h and store each resultant block back from __odata to __odata+7. And +/// return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESDECWIDE256KL instructions. +/// +/// \operation +/// Handle[511:0] := MEM[__h+511:__h] +/// IllegalHandle = ( HandleReservedBitSet (Handle[511:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[255:128] || +/// HandleKeyType (Handle) != HANDLE_KEY_TYPE_AES512 ) +/// If (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey) +/// IF Authentic == 0 +/// ZF := 1 +/// ELSE +/// FOR i := 0 to 7 +/// __odata[i] := AES256Decrypt (__idata[i], UnwrappedKey) +/// ENDFOR +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesdecwide256kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) { + return __builtin_ia32_aesdecwide256kl(__h, + __odata, + __odata + 1, + __odata + 2, + __odata + 3, + __odata + 4, + __odata + 5, + __odata + 6, + __odata + 7, + __idata[0], + __idata[1], + __idata[2], + __idata[3], + __idata[4], + __idata[5], + __idata[6], + __idata[7]); +} + + +#undef __DEFAULT_FN_ATTRS + +#endif /* _KEYLOCKERINTRIN_WIDE_H */ Index: clang/lib/Headers/keylockerintrin.h =================================================================== --- /dev/null +++ clang/lib/Headers/keylockerintrin.h @@ -0,0 +1,343 @@ +/*===----------------- keylockerintrin.h - KL Intrinsics -------------------=== + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __IMMINTRIN_H +#error "Never use directly; include instead." +#endif + +#ifndef _KEYLOCKERINTRIN_H +#define _KEYLOCKERINTRIN_H + +/* Define the default attributes for the functions in this file. */ +#define __DEFAULT_FN_ATTRS \ + __attribute__((__always_inline__, __nodebug__, __target__("kl"),\ + __min_vector_width__(128))) + +/// Load internal wrapping key from __intkey, __enkey_lo and __enkey_hi. __ctl +/// will assigned to EAX, whch specifies the KeySource and whether backing up +/// the key is permitted. The 256-bit encryption key is loaded from the two +/// explicit operands (__enkey_lo and __enkey_hi). The 128-bit integrity key is +/// loaded from the implicit operand XMM0 which assigned by __intkey. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the LOADIWKEY instructions. +/// +/// \operation +/// IF CPL > 0 // LOADKWKEY only allowed at ring 0 (supervisor mode) +/// GP (0) +/// FI +/// IF “LOADIWKEY exiting” VM execution control set +/// VMexit +/// FI +/// IF __ctl[4:1] > 1 // Reserved KeySource encoding used +/// GP (0) +/// FI +/// IF __ctl[31:5] != 0 // Reserved bit in __ctl is set +/// GP (0) +/// FI +/// IF __ctl[0] AND (CPUID.19H.ECX[0] == 0) // NoBackup is not supported on this part +/// GP (0) +/// FI +/// IF (__ctl[4:1] == 1) AND (CPUID.19H.ECX[1] == 0) // KeySource of 1 is not supported on this part +/// GP (0) +/// FI +/// IF (__ctl[4:1] == 0) // KeySource of 0. +/// IWKey.Encryption Key[127:0] := __enkey_hi[127:0]: +/// IWKey.Encryption Key[255:128] := __enkey_lo[127:0] +/// IWKey.IntegrityKey[127:0] := __intkey[127:0] +/// IWKey.NoBackup := __ctl[0] +/// IWKey.KeySource := __ctl[4:1] +/// ZF := 0 +/// ELSE // KeySource of 1. See RDSEED definition for details of randomness +/// IF HW_NRND_GEN.ready == 1 // Full-entropy random data from RDSEED was received +/// IWKey.Encryption Key[127:0] := __enkey_hi[127:0] XOR HW_NRND_GEN.data[127:0] +/// IWKey.Encryption Key[255:128] := __enkey_lo[127:0] XOR HW_NRND_GEN.data[255:128] +/// IWKey.Encryption Key[255:0] := __enkey_hi[127:0]:__enkey_lo[127:0] XOR HW_NRND_GEN.data[255:0] +/// IWKey.IntegrityKey[127:0] := __intkey[127:0] XOR HW_NRND_GEN.data[383:256] +/// IWKey.NoBackup := __ctl[0] +/// IWKey.KeySource := __ctl[4:1] +/// ZF := 0 +/// ELSE // Random data was not returned from RDSEED. IWKey was not loaded +/// ZF := 1 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ void __DEFAULT_FN_ATTRS +_mm_loadiwkey (unsigned int __ctl, __m128i __intkey, + __m128i __enkey_lo, __m128i __enkey_hi) { + __builtin_ia32_loadiwkey (__ctl, __intkey, __enkey_lo, __enkey_hi); +} + +/// Wrap a 128-bit AES key from __key into a key handle and output in +/// ((__m128i*)__h) to ((__m128i*)__h) + 5 and a 32-bit value as return. +/// The explicit source operand __htype specifies handle restrictions. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the ENCODEKEY128 instructions. +/// +/// \operation +/// InputKey[127:0] := __key[127:0] +/// KeyMetadata[2:0] := __htype[2:0] +/// KeyMetadata[23:3] := 0 // Reserved for future usage +/// KeyMetadata[27:24] := 0 // KeyType is AES-128 (value of 0) +/// KeyMetadata[127:28] := 0 // Reserved for future usage +/// Handle[383:0] := WrapKey128(InputKey[127:0], KeyMetadata[127:0], +/// IWKey.Integrity Key[127:0], IWKey.Encryption Key[255:0]) +/// dst[0] := IWKey.NoBackup +/// dst[4:1] := IWKey.KeySource[3:0] +/// dst[31:5] := 0 +/// MEM[__h+127:__h] := Handle[127:0] // AAD +/// MEM[__h+255:__h+128] := Handle[255:128] // Integrity Tag +/// MEM[__h+383:__h+256] := Handle[383:256] // CipherText +/// MEM[__h+511:__h+384] := 0 // Reserved for future usage +/// MEM[__h+639:__h+512] := 0 // Reserved for future usage +/// MEM[__h+767:__h+640] := 0 // Reserved for future usage +/// OF := 0 +/// SF := 0 +/// ZF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned int __DEFAULT_FN_ATTRS +_mm_encodekey128_u32(unsigned int __htype, __m128i __key, void *__h) { + __m128i *__results = (__m128i*)__h; + + return __builtin_ia32_encodekey128(__htype, __key, + __results, + __results + 1, + __results + 2, + __results + 3, + __results + 4, + __results + 5); +} + +/// Wrap a 256-bit AES key from __key_hi:__key_lo into a key handle, then +/// output handle in ((__m128i*)__h) to ((__m128i*)__h) + 6 and +/// a 32-bit value as return. +/// The explicit source operand __htype specifies handle restrictions. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the ENCODEKEY256 instructions. +/// +/// \operation +/// InputKey[127:0] := __key_lo[127:0] +/// InputKey[255:128] := __key_hi[255:128] +/// KeyMetadata[2:0] := __htype[2:0] +/// KeyMetadata[23:3] := 0 // Reserved for future usage +/// KeyMetadata[27:24] := 1 // KeyType is AES-256 (value of 1) +/// KeyMetadata[127:28] := 0 // Reserved for future usage +/// Handle[511:0] := WrapKey256(InputKey[255:0], KeyMetadata[127:0], +/// IWKey.Integrity Key[127:0], IWKey.Encryption Key[255:0]) +/// dst[0] := IWKey.NoBackup +/// dst[4:1] := IWKey.KeySource[3:0] +/// dst[31:5] := 0 +/// MEM[__h+127:__h] := Handle[127:0] // AAD +/// MEM[__h+255:__h+128] := Handle[255:128] // Tag +/// MEM[__h+383:__h+256] := Handle[383:256] // CipherText[127:0] +/// MEM[__h+511:__h+384] := Handle[511:384] // CipherText[255:128] +/// MEM[__h+639:__h+512] := 0 // Reserved for future usage +/// MEM[__h+767:__h+640] := 0 // Reserved for future usage +/// MEM[__h+895:__h+768] := 0 Integrity// Reserved for future usage +/// OF := 0 +/// SF := 0 +/// ZF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned int __DEFAULT_FN_ATTRS +_mm_encodekey256_u32(unsigned int __htype, __m128i __key_lo, __m128i __key_hi, + void *__h) { + __m128i *__results = (__m128i*)__h; + + return __builtin_ia32_encodekey256(__htype, __key_lo, __key_hi, + __results, + __results + 1, + __results + 2, + __results + 3, + __results + 4, + __results + 5, + __results + 6); +} + +/// The AESENC128KL performs 10 rounds of AES to encrypt the __idata using +/// the 128-bit key in the handle from the __h. It stores the result in the +/// __odata. And return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESENC128KL instructions. +/// +/// \operation +/// Handle[383:0] := MEM[__h+383:__h] // Load is not guaranteed to be atomic. +/// IllegalHandle := ( HandleReservedBitSet (Handle[383:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[383:256] || +/// HandleKeyType (Handle[383:0]) != HANDLE_KEY_TYPE_AES128 ) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey) +/// IF (Authentic == 0) +/// ZF := 1 +/// ELSE +/// MEM[__odata+127:__odata] := AES128Encrypt (__idata[127:0], UnwrappedKey) +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesenc128kl_u8(__m128i* __odata, __m128i __idata, const void *__h) { + return __builtin_ia32_aesenc128kl(__odata, __idata, __h); +} + +/// The AESENC256KL performs 14 rounds of AES to encrypt the __idata using +/// the 256-bit key in the handle from the __h. It stores the result in the +/// __odata. And return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESENC256KL instructions. +/// +/// \operation +/// Handle[511:0] := MEM[__h+511:__h] // Load is not guaranteed to be atomic. +/// IllegalHandle := ( HandleReservedBitSet (Handle[511:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[255:128] || +/// HandleKeyType (Handle[511:0]) != HANDLE_KEY_TYPE_AES256 ) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey) +/// IF (Authentic == 0) +/// ZF := 1 +/// ELSE +/// MEM[__odata+127:__odata] := AES256Encrypt (__idata[127:0], UnwrappedKey) +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesenc256kl_u8(__m128i* __odata, __m128i __idata, const void *__h) { + return __builtin_ia32_aesenc256kl(__odata, __idata, __h); +} + +/// The AESDEC128KL performs 10 rounds of AES to decrypt the __idata using +/// the 128-bit key in the handle from the __h. It stores the result in the +/// __odata. And return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESDEC128KL instructions. +/// +/// \operation +/// Handle[383:0] := MEM[__h+383:__h] // Load is not guaranteed to be atomic. +/// IllegalHandle := (HandleReservedBitSet (Handle[383:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[383:256] || +/// HandleKeyType (Handle[383:0]) != HANDLE_KEY_TYPE_AES128) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey) +/// IF (Authentic == 0) +/// ZF := 1 +/// ELSE +/// MEM[__odata+127:__odata] := AES128Decrypt (__idata[127:0], UnwrappedKey) +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesdec128kl_u8(__m128i* __odata, __m128i __idata, const void *__h) { + return __builtin_ia32_aesdec128kl(__odata, __idata, __h); +} + +/// The AESDEC256KL performs 10 rounds of AES to decrypt the __idata using +/// the 256-bit key in the handle from the __h. It stores the result in the +/// __odata. And return the affected ZF flag status. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the AESDEC256KL instructions. +/// +/// \operation +/// Handle[511:0] := MEM[__h+511:__h] +/// IllegalHandle := (HandleReservedBitSet (Handle[511:0]) || +/// (Handle[127:0] AND (CPL > 0)) || +/// Handle[383:256] || +/// HandleKeyType (Handle[511:0]) != HANDLE_KEY_TYPE_AES256) +/// IF (IllegalHandle) +/// ZF := 1 +/// ELSE +/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey) +/// IF (Authentic == 0) +/// ZF := 1 +/// ELSE +/// MEM[__odata+127:__odata] := AES256Decrypt (__idata[127:0], UnwrappedKey) +/// ZF := 0 +/// FI +/// FI +/// dst := ZF +/// OF := 0 +/// SF := 0 +/// AF := 0 +/// PF := 0 +/// CF := 0 +/// \endoperation +static __inline__ unsigned char __DEFAULT_FN_ATTRS +_mm_aesdec256kl_u8(__m128i* __odata, __m128i __idata, const void *__h) { + return __builtin_ia32_aesdec256kl(__odata, __idata, __h); +} + +#undef __DEFAULT_FN_ATTRS + +#endif /* _KEYLOCKERINTRIN_H */ Index: clang/test/CodeGen/X86/keylocker.c =================================================================== --- /dev/null +++ clang/test/CodeGen/X86/keylocker.c @@ -0,0 +1,72 @@ +// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +kl -target-feature +widekl -emit-llvm -o - -Wall -Werror | FileCheck %s +// RUN: %clang_cc1 %s -ffreestanding -triple=i386-unknown-unknown -target-feature +kl -target-feature +widekl -emit-llvm -o - -Wall -Werror | FileCheck %s +// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +widekl -emit-llvm -o - -Wall -Werror | FileCheck %s +// RUN: %clang_cc1 %s -ffreestanding -triple=i386-unknown-unknown -target-feature +widekl -emit-llvm -o - -Wall -Werror | FileCheck %s + +#include + +void test_loadiwkey(unsigned int ctl, __m128i intkey, __m128i enkey_lo, __m128i enkey_hi) { + //CHECK-LABEL: @test_loadiwkey + //CHECK: @llvm.x86.loadiwkey + _mm_loadiwkey(ctl, intkey, enkey_lo, enkey_hi); +} + +unsigned int test_encodekey128_u32(unsigned int htype, __m128i key, void *h) { + //CHECK-LABEL: @test_encodekey128_u32 + //CHECK: call { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.encodekey128(i32 %{{.*}}, <2 x i64> %{{.*}}) + return _mm_encodekey128_u32(htype, key, h); +} + +unsigned int test_encodekey256_u32(unsigned int htype, __m128i key_lo, __m128i key_hi, void *h) { + //CHECK-LABEL: @test_encodekey256_u32 + //CHECK: call { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.encodekey256(i32 %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}) + return _mm_encodekey256_u32(htype, key_lo, key_hi, h); +} + +unsigned char test_mm_aesenc256kl_u8(__m128i *odata, __m128i idata, const void *h) { + //CHECK-LABEL: @test_mm_aesenc256kl_u8 + //CHECK: call { i8, <2 x i64> } @llvm.x86.aesenc256kl(<2 x i64> %{{.*}}, i8* %{{.*}}) + return _mm_aesenc256kl_u8(odata, idata, h); +} + +unsigned char test_mm_aesdec256kl_u8(__m128i *odata, __m128i idata, const void *h) { + //CHECK-LABEL: @test_mm_aesdec256kl_u8 + //CHECK: call { i8, <2 x i64> } @llvm.x86.aesdec256kl(<2 x i64> %{{.*}}, i8* %{{.*}}) + return _mm_aesdec256kl_u8(odata, idata, h); +} + +unsigned char test_mm_aesenc128kl_u8(__m128i *odata, __m128i idata, const void *h) { + //CHECK-LABEL: @test_mm_aesenc128kl_u8 + //CHECK: call { i8, <2 x i64> } @llvm.x86.aesenc128kl(<2 x i64> %{{.*}}, i8* %{{.*}}) + return _mm_aesenc128kl_u8(odata, idata, h); +} + +unsigned char test_mm_aesdec128kl_u8(__m128i *odata, __m128i idata, const void *h) { + //CHECK-LABEL: @test_mm_aesdec128kl_u8 + //CHECK: call { i8, <2 x i64> } @llvm.x86.aesdec128kl(<2 x i64> %{{.*}}, i8* %{{.*}}) + return _mm_aesdec128kl_u8(odata, idata, h); +} + +unsigned char test__mm_aesencwide128kl_u8(__m128i odata[8], const __m128i idata[8], const void* h) { + //CHECK-LABEL: @test__mm_aesencwide128kl + //CHECK: call { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesencwide128kl(i8* %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}) + return _mm_aesencwide128kl_u8(odata, idata, h); +} + +unsigned char test__mm_aesdecwide128kl_u8(__m128i odata[8], const __m128i idata[8], const void* h) { + //CHECK-LABEL: @test__mm_aesdecwide128kl + //CHECK: call { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesdecwide128kl(i8* %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}) + return _mm_aesdecwide128kl_u8(odata, idata, h); +} + +unsigned char test__mm_aesencwide256kl_u8(__m128i odata[8], const __m128i idata[8], const void* h) { + //CHECK-LABEL: @test__mm_aesencwide256kl + //CHECK: call { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesencwide256kl(i8* %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}) + return _mm_aesencwide256kl_u8(odata, idata, h); +} + +unsigned char test__mm_aesdecwide256kl_u8(__m128i odata[8], const __m128i idata[8], const void* h) { + //CHECK-LABEL: @test__mm_aesdecwide256kl + //CHECK: call { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesdecwide256kl(i8* %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}) + return _mm_aesdecwide256kl_u8(odata, idata, h); +} Index: clang/test/CodeGen/attr-target-x86.c =================================================================== --- clang/test/CodeGen/attr-target-x86.c +++ clang/test/CodeGen/attr-target-x86.c @@ -50,7 +50,7 @@ // CHECK: #0 = {{.*}}"target-cpu"="i686" "target-features"="+cx8,+x87" "tune-cpu"="i686" // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+cx8,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" // CHECK-NOT: tune-cpu -// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+cx8,+x87,-aes,-avx,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-f16c,-fma,-fma4,-gfni,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-xop" "tune-cpu"="i686" +// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+cx8,+x87,-aes,-avx,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-f16c,-fma,-fma4,-gfni,-kl,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-widekl,-xop" "tune-cpu"="i686" // CHECK: #3 = {{.*}}"target-cpu"="i686" "target-features"="+cx8,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "tune-cpu"="i686" // CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+cx8,+x87,-avx,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-f16c,-fma,-fma4,-sse4.1,-sse4.2,-vaes,-vpclmulqdq,-xop" "tune-cpu"="i686" // CHECK: #5 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+cx8,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes,-vaes" Index: clang/test/Driver/x86-target-features.c =================================================================== --- clang/test/Driver/x86-target-features.c +++ clang/test/Driver/x86-target-features.c @@ -254,6 +254,16 @@ // TSXLDTRK: "-target-feature" "+tsxldtrk" // NO-TSXLDTRK: "-target-feature" "-tsxldtrk" +// RUN: %clang -target i386-linux-gnu -mkl %s -### -o %t.o 2>&1 | FileCheck -check-prefix=KL %s +// RUN: %clang -target i386-linux-gnu -mno-kl %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-KL %s +// KL: "-target-feature" "+kl" +// NO-KL: "-target-feature" "-kl" + +// RUN: %clang -target i386-linux-gnu -mwidekl %s -### -o %t.o 2>&1 | FileCheck -check-prefix=WIDE_KL %s +// RUN: %clang -target i386-linux-gnu -mno-widekl %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WIDE_KL %s +// WIDE_KL: "-target-feature" "+widekl" +// NO-WIDE_KL: "-target-feature" "-widekl" + // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mamx-tile %s -### -o %t.o 2>&1 | FileCheck --check-prefix=AMX-TILE %s // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-amx-tile %s -### -o %t.o 2>&1 | FileCheck --check-prefix=NO-AMX-TILE %s // AMX-TILE: "-target-feature" "+amx-tile" Index: clang/test/Preprocessor/x86_target_features.c =================================================================== --- clang/test/Preprocessor/x86_target_features.c +++ clang/test/Preprocessor/x86_target_features.c @@ -486,6 +486,25 @@ // NOVP2INTERSECT-NOT: #define __AVX512VP2INTERSECT__ 1 + +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mkl -x c -E -dM -o - %s | FileCheck -check-prefix=KEYLOCKER %s +// KEYLOCKER: #define __KL__ 1 + +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-kl -x c -E -dM -o - %s | FileCheck -check-prefix=NOKEYLOCKER %s +// NOKEYLOCKER-NOT: #define __KL__ 1 + +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mwidekl -x c -E -dM -o - %s | FileCheck -check-prefix=KEYLOCKERW %s +// KEYLOCKERW: #define __KL__ 1 +// KEYLOCKERW: #define __WIDEKL__ 1 + +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-widekl -x c -E -dM -o - %s | FileCheck -check-prefix=NOKEYLOCKERW %s +// NOKEYLOCKERW-NOT: #define __KL__ 1 +// NOKEYLOCKERW-NOT: #define __WIDEKL__ 1 + +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mwidekl -mno-kl -x c -E -dM -o - %s | FileCheck -check-prefix=NOKEYLOCKERW2 %s +// NOKEYLOCKERW2-NOT: #define __KL__ 1 +// NOKEYLOCKERW2-NOT: #define __WIDEKL__ 1 + // RUN: %clang -target i386-unknown-unknown -march=atom -menqcmd -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=ENQCMD %s // ENQCMD: #define __ENQCMD__ 1 Index: llvm/include/llvm/IR/IntrinsicsX86.td =================================================================== --- llvm/include/llvm/IR/IntrinsicsX86.td +++ llvm/include/llvm/IR/IntrinsicsX86.td @@ -4948,6 +4948,59 @@ def int_x86_xresldtrk : GCCBuiltin<"__builtin_ia32_xresldtrk">, Intrinsic<[], [], []>; } + +//===----------------------------------------------------------------------===// +// Key Locker +let TargetPrefix = "x86" in { + def int_x86_loadiwkey : GCCBuiltin<"__builtin_ia32_loadiwkey">, + Intrinsic<[], [llvm_i32_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + []>; + def int_x86_encodekey128 : + Intrinsic<[llvm_i32_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + [llvm_i32_ty, llvm_v2i64_ty], []>; + def int_x86_encodekey256 : + Intrinsic<[llvm_i32_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + [llvm_i32_ty, llvm_v2i64_ty, llvm_v2i64_ty], []>; + def int_x86_aesenc128kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty], [llvm_v2i64_ty, llvm_ptr_ty], []>; + def int_x86_aesdec128kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty], [llvm_v2i64_ty, llvm_ptr_ty], []>; + def int_x86_aesenc256kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty], [llvm_v2i64_ty, llvm_ptr_ty], []>; + def int_x86_aesdec256kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty], [llvm_v2i64_ty, llvm_ptr_ty], []>; + def int_x86_aesencwide128kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], []>; + def int_x86_aesdecwide128kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], []>; + def int_x86_aesencwide256kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], []>; + def int_x86_aesdecwide256kl : + Intrinsic<[llvm_i8_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], + [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], []>; +} + //===----------------------------------------------------------------------===// // AMX - Intel AMX extensions Index: llvm/include/llvm/Support/X86TargetParser.def =================================================================== --- llvm/include/llvm/Support/X86TargetParser.def +++ llvm/include/llvm/Support/X86TargetParser.def @@ -154,6 +154,8 @@ X86_FEATURE (FSGSBASE, "fsgsbase") X86_FEATURE (FXSR, "fxsr") X86_FEATURE (INVPCID, "invpcid") +X86_FEATURE (KL, "kl") +X86_FEATURE (WIDEKL, "widekl") X86_FEATURE (LWP, "lwp") X86_FEATURE (LZCNT, "lzcnt") X86_FEATURE (MOVBE, "movbe") Index: llvm/lib/IR/Function.cpp =================================================================== --- llvm/lib/IR/Function.cpp +++ llvm/lib/IR/Function.cpp @@ -833,7 +833,8 @@ IIT_SUBDIVIDE4_ARG = 45, IIT_VEC_OF_BITCASTS_TO_INT = 46, IIT_V128 = 47, - IIT_BF16 = 48 + IIT_BF16 = 48, + IIT_STRUCT9 = 49 }; static void DecodeIITType(unsigned &NextElt, ArrayRef Infos, @@ -995,6 +996,7 @@ case IIT_EMPTYSTRUCT: OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct, 0)); return; + case IIT_STRUCT9: ++StructElts; LLVM_FALLTHROUGH; case IIT_STRUCT8: ++StructElts; LLVM_FALLTHROUGH; case IIT_STRUCT7: ++StructElts; LLVM_FALLTHROUGH; case IIT_STRUCT6: ++StructElts; LLVM_FALLTHROUGH; Index: llvm/lib/Support/Host.cpp =================================================================== --- llvm/lib/Support/Host.cpp +++ llvm/lib/Support/Host.cpp @@ -1469,6 +1469,7 @@ Features["avx512bitalg"] = HasLeaf7 && ((ECX >> 12) & 1) && HasAVX512Save; Features["avx512vpopcntdq"] = HasLeaf7 && ((ECX >> 14) & 1) && HasAVX512Save; Features["rdpid"] = HasLeaf7 && ((ECX >> 22) & 1); + Features["kl"] = HasLeaf7 && ((ECX >> 23) & 1); // key locker Features["cldemote"] = HasLeaf7 && ((ECX >> 25) & 1); Features["movdiri"] = HasLeaf7 && ((ECX >> 27) & 1); Features["movdir64b"] = HasLeaf7 && ((ECX >> 28) & 1); @@ -1509,6 +1510,10 @@ Features["ptwrite"] = HasLeaf14 && ((EBX >> 4) & 1); + bool HasLeaf19 = + MaxLevel >= 0x19 && !getX86CpuIDAndInfo(0x19, &EAX, &EBX, &ECX, &EDX); + Features["widekl"] = HasLeaf7 && HasLeaf19 && ((EBX >> 2) & 1); + return true; } #elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__)) Index: llvm/lib/Support/X86TargetParser.cpp =================================================================== --- llvm/lib/Support/X86TargetParser.cpp +++ llvm/lib/Support/X86TargetParser.cpp @@ -194,7 +194,7 @@ FeaturesICLClient | FeaturePCONFIG | FeatureWBNOINVD; static constexpr FeatureBitset FeaturesTigerlake = FeaturesICLClient | FeatureAVX512VP2INTERSECT | FeatureMOVDIR64B | - FeatureMOVDIRI | FeatureSHSTK; + FeatureMOVDIRI | FeatureSHSTK | FeatureKL | FeatureWIDEKL; static constexpr FeatureBitset FeaturesSapphireRapids = FeaturesICLServer | FeatureAMX_TILE | FeatureAMX_INT8 | FeatureAMX_BF16 | FeatureAVX512BF16 | FeatureAVX512VP2INTERSECT | FeatureCLDEMOTE | FeatureENQCMD | @@ -538,6 +538,10 @@ static constexpr FeatureBitset ImpliedFeaturesAMX_BF16 = FeatureAMX_TILE; static constexpr FeatureBitset ImpliedFeaturesAMX_INT8 = FeatureAMX_TILE; +// Key Locker Features +static constexpr FeatureBitset ImpliedFeaturesKL = FeatureSSE2; +static constexpr FeatureBitset ImpliedFeaturesWIDEKL = FeatureKL; + static constexpr FeatureInfo FeatureInfos[X86::CPU_FEATURE_MAX] = { #define X86_FEATURE(ENUM, STR) {{STR}, ImpliedFeatures##ENUM}, #include "llvm/Support/X86TargetParser.def" Index: llvm/lib/Target/X86/X86.td =================================================================== --- llvm/lib/Target/X86/X86.td +++ llvm/lib/Target/X86/X86.td @@ -279,6 +279,12 @@ "Wait and pause enhancements">; def FeatureENQCMD : SubtargetFeature<"enqcmd", "HasENQCMD", "true", "Has ENQCMD instructions">; +def FeatureKL : SubtargetFeature<"kl", "HasKL", "true", + "Support Key Locker kl Instructions", + [FeatureSSE2]>; +def FeatureWIDEKL : SubtargetFeature<"widekl", "HasWIDEKL", "true", + "Support Key Locker wide Instructions", + [FeatureKL]>; def FeatureSERIALIZE : SubtargetFeature<"serialize", "HasSERIALIZE", "true", "Has serialize instruction">; def FeatureTSXLDTRK : SubtargetFeature<"tsxldtrk", "HasTSXLDTRK", "true", Index: llvm/lib/Target/X86/X86ISelLowering.cpp =================================================================== --- llvm/lib/Target/X86/X86ISelLowering.cpp +++ llvm/lib/Target/X86/X86ISelLowering.cpp @@ -25957,6 +25957,185 @@ Op->getOperand(3), Op->getOperand(4)}); return Chain; } + case Intrinsic::x86_encodekey128: + case Intrinsic::x86_encodekey256: { + SDLoc DL(Op); + SDVTList VTs = DAG.getVTList(MVT::i32, MVT::Other, MVT::Glue); + SDValue Chain = Op.getOperand(0); + bool IsEK256 = false; + Chain = DAG.getCopyToReg(Chain, DL, X86::XMM0, Op->getOperand(3), + SDValue()); + + unsigned Opcode; + + switch (IntNo) { + default: llvm_unreachable("Impossible intrinsic"); + case Intrinsic::x86_encodekey128: + Opcode = X86::ENCODEKEY128; + break; + case Intrinsic::x86_encodekey256: + Opcode = X86::ENCODEKEY256; + Chain = DAG.getCopyToReg(Chain, DL, X86::XMM1, Op->getOperand(4), + Chain.getValue(1)); + IsEK256 = true; + break; + } + + SDNode *Res = DAG.getMachineNode(Opcode, DL, VTs, + {Op.getOperand(2), Chain, + Chain.getValue(1)}); + + Chain = SDValue(Res, 1); + + SDValue XMM0 = DAG.getCopyFromReg(Chain, DL, X86::XMM0, MVT::v16i8, + SDValue(Res, 2)); + SDValue XMM1 = DAG.getCopyFromReg(XMM0.getValue(1), DL, X86::XMM1, + MVT::v16i8, XMM0.getValue(2)); + SDValue XMM2 = DAG.getCopyFromReg(XMM1.getValue(1), DL, X86::XMM2, + MVT::v16i8, XMM1.getValue(2)); + SDValue XMM3, XMM4; + if (IsEK256) { + XMM3 = DAG.getCopyFromReg(XMM2.getValue(1), DL, X86::XMM3, + MVT::v16i8, XMM2.getValue(2)); + XMM4 = DAG.getCopyFromReg(XMM3.getValue(1), DL, X86::XMM4, + MVT::v16i8, XMM3.getValue(2)); + } else { + XMM4 = DAG.getCopyFromReg(XMM2.getValue(1), DL, X86::XMM4, + MVT::v16i8, XMM2.getValue(2)); + } + SDValue XMM5 = DAG.getCopyFromReg(XMM4.getValue(1), DL, X86::XMM5, + MVT::v16i8, XMM4.getValue(2)); + SDValue XMM6 = DAG.getCopyFromReg(XMM5.getValue(1), DL, X86::XMM6, + MVT::v16i8, XMM5.getValue(2)); + + if (IsEK256) { + return DAG.getNode(ISD::MERGE_VALUES, DL, Op->getVTList(), + {SDValue(Res, 0), + XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, Chain}); + } else { + return DAG.getNode(ISD::MERGE_VALUES, DL, Op->getVTList(), + {SDValue(Res, 0), + XMM0, XMM1, XMM2, XMM4, XMM5, XMM6, Chain}); + } + } + case Intrinsic::x86_aesenc128kl: + case Intrinsic::x86_aesdec128kl: + case Intrinsic::x86_aesenc256kl: + case Intrinsic::x86_aesdec256kl: { + SDLoc DL(Op); + SDVTList VTs = DAG.getVTList(MVT::v16i8, MVT::Other, MVT::Glue); + SDValue Chain = Op.getOperand(0); + unsigned Opcode; + + switch (IntNo) { + default: llvm_unreachable("Impossible intrinsic"); + case Intrinsic::x86_aesenc128kl: + Opcode = X86::AESENC128KL; + break; + case Intrinsic::x86_aesdec128kl: + Opcode = X86::AESDEC128KL; + break; + case Intrinsic::x86_aesenc256kl: + Opcode = X86::AESENC256KL; + break; + case Intrinsic::x86_aesdec256kl: + Opcode = X86::AESDEC256KL; + break; + } + + SDValue XMM = Op.getOperand(2); + SDValue Base = Op.getOperand(3); + SDValue Index = DAG.getRegister(0, MVT::i32); + SDValue Scale = DAG.getTargetConstant(1, DL, MVT::i8); + SDValue Disp = DAG.getTargetConstant(0, DL, MVT::i32); + SDValue Segment = DAG.getRegister(0, MVT::i32); + + SDNode *Res = DAG.getMachineNode(Opcode, DL, VTs, {XMM, Base, Scale, Index, + Disp, Segment, Chain}); + Chain = SDValue(Res, 1); + SDValue EFLAGS = DAG.getCopyFromReg(Chain, DL, X86::EFLAGS, MVT::i32, + SDValue(Res, 2)); + SDValue ZF = getSETCC(X86::COND_E, EFLAGS.getValue(0), DL, DAG); + + return DAG.getNode(ISD::MERGE_VALUES, DL, Op->getVTList(), + {ZF, SDValue(Res, 0), EFLAGS.getValue(1)}); + } + case Intrinsic::x86_aesencwide128kl: + case Intrinsic::x86_aesdecwide128kl: + case Intrinsic::x86_aesencwide256kl: + case Intrinsic::x86_aesdecwide256kl: { + SDLoc DL(Op); + SDVTList VTs = DAG.getVTList(MVT::Other, MVT::Glue); + SDValue Chain = Op.getOperand(0); + unsigned Opcode; + + switch (IntNo) { + default: llvm_unreachable("Impossible intrinsic"); + case Intrinsic::x86_aesencwide128kl: + Opcode = X86::AESENCWIDE128KL; + break; + case Intrinsic::x86_aesdecwide128kl: + Opcode = X86::AESDECWIDE128KL; + break; + case Intrinsic::x86_aesencwide256kl: + Opcode = X86::AESENCWIDE256KL; + break; + case Intrinsic::x86_aesdecwide256kl: + Opcode = X86::AESDECWIDE256KL; + break; + } + + SDValue Base = Op.getOperand(2); + SDValue Index = DAG.getRegister(0, MVT::i32); + SDValue Scale = DAG.getTargetConstant(1, DL, MVT::i8); + SDValue Disp = DAG.getTargetConstant(0, DL, MVT::i32); + SDValue Segment = DAG.getRegister(0, MVT::i32); + + Chain = DAG.getCopyToReg(Chain, DL, X86::XMM0, Op->getOperand(3), + SDValue()); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM1, + Op->getOperand(4), Chain.getValue(1)); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM2, + Op->getOperand(5), Chain.getValue(1)); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM3, + Op->getOperand(6), Chain.getValue(1)); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM4, + Op->getOperand(7), Chain.getValue(1)); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM5, + Op->getOperand(8), Chain.getValue(1)); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM6, + Op->getOperand(9), Chain.getValue(1)); + Chain = DAG.getCopyToReg(Chain.getValue(0), DL, X86::XMM7, + Op->getOperand(10),Chain.getValue(1)); + + SDNode *Res = DAG.getMachineNode(Opcode, DL, VTs, {Base, Scale, Index, + Disp, Segment, Chain, + Chain.getValue(1)}); + + Chain = SDValue(Res, 0); + SDValue EFLAGS = DAG.getCopyFromReg(Chain, DL, X86::EFLAGS, MVT::i32, + SDValue(Res, 1)); + SDValue ZF = getSETCC(X86::COND_E, EFLAGS.getValue(0), DL, DAG); + SDValue XMM0 = DAG.getCopyFromReg(EFLAGS.getValue(1), DL, X86::XMM0, + MVT::v16i8, EFLAGS.getValue(2)); + SDValue XMM1 = DAG.getCopyFromReg(XMM0.getValue(1), DL, X86::XMM1, + MVT::v16i8, XMM0.getValue(2)); + SDValue XMM2 = DAG.getCopyFromReg(XMM1.getValue(1), DL, X86::XMM2, + MVT::v16i8, XMM1.getValue(2)); + SDValue XMM3 = DAG.getCopyFromReg(XMM2.getValue(1), DL, X86::XMM3, + MVT::v16i8, XMM2.getValue(2)); + SDValue XMM4 = DAG.getCopyFromReg(XMM3.getValue(1), DL, X86::XMM4, + MVT::v16i8, XMM3.getValue(2)); + SDValue XMM5 = DAG.getCopyFromReg(XMM4.getValue(1), DL, X86::XMM5, + MVT::v16i8, XMM4.getValue(2)); + SDValue XMM6 = DAG.getCopyFromReg(XMM5.getValue(1), DL, X86::XMM6, + MVT::v16i8, XMM5.getValue(2)); + SDValue XMM7 = DAG.getCopyFromReg(XMM6.getValue(1), DL, X86::XMM7, + MVT::v16i8, XMM6.getValue(2)); + return DAG.getNode(ISD::MERGE_VALUES, DL, Op->getVTList(), + {ZF, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, + XMM7.getValue(1)}); + } } return SDValue(); } Index: llvm/lib/Target/X86/X86InstrInfo.td =================================================================== --- llvm/lib/Target/X86/X86InstrInfo.td +++ llvm/lib/Target/X86/X86InstrInfo.td @@ -971,6 +971,8 @@ def HasCmpxchg16b: Predicate<"Subtarget->hasCmpxchg16b()">; def HasPCONFIG : Predicate<"Subtarget->hasPCONFIG()">; def HasENQCMD : Predicate<"Subtarget->hasENQCMD()">; +def HasKL : Predicate<"Subtarget->hasKL()">; +def HasWIDEKL : Predicate<"Subtarget->hasWIDEKL()">; def HasSERIALIZE : Predicate<"Subtarget->hasSERIALIZE()">; def HasTSXLDTRK : Predicate<"Subtarget->hasTSXLDTRK()">; def HasAMXTILE : Predicate<"Subtarget->hasAMXTILE()">; @@ -3094,6 +3096,9 @@ include "X86InstrTDX.td" +// Key Locker instructions +include "X86InstrKL.td" + // AMX instructions include "X86InstrAMX.td" Index: llvm/lib/Target/X86/X86InstrInfo.td.rej =================================================================== --- /dev/null +++ llvm/lib/Target/X86/X86InstrInfo.td.rej @@ -0,0 +1,11 @@ +diff a/llvm/lib/Target/X86/X86InstrInfo.td b/llvm/lib/Target/X86/X86InstrInfo.td (rejected hunks) +@@ -3092,6 +3094,9 @@ include "X86InstrSVM.td" + include "X86InstrTSX.td" + include "X86InstrSGX.td" + ++// Key Locker instructions ++include "X86InstrKL.td" ++ + // AMX instructions + include "X86InstrAMX.td" + Index: llvm/lib/Target/X86/X86InstrKL.td =================================================================== --- /dev/null +++ llvm/lib/Target/X86/X86InstrKL.td @@ -0,0 +1,66 @@ +//===---------------------------*-tablegen-*-------------------------------===// +//===------------- X86InstrKL.td - KL Instruction Set Extension -----------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file describes the instructions that make up the Intel key locker +// instruction set. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// Key Locker instructions + +let SchedRW = [WriteSystem], Predicates = [HasKL] in { + let Uses = [XMM0, EAX] in { + def LOADIWKEY : I<0xDC, MRMSrcReg, (outs), (ins VR128X:$src1, VR128X:$src2), + "loadiwkey\t{$src2, $src1|$src1, $src2}", + [(int_x86_loadiwkey EAX, XMM0, VR128X:$src1, VR128X:$src2)]>, T8XS; + } + + let Uses = [XMM0], Defs = [XMM0, XMM1, XMM2, XMM4, XMM5, XMM6] in { + def ENCODEKEY128 : I<0xFA, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), + "encodekey128\t{$src, $dst|$dst, $src}", []>, T8XS; + } + + let Uses = [XMM0, XMM1], Defs = [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6] in { + def ENCODEKEY256 : I<0xFB, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), + "encodekey256\t{$src, $dst|$dst, $src}", []>, T8XS; + } + + let Constraints = "$src1 = $dst", + Defs = [EFLAGS] in { + def AESENC128KL : I<0xDC, MRMSrcMem, (outs VR128X:$dst), (ins VR128X:$src1, opaquemem:$src2), + "aesenc128kl\t{$src2, $src1|$src1, $src2}", []>, T8XS; + + def AESDEC128KL : I<0xDD, MRMSrcMem, (outs VR128X:$dst), (ins VR128X:$src1, opaquemem:$src2), + "aesdec128kl\t{$src2, $src1|$src1, $src2}", []>, T8XS; + + def AESENC256KL : I<0xDE, MRMSrcMem, (outs VR128X:$dst), (ins VR128X:$src1, opaquemem:$src2), + "aesenc256kl\t{$src2, $src1|$src1, $src2}", []>, T8XS; + + def AESDEC256KL : I<0xDF, MRMSrcMem, (outs VR128X:$dst), (ins VR128X:$src1, opaquemem:$src2), + "aesdec256kl\t{$src2, $src1|$src1, $src2}", []>, T8XS; + } + +} // SchedRW, Predicates + +let SchedRW = [WriteSystem], Predicates = [HasWIDEKL] in { + let Uses = [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7], + Defs = [EFLAGS, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7] in { + def AESENCWIDE128KL : I<0xD8, MRM0m, (outs), (ins opaquemem:$src), + "aesencwide128kl\t$src", []>, T8XS; + def AESDECWIDE128KL : I<0xD8, MRM1m, (outs), (ins opaquemem:$src), + "aesdecwide128kl\t$src", []>, T8XS; + def AESENCWIDE256KL : I<0xD8, MRM2m, (outs), (ins opaquemem:$src), + "aesencwide256kl\t$src", []>, T8XS; + def AESDECWIDE256KL : I<0xD8, MRM3m, (outs), (ins opaquemem:$src), + "aesdecwide256kl\t$src", []>, T8XS; + } + +} // SchedRW, Predicates Index: llvm/lib/Target/X86/X86Subtarget.h =================================================================== --- llvm/lib/Target/X86/X86Subtarget.h +++ llvm/lib/Target/X86/X86Subtarget.h @@ -395,6 +395,12 @@ /// Processor supports PCONFIG instruction bool HasPCONFIG = false; + /// Processor support key locker instructions + bool HasKL = false; + + /// Processor support key locker wide instructions + bool HasWIDEKL = false; + /// Processor supports SERIALIZE instruction bool HasSERIALIZE = false; @@ -728,6 +734,8 @@ bool hasSGX() const { return HasSGX; } bool hasINVPCID() const { return HasINVPCID; } bool hasENQCMD() const { return HasENQCMD; } + bool hasKL() const { return HasKL; } + bool hasWIDEKL() const { return HasWIDEKL; } bool hasSERIALIZE() const { return HasSERIALIZE; } bool hasTSXLDTRK() const { return HasTSXLDTRK; } bool useRetpolineIndirectCalls() const { return UseRetpolineIndirectCalls; } Index: llvm/test/CodeGen/X86/keylocker-intrinsics.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/X86/keylocker-intrinsics.ll @@ -0,0 +1,312 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-unkown-unknown -mattr=+kl,widekl | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=i386-unkown-unknown -mattr=+kl,widekl -mattr=+avx2 | FileCheck %s --check-prefix=X32 +; RUN: llc < %s -mtriple=x86_64-unkown-unknown -mattr=+widekl | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=i386-unkown-unknown -mattr=+widekl -mattr=+avx2 | FileCheck %s --check-prefix=X32 + +declare void @llvm.x86.loadiwkey(i32, <2 x i64>, <2 x i64>, <2 x i64>) +declare { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.encodekey128(i32, <2 x i64>) +declare { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.encodekey256(i32, <2 x i64>, <2 x i64>) +declare { i8, <2 x i64> } @llvm.x86.aesenc128kl(<2 x i64>, i8*) +declare { i8, <2 x i64> } @llvm.x86.aesdec128kl(<2 x i64>, i8*) +declare { i8, <2 x i64> } @llvm.x86.aesenc256kl(<2 x i64>, i8*) +declare { i8, <2 x i64> } @llvm.x86.aesdec256kl(<2 x i64>, i8*) +declare { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesencwide128kl(i8*, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>) +declare { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesencwide256kl(i8*, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>) + +define void @test_loadiwkey(i32 %ctl, <2 x i64> %intkey, <2 x i64> %enkey_lo, <2 x i64> %enkey_hi) { +; X64-LABEL: test_loadiwkey: +; X64: # %bb.0: # %entry +; X64-NEXT: movl %edi, %eax +; X64-NEXT: loadiwkey %xmm2, %xmm1 +; X64-NEXT: retq +; +; X32-LABEL: test_loadiwkey: +; X32: # %bb.0: # %entry +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: loadiwkey %xmm2, %xmm1 +; X32-NEXT: retl +entry: + tail call void @llvm.x86.loadiwkey(i32 %ctl, <2 x i64> %intkey, <2 x i64> %enkey_lo, <2 x i64> %enkey_hi) + ret void +} + +define i32 @test_encodekey128_u32(i32 %htype, <2 x i64> %key, <2 x i64>* nocapture %h0, <2 x i64>* nocapture %h1, <2 x i64>* nocapture %h2, <2 x i64>* nocapture %h3, <2 x i64>* nocapture %h4, <2 x i64>* nocapture %h5) { +; X64-LABEL: test_encodekey128_u32: +; X64: # %bb.0: # %entry +; X64-NEXT: movq {{[0-9]+}}(%rsp), %r10 +; X64-NEXT: encodekey128 %edi, %eax +; X64-NEXT: movaps %xmm0, (%rsi) +; X64-NEXT: movaps %xmm1, (%rdx) +; X64-NEXT: movaps %xmm2, (%rcx) +; X64-NEXT: movaps %xmm4, (%r8) +; X64-NEXT: movaps %xmm5, (%r9) +; X64-NEXT: movaps %xmm6, (%r10) +; X64-NEXT: retq +; +; X32-LABEL: test_encodekey128_u32: +; X32: # %bb.0: # %entry +; X32-NEXT: pushl %ebp +; X32-NEXT: .cfi_def_cfa_offset 8 +; X32-NEXT: pushl %ebx +; X32-NEXT: .cfi_def_cfa_offset 12 +; X32-NEXT: pushl %edi +; X32-NEXT: .cfi_def_cfa_offset 16 +; X32-NEXT: pushl %esi +; X32-NEXT: .cfi_def_cfa_offset 20 +; X32-NEXT: .cfi_offset %esi, -20 +; X32-NEXT: .cfi_offset %edi, -16 +; X32-NEXT: .cfi_offset %ebx, -12 +; X32-NEXT: .cfi_offset %ebp, -8 +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %edx +; X32-NEXT: movl {{[0-9]+}}(%esp), %esi +; X32-NEXT: movl {{[0-9]+}}(%esp), %edi +; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx +; X32-NEXT: movl {{[0-9]+}}(%esp), %ebp +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: encodekey128 %eax, %eax +; X32-NEXT: vmovaps %xmm0, (%ebp) +; X32-NEXT: vmovaps %xmm1, (%ebx) +; X32-NEXT: vmovaps %xmm2, (%edi) +; X32-NEXT: vmovaps %xmm4, (%esi) +; X32-NEXT: vmovaps %xmm5, (%edx) +; X32-NEXT: vmovaps %xmm6, (%ecx) +; X32-NEXT: popl %esi +; X32-NEXT: .cfi_def_cfa_offset 16 +; X32-NEXT: popl %edi +; X32-NEXT: .cfi_def_cfa_offset 12 +; X32-NEXT: popl %ebx +; X32-NEXT: .cfi_def_cfa_offset 8 +; X32-NEXT: popl %ebp +; X32-NEXT: .cfi_def_cfa_offset 4 +; X32-NEXT: retl +entry: + %0 = tail call { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.encodekey128(i32 %htype, <2 x i64> %key) + %1 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 1 + store <2 x i64> %1, <2 x i64>* %h0, align 16 + %2 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 2 + store <2 x i64> %2, <2 x i64>* %h1, align 16 + %3 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 3 + store <2 x i64> %3, <2 x i64>* %h2, align 16 + %4 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 4 + store <2 x i64> %4, <2 x i64>* %h3, align 16 + %5 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 5 + store <2 x i64> %5, <2 x i64>* %h4, align 16 + %6 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 6 + store <2 x i64> %6, <2 x i64>* %h5, align 16 + %7 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 0 + ret i32 %7 +} + +define i32 @test_encodekey256_u32(i32 %htype, <2 x i64> %key_lo, <2 x i64> %key_hi, <2 x i64>* nocapture %h0, <2 x i64>* nocapture %h1, <2 x i64>* nocapture %h2, <2 x i64>* nocapture %h3, <2 x i64>* nocapture %h4, <2 x i64>* nocapture %h5, <2 x i64>* nocapture readnone %h6) { +; X64-LABEL: test_encodekey256_u32: +; X64: # %bb.0: # %entry +; X64-NEXT: movq {{[0-9]+}}(%rsp), %r10 +; X64-NEXT: encodekey256 %edi, %eax +; X64-NEXT: movaps %xmm0, (%rsi) +; X64-NEXT: movaps %xmm1, (%rdx) +; X64-NEXT: movaps %xmm2, (%rcx) +; X64-NEXT: movaps %xmm3, (%r8) +; X64-NEXT: movaps %xmm4, (%r9) +; X64-NEXT: movaps %xmm5, (%r10) +; X64-NEXT: retq +; +; X32-LABEL: test_encodekey256_u32: +; X32: # %bb.0: # %entry +; X32-NEXT: pushl %ebp +; X32-NEXT: .cfi_def_cfa_offset 8 +; X32-NEXT: pushl %ebx +; X32-NEXT: .cfi_def_cfa_offset 12 +; X32-NEXT: pushl %edi +; X32-NEXT: .cfi_def_cfa_offset 16 +; X32-NEXT: pushl %esi +; X32-NEXT: .cfi_def_cfa_offset 20 +; X32-NEXT: .cfi_offset %esi, -20 +; X32-NEXT: .cfi_offset %edi, -16 +; X32-NEXT: .cfi_offset %ebx, -12 +; X32-NEXT: .cfi_offset %ebp, -8 +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %edx +; X32-NEXT: movl {{[0-9]+}}(%esp), %esi +; X32-NEXT: movl {{[0-9]+}}(%esp), %edi +; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx +; X32-NEXT: movl {{[0-9]+}}(%esp), %ebp +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: encodekey256 %eax, %eax +; X32-NEXT: vmovaps %xmm0, (%ebp) +; X32-NEXT: vmovaps %xmm1, (%ebx) +; X32-NEXT: vmovaps %xmm2, (%edi) +; X32-NEXT: vmovaps %xmm3, (%esi) +; X32-NEXT: vmovaps %xmm4, (%edx) +; X32-NEXT: vmovaps %xmm5, (%ecx) +; X32-NEXT: popl %esi +; X32-NEXT: .cfi_def_cfa_offset 16 +; X32-NEXT: popl %edi +; X32-NEXT: .cfi_def_cfa_offset 12 +; X32-NEXT: popl %ebx +; X32-NEXT: .cfi_def_cfa_offset 8 +; X32-NEXT: popl %ebp +; X32-NEXT: .cfi_def_cfa_offset 4 +; X32-NEXT: retl +entry: + %0 = tail call { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.encodekey256(i32 %htype, <2 x i64> %key_lo, <2 x i64> %key_hi) + %1 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 1 + store <2 x i64> %1, <2 x i64>* %h0, align 16 + %2 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 2 + store <2 x i64> %2, <2 x i64>* %h1, align 16 + %3 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 3 + store <2 x i64> %3, <2 x i64>* %h2, align 16 + %4 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 4 + store <2 x i64> %4, <2 x i64>* %h3, align 16 + %5 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 5 + store <2 x i64> %5, <2 x i64>* %h4, align 16 + %6 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 6 + store <2 x i64> %6, <2 x i64>* %h5, align 16 + %7 = extractvalue { i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 0 + ret i32 %7 +} + +define i8 @test_mm_aesenc128kl_u8(<2 x i64> %data, i8* %h) { +; X64-LABEL: test_mm_aesenc128kl_u8: +; X64: # %bb.0: # %entry +; X64-NEXT: aesenc128kl (%rdi), %xmm0 +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; X32-LABEL: test_mm_aesenc128kl_u8: +; X32: # %bb.0: # %entry +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: aesenc128kl (%eax), %xmm0 +; X32-NEXT: sete %al +; X32-NEXT: retl +entry: + %0 = tail call { i8, <2 x i64> } @llvm.x86.aesenc128kl(<2 x i64> %data, i8* %h) + %1 = extractvalue { i8, <2 x i64> } %0, 0 + ret i8 %1 +} + +define i8 @test_mm_aesdec128kl_u8(<2 x i64> %data, i8* %h) { +; X64-LABEL: test_mm_aesdec128kl_u8: +; X64: # %bb.0: # %entry +; X64-NEXT: aesdec128kl (%rdi), %xmm0 +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; X32-LABEL: test_mm_aesdec128kl_u8: +; X32: # %bb.0: # %entry +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: aesdec128kl (%eax), %xmm0 +; X32-NEXT: sete %al +; X32-NEXT: retl +entry: + %0 = tail call { i8, <2 x i64> } @llvm.x86.aesdec128kl(<2 x i64> %data, i8* %h) + %1 = extractvalue { i8, <2 x i64> } %0, 0 + ret i8 %1 +} + +define i8 @test_mm_aesenc256kl_u8(<2 x i64> %data, i8* %h) { +; X64-LABEL: test_mm_aesenc256kl_u8: +; X64: # %bb.0: # %entry +; X64-NEXT: aesenc256kl (%rdi), %xmm0 +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; X32-LABEL: test_mm_aesenc256kl_u8: +; X32: # %bb.0: # %entry +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: aesenc256kl (%eax), %xmm0 +; X32-NEXT: sete %al +; X32-NEXT: retl +entry: + %0 = tail call { i8, <2 x i64> } @llvm.x86.aesenc256kl(<2 x i64> %data, i8* %h) + %1 = extractvalue { i8, <2 x i64> } %0, 0 + ret i8 %1 +} + +define i8 @test_mm_aesdec256kl_u8(<2 x i64> %data, i8* %h) { +; X64-LABEL: test_mm_aesdec256kl_u8: +; X64: # %bb.0: # %entry +; X64-NEXT: aesdec256kl (%rdi), %xmm0 +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; X32-LABEL: test_mm_aesdec256kl_u8: +; X32: # %bb.0: # %entry +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: aesdec256kl (%eax), %xmm0 +; X32-NEXT: sete %al +; X32-NEXT: retl +entry: + %0 = tail call { i8, <2 x i64> } @llvm.x86.aesdec256kl(<2 x i64> %data, i8* %h) + %1 = extractvalue { i8, <2 x i64> } %0, 0 + ret i8 %1 +} + +define i8 @test_mm_aesencwide128kl_u8(i8* %p, <2 x i64> %v0, <2 x i64> %v1, <2 x i64> %v2, <2 x i64> %v3, <2 x i64> %v4, <2 x i64> %v5, <2 x i64> %v6, <2 x i64> %v7) { +; X64-LABEL: test_mm_aesencwide128kl_u8: +; X64: # %bb.0: # %entry +; X64-NEXT: aesencwide128kl (%rdi) +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; X32-LABEL: test_mm_aesencwide128kl_u8: +; X32: # %bb.0: # %entry +; X32-NEXT: pushl %ebp +; X32-NEXT: .cfi_def_cfa_offset 8 +; X32-NEXT: .cfi_offset %ebp, -8 +; X32-NEXT: movl %esp, %ebp +; X32-NEXT: .cfi_def_cfa_register %ebp +; X32-NEXT: andl $-16, %esp +; X32-NEXT: subl $16, %esp +; X32-NEXT: vmovaps 24(%ebp), %xmm3 +; X32-NEXT: vmovaps 40(%ebp), %xmm4 +; X32-NEXT: vmovaps 56(%ebp), %xmm5 +; X32-NEXT: vmovaps 72(%ebp), %xmm6 +; X32-NEXT: vmovaps 88(%ebp), %xmm7 +; X32-NEXT: movl 8(%ebp), %eax +; X32-NEXT: aesencwide128kl (%eax) +; X32-NEXT: sete %al +; X32-NEXT: movl %ebp, %esp +; X32-NEXT: popl %ebp +; X32-NEXT: .cfi_def_cfa %esp, 4 +; X32-NEXT: retl +entry: + %0 = call { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesencwide128kl(i8* %p, <2 x i64> %v0, <2 x i64> %v1, <2 x i64> %v2, <2 x i64> %v3, <2 x i64> %v4, <2 x i64> %v5, <2 x i64> %v6, <2 x i64> %v7) + %1 = extractvalue { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 0 + ret i8 %1 +} + +define i8 @test_mm_aesencwide256kl_u8(i8* %p, <2 x i64> %v0, <2 x i64> %v1, <2 x i64> %v2, <2 x i64> %v3, <2 x i64> %v4, <2 x i64> %v5, <2 x i64> %v6, <2 x i64> %v7) { +; X64-LABEL: test_mm_aesencwide256kl_u8: +; X64: # %bb.0: # %entry +; X64-NEXT: aesencwide256kl (%rdi) +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; X32-LABEL: test_mm_aesencwide256kl_u8: +; X32: # %bb.0: # %entry +; X32-NEXT: pushl %ebp +; X32-NEXT: .cfi_def_cfa_offset 8 +; X32-NEXT: .cfi_offset %ebp, -8 +; X32-NEXT: movl %esp, %ebp +; X32-NEXT: .cfi_def_cfa_register %ebp +; X32-NEXT: andl $-16, %esp +; X32-NEXT: subl $16, %esp +; X32-NEXT: vmovaps 24(%ebp), %xmm3 +; X32-NEXT: vmovaps 40(%ebp), %xmm4 +; X32-NEXT: vmovaps 56(%ebp), %xmm5 +; X32-NEXT: vmovaps 72(%ebp), %xmm6 +; X32-NEXT: vmovaps 88(%ebp), %xmm7 +; X32-NEXT: movl 8(%ebp), %eax +; X32-NEXT: aesencwide256kl (%eax) +; X32-NEXT: sete %al +; X32-NEXT: movl %ebp, %esp +; X32-NEXT: popl %ebp +; X32-NEXT: .cfi_def_cfa %esp, 4 +; X32-NEXT: retl +entry: + %0 = call { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.x86.aesencwide256kl(i8* %p, <2 x i64> %v0, <2 x i64> %v1, <2 x i64> %v2, <2 x i64> %v3, <2 x i64> %v4, <2 x i64> %v5, <2 x i64> %v6, <2 x i64> %v7) + %1 = extractvalue { i8, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } %0, 0 + ret i8 %1 +} Index: llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-32-att.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-32-att.txt @@ -0,0 +1,276 @@ +# RUN: llvm-mc --disassemble %s -triple=i686-apple-darwin9 | FileCheck %s +# CHECK: loadiwkey %xmm2, %xmm3 +0xf3 0x0f 0x38 0xdc 0xda + +# CHECK: loadiwkey %xmm2, %xmm6 +0xf3 0x0f 0x38 0xdc 0xf2 + +# CHECK: encodekey128 %eax, %ebx +0xf3 0x0f 0x38 0xfa 0xd8 + +# CHECK: encodekey128 %eax, %edx +0xf3 0x0f 0x38 0xfa 0xd0 + +# CHECK: encodekey256 %eax, %ebx +0xf3 0x0f 0x38 0xfb 0xd8 + +# CHECK: encodekey256 %eax, %edx +0xf3 0x0f 0x38 0xfb 0xd0 + +# CHECK: aesenc128kl 126(%edx), %xmm2 +0xf3 0x0f 0x38 0xdc 0x52 0x7e + +# CHECK: aesdec128kl 126(%edx), %xmm2 +0xf3 0x0f 0x38 0xdd 0x52 0x7e + +# CHECK: aesenc256kl 126(%edx), %xmm2 +0xf3 0x0f 0x38 0xde 0x52 0x7e + +# CHECK: aesdec256kl 126(%edx), %xmm2 +0xf3 0x0f 0x38 0xdf 0x52 0x7e + +# CHECK: aesencwide128kl (%ebx) +0xf3 0x0f 0x38 0xd8 0x03 + +# CHECK: aesencwide128kl 126(%edx) +0xf3 0x0f 0x38 0xd8 0x42 0x7e + +# CHECK: aesdecwide128kl (%ebx) +0xf3 0x0f 0x38 0xd8 0x0b + +# CHECK: aesdecwide128kl 126(%edx) +0xf3 0x0f 0x38 0xd8 0x4a 0x7e + +# CHECK: aesencwide256kl (%ebx) +0xf3 0x0f 0x38 0xd8 0x13 + +# CHECK: aesencwide256kl 126(%edx) +0xf3 0x0f 0x38 0xd8 0x52 0x7e + +# CHECK: aesdecwide256kl (%ebx) +0xf3 0x0f 0x38 0xd8 0x1b + +# CHECK: aesdecwide256kl 126(%edx) +0xf3 0x0f 0x38 0xd8 0x5a 0x7e + +# CHECK: aesdec128kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xdd,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xdd,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xdd,0x10 + +# CHECK: aesdec128kl -1536(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xdd,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl 6096(%ecx), %xmm2 +0xf3,0x0f,0x38,0xdd,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl -6144(%edx), %xmm2 +0xf3,0x0f,0x38,0xdd,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xdf,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xdf,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xdf,0x10 + +# CHECK: aesdec256kl -2048(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xdf,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl 8128(%ecx), %xmm2 +0xf3,0x0f,0x38,0xdf,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl -8192(%edx), %xmm2 +0xf3,0x0f,0x38,0xdf,0x92,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xdc,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xdc,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xdc,0x10 + +# CHECK: aesenc128kl -1536(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xdc,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl 6096(%ecx), %xmm2 +0xf3,0x0f,0x38,0xdc,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl -6144(%edx), %xmm2 +0xf3,0x0f,0x38,0xdc,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xde,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xde,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xde,0x10 + +# CHECK: aesenc256kl -2048(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xde,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl 8128(%ecx), %xmm2 +0xf3,0x0f,0x38,0xde,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl -8192(%edx), %xmm2 +0xf3,0x0f,0x38,0xde,0x92,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey %xmm3, %xmm2 +0xf3,0x0f,0x38,0xdc,0xd3 + +# CHECK: aesdec128kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xdd,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xdd,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xdd,0x10 + +# CHECK: aesdec128kl -1536(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xdd,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl 6096(%ecx), %xmm2 +0xf3,0x0f,0x38,0xdd,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl -6144(%edx), %xmm2 +0xf3,0x0f,0x38,0xdd,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xdf,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xdf,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xdf,0x10 + +# CHECK: aesdec256kl -2048(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xdf,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl 8128(%ecx), %xmm2 +0xf3,0x0f,0x38,0xdf,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl -8192(%edx), %xmm2 +0xf3,0x0f,0x38,0xdf,0x92,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xdc,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xdc,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xdc,0x10 + +# CHECK: aesenc128kl -1536(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xdc,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl 6096(%ecx), %xmm2 +0xf3,0x0f,0x38,0xdc,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl -6144(%edx), %xmm2 +0xf3,0x0f,0x38,0xdc,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl 268435456(%esp,%esi,8), %xmm2 +0xf3,0x0f,0x38,0xde,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl 291(%edi,%eax,4), %xmm2 +0xf3,0x0f,0x38,0xde,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl (%eax), %xmm2 +0xf3,0x0f,0x38,0xde,0x10 + +# CHECK: aesenc256kl -2048(,%ebp,2), %xmm2 +0xf3,0x0f,0x38,0xde,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl 8128(%ecx), %xmm2 +0xf3,0x0f,0x38,0xde,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl -8192(%edx), %xmm2 +0xf3,0x0f,0x38,0xde,0x92,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey %xmm3, %xmm2 +0xf3,0x0f,0x38,0xdc,0xd3 + +# CHECK: aesdecwide128kl 268435456(%esp,%esi,8) +0xf3,0x0f,0x38,0xd8,0x8c,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide128kl 291(%edi,%eax,4) +0xf3,0x0f,0x38,0xd8,0x8c,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide128kl (%eax) +0xf3,0x0f,0x38,0xd8,0x08 + +# CHECK: aesdecwide128kl -1536(,%ebp,2) +0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdecwide128kl 6096(%ecx) +0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00 + +# CHECK: aesdecwide128kl -6144(%edx) +0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff + +# CHECK: aesdecwide256kl 268435456(%esp,%esi,8) +0xf3,0x0f,0x38,0xd8,0x9c,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide256kl 291(%edi,%eax,4) +0xf3,0x0f,0x38,0xd8,0x9c,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide256kl (%eax) +0xf3,0x0f,0x38,0xd8,0x18 + +# CHECK: aesdecwide256kl -2048(,%ebp,2) +0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdecwide256kl 8128(%ecx) +0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdecwide256kl -8192(%edx) +0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff + +# CHECK: aesencwide128kl 268435456(%esp,%esi,8) +0xf3,0x0f,0x38,0xd8,0x84,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide128kl 291(%edi,%eax,4) +0xf3,0x0f,0x38,0xd8,0x84,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide128kl (%eax) +0xf3,0x0f,0x38,0xd8,0x00 + +# CHECK: aesencwide128kl -1536(,%ebp,2) +0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesencwide128kl 6096(%ecx) +0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00 + +# CHECK: aesencwide128kl -6144(%edx) +0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff + +# CHECK: aesencwide256kl 268435456(%esp,%esi,8) +0xf3,0x0f,0x38,0xd8,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide256kl 291(%edi,%eax,4) +0xf3,0x0f,0x38,0xd8,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide256kl (%eax) +0xf3,0x0f,0x38,0xd8,0x10 + +# CHECK: aesencwide256kl -2048(,%ebp,2) +0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesencwide256kl 8128(%ecx) +0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesencwide256kl -8192(%edx) +0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff Index: llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-32-intel.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-32-intel.txt @@ -0,0 +1,223 @@ +# RUN: llvm-mc --disassemble %s -triple=i386 -x86-asm-syntax=intel --output-asm-variant=1 | FileCheck %s + +# CHECK: aesdec128kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xdd,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xdd,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl xmm2, [eax] +0xf3,0x0f,0x38,0xdd,0x10 + +# CHECK: aesdec128kl xmm2, [2*ebp - 1536] +0xf3,0x0f,0x38,0xdd,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl xmm2, [ecx + 6096] +0xf3,0x0f,0x38,0xdd,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl xmm2, [edx - 6144] +0xf3,0x0f,0x38,0xdd,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xdf,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xdf,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl xmm2, [eax] +0xf3,0x0f,0x38,0xdf,0x10 + +# CHECK: aesdec256kl xmm2, [2*ebp - 2048] +0xf3,0x0f,0x38,0xdf,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl xmm2, [ecx + 8128] +0xf3,0x0f,0x38,0xdf,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl xmm2, [edx - 8192] +0xf3,0x0f,0x38,0xdf,0x92,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xdc,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xdc,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl xmm2, [eax] +0xf3,0x0f,0x38,0xdc,0x10 + +# CHECK: aesenc128kl xmm2, [2*ebp - 1536] +0xf3,0x0f,0x38,0xdc,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl xmm2, [ecx + 6096] +0xf3,0x0f,0x38,0xdc,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl xmm2, [edx - 6144] +0xf3,0x0f,0x38,0xdc,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xde,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xde,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl xmm2, [eax] +0xf3,0x0f,0x38,0xde,0x10 + +# CHECK: aesenc256kl xmm2, [2*ebp - 2048] +0xf3,0x0f,0x38,0xde,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl xmm2, [ecx + 8128] +0xf3,0x0f,0x38,0xde,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl xmm2, [edx - 8192] +0xf3,0x0f,0x38,0xde,0x92,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey xmm2, xmm3 +0xf3,0x0f,0x38,0xdc,0xd3 + +# CHECK: aesdec128kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xdd,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xdd,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl xmm2, [eax] +0xf3,0x0f,0x38,0xdd,0x10 + +# CHECK: aesdec128kl xmm2, [2*ebp - 1536] +0xf3,0x0f,0x38,0xdd,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl xmm2, [ecx + 6096] +0xf3,0x0f,0x38,0xdd,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl xmm2, [edx - 6144] +0xf3,0x0f,0x38,0xdd,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xdf,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xdf,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl xmm2, [eax] +0xf3,0x0f,0x38,0xdf,0x10 + +# CHECK: aesdec256kl xmm2, [2*ebp - 2048] +0xf3,0x0f,0x38,0xdf,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl xmm2, [ecx + 8128] +0xf3,0x0f,0x38,0xdf,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl xmm2, [edx - 8192] +0xf3,0x0f,0x38,0xdf,0x92,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xdc,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xdc,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl xmm2, [eax] +0xf3,0x0f,0x38,0xdc,0x10 + +# CHECK: aesenc128kl xmm2, [2*ebp - 1536] +0xf3,0x0f,0x38,0xdc,0x14,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl xmm2, [ecx + 6096] +0xf3,0x0f,0x38,0xdc,0x91,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl xmm2, [edx - 6144] +0xf3,0x0f,0x38,0xdc,0x92,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl xmm2, [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xde,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl xmm2, [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xde,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl xmm2, [eax] +0xf3,0x0f,0x38,0xde,0x10 + +# CHECK: aesenc256kl xmm2, [2*ebp - 2048] +0xf3,0x0f,0x38,0xde,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl xmm2, [ecx + 8128] +0xf3,0x0f,0x38,0xde,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl xmm2, [edx - 8192] +0xf3,0x0f,0x38,0xde,0x92,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey xmm2, xmm3 +0xf3,0x0f,0x38,0xdc,0xd3 + +# CHECK: aesdecwide128kl [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xd8,0x8c,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide128kl [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xd8,0x8c,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide128kl [eax] +0xf3,0x0f,0x38,0xd8,0x08 + +# CHECK: aesdecwide128kl [2*ebp - 1536] +0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdecwide128kl [ecx + 6096] +0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00 + +# CHECK: aesdecwide128kl [edx - 6144] +0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff + +# CHECK: aesdecwide256kl [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xd8,0x9c,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide256kl [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xd8,0x9c,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide256kl [eax] +0xf3,0x0f,0x38,0xd8,0x18 + +# CHECK: aesdecwide256kl [2*ebp - 2048] +0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdecwide256kl [ecx + 8128] +0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdecwide256kl [edx - 8192] +0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff + +# CHECK: aesencwide128kl [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xd8,0x84,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide128kl [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xd8,0x84,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide128kl [eax] +0xf3,0x0f,0x38,0xd8,0x00 + +# CHECK: aesencwide128kl [2*ebp - 1536] +0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesencwide128kl [ecx + 6096] +0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00 + +# CHECK: aesencwide128kl [edx - 6144] +0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff + +# CHECK: aesencwide256kl [esp + 8*esi + 268435456] +0xf3,0x0f,0x38,0xd8,0x94,0xf4,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide256kl [edi + 4*eax + 291] +0xf3,0x0f,0x38,0xd8,0x94,0x87,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide256kl [eax] +0xf3,0x0f,0x38,0xd8,0x10 + +# CHECK: aesencwide256kl [2*ebp - 2048] +0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesencwide256kl [ecx + 8128] +0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesencwide256kl [edx - 8192] +0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff Index: llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-64-att.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-64-att.txt @@ -0,0 +1,277 @@ +# RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s +# CHECK: loadiwkey %xmm2, %xmm3 +0xf3 0x0f 0x38 0xdc 0xda + +# CHECK: loadiwkey %xmm2, %xmm6 +0xf3 0x0f 0x38 0xdc 0xf2 + +# CHECK: encodekey128 %eax, %ebx +0xf3 0x0f 0x38 0xfa 0xd8 + +# CHECK: encodekey128 %eax, %edx +0xf3 0x0f 0x38 0xfa 0xd0 + +# CHECK: encodekey256 %eax, %ebx +0xf3 0x0f 0x38 0xfb 0xd8 + +# CHECK: encodekey256 %eax, %edx +0xf3 0x0f 0x38 0xfb 0xd0 + +# CHECK: aesenc128kl 126(%rdx), %xmm2 +0xf3 0x0f 0x38 0xdc 0x52 0x7e + +# CHECK: aesdec128kl 126(%rdx), %xmm2 +0xf3 0x0f 0x38 0xdd 0x52 0x7e + +# CHECK: aesenc256kl 126(%rdx), %xmm2 +0xf3 0x0f 0x38 0xde 0x52 0x7e + +# CHECK: aesdec256kl 126(%rdx), %xmm2 +0xf3 0x0f 0x38 0xdf 0x52 0x7e + +# CHECK: aesencwide128kl (%rbx) +0xf3 0x0f 0x38 0xd8 0x03 + +# CHECK: aesencwide128kl 126(%rdx) +0xf3 0x0f 0x38 0xd8 0x42 0x7e + +# CHECK: aesdecwide128kl (%rbx) +0xf3 0x0f 0x38 0xd8 0x0b + +# CHECK: aesdecwide128kl 126(%rdx) +0xf3 0x0f 0x38 0xd8 0x4a 0x7e + +# CHECK: aesencwide256kl (%rbx) +0xf3 0x0f 0x38 0xd8 0x13 + +# CHECK: aesencwide256kl 126(%rdx) +0xf3 0x0f 0x38 0xd8 0x52 0x7e + +# CHECK: aesdecwide256kl (%rbx) +0xf3 0x0f 0x38 0xd8 0x1b + +# CHECK: aesdecwide256kl 126(%rdx) +0xf3 0x0f 0x38 0xd8 0x5a 0x7e + +# CHECK: aesdec128kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xdd,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xdd,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xdd,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec128kl -1536(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xdd,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl 6096(%rcx), %xmm6 +0xf3,0x0f,0x38,0xdd,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl -6144(%rdx), %xmm6 +0xf3,0x0f,0x38,0xdd,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xdf,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xdf,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xdf,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec256kl -2048(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xdf,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl 8128(%rcx), %xmm6 +0xf3,0x0f,0x38,0xdf,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl -8192(%rdx), %xmm6 +0xf3,0x0f,0x38,0xdf,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xdc,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xdc,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xdc,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc128kl -1536(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xdc,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl 6096(%rcx), %xmm6 +0xf3,0x0f,0x38,0xdc,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl -6144(%rdx), %xmm6 +0xf3,0x0f,0x38,0xdc,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xde,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xde,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xde,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc256kl -2048(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xde,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl 8128(%rcx), %xmm6 +0xf3,0x0f,0x38,0xde,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl -8192(%rdx), %xmm6 +0xf3,0x0f,0x38,0xde,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey %xmm7, %xmm6 +0xf3,0x0f,0x38,0xdc,0xf7 + +# CHECK: aesdec128kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xdd,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xdd,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xdd,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec128kl -1536(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xdd,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl 6096(%rcx), %xmm6 +0xf3,0x0f,0x38,0xdd,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl -6144(%rdx), %xmm6 +0xf3,0x0f,0x38,0xdd,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xdf,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xdf,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xdf,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec256kl -2048(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xdf,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl 8128(%rcx), %xmm6 +0xf3,0x0f,0x38,0xdf,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl -8192(%rdx), %xmm6 +0xf3,0x0f,0x38,0xdf,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xdc,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xdc,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xdc,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc128kl -1536(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xdc,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl 6096(%rcx), %xmm6 +0xf3,0x0f,0x38,0xdc,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl -6144(%rdx), %xmm6 +0xf3,0x0f,0x38,0xdc,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl 268435456(%rbp,%r14,8), %xmm6 +0xf3,0x42,0x0f,0x38,0xde,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl 291(%r8,%rax,4), %xmm6 +0xf3,0x41,0x0f,0x38,0xde,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl (%rip), %xmm6 +0xf3,0x0f,0x38,0xde,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc256kl -2048(,%rbp,2), %xmm6 +0xf3,0x0f,0x38,0xde,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl 8128(%rcx), %xmm6 +0xf3,0x0f,0x38,0xde,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl -8192(%rdx), %xmm6 +0xf3,0x0f,0x38,0xde,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey %xmm7, %xmm6 +0xf3,0x0f,0x38,0xdc,0xf7 + +# CHECK: aesdecwide128kl 268435456(%rbp,%r14,8) +0xf3,0x42,0x0f,0x38,0xd8,0x8c,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide128kl 291(%r8,%rax,4) +0xf3,0x41,0x0f,0x38,0xd8,0x8c,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide128kl (%rip) +0xf3,0x0f,0x38,0xd8,0x0d,0x00,0x00,0x00,0x00 + +# CHECK: aesdecwide128kl -1536(,%rbp,2) +0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdecwide128kl 6096(%rcx) +0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00 + +# CHECK: aesdecwide128kl -6144(%rdx) +0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff + +# CHECK: aesdecwide256kl 268435456(%rbp,%r14,8) +0xf3,0x42,0x0f,0x38,0xd8,0x9c,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide256kl 291(%r8,%rax,4) +0xf3,0x41,0x0f,0x38,0xd8,0x9c,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide256kl (%rip) +0xf3,0x0f,0x38,0xd8,0x1d,0x00,0x00,0x00,0x00 + +# CHECK: aesdecwide256kl -2048(,%rbp,2) +0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdecwide256kl 8128(%rcx) +0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdecwide256kl -8192(%rdx) +0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff + +# CHECK: aesencwide128kl 268435456(%rbp,%r14,8) +0xf3,0x42,0x0f,0x38,0xd8,0x84,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide128kl 291(%r8,%rax,4) +0xf3,0x41,0x0f,0x38,0xd8,0x84,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide128kl (%rip) +0xf3,0x0f,0x38,0xd8,0x05,0x00,0x00,0x00,0x00 + +# CHECK: aesencwide128kl -1536(,%rbp,2) +0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesencwide128kl 6096(%rcx) +0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00 + +# CHECK: aesencwide128kl -6144(%rdx) +0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff + +# CHECK: aesencwide256kl 268435456(%rbp,%r14,8) +0xf3,0x42,0x0f,0x38,0xd8,0x94,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide256kl 291(%r8,%rax,4) +0xf3,0x41,0x0f,0x38,0xd8,0x94,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide256kl (%rip) +0xf3,0x0f,0x38,0xd8,0x15,0x00,0x00,0x00,0x00 + +# CHECK: aesencwide256kl -2048(,%rbp,2) +0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesencwide256kl 8128(%rcx) +0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesencwide256kl -8192(%rdx) +0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff + Index: llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-64-intel.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/X86/KEYLOCKER/Keylocker-x86-64-intel.txt @@ -0,0 +1,223 @@ +# RUN: llvm-mc --disassemble %s -triple=x86_64 -x86-asm-syntax=intel --output-asm-variant=1 | FileCheck %s + +# CHECK: aesdec128kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xdd,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xdd,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl xmm6, [rip] +0xf3,0x0f,0x38,0xdd,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec128kl xmm6, [2*rbp - 1536] +0xf3,0x0f,0x38,0xdd,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl xmm6, [rcx + 6096] +0xf3,0x0f,0x38,0xdd,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl xmm6, [rdx - 6144] +0xf3,0x0f,0x38,0xdd,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xdf,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xdf,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl xmm6, [rip] +0xf3,0x0f,0x38,0xdf,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec256kl xmm6, [2*rbp - 2048] +0xf3,0x0f,0x38,0xdf,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl xmm6, [rcx + 8128] +0xf3,0x0f,0x38,0xdf,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl xmm6, [rdx - 8192] +0xf3,0x0f,0x38,0xdf,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xdc,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xdc,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl xmm6, [rip] +0xf3,0x0f,0x38,0xdc,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc128kl xmm6, [2*rbp - 1536] +0xf3,0x0f,0x38,0xdc,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl xmm6, [rcx + 6096] +0xf3,0x0f,0x38,0xdc,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl xmm6, [rdx - 6144] +0xf3,0x0f,0x38,0xdc,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xde,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xde,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl xmm6, [rip] +0xf3,0x0f,0x38,0xde,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc256kl xmm6, [2*rbp - 2048] +0xf3,0x0f,0x38,0xde,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl xmm6, [rcx + 8128] +0xf3,0x0f,0x38,0xde,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl xmm6, [rdx - 8192] +0xf3,0x0f,0x38,0xde,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey xmm6, xmm7 +0xf3,0x0f,0x38,0xdc,0xf7 + +# CHECK: aesdec128kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xdd,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec128kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xdd,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec128kl xmm6, [rip] +0xf3,0x0f,0x38,0xdd,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec128kl xmm6, [2*rbp - 1536] +0xf3,0x0f,0x38,0xdd,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdec128kl xmm6, [rcx + 6096] +0xf3,0x0f,0x38,0xdd,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesdec128kl xmm6, [rdx - 6144] +0xf3,0x0f,0x38,0xdd,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesdec256kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xdf,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdec256kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xdf,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdec256kl xmm6, [rip] +0xf3,0x0f,0x38,0xdf,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesdec256kl xmm6, [2*rbp - 2048] +0xf3,0x0f,0x38,0xdf,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdec256kl xmm6, [rcx + 8128] +0xf3,0x0f,0x38,0xdf,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdec256kl xmm6, [rdx - 8192] +0xf3,0x0f,0x38,0xdf,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: aesenc128kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xdc,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc128kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xdc,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc128kl xmm6, [rip] +0xf3,0x0f,0x38,0xdc,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc128kl xmm6, [2*rbp - 1536] +0xf3,0x0f,0x38,0xdc,0x34,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesenc128kl xmm6, [rcx + 6096] +0xf3,0x0f,0x38,0xdc,0xb1,0xd0,0x17,0x00,0x00 + +# CHECK: aesenc128kl xmm6, [rdx - 6144] +0xf3,0x0f,0x38,0xdc,0xb2,0x00,0xe8,0xff,0xff + +# CHECK: aesenc256kl xmm6, [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xde,0xb4,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesenc256kl xmm6, [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xde,0xb4,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesenc256kl xmm6, [rip] +0xf3,0x0f,0x38,0xde,0x35,0x00,0x00,0x00,0x00 + +# CHECK: aesenc256kl xmm6, [2*rbp - 2048] +0xf3,0x0f,0x38,0xde,0x34,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesenc256kl xmm6, [rcx + 8128] +0xf3,0x0f,0x38,0xde,0xb1,0xc0,0x1f,0x00,0x00 + +# CHECK: aesenc256kl xmm6, [rdx - 8192] +0xf3,0x0f,0x38,0xde,0xb2,0x00,0xe0,0xff,0xff + +# CHECK: loadiwkey xmm6, xmm7 +0xf3,0x0f,0x38,0xdc,0xf7 + +# CHECK: aesdecwide128kl [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xd8,0x8c,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide128kl [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xd8,0x8c,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide128kl [rip] +0xf3,0x0f,0x38,0xd8,0x0d,0x00,0x00,0x00,0x00 + +# CHECK: aesdecwide128kl [2*rbp - 1536] +0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesdecwide128kl [rcx + 6096] +0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00 + +# CHECK: aesdecwide128kl [rdx - 6144] +0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff + +# CHECK: aesdecwide256kl [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xd8,0x9c,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesdecwide256kl [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xd8,0x9c,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesdecwide256kl [rip] +0xf3,0x0f,0x38,0xd8,0x1d,0x00,0x00,0x00,0x00 + +# CHECK: aesdecwide256kl [2*rbp - 2048] +0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesdecwide256kl [rcx + 8128] +0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00 + +# CHECK: aesdecwide256kl [rdx - 8192] +0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff + +# CHECK: aesencwide128kl [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xd8,0x84,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide128kl [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xd8,0x84,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide128kl [rip] +0xf3,0x0f,0x38,0xd8,0x05,0x00,0x00,0x00,0x00 + +# CHECK: aesencwide128kl [2*rbp - 1536] +0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff + +# CHECK: aesencwide128kl [rcx + 6096] +0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00 + +# CHECK: aesencwide128kl [rdx - 6144] +0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff + +# CHECK: aesencwide256kl [rbp + 8*r14 + 268435456] +0xf3,0x42,0x0f,0x38,0xd8,0x94,0xf5,0x00,0x00,0x00,0x10 + +# CHECK: aesencwide256kl [r8 + 4*rax + 291] +0xf3,0x41,0x0f,0x38,0xd8,0x94,0x80,0x23,0x01,0x00,0x00 + +# CHECK: aesencwide256kl [rip] +0xf3,0x0f,0x38,0xd8,0x15,0x00,0x00,0x00,0x00 + +# CHECK: aesencwide256kl [2*rbp - 2048] +0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff + +# CHECK: aesencwide256kl [rcx + 8128] +0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00 + +# CHECK: aesencwide256kl [rdx - 8192] +0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff Index: llvm/test/MC/X86/KEYLOCKER/keylocker-att.s =================================================================== --- /dev/null +++ llvm/test/MC/X86/KEYLOCKER/keylocker-att.s @@ -0,0 +1,205 @@ +// RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s + +// CHECK: aesdec128kl 268435456(%esp,%esi,8), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x94,0xf4,0x00,0x00,0x00,0x10] + aesdec128kl 268435456(%esp,%esi,8), %xmm2 + +// CHECK: aesdec128kl 291(%edi,%eax,4), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x94,0x87,0x23,0x01,0x00,0x00] + aesdec128kl 291(%edi,%eax,4), %xmm2 + +// CHECK: aesdec128kl (%eax), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x10] + aesdec128kl (%eax), %xmm2 + +// CHECK: aesdec128kl -1536(,%ebp,2), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x14,0x6d,0x00,0xfa,0xff,0xff] + aesdec128kl -1536(,%ebp,2), %xmm2 + +// CHECK: aesdec128kl 6096(%ecx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x91,0xd0,0x17,0x00,0x00] + aesdec128kl 6096(%ecx), %xmm2 + +// CHECK: aesdec128kl -6144(%edx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x92,0x00,0xe8,0xff,0xff] + aesdec128kl -6144(%edx), %xmm2 + +// CHECK: aesdec256kl 268435456(%esp,%esi,8), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x94,0xf4,0x00,0x00,0x00,0x10] + aesdec256kl 268435456(%esp,%esi,8), %xmm2 + +// CHECK: aesdec256kl 291(%edi,%eax,4), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x94,0x87,0x23,0x01,0x00,0x00] + aesdec256kl 291(%edi,%eax,4), %xmm2 + +// CHECK: aesdec256kl (%eax), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x10] + aesdec256kl (%eax), %xmm2 + +// CHECK: aesdec256kl -2048(,%ebp,2), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesdec256kl -2048(,%ebp,2), %xmm2 + +// CHECK: aesdec256kl 8128(%ecx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x91,0xc0,0x1f,0x00,0x00] + aesdec256kl 8128(%ecx), %xmm2 + +// CHECK: aesdec256kl -8192(%edx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x92,0x00,0xe0,0xff,0xff] + aesdec256kl -8192(%edx), %xmm2 + +// CHECK: aesenc128kl 268435456(%esp,%esi,8), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x94,0xf4,0x00,0x00,0x00,0x10] + aesenc128kl 268435456(%esp,%esi,8), %xmm2 + +// CHECK: aesenc128kl 291(%edi,%eax,4), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x94,0x87,0x23,0x01,0x00,0x00] + aesenc128kl 291(%edi,%eax,4), %xmm2 + +// CHECK: aesenc128kl (%eax), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x10] + aesenc128kl (%eax), %xmm2 + +// CHECK: aesenc128kl -1536(,%ebp,2), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x14,0x6d,0x00,0xfa,0xff,0xff] + aesenc128kl -1536(,%ebp,2), %xmm2 + +// CHECK: aesenc128kl 6096(%ecx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x91,0xd0,0x17,0x00,0x00] + aesenc128kl 6096(%ecx), %xmm2 + +// CHECK: aesenc128kl -6144(%edx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x92,0x00,0xe8,0xff,0xff] + aesenc128kl -6144(%edx), %xmm2 + +// CHECK: aesenc256kl 268435456(%esp,%esi,8), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x94,0xf4,0x00,0x00,0x00,0x10] + aesenc256kl 268435456(%esp,%esi,8), %xmm2 + +// CHECK: aesenc256kl 291(%edi,%eax,4), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x94,0x87,0x23,0x01,0x00,0x00] + aesenc256kl 291(%edi,%eax,4), %xmm2 + +// CHECK: aesenc256kl (%eax), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x10] + aesenc256kl (%eax), %xmm2 + +// CHECK: aesenc256kl -2048(,%ebp,2), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesenc256kl -2048(,%ebp,2), %xmm2 + +// CHECK: aesenc256kl 8128(%ecx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x91,0xc0,0x1f,0x00,0x00] + aesenc256kl 8128(%ecx), %xmm2 + +// CHECK: aesenc256kl -8192(%edx), %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x92,0x00,0xe0,0xff,0xff] + aesenc256kl -8192(%edx), %xmm2 + +// CHECK: encodekey128 %ecx, %ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfa,0xc9] + encodekey128 %ecx, %ecx + +// CHECK: encodekey256 %ecx, %ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfb,0xc9] + encodekey256 %ecx, %ecx + +// CHECK: loadiwkey %xmm3, %xmm2 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xd3] + loadiwkey %xmm3, %xmm2 + +// CHECK: aesdecwide128kl 268435456(%esp,%esi,8) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8c,0xf4,0x00,0x00,0x00,0x10] + aesdecwide128kl 268435456(%esp,%esi,8) + +// CHECK: aesdecwide128kl 291(%edi,%eax,4) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8c,0x87,0x23,0x01,0x00,0x00] + aesdecwide128kl 291(%edi,%eax,4) + +// CHECK: aesdecwide128kl (%eax) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x08] + aesdecwide128kl (%eax) + +// CHECK: aesdecwide128kl -1536(,%ebp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff] + aesdecwide128kl -1536(,%ebp,2) + +// CHECK: aesdecwide128kl 6096(%ecx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00] + aesdecwide128kl 6096(%ecx) + +// CHECK: aesdecwide128kl -6144(%edx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff] + aesdecwide128kl -6144(%edx) + +// CHECK: aesdecwide256kl 268435456(%esp,%esi,8) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9c,0xf4,0x00,0x00,0x00,0x10] + aesdecwide256kl 268435456(%esp,%esi,8) + +// CHECK: aesdecwide256kl 291(%edi,%eax,4) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9c,0x87,0x23,0x01,0x00,0x00] + aesdecwide256kl 291(%edi,%eax,4) + +// CHECK: aesdecwide256kl (%eax) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x18] + aesdecwide256kl (%eax) + +// CHECK: aesdecwide256kl -2048(,%ebp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff] + aesdecwide256kl -2048(,%ebp,2) + +// CHECK: aesdecwide256kl 8128(%ecx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00] + aesdecwide256kl 8128(%ecx) + +// CHECK: aesdecwide256kl -8192(%edx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff] + aesdecwide256kl -8192(%edx) + +// CHECK: aesencwide128kl 268435456(%esp,%esi,8) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x84,0xf4,0x00,0x00,0x00,0x10] + aesencwide128kl 268435456(%esp,%esi,8) + +// CHECK: aesencwide128kl 291(%edi,%eax,4) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x84,0x87,0x23,0x01,0x00,0x00] + aesencwide128kl 291(%edi,%eax,4) + +// CHECK: aesencwide128kl (%eax) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x00] + aesencwide128kl (%eax) + +// CHECK: aesencwide128kl -1536(,%ebp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff] + aesencwide128kl -1536(,%ebp,2) + +// CHECK: aesencwide128kl 6096(%ecx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00] + aesencwide128kl 6096(%ecx) + +// CHECK: aesencwide128kl -6144(%edx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff] + aesencwide128kl -6144(%edx) + +// CHECK: aesencwide256kl 268435456(%esp,%esi,8) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x94,0xf4,0x00,0x00,0x00,0x10] + aesencwide256kl 268435456(%esp,%esi,8) + +// CHECK: aesencwide256kl 291(%edi,%eax,4) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x94,0x87,0x23,0x01,0x00,0x00] + aesencwide256kl 291(%edi,%eax,4) + +// CHECK: aesencwide256kl (%eax) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x10] + aesencwide256kl (%eax) + +// CHECK: aesencwide256kl -2048(,%ebp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesencwide256kl -2048(,%ebp,2) + +// CHECK: aesencwide256kl 8128(%ecx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00] + aesencwide256kl 8128(%ecx) + +// CHECK: aesencwide256kl -8192(%edx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff] + aesencwide256kl -8192(%edx) Index: llvm/test/MC/X86/KEYLOCKER/keylocker-intel.s =================================================================== --- /dev/null +++ llvm/test/MC/X86/KEYLOCKER/keylocker-intel.s @@ -0,0 +1,205 @@ +// RUN: llvm-mc -triple i386-unknown-unknown -x86-asm-syntax=intel -output-asm-variant=1 --show-encoding %s | FileCheck %s + +// CHECK: aesdec128kl xmm2, [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x94,0xf4,0x00,0x00,0x00,0x10] + aesdec128kl xmm2, [esp + 8*esi + 268435456] + +// CHECK: aesdec128kl xmm2, [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x94,0x87,0x23,0x01,0x00,0x00] + aesdec128kl xmm2, [edi + 4*eax + 291] + +// CHECK: aesdec128kl xmm2, [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x10] + aesdec128kl xmm2, [eax] + +// CHECK: aesdec128kl xmm2, [2*ebp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x14,0x6d,0x00,0xfa,0xff,0xff] + aesdec128kl xmm2, [2*ebp - 1536] + +// CHECK: aesdec128kl xmm2, [ecx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x91,0xd0,0x17,0x00,0x00] + aesdec128kl xmm2, [ecx + 6096] + +// CHECK: aesdec128kl xmm2, [edx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x92,0x00,0xe8,0xff,0xff] + aesdec128kl xmm2, [edx - 6144] + +// CHECK: aesdec256kl xmm2, [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x94,0xf4,0x00,0x00,0x00,0x10] + aesdec256kl xmm2, [esp + 8*esi + 268435456] + +// CHECK: aesdec256kl xmm2, [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x94,0x87,0x23,0x01,0x00,0x00] + aesdec256kl xmm2, [edi + 4*eax + 291] + +// CHECK: aesdec256kl xmm2, [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x10] + aesdec256kl xmm2, [eax] + +// CHECK: aesdec256kl xmm2, [2*ebp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesdec256kl xmm2, [2*ebp - 2048] + +// CHECK: aesdec256kl xmm2, [ecx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x91,0xc0,0x1f,0x00,0x00] + aesdec256kl xmm2, [ecx + 8128] + +// CHECK: aesdec256kl xmm2, [edx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x92,0x00,0xe0,0xff,0xff] + aesdec256kl xmm2, [edx - 8192] + +// CHECK: aesenc128kl xmm2, [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x94,0xf4,0x00,0x00,0x00,0x10] + aesenc128kl xmm2, [esp + 8*esi + 268435456] + +// CHECK: aesenc128kl xmm2, [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x94,0x87,0x23,0x01,0x00,0x00] + aesenc128kl xmm2, [edi + 4*eax + 291] + +// CHECK: aesenc128kl xmm2, [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x10] + aesenc128kl xmm2, [eax] + +// CHECK: aesenc128kl xmm2, [2*ebp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x14,0x6d,0x00,0xfa,0xff,0xff] + aesenc128kl xmm2, [2*ebp - 1536] + +// CHECK: aesenc128kl xmm2, [ecx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x91,0xd0,0x17,0x00,0x00] + aesenc128kl xmm2, [ecx + 6096] + +// CHECK: aesenc128kl xmm2, [edx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x92,0x00,0xe8,0xff,0xff] + aesenc128kl xmm2, [edx - 6144] + +// CHECK: aesenc256kl xmm2, [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x94,0xf4,0x00,0x00,0x00,0x10] + aesenc256kl xmm2, [esp + 8*esi + 268435456] + +// CHECK: aesenc256kl xmm2, [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x94,0x87,0x23,0x01,0x00,0x00] + aesenc256kl xmm2, [edi + 4*eax + 291] + +// CHECK: aesenc256kl xmm2, [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x10] + aesenc256kl xmm2, [eax] + +// CHECK: aesenc256kl xmm2, [2*ebp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesenc256kl xmm2, [2*ebp - 2048] + +// CHECK: aesenc256kl xmm2, [ecx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x91,0xc0,0x1f,0x00,0x00] + aesenc256kl xmm2, [ecx + 8128] + +// CHECK: aesenc256kl xmm2, [edx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x92,0x00,0xe0,0xff,0xff] + aesenc256kl xmm2, [edx - 8192] + +// CHECK: encodekey128 ecx, ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfa,0xc9] + encodekey128 ecx, ecx + +// CHECK: encodekey256 ecx, ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfb,0xc9] + encodekey256 ecx, ecx + +// CHECK: loadiwkey xmm2, xmm3 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xd3] + loadiwkey xmm2, xmm3 + +// CHECK: aesdecwide128kl [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8c,0xf4,0x00,0x00,0x00,0x10] + aesdecwide128kl [esp + 8*esi + 268435456] + +// CHECK: aesdecwide128kl [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8c,0x87,0x23,0x01,0x00,0x00] + aesdecwide128kl [edi + 4*eax + 291] + +// CHECK: aesdecwide128kl [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x08] + aesdecwide128kl [eax] + +// CHECK: aesdecwide128kl [2*ebp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff] + aesdecwide128kl [2*ebp - 1536] + +// CHECK: aesdecwide128kl [ecx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00] + aesdecwide128kl [ecx + 6096] + +// CHECK: aesdecwide128kl [edx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff] + aesdecwide128kl [edx - 6144] + +// CHECK: aesdecwide256kl [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9c,0xf4,0x00,0x00,0x00,0x10] + aesdecwide256kl [esp + 8*esi + 268435456] + +// CHECK: aesdecwide256kl [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9c,0x87,0x23,0x01,0x00,0x00] + aesdecwide256kl [edi + 4*eax + 291] + +// CHECK: aesdecwide256kl [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x18] + aesdecwide256kl [eax] + +// CHECK: aesdecwide256kl [2*ebp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff] + aesdecwide256kl [2*ebp - 2048] + +// CHECK: aesdecwide256kl [ecx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00] + aesdecwide256kl [ecx + 8128] + +// CHECK: aesdecwide256kl [edx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff] + aesdecwide256kl [edx - 8192] + +// CHECK: aesencwide128kl [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x84,0xf4,0x00,0x00,0x00,0x10] + aesencwide128kl [esp + 8*esi + 268435456] + +// CHECK: aesencwide128kl [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x84,0x87,0x23,0x01,0x00,0x00] + aesencwide128kl [edi + 4*eax + 291] + +// CHECK: aesencwide128kl [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x00] + aesencwide128kl [eax] + +// CHECK: aesencwide128kl [2*ebp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff] + aesencwide128kl [2*ebp - 1536] + +// CHECK: aesencwide128kl [ecx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00] + aesencwide128kl [ecx + 6096] + +// CHECK: aesencwide128kl [edx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff] + aesencwide128kl [edx - 6144] + +// CHECK: aesencwide256kl [esp + 8*esi + 268435456] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x94,0xf4,0x00,0x00,0x00,0x10] + aesencwide256kl [esp + 8*esi + 268435456] + +// CHECK: aesencwide256kl [edi + 4*eax + 291] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x94,0x87,0x23,0x01,0x00,0x00] + aesencwide256kl [edi + 4*eax + 291] + +// CHECK: aesencwide256kl [eax] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x10] + aesencwide256kl [eax] + +// CHECK: aesencwide256kl [2*ebp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesencwide256kl [2*ebp - 2048] + +// CHECK: aesencwide256kl [ecx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00] + aesencwide256kl [ecx + 8128] + +// CHECK: aesencwide256kl [edx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff] + aesencwide256kl [edx - 8192] Index: llvm/test/MC/X86/KEYLOCKER/x86-64-keylocker-att.s =================================================================== --- /dev/null +++ llvm/test/MC/X86/KEYLOCKER/x86-64-keylocker-att.s @@ -0,0 +1,205 @@ +// RUN: llvm-mc -triple x86_64-unknown-unknown --show-encoding %s | FileCheck %s + +// CHECK: aesdec128kl 268435456(%rbp,%r14,8), %xmm6 +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xdd,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesdec128kl 268435456(%rbp,%r14,8), %xmm6 + +// CHECK: aesdec128kl 291(%r8,%rax,4), %xmm6 +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xdd,0xb4,0x80,0x23,0x01,0x00,0x00] + aesdec128kl 291(%r8,%rax,4), %xmm6 + +// CHECK: aesdec128kl (%rip), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x35,0x00,0x00,0x00,0x00] + aesdec128kl (%rip), %xmm6 + +// CHECK: aesdec128kl -1536(,%rbp,2), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x34,0x6d,0x00,0xfa,0xff,0xff] + aesdec128kl -1536(,%rbp,2), %xmm6 + +// CHECK: aesdec128kl 6096(%rcx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0xb1,0xd0,0x17,0x00,0x00] + aesdec128kl 6096(%rcx), %xmm6 + +// CHECK: aesdec128kl -6144(%rdx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0xb2,0x00,0xe8,0xff,0xff] + aesdec128kl -6144(%rdx), %xmm6 + +// CHECK: aesdec256kl 268435456(%rbp,%r14,8), %xmm6 +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xdf,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesdec256kl 268435456(%rbp,%r14,8), %xmm6 + +// CHECK: aesdec256kl 291(%r8,%rax,4), %xmm6 +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xdf,0xb4,0x80,0x23,0x01,0x00,0x00] + aesdec256kl 291(%r8,%rax,4), %xmm6 + +// CHECK: aesdec256kl (%rip), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x35,0x00,0x00,0x00,0x00] + aesdec256kl (%rip), %xmm6 + +// CHECK: aesdec256kl -2048(,%rbp,2), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x34,0x6d,0x00,0xf8,0xff,0xff] + aesdec256kl -2048(,%rbp,2), %xmm6 + +// CHECK: aesdec256kl 8128(%rcx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0xb1,0xc0,0x1f,0x00,0x00] + aesdec256kl 8128(%rcx), %xmm6 + +// CHECK: aesdec256kl -8192(%rdx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0xb2,0x00,0xe0,0xff,0xff] + aesdec256kl -8192(%rdx), %xmm6 + +// CHECK: aesenc128kl 268435456(%rbp,%r14,8), %xmm6 +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xdc,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesenc128kl 268435456(%rbp,%r14,8), %xmm6 + +// CHECK: aesenc128kl 291(%r8,%rax,4), %xmm6 +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xdc,0xb4,0x80,0x23,0x01,0x00,0x00] + aesenc128kl 291(%r8,%rax,4), %xmm6 + +// CHECK: aesenc128kl (%rip), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x35,0x00,0x00,0x00,0x00] + aesenc128kl (%rip), %xmm6 + +// CHECK: aesenc128kl -1536(,%rbp,2), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x34,0x6d,0x00,0xfa,0xff,0xff] + aesenc128kl -1536(,%rbp,2), %xmm6 + +// CHECK: aesenc128kl 6096(%rcx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xb1,0xd0,0x17,0x00,0x00] + aesenc128kl 6096(%rcx), %xmm6 + +// CHECK: aesenc128kl -6144(%rdx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xb2,0x00,0xe8,0xff,0xff] + aesenc128kl -6144(%rdx), %xmm6 + +// CHECK: aesenc256kl 268435456(%rbp,%r14,8), %xmm6 +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xde,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesenc256kl 268435456(%rbp,%r14,8), %xmm6 + +// CHECK: aesenc256kl 291(%r8,%rax,4), %xmm6 +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xde,0xb4,0x80,0x23,0x01,0x00,0x00] + aesenc256kl 291(%r8,%rax,4), %xmm6 + +// CHECK: aesenc256kl (%rip), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x35,0x00,0x00,0x00,0x00] + aesenc256kl (%rip), %xmm6 + +// CHECK: aesenc256kl -2048(,%rbp,2), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x34,0x6d,0x00,0xf8,0xff,0xff] + aesenc256kl -2048(,%rbp,2), %xmm6 + +// CHECK: aesenc256kl 8128(%rcx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0xb1,0xc0,0x1f,0x00,0x00] + aesenc256kl 8128(%rcx), %xmm6 + +// CHECK: aesenc256kl -8192(%rdx), %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0xb2,0x00,0xe0,0xff,0xff] + aesenc256kl -8192(%rdx), %xmm6 + +// CHECK: encodekey128 %ecx, %ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfa,0xc9] + encodekey128 %ecx, %ecx + +// CHECK: encodekey256 %ecx, %ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfb,0xc9] + encodekey256 %ecx, %ecx + +// CHECK: loadiwkey %xmm7, %xmm6 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xf7] + loadiwkey %xmm7, %xmm6 + +// CHECK: aesdecwide128kl 268435456(%rbp,%r14,8) +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x8c,0xf5,0x00,0x00,0x00,0x10] + aesdecwide128kl 268435456(%rbp,%r14,8) + +// CHECK: aesdecwide128kl 291(%r8,%rax,4) +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x8c,0x80,0x23,0x01,0x00,0x00] + aesdecwide128kl 291(%r8,%rax,4) + +// CHECK: aesdecwide128kl (%rip) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x0d,0x00,0x00,0x00,0x00] + aesdecwide128kl (%rip) + +// CHECK: aesdecwide128kl -1536(,%rbp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff] + aesdecwide128kl -1536(,%rbp,2) + +// CHECK: aesdecwide128kl 6096(%rcx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00] + aesdecwide128kl 6096(%rcx) + +// CHECK: aesdecwide128kl -6144(%rdx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff] + aesdecwide128kl -6144(%rdx) + +// CHECK: aesdecwide256kl 268435456(%rbp,%r14,8) +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x9c,0xf5,0x00,0x00,0x00,0x10] + aesdecwide256kl 268435456(%rbp,%r14,8) + +// CHECK: aesdecwide256kl 291(%r8,%rax,4) +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x9c,0x80,0x23,0x01,0x00,0x00] + aesdecwide256kl 291(%r8,%rax,4) + +// CHECK: aesdecwide256kl (%rip) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x1d,0x00,0x00,0x00,0x00] + aesdecwide256kl (%rip) + +// CHECK: aesdecwide256kl -2048(,%rbp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff] + aesdecwide256kl -2048(,%rbp,2) + +// CHECK: aesdecwide256kl 8128(%rcx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00] + aesdecwide256kl 8128(%rcx) + +// CHECK: aesdecwide256kl -8192(%rdx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff] + aesdecwide256kl -8192(%rdx) + +// CHECK: aesencwide128kl 268435456(%rbp,%r14,8) +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x84,0xf5,0x00,0x00,0x00,0x10] + aesencwide128kl 268435456(%rbp,%r14,8) + +// CHECK: aesencwide128kl 291(%r8,%rax,4) +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x84,0x80,0x23,0x01,0x00,0x00] + aesencwide128kl 291(%r8,%rax,4) + +// CHECK: aesencwide128kl (%rip) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x05,0x00,0x00,0x00,0x00] + aesencwide128kl (%rip) + +// CHECK: aesencwide128kl -1536(,%rbp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff] + aesencwide128kl -1536(,%rbp,2) + +// CHECK: aesencwide128kl 6096(%rcx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00] + aesencwide128kl 6096(%rcx) + +// CHECK: aesencwide128kl -6144(%rdx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff] + aesencwide128kl -6144(%rdx) + +// CHECK: aesencwide256kl 268435456(%rbp,%r14,8) +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x94,0xf5,0x00,0x00,0x00,0x10] + aesencwide256kl 268435456(%rbp,%r14,8) + +// CHECK: aesencwide256kl 291(%r8,%rax,4) +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x94,0x80,0x23,0x01,0x00,0x00] + aesencwide256kl 291(%r8,%rax,4) + +// CHECK: aesencwide256kl (%rip) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x15,0x00,0x00,0x00,0x00] + aesencwide256kl (%rip) + +// CHECK: aesencwide256kl -2048(,%rbp,2) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesencwide256kl -2048(,%rbp,2) + +// CHECK: aesencwide256kl 8128(%rcx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00] + aesencwide256kl 8128(%rcx) + +// CHECK: aesencwide256kl -8192(%rdx) +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff] + aesencwide256kl -8192(%rdx) Index: llvm/test/MC/X86/KEYLOCKER/x86-64-keylocker-intel.s =================================================================== --- /dev/null +++ llvm/test/MC/X86/KEYLOCKER/x86-64-keylocker-intel.s @@ -0,0 +1,205 @@ +// RUN: llvm-mc -triple x86_64-unknown-unknown -x86-asm-syntax=intel -output-asm-variant=1 --show-encoding %s | FileCheck %s + +// CHECK: aesdec128kl xmm6, [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xdd,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesdec128kl xmm6, [rbp + 8*r14 + 268435456] + +// CHECK: aesdec128kl xmm6, [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xdd,0xb4,0x80,0x23,0x01,0x00,0x00] + aesdec128kl xmm6, [r8 + 4*rax + 291] + +// CHECK: aesdec128kl xmm6, [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x35,0x00,0x00,0x00,0x00] + aesdec128kl xmm6, [rip] + +// CHECK: aesdec128kl xmm6, [2*rbp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0x34,0x6d,0x00,0xfa,0xff,0xff] + aesdec128kl xmm6, [2*rbp - 1536] + +// CHECK: aesdec128kl xmm6, [rcx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0xb1,0xd0,0x17,0x00,0x00] + aesdec128kl xmm6, [rcx + 6096] + +// CHECK: aesdec128kl xmm6, [rdx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdd,0xb2,0x00,0xe8,0xff,0xff] + aesdec128kl xmm6, [rdx - 6144] + +// CHECK: aesdec256kl xmm6, [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xdf,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesdec256kl xmm6, [rbp + 8*r14 + 268435456] + +// CHECK: aesdec256kl xmm6, [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xdf,0xb4,0x80,0x23,0x01,0x00,0x00] + aesdec256kl xmm6, [r8 + 4*rax + 291] + +// CHECK: aesdec256kl xmm6, [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x35,0x00,0x00,0x00,0x00] + aesdec256kl xmm6, [rip] + +// CHECK: aesdec256kl xmm6, [2*rbp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0x34,0x6d,0x00,0xf8,0xff,0xff] + aesdec256kl xmm6, [2*rbp - 2048] + +// CHECK: aesdec256kl xmm6, [rcx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0xb1,0xc0,0x1f,0x00,0x00] + aesdec256kl xmm6, [rcx + 8128] + +// CHECK: aesdec256kl xmm6, [rdx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdf,0xb2,0x00,0xe0,0xff,0xff] + aesdec256kl xmm6, [rdx - 8192] + +// CHECK: aesenc128kl xmm6, [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xdc,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesenc128kl xmm6, [rbp + 8*r14 + 268435456] + +// CHECK: aesenc128kl xmm6, [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xdc,0xb4,0x80,0x23,0x01,0x00,0x00] + aesenc128kl xmm6, [r8 + 4*rax + 291] + +// CHECK: aesenc128kl xmm6, [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x35,0x00,0x00,0x00,0x00] + aesenc128kl xmm6, [rip] + +// CHECK: aesenc128kl xmm6, [2*rbp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0x34,0x6d,0x00,0xfa,0xff,0xff] + aesenc128kl xmm6, [2*rbp - 1536] + +// CHECK: aesenc128kl xmm6, [rcx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xb1,0xd0,0x17,0x00,0x00] + aesenc128kl xmm6, [rcx + 6096] + +// CHECK: aesenc128kl xmm6, [rdx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xb2,0x00,0xe8,0xff,0xff] + aesenc128kl xmm6, [rdx - 6144] + +// CHECK: aesenc256kl xmm6, [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xde,0xb4,0xf5,0x00,0x00,0x00,0x10] + aesenc256kl xmm6, [rbp + 8*r14 + 268435456] + +// CHECK: aesenc256kl xmm6, [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xde,0xb4,0x80,0x23,0x01,0x00,0x00] + aesenc256kl xmm6, [r8 + 4*rax + 291] + +// CHECK: aesenc256kl xmm6, [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x35,0x00,0x00,0x00,0x00] + aesenc256kl xmm6, [rip] + +// CHECK: aesenc256kl xmm6, [2*rbp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0x34,0x6d,0x00,0xf8,0xff,0xff] + aesenc256kl xmm6, [2*rbp - 2048] + +// CHECK: aesenc256kl xmm6, [rcx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0xb1,0xc0,0x1f,0x00,0x00] + aesenc256kl xmm6, [rcx + 8128] + +// CHECK: aesenc256kl xmm6, [rdx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xde,0xb2,0x00,0xe0,0xff,0xff] + aesenc256kl xmm6, [rdx - 8192] + +// CHECK: encodekey128 ecx, ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfa,0xc9] + encodekey128 ecx, ecx + +// CHECK: encodekey256 ecx, ecx +// CHECK: encoding: [0xf3,0x0f,0x38,0xfb,0xc9] + encodekey256 ecx, ecx + +// CHECK: loadiwkey xmm6, xmm7 +// CHECK: encoding: [0xf3,0x0f,0x38,0xdc,0xf7] + loadiwkey xmm6, xmm7 + +// CHECK: aesdecwide128kl [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x8c,0xf5,0x00,0x00,0x00,0x10] + aesdecwide128kl [rbp + 8*r14 + 268435456] + +// CHECK: aesdecwide128kl [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x8c,0x80,0x23,0x01,0x00,0x00] + aesdecwide128kl [r8 + 4*rax + 291] + +// CHECK: aesdecwide128kl [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x0d,0x00,0x00,0x00,0x00] + aesdecwide128kl [rip] + +// CHECK: aesdecwide128kl [2*rbp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x0c,0x6d,0x00,0xfa,0xff,0xff] + aesdecwide128kl [2*rbp - 1536] + +// CHECK: aesdecwide128kl [rcx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x89,0xd0,0x17,0x00,0x00] + aesdecwide128kl [rcx + 6096] + +// CHECK: aesdecwide128kl [rdx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x8a,0x00,0xe8,0xff,0xff] + aesdecwide128kl [rdx - 6144] + +// CHECK: aesdecwide256kl [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x9c,0xf5,0x00,0x00,0x00,0x10] + aesdecwide256kl [rbp + 8*r14 + 268435456] + +// CHECK: aesdecwide256kl [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x9c,0x80,0x23,0x01,0x00,0x00] + aesdecwide256kl [r8 + 4*rax + 291] + +// CHECK: aesdecwide256kl [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x1d,0x00,0x00,0x00,0x00] + aesdecwide256kl [rip] + +// CHECK: aesdecwide256kl [2*rbp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x1c,0x6d,0x00,0xf8,0xff,0xff] + aesdecwide256kl [2*rbp - 2048] + +// CHECK: aesdecwide256kl [rcx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x99,0xc0,0x1f,0x00,0x00] + aesdecwide256kl [rcx + 8128] + +// CHECK: aesdecwide256kl [rdx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x9a,0x00,0xe0,0xff,0xff] + aesdecwide256kl [rdx - 8192] + +// CHECK: aesencwide128kl [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x84,0xf5,0x00,0x00,0x00,0x10] + aesencwide128kl [rbp + 8*r14 + 268435456] + +// CHECK: aesencwide128kl [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x84,0x80,0x23,0x01,0x00,0x00] + aesencwide128kl [r8 + 4*rax + 291] + +// CHECK: aesencwide128kl [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x05,0x00,0x00,0x00,0x00] + aesencwide128kl [rip] + +// CHECK: aesencwide128kl [2*rbp - 1536] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x04,0x6d,0x00,0xfa,0xff,0xff] + aesencwide128kl [2*rbp - 1536] + +// CHECK: aesencwide128kl [rcx + 6096] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x81,0xd0,0x17,0x00,0x00] + aesencwide128kl [rcx + 6096] + +// CHECK: aesencwide128kl [rdx - 6144] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x82,0x00,0xe8,0xff,0xff] + aesencwide128kl [rdx - 6144] + +// CHECK: aesencwide256kl [rbp + 8*r14 + 268435456] +// CHECK: encoding: [0xf3,0x42,0x0f,0x38,0xd8,0x94,0xf5,0x00,0x00,0x00,0x10] + aesencwide256kl [rbp + 8*r14 + 268435456] + +// CHECK: aesencwide256kl [r8 + 4*rax + 291] +// CHECK: encoding: [0xf3,0x41,0x0f,0x38,0xd8,0x94,0x80,0x23,0x01,0x00,0x00] + aesencwide256kl [r8 + 4*rax + 291] + +// CHECK: aesencwide256kl [rip] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x15,0x00,0x00,0x00,0x00] + aesencwide256kl [rip] + +// CHECK: aesencwide256kl [2*rbp - 2048] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x14,0x6d,0x00,0xf8,0xff,0xff] + aesencwide256kl [2*rbp - 2048] + +// CHECK: aesencwide256kl [rcx + 8128] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x91,0xc0,0x1f,0x00,0x00] + aesencwide256kl [rcx + 8128] + +// CHECK: aesencwide256kl [rdx - 8192] +// CHECK: encoding: [0xf3,0x0f,0x38,0xd8,0x92,0x00,0xe0,0xff,0xff] + aesencwide256kl [rdx - 8192] Index: llvm/utils/TableGen/IntrinsicEmitter.cpp =================================================================== --- llvm/utils/TableGen/IntrinsicEmitter.cpp +++ llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -246,7 +246,8 @@ IIT_SUBDIVIDE4_ARG = 45, IIT_VEC_OF_BITCASTS_TO_INT = 46, IIT_V128 = 47, - IIT_BF16 = 48 + IIT_BF16 = 48, + IIT_STRUCT9 = 49 }; static void EncodeFixedValueType(MVT::SimpleValueType VT, @@ -469,6 +470,7 @@ case 6: TypeSig.push_back(IIT_STRUCT6); break; case 7: TypeSig.push_back(IIT_STRUCT7); break; case 8: TypeSig.push_back(IIT_STRUCT8); break; + case 9: TypeSig.push_back(IIT_STRUCT9); break; default: llvm_unreachable("Unhandled case in struct"); }