diff --git a/llvm/include/llvm/IR/IntrinsicsX86.td b/llvm/include/llvm/IR/IntrinsicsX86.td index 6d9b8246ccb2..cbce67d68b50 100644 --- a/llvm/include/llvm/IR/IntrinsicsX86.td +++ b/llvm/include/llvm/IR/IntrinsicsX86.td @@ -697,18 +697,51 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". def int_x86_aesni_aesimc : GCCBuiltin<"__builtin_ia32_aesimc128">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>; + def int_x86_aesni_aesenc : GCCBuiltin<"__builtin_ia32_aesenc128">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>; + def int_x86_aesni_aesenc_256 : GCCBuiltin<"__builtin_ia32_aesenc256">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesenc_512 : GCCBuiltin<"__builtin_ia32_aesenc512">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesenclast : GCCBuiltin<"__builtin_ia32_aesenclast128">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>; + def int_x86_aesni_aesenclast_256 : + GCCBuiltin<"__builtin_ia32_aesenclast256">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesenclast_512 : + GCCBuiltin<"__builtin_ia32_aesenclast512">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesdec : GCCBuiltin<"__builtin_ia32_aesdec128">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>; + def int_x86_aesni_aesdec_256 : GCCBuiltin<"__builtin_ia32_aesdec256">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesdec_512 : GCCBuiltin<"__builtin_ia32_aesdec512">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesdeclast : GCCBuiltin<"__builtin_ia32_aesdeclast128">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>; + def int_x86_aesni_aesdeclast_256 : + GCCBuiltin<"__builtin_ia32_aesdeclast256">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aesdeclast_512 : + GCCBuiltin<"__builtin_ia32_aesdeclast512">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty], + [IntrNoMem]>; + def int_x86_aesni_aeskeygenassist : GCCBuiltin<"__builtin_ia32_aeskeygenassist128">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty], diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 78f0f5e929ba..046aed82e46b 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -1260,6 +1260,7 @@ bool sys::getHostCPUFeatures(StringMap &Features) { Features["avx512vbmi"] = HasLeaf7 && ((ECX >> 1) & 1) && HasAVX512Save; Features["avx512vpopcntdq"] = HasLeaf7 && ((ECX >> 14) & 1) && HasAVX512Save; Features["pku"] = HasLeaf7 && ((ECX >> 4) & 1); + Features["vaes"] = HasLeaf7 && ((ECX >> 9) & 1) && HasAVXSave; bool HasLeafD = MaxLevel >= 0xd && !getX86CpuIDAndInfoEx(0xd, 0x1, &EAX, &EBX, &ECX, &EDX); diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td index 62aab8402583..5c7bb0045c83 100644 --- a/llvm/lib/Target/X86/X86.td +++ b/llvm/lib/Target/X86/X86.td @@ -172,6 +172,9 @@ def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem", def FeatureAES : SubtargetFeature<"aes", "HasAES", "true", "Enable AES instructions", [FeatureSSE2]>; +def FeatureVAES : SubtargetFeature<"vaes", "HasVAES", "true", + "Promote selected AES instructions to AVX512/AVX registers", + [FeatureAVX, FeatureAES]>; def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true", "Enable TBM instructions">; def FeatureLWP : SubtargetFeature<"lwp", "HasLWP", "true", diff --git a/llvm/lib/Target/X86/X86InstrAVX512.td b/llvm/lib/Target/X86/X86InstrAVX512.td index 95dd78255fa1..964e495a4d31 100644 --- a/llvm/lib/Target/X86/X86InstrAVX512.td +++ b/llvm/lib/Target/X86/X86InstrAVX512.td @@ -10013,3 +10013,30 @@ defm : AVX512_scalar_math_f64_patterns; defm : AVX512_scalar_math_f64_patterns; defm : AVX512_scalar_math_f64_patterns; defm : AVX512_scalar_math_f64_patterns; + +//===----------------------------------------------------------------------===// +// AES instructions +//===----------------------------------------------------------------------===// +multiclass avx512_vaes Op, string OpStr, string IntPrefix> { + let Predicates = [HasVLX, HasVAES] in { + defm Z128 : AESI_binop_rm_int(IntPrefix), + loadv2i64, 0, VR128X, i128mem>, + EVEX_4V, EVEX_CD8<64, CD8VF>, EVEX_V128, VEX_WIG; + defm Z256 : AESI_binop_rm_int(IntPrefix##"_256"), + loadv4i64, 0, VR256X, i256mem>, + EVEX_4V, EVEX_CD8<64, CD8VF>, EVEX_V256, VEX_WIG; + } + let Predicates = [HasAVX512, HasVAES] in + defm Z : AESI_binop_rm_int(IntPrefix##"_512"), + loadv8i64, 0, VR512, i512mem>, + EVEX_4V, EVEX_CD8<64, CD8VF>, EVEX_V512, VEX_WIG; +} + +defm VAESENC : avx512_vaes<0xDC, "vaesenc", "int_x86_aesni_aesenc">; +defm VAESENCLAST : avx512_vaes<0xDD, "vaesenclast", "int_x86_aesni_aesenclast">; +defm VAESDEC : avx512_vaes<0xDE, "vaesdec", "int_x86_aesni_aesdec">; +defm VAESDECLAST : avx512_vaes<0xDF, "vaesdeclast", "int_x86_aesni_aesdeclast">; + diff --git a/llvm/lib/Target/X86/X86InstrInfo.td b/llvm/lib/Target/X86/X86InstrInfo.td index f00caa130d0b..c8698255c9a1 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.td +++ b/llvm/lib/Target/X86/X86InstrInfo.td @@ -835,6 +835,8 @@ def PKU : Predicate<"Subtarget->hasPKU()">; def HasPOPCNT : Predicate<"Subtarget->hasPOPCNT()">; def HasAES : Predicate<"Subtarget->hasAES()">; +def HasVAES : Predicate<"Subtarget->hasVAES()">; +def NoVLX_Or_NoVAES : Predicate<"!Subtarget->hasVLX() || !Subtarget->hasVAES()">; def HasFXSR : Predicate<"Subtarget->hasFXSR()">; def HasXSAVE : Predicate<"Subtarget->hasXSAVE()">; def HasXSAVEOPT : Predicate<"Subtarget->hasXSAVEOPT()">; diff --git a/llvm/lib/Target/X86/X86InstrSSE.td b/llvm/lib/Target/X86/X86InstrSSE.td index 7e20951b588b..a0b370ee5460 100644 --- a/llvm/lib/Target/X86/X86InstrSSE.td +++ b/llvm/lib/Target/X86/X86InstrSSE.td @@ -7129,46 +7129,60 @@ def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}", // AES-NI Instructions //===----------------------------------------------------------------------===// -multiclass AESI_binop_rm_int opc, string OpcodeStr, Intrinsic IntId128, - PatFrag ld_frag, bit Is2Addr = 1> { - def rr : AES8I, - Sched<[WriteAESDecEnc]>; - def rm : AES8I, - Sched<[WriteAESDecEncLd, ReadAfterLd]>; +multiclass AESI_binop_rm_int opc, string OpcodeStr, + Intrinsic IntId, PatFrag ld_frag, + bit Is2Addr = 0, RegisterClass RC = VR128, + X86MemOperand MemOp = i128mem> { + let AsmString = OpcodeStr## + !if(Is2Addr, "\t{$src2, $dst|$dst, $src2}", + "\t{$src2, $src1, $dst|$dst, $src1, $src2}") in { + def rr : AES8I, + Sched<[WriteAESDecEnc]>; + def rm : AES8I, + Sched<[WriteAESDecEncLd, ReadAfterLd]>; + } } // Perform One Round of an AES Encryption/Decryption Flow -let Predicates = [HasAVX, HasAES] in { +let Predicates = [HasAVX, NoVLX_Or_NoVAES, HasAES] in { defm VAESENC : AESI_binop_rm_int<0xDC, "vaesenc", - int_x86_aesni_aesenc, loadv2i64, 0>, VEX_4V, VEX_WIG; + int_x86_aesni_aesenc, loadv2i64>, VEX_4V, VEX_WIG; defm VAESENCLAST : AESI_binop_rm_int<0xDD, "vaesenclast", - int_x86_aesni_aesenclast, loadv2i64, 0>, VEX_4V, VEX_WIG; + int_x86_aesni_aesenclast, loadv2i64>, VEX_4V, VEX_WIG; defm VAESDEC : AESI_binop_rm_int<0xDE, "vaesdec", - int_x86_aesni_aesdec, loadv2i64, 0>, VEX_4V, VEX_WIG; + int_x86_aesni_aesdec, loadv2i64>, VEX_4V, VEX_WIG; defm VAESDECLAST : AESI_binop_rm_int<0xDF, "vaesdeclast", - int_x86_aesni_aesdeclast, loadv2i64, 0>, VEX_4V, VEX_WIG; + int_x86_aesni_aesdeclast, loadv2i64>, VEX_4V, VEX_WIG; +} + +let Predicates = [NoVLX, HasVAES] in { + defm VAESENCY : AESI_binop_rm_int<0xDC, "vaesenc", + int_x86_aesni_aesenc_256, loadv4i64, 0, VR256, + i256mem>, VEX_4V, VEX_L, VEX_WIG; + defm VAESENCLASTY : AESI_binop_rm_int<0xDD, "vaesenclast", + int_x86_aesni_aesenclast_256, loadv4i64, 0, VR256, + i256mem>, VEX_4V, VEX_L, VEX_WIG; + defm VAESDECY : AESI_binop_rm_int<0xDE, "vaesdec", + int_x86_aesni_aesdec_256, loadv4i64, 0, VR256, + i256mem>, VEX_4V, VEX_L, VEX_WIG; + defm VAESDECLASTY : AESI_binop_rm_int<0xDF, "vaesdeclast", + int_x86_aesni_aesdeclast_256, loadv4i64, 0, VR256, + i256mem>, VEX_4V, VEX_L, VEX_WIG; } let Constraints = "$src1 = $dst" in { defm AESENC : AESI_binop_rm_int<0xDC, "aesenc", - int_x86_aesni_aesenc, memopv2i64>; + int_x86_aesni_aesenc, memopv2i64, 1>; defm AESENCLAST : AESI_binop_rm_int<0xDD, "aesenclast", - int_x86_aesni_aesenclast, memopv2i64>; + int_x86_aesni_aesenclast, memopv2i64, 1>; defm AESDEC : AESI_binop_rm_int<0xDE, "aesdec", - int_x86_aesni_aesdec, memopv2i64>; + int_x86_aesni_aesdec, memopv2i64, 1>; defm AESDECLAST : AESI_binop_rm_int<0xDF, "aesdeclast", - int_x86_aesni_aesdeclast, memopv2i64>; + int_x86_aesni_aesdeclast, memopv2i64, 1>; } // Perform the AES InvMixColumn Transformation diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index 1d1a78fb7beb..a4581e1a1a23 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -292,6 +292,7 @@ void X86Subtarget::initializeEnvironment() { HasPOPCNT = false; HasSSE4A = false; HasAES = false; + HasVAES = false; HasFXSR = false; HasXSAVE = false; HasXSAVEOPT = false; diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h index 0b1eddcb6313..3f0657be7a4a 100644 --- a/llvm/lib/Target/X86/X86Subtarget.h +++ b/llvm/lib/Target/X86/X86Subtarget.h @@ -107,6 +107,7 @@ protected: /// Target has AES instructions bool HasAES; + bool HasVAES; /// Target has FXSAVE/FXRESTOR instructions bool HasFXSR; @@ -457,6 +458,7 @@ public: bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } bool hasPOPCNT() const { return HasPOPCNT; } bool hasAES() const { return HasAES; } + bool hasVAES() const { return HasVAES; } bool hasFXSR() const { return HasFXSR; } bool hasXSAVE() const { return HasXSAVE; } bool hasXSAVEOPT() const { return HasXSAVEOPT; } diff --git a/llvm/test/CodeGen/X86/vaes-intrinsics-avx-x86.ll b/llvm/test/CodeGen/X86/vaes-intrinsics-avx-x86.ll new file mode 100644 index 000000000000..cc5915df4f01 --- /dev/null +++ b/llvm/test/CodeGen/X86/vaes-intrinsics-avx-x86.ll @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx,+vaes -show-mc-encoding | FileCheck %s --check-prefix=VAES_AVX + +; {vaes, avx} +define <4 x i64> @test_x86_aesni_aesenc_256(<4 x i64> %a0, <4 x i64> %a1) { +; VAES_AVX-LABEL: test_x86_aesni_aesenc_256: +; VAES_AVX: # BB#0: +; VAES_AVX-NEXT: vaesenc %ymm1, %ymm0, %ymm0 # encoding: [0xc4,0xe2,0x7d,0xdc,0xc1] +; VAES_AVX-NEXT: retl # encoding: [0xc3] + %res = call <4 x i64> @llvm.x86.aesni.aesenc.256(<4 x i64> %a0, <4 x i64> %a1) + ret <4 x i64> %res +} +declare <4 x i64> @llvm.x86.aesni.aesenc.256(<4 x i64>, <4 x i64>) nounwind readnone diff --git a/llvm/test/CodeGen/X86/vaes-intrinsics-avx512-x86.ll b/llvm/test/CodeGen/X86/vaes-intrinsics-avx512-x86.ll new file mode 100644 index 000000000000..dd451b804300 --- /dev/null +++ b/llvm/test/CodeGen/X86/vaes-intrinsics-avx512-x86.ll @@ -0,0 +1,42 @@ +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+vaes,+avx512f -show-mc-encoding | FileCheck %s --check-prefix=VAES_AVX512 + +define <8 x i64> @test_x86_aesni_aesenc_512(<8 x i64> %a0, <8 x i64> %a1) { +; VAES_AVX512-LABEL: test_x86_aesni_aesenc_512: +; VAES_AVX512: # BB#0: +; VAES_AVX512-NEXT: vaesenc %zmm1, %zmm0, %zmm0 # encoding: [0x62,0xf2,0x7d,0x48,0xdc,0xc1] +; VAES_AVX512-NEXT: retq # encoding: [0xc3] + %res = call <8 x i64> @llvm.x86.aesni.aesenc.512(<8 x i64> %a0, <8 x i64> %a1) + ret <8 x i64> %res +} +declare <8 x i64> @llvm.x86.aesni.aesenc.512(<8 x i64>, <8 x i64>) nounwind readnone + +define <8 x i64> @test_x86_aesni_aesenclast_512(<8 x i64> %a0, <8 x i64> %a1) { +; VAES_AVX512-LABEL: test_x86_aesni_aesenclast_512: +; VAES_AVX512: # BB#0: +; VAES_AVX512-NEXT: vaesenclast %zmm1, %zmm0, %zmm0 # encoding: [0x62,0xf2,0x7d,0x48,0xdd,0xc1] +; VAES_AVX512-NEXT: retq # encoding: [0xc3] + %res = call <8 x i64> @llvm.x86.aesni.aesenclast.512(<8 x i64> %a0, <8 x i64> %a1) + ret <8 x i64> %res +} +declare <8 x i64> @llvm.x86.aesni.aesenclast.512(<8 x i64>, <8 x i64>) nounwind readnone + +define <8 x i64> @test_x86_aesni_aesdec_512(<8 x i64> %a0, <8 x i64> %a1) { +; VAES_AVX512-LABEL: test_x86_aesni_aesdec_512: +; VAES_AVX512: # BB#0: +; VAES_AVX512-NEXT: vaesdec %zmm1, %zmm0, %zmm0 # encoding: [0x62,0xf2,0x7d,0x48,0xde,0xc1] +; VAES_AVX512-NEXT: retq # encoding: [0xc3] + %res = call <8 x i64> @llvm.x86.aesni.aesdec.512(<8 x i64> %a0, <8 x i64> %a1) + ret <8 x i64> %res +} +declare <8 x i64> @llvm.x86.aesni.aesdec.512(<8 x i64>, <8 x i64>) nounwind readnone + +define <8 x i64> @test_x86_aesni_aesdeclast_512(<8 x i64> %a0, <8 x i64> %a1) { +; VAES_AVX512-LABEL: test_x86_aesni_aesdeclast_512: +; VAES_AVX512: # BB#0: +; VAES_AVX512-NEXT: vaesdeclast %zmm1, %zmm0, %zmm0 # encoding: [0x62,0xf2,0x7d,0x48,0xdf,0xc1] +; VAES_AVX512-NEXT: retq # encoding: [0xc3] + %res = call <8 x i64> @llvm.x86.aesni.aesdeclast.512(<8 x i64> %a0, <8 x i64> %a1) + ret <8 x i64> %res +} +declare <8 x i64> @llvm.x86.aesni.aesdeclast.512(<8 x i64>, <8 x i64>) nounwind readnone + diff --git a/llvm/test/CodeGen/X86/vaes-intrinsics-avx512vl-x86.ll b/llvm/test/CodeGen/X86/vaes-intrinsics-avx512vl-x86.ll new file mode 100644 index 000000000000..29285bfbeaf3 --- /dev/null +++ b/llvm/test/CodeGen/X86/vaes-intrinsics-avx512vl-x86.ll @@ -0,0 +1,82 @@ +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+vaes,+avx512f,+avx512vl -show-mc-encoding | FileCheck %s --check-prefix=VAES_AVX512VL + +define <2 x i64> @test_x86_aesni_aesenc(<2 x i64> %a0, <2 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesenc: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesenc %xmm1, %xmm0, %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0xdc,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %a0, <2 x i64> %a1) + ret <2 x i64> %res +} +declare <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64>, <2 x i64>) nounwind readnone + +define <4 x i64> @test_x86_aesni_aesenc_256(<4 x i64> %a0, <4 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesenc_256: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesenc %ymm1, %ymm0, %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0xdc,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <4 x i64> @llvm.x86.aesni.aesenc.256(<4 x i64> %a0, <4 x i64> %a1) + ret <4 x i64> %res +} +declare <4 x i64> @llvm.x86.aesni.aesenc.256(<4 x i64>, <4 x i64>) nounwind readnone + +define <2 x i64> @test_x86_aesni_aesenclast(<2 x i64> %a0, <2 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesenclast: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesenclast %xmm1, %xmm0, %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0xdd,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <2 x i64> @llvm.x86.aesni.aesenclast(<2 x i64> %a0, <2 x i64> %a1) + ret <2 x i64> %res +} +declare <2 x i64> @llvm.x86.aesni.aesenclast(<2 x i64>, <2 x i64>) nounwind readnone + +define <4 x i64> @test_x86_aesni_aesenclast_256(<4 x i64> %a0, <4 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesenclast_256: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesenclast %ymm1, %ymm0, %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0xdd,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <4 x i64> @llvm.x86.aesni.aesenclast.256(<4 x i64> %a0, <4 x i64> %a1) + ret <4 x i64> %res +} +declare <4 x i64> @llvm.x86.aesni.aesenclast.256(<4 x i64>, <4 x i64>) nounwind readnone + +define <2 x i64> @test_x86_aesni_aesdec(<2 x i64> %a0, <2 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesdec: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesdec %xmm1, %xmm0, %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0xde,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <2 x i64> @llvm.x86.aesni.aesdec(<2 x i64> %a0, <2 x i64> %a1) + ret <2 x i64> %res +} +declare <2 x i64> @llvm.x86.aesni.aesdec(<2 x i64>, <2 x i64>) nounwind readnone + +define <4 x i64> @test_x86_aesni_aesdec_256(<4 x i64> %a0, <4 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesdec_256: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesdec %ymm1, %ymm0, %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0xde,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <4 x i64> @llvm.x86.aesni.aesdec.256(<4 x i64> %a0, <4 x i64> %a1) + ret <4 x i64> %res +} +declare <4 x i64> @llvm.x86.aesni.aesdec.256(<4 x i64>, <4 x i64>) nounwind readnone + +define <2 x i64> @test_x86_aesni_aesdeclast(<2 x i64> %a0, <2 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesdeclast: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesdeclast %xmm1, %xmm0, %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0xdf,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <2 x i64> @llvm.x86.aesni.aesdeclast(<2 x i64> %a0, <2 x i64> %a1) + ret <2 x i64> %res +} +declare <2 x i64> @llvm.x86.aesni.aesdeclast(<2 x i64>, <2 x i64>) nounwind readnone + +define <4 x i64> @test_x86_aesni_aesdeclast_256(<4 x i64> %a0, <4 x i64> %a1) { +; VAES_AVX512VL-LABEL: test_x86_aesni_aesdeclast_256: +; VAES_AVX512VL: # BB#0: +; VAES_AVX512VL-NEXT: vaesdeclast %ymm1, %ymm0, %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0xdf,0xc1] +; VAES_AVX512VL-NEXT: retq # encoding: [0xc3] + %res = call <4 x i64> @llvm.x86.aesni.aesdeclast.256(<4 x i64> %a0, <4 x i64> %a1) + ret <4 x i64> %res +} +declare <4 x i64> @llvm.x86.aesni.aesdeclast.256(<4 x i64>, <4 x i64>) nounwind readnone + diff --git a/llvm/test/MC/X86/avx512vaes-encoding.s b/llvm/test/MC/X86/avx512vaes-encoding.s new file mode 100644 index 000000000000..d0c1ea9f956d --- /dev/null +++ b/llvm/test/MC/X86/avx512vaes-encoding.s @@ -0,0 +1,114 @@ +// RUN: llvm-mc -triple x86_64-unknown-unknown -mcpu=knl -mattr=+vaes --show-encoding < %s | FileCheck %s + +// CHECK: vaesenc %zmm3, %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdc,0xeb] + vaesenc %zmm3, %zmm2, %zmm21 + +// CHECK: vaesenclast %zmm3, %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdd,0xeb] + vaesenclast %zmm3, %zmm2, %zmm21 + +// CHECK: vaesdec %zmm3, %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xde,0xeb] + vaesdec %zmm3, %zmm2, %zmm21 + +// CHECK: vaesdeclast %zmm3, %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdf,0xeb] + vaesdeclast %zmm3, %zmm2, %zmm21 + +// CHECK: vaesenc (%rcx), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdc,0x29] + vaesenc (%rcx), %zmm2, %zmm21 + +// CHECK: vaesenc -256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdc,0x6c,0x24,0xfc] + vaesenc -256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesenc 256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdc,0x6c,0x24,0x04] + vaesenc 256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesenc 268435456(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdc,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesenc 268435456(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesenc -536870912(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdc,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesenc -536870912(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesenc -536870910(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdc,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesenc -536870910(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesenclast (%rcx), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdd,0x29] + vaesenclast (%rcx), %zmm2, %zmm21 + +// CHECK: vaesenclast -256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdd,0x6c,0x24,0xfc] + vaesenclast -256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesenclast 256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdd,0x6c,0x24,0x04] + vaesenclast 256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesenclast 268435456(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdd,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesenclast 268435456(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesenclast -536870912(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdd,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesenclast -536870912(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesenclast -536870910(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdd,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesenclast -536870910(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesdec (%rcx), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xde,0x29] + vaesdec (%rcx), %zmm2, %zmm21 + +// CHECK: vaesdec -256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xde,0x6c,0x24,0xfc] + vaesdec -256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesdec 256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xde,0x6c,0x24,0x04] + vaesdec 256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesdec 268435456(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xde,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesdec 268435456(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesdec -536870912(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xde,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesdec -536870912(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesdec -536870910(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xde,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesdec -536870910(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesdeclast (%rcx), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdf,0x29] + vaesdeclast (%rcx), %zmm2, %zmm21 + +// CHECK: vaesdeclast -256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdf,0x6c,0x24,0xfc] + vaesdeclast -256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesdeclast 256(%rsp), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x48,0xdf,0x6c,0x24,0x04] + vaesdeclast 256(%rsp), %zmm2, %zmm21 + +// CHECK: vaesdeclast 268435456(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdf,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesdeclast 268435456(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesdeclast -536870912(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdf,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesdeclast -536870912(%rcx,%r14,8), %zmm2, %zmm21 + +// CHECK: vaesdeclast -536870910(%rcx,%r14,8), %zmm2, %zmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x48,0xdf,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesdeclast -536870910(%rcx,%r14,8), %zmm2, %zmm21 + diff --git a/llvm/test/MC/X86/avx512vl_vaes-encoding.s b/llvm/test/MC/X86/avx512vl_vaes-encoding.s new file mode 100644 index 000000000000..1ae1d0c8685f --- /dev/null +++ b/llvm/test/MC/X86/avx512vl_vaes-encoding.s @@ -0,0 +1,226 @@ +//RUN: llvm-mc -triple x86_64-unknown-unknown -mcpu=skx -mattr=+vaes --show-encoding < %s | FileCheck %s + +// CHECK: vaesenc %xmm3, %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdc,0xeb] + vaesenc %xmm3, %xmm2, %xmm21 + +// CHECK: vaesenclast %xmm3, %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdd,0xeb] + vaesenclast %xmm3, %xmm2, %xmm21 + +// CHECK: vaesdec %xmm3, %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xde,0xeb] + vaesdec %xmm3, %xmm2, %xmm21 + +// CHECK: vaesdeclast %xmm3, %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdf,0xeb] + vaesdeclast %xmm3, %xmm2, %xmm21 + +// CHECK: vaesenc (%rcx), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdc,0x29] + vaesenc (%rcx), %xmm2, %xmm21 + +// CHECK: vaesenc -64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdc,0x6c,0x24,0xfc] + vaesenc -64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesenc 64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdc,0x6c,0x24,0x04] + vaesenc 64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesenc 268435456(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdc,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesenc 268435456(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesenc -536870912(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdc,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesenc -536870912(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesenc -536870910(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdc,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesenc -536870910(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesenclast (%rcx), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdd,0x29] + vaesenclast (%rcx), %xmm2, %xmm21 + +// CHECK: vaesenclast -64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdd,0x6c,0x24,0xfc] + vaesenclast -64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesenclast 64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdd,0x6c,0x24,0x04] + vaesenclast 64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesenclast 268435456(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdd,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesenclast 268435456(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesenclast -536870912(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdd,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesenclast -536870912(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesenclast -536870910(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdd,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesenclast -536870910(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesdec (%rcx), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xde,0x29] + vaesdec (%rcx), %xmm2, %xmm21 + +// CHECK: vaesdec -64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xde,0x6c,0x24,0xfc] + vaesdec -64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesdec 64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xde,0x6c,0x24,0x04] + vaesdec 64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesdec 268435456(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xde,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesdec 268435456(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesdec -536870912(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xde,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesdec -536870912(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesdec -536870910(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xde,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesdec -536870910(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesdeclast (%rcx), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdf,0x29] + vaesdeclast (%rcx), %xmm2, %xmm21 + +// CHECK: vaesdeclast -64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdf,0x6c,0x24,0xfc] + vaesdeclast -64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesdeclast 64(%rsp), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x08,0xdf,0x6c,0x24,0x04] + vaesdeclast 64(%rsp), %xmm2, %xmm21 + +// CHECK: vaesdeclast 268435456(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdf,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesdeclast 268435456(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesdeclast -536870912(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdf,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesdeclast -536870912(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesdeclast -536870910(%rcx,%r14,8), %xmm2, %xmm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x08,0xdf,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesdeclast -536870910(%rcx,%r14,8), %xmm2, %xmm21 + +// CHECK: vaesenc %ymm3, %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdc,0xeb] + vaesenc %ymm3, %ymm2, %ymm21 + +// CHECK: vaesenclast %ymm3, %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdd,0xeb] + vaesenclast %ymm3, %ymm2, %ymm21 + +// CHECK: vaesdec %ymm3, %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xde,0xeb] + vaesdec %ymm3, %ymm2, %ymm21 + +// CHECK: vaesdeclast %ymm3, %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdf,0xeb] + vaesdeclast %ymm3, %ymm2, %ymm21 + +// CHECK: vaesenc (%rcx), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdc,0x29] + vaesenc (%rcx), %ymm2, %ymm21 + +// CHECK: vaesenc -128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdc,0x6c,0x24,0xfc] + vaesenc -128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesenc 128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdc,0x6c,0x24,0x04] + vaesenc 128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesenc 268435456(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdc,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesenc 268435456(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesenc -536870912(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdc,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesenc -536870912(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesenc -536870910(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdc,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesenc -536870910(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesenclast (%rcx), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdd,0x29] + vaesenclast (%rcx), %ymm2, %ymm21 + +// CHECK: vaesenclast -128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdd,0x6c,0x24,0xfc] + vaesenclast -128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesenclast 128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdd,0x6c,0x24,0x04] + vaesenclast 128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesenclast 268435456(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdd,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesenclast 268435456(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesenclast -536870912(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdd,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesenclast -536870912(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesenclast -536870910(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdd,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesenclast -536870910(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesdec (%rcx), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xde,0x29] + vaesdec (%rcx), %ymm2, %ymm21 + +// CHECK: vaesdec -128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xde,0x6c,0x24,0xfc] + vaesdec -128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesdec 128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xde,0x6c,0x24,0x04] + vaesdec 128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesdec 268435456(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xde,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesdec 268435456(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesdec -536870912(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xde,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesdec -536870912(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesdec -536870910(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xde,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesdec -536870910(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesdeclast (%rcx), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdf,0x29] + vaesdeclast (%rcx), %ymm2, %ymm21 + +// CHECK: vaesdeclast -128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdf,0x6c,0x24,0xfc] + vaesdeclast -128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesdeclast 128(%rsp), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xe2,0x6d,0x28,0xdf,0x6c,0x24,0x04] + vaesdeclast 128(%rsp), %ymm2, %ymm21 + +// CHECK: vaesdeclast 268435456(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdf,0xac,0xf1,0x00,0x00,0x00,0x10] + vaesdeclast 268435456(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesdeclast -536870912(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdf,0xac,0xf1,0x00,0x00,0x00,0xe0] + vaesdeclast -536870912(%rcx,%r14,8), %ymm2, %ymm21 + +// CHECK: vaesdeclast -536870910(%rcx,%r14,8), %ymm2, %ymm21 +// CHECK: encoding: [0x62,0xa2,0x6d,0x28,0xdf,0xac,0xf1,0x02,0x00,0x00,0xe0] + vaesdeclast -536870910(%rcx,%r14,8), %ymm2, %ymm21 + diff --git a/llvm/test/MC/X86/avx_vaes-encoding.s b/llvm/test/MC/X86/avx_vaes-encoding.s new file mode 100644 index 000000000000..e170d4384749 --- /dev/null +++ b/llvm/test/MC/X86/avx_vaes-encoding.s @@ -0,0 +1,114 @@ +// RUN: llvm-mc -triple x86_64-unknown-unknown -mattr=vaes --show-encoding %s | FileCheck %s + +// CHECK: vaesenc %ymm3, %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdc,0xcb] + vaesenc %ymm3, %ymm2, %ymm1 + +// CHECK: vaesenclast %ymm3, %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdd,0xcb] + vaesenclast %ymm3, %ymm2, %ymm1 + +// CHECK: vaesdec %ymm3, %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xde,0xcb] + vaesdec %ymm3, %ymm2, %ymm1 + +// CHECK: vaesdeclast %ymm3, %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdf,0xcb] + vaesdeclast %ymm3, %ymm2, %ymm1 + +// CHECK: vaesenc (%rcx), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdc,0x09] + vaesenc (%rcx), %ymm2, %ymm1 + +// CHECK: vaesenc -4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdc,0x4c,0x24,0xfc] + vaesenc -4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesenc 4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdc,0x4c,0x24,0x04] + vaesenc 4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesenc 268435456(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdc,0x8c,0xf1,0x00,0x00,0x00,0x10] + vaesenc 268435456(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesenc -536870912(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdc,0x8c,0xf1,0x00,0x00,0x00,0xe0] + vaesenc -536870912(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesenc -536870910(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdc,0x8c,0xf1,0x02,0x00,0x00,0xe0] + vaesenc -536870910(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesenclast (%rcx), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdd,0x09] + vaesenclast (%rcx), %ymm2, %ymm1 + +// CHECK: vaesenclast -4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdd,0x4c,0x24,0xfc] + vaesenclast -4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesenclast 4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdd,0x4c,0x24,0x04] + vaesenclast 4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesenclast 268435456(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdd,0x8c,0xf1,0x00,0x00,0x00,0x10] + vaesenclast 268435456(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesenclast -536870912(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdd,0x8c,0xf1,0x00,0x00,0x00,0xe0] + vaesenclast -536870912(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesenclast -536870910(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdd,0x8c,0xf1,0x02,0x00,0x00,0xe0] + vaesenclast -536870910(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesdec (%rcx), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xde,0x09] + vaesdec (%rcx), %ymm2, %ymm1 + +// CHECK: vaesdec -4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xde,0x4c,0x24,0xfc] + vaesdec -4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesdec 4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xde,0x4c,0x24,0x04] + vaesdec 4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesdec 268435456(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xde,0x8c,0xf1,0x00,0x00,0x00,0x10] + vaesdec 268435456(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesdec -536870912(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xde,0x8c,0xf1,0x00,0x00,0x00,0xe0] + vaesdec -536870912(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesdec -536870910(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xde,0x8c,0xf1,0x02,0x00,0x00,0xe0] + vaesdec -536870910(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesdeclast (%rcx), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdf,0x09] + vaesdeclast (%rcx), %ymm2, %ymm1 + +// CHECK: vaesdeclast -4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdf,0x4c,0x24,0xfc] + vaesdeclast -4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesdeclast 4(%rsp), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xe2,0x6d,0xdf,0x4c,0x24,0x04] + vaesdeclast 4(%rsp), %ymm2, %ymm1 + +// CHECK: vaesdeclast 268435456(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdf,0x8c,0xf1,0x00,0x00,0x00,0x10] + vaesdeclast 268435456(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesdeclast -536870912(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdf,0x8c,0xf1,0x00,0x00,0x00,0xe0] + vaesdeclast -536870912(%rcx,%r14,8), %ymm2, %ymm1 + +// CHECK: vaesdeclast -536870910(%rcx,%r14,8), %ymm2, %ymm1 +// CHECK: encoding: [0xc4,0xa2,0x6d,0xdf,0x8c,0xf1,0x02,0x00,0x00,0xe0] + vaesdeclast -536870910(%rcx,%r14,8), %ymm2, %ymm1 +