diff options
| author | Coby Tayree <coby.tayree@intel.com> | 2017-12-27 08:16:54 +0000 |
|---|---|---|
| committer | Coby Tayree <coby.tayree@intel.com> | 2017-12-27 08:16:54 +0000 |
| commit | a1e5f0c3396b64055e01287bfb1aff18ef4e6f92 (patch) | |
| tree | c483d35a9b72ed2e37b3045c61706cfa753d160b /clang/test | |
| parent | a0ab8d7a5890f0c4c3dc7b1c919fe7d65251ab31 (diff) | |
| download | bcm5719-llvm-a1e5f0c3396b64055e01287bfb1aff18ef4e6f92.tar.gz bcm5719-llvm-a1e5f0c3396b64055e01287bfb1aff18ef4e6f92.zip | |
[x86][icelake][vaes]
added vaes feature recognition
added intrinsics support for vaes instructions, matching a similar work on the backend (D40078)
_mm256_aesenc_epi128
_mm512_aesenc_epi128
_mm256_aesenclast_epi128
_mm512_aesenclast_epi128
_mm256_aesdec_epi128
_mm512_aesdec_epi128
_mm256_aesdeclast_epi128
_mm512_aesdeclast_epi128
llvm-svn: 321474
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/attr-target-x86.c | 6 | ||||
| -rw-r--r-- | clang/test/CodeGen/vaes-builtins.c | 55 | ||||
| -rw-r--r-- | clang/test/Driver/x86-target-features.c | 6 | ||||
| -rw-r--r-- | clang/test/Preprocessor/predefined-arch-macros.c | 2 | ||||
| -rw-r--r-- | clang/test/Preprocessor/x86_target_features.c | 11 |
5 files changed, 77 insertions, 3 deletions
diff --git a/clang/test/CodeGen/attr-target-x86.c b/clang/test/CodeGen/attr-target-x86.c index 6ec2d6578dc..5bd82f8bb7c 100644 --- a/clang/test/CodeGen/attr-target-x86.c +++ b/clang/test/CodeGen/attr-target-x86.c @@ -38,9 +38,9 @@ int __attribute__((target("arch=lakemont,mmx"))) lake(int a) { return 4; } // CHECK: lake{{.*}} #7 // CHECK: #0 = {{.*}}"target-cpu"="i686" "target-features"="+x87" // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" -// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop,-xsave,-xsaveopt" +// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-xop,-xsave,-xsaveopt" // CHECK: #3 = {{.*}}"target-cpu"="i686" "target-features"="+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" -// CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-f16c,-fma,-fma4,-sse4.1,-sse4.2,-xop,-xsave,-xsaveopt" -// CHECK: #5 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes" +// CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-f16c,-fma,-fma4,-sse4.1,-sse4.2,-vaes,-xop,-xsave,-xsaveopt" +// CHECK: #5 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes,-vaes" // CHECK: #6 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-3dnow,-3dnowa,-mmx" // CHECK: #7 = {{.*}}"target-cpu"="lakemont" "target-features"="+mmx" diff --git a/clang/test/CodeGen/vaes-builtins.c b/clang/test/CodeGen/vaes-builtins.c new file mode 100644 index 00000000000..df160aa16ee --- /dev/null +++ b/clang/test/CodeGen/vaes-builtins.c @@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +vaes -emit-llvm -o - | FileCheck %s --check-prefix AVX +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -DAVX512 -target-feature +vaes -target-feature +avx512f -emit-llvm -o - | FileCheck %s --check-prefixes AVX,AVX512 + +#include <immintrin.h> + +__m256i test_mm256_aesenc_epi128(__m256i __A, __m256i __B) { + // AVX-LABEL: @test_mm256_aesenc_epi128 + // AVX: @llvm.x86.aesni.aesenc.256 + return _mm256_aesenc_epi128(__A, __B); +} + +__m256i test_mm256_aesenclast_epi128(__m256i __A, __m256i __B) { + // AVX-LABEL: @test_mm256_aesenclast_epi128 + // AVX: @llvm.x86.aesni.aesenclast.256 + return _mm256_aesenclast_epi128(__A, __B); +} + +__m256i test_mm256_aesdec_epi128(__m256i __A, __m256i __B) { + // AVX-LABEL: @test_mm256_aesdec_epi128 + // AVX: @llvm.x86.aesni.aesdec.256 + return _mm256_aesdec_epi128(__A, __B); +} + +__m256i test_mm256_aesdeclast_epi128(__m256i __A, __m256i __B) { + // AVX-LABEL: @test_mm256_aesdeclast_epi128 + // AVX: @llvm.x86.aesni.aesdeclast.256 + return _mm256_aesdeclast_epi128(__A, __B); +} + +#ifdef AVX512 +__m512i test_mm512_aesenc_epi128(__m512i __A, __m512i __B) { + // AVX512-LABEL: @test_mm512_aesenc_epi128 + // AVX512: @llvm.x86.aesni.aesenc.512 + return _mm512_aesenc_epi128(__A, __B); +} + +__m512i test_mm512_aesenclast_epi128(__m512i __A, __m512i __B) { + // AVX512-LABEL: @test_mm512_aesenclast_epi128 + // AVX512: @llvm.x86.aesni.aesenclast.512 + return _mm512_aesenclast_epi128(__A, __B); +} + +__m512i test_mm512_aesdec_epi128(__m512i __A, __m512i __B) { + // AVX512-LABEL: @test_mm512_aesdec_epi128 + // AVX512: @llvm.x86.aesni.aesdec.512 + return _mm512_aesdec_epi128(__A, __B); +} + +__m512i test_mm512_aesdeclast_epi128(__m512i __A, __m512i __B) { + // AVX512-LABEL: @test_mm512_aesdeclast_epi128 + // AVX512: @llvm.x86.aesni.aesdeclast.512 + return _mm512_aesdeclast_epi128(__A, __B); +} +#endif + diff --git a/clang/test/Driver/x86-target-features.c b/clang/test/Driver/x86-target-features.c index c552ef7bd27..065a21e1f16 100644 --- a/clang/test/Driver/x86-target-features.c +++ b/clang/test/Driver/x86-target-features.c @@ -94,3 +94,9 @@ // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-clzero %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CLZERO %s // CLZERO: "-target-feature" "+clzero" // NO-CLZERO: "-target-feature" "-clzero" + +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mvaes %s -### -o %t.o 2>&1 | FileCheck -check-prefix=VAES %s +// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-vaes %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-VAES %s +// VAES: "-target-feature" "+vaes" +// NO-VAES: "-target-feature" "-vaes" + diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index f370f3e5f07..81b9ad66ff0 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -1079,6 +1079,7 @@ // CHECK_ICL_M32: #define __SSE4_2__ 1 // CHECK_ICL_M32: #define __SSE__ 1 // CHECK_ICL_M32: #define __SSSE3__ 1 +// CHECK_ICL_M32: #define __VAES__ 1 // CHECK_ICL_M32: #define __XSAVEC__ 1 // CHECK_ICL_M32: #define __XSAVEOPT__ 1 // CHECK_ICL_M32: #define __XSAVES__ 1 @@ -1124,6 +1125,7 @@ // CHECK_ICL_M64: #define __SSE4_2__ 1 // CHECK_ICL_M64: #define __SSE__ 1 // CHECK_ICL_M64: #define __SSSE3__ 1 +// CHECK_ICL_M64: #define __VAES__ 1 // CHECK_ICL_M64: #define __XSAVEC__ 1 // CHECK_ICL_M64: #define __XSAVEOPT__ 1 // CHECK_ICL_M64: #define __XSAVES__ 1 diff --git a/clang/test/Preprocessor/x86_target_features.c b/clang/test/Preprocessor/x86_target_features.c index e2d0e39a03f..18e2b2be9a2 100644 --- a/clang/test/Preprocessor/x86_target_features.c +++ b/clang/test/Preprocessor/x86_target_features.c @@ -368,3 +368,14 @@ // RUN: %clang -target i386-unknown-unknown -march=atom -mclflushopt -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=CLFLUSHOPT %s // CLFLUSHOPT: #define __CLFLUSHOPT__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mvaes -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=VAES %s + +// VAES: #define __AES__ 1 +// VAES: #define __VAES__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mvaes -mno-aes -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=VAESNOAES %s + +// VAESNOAES-NOT: #define __AES__ 1 +// VAESNOAES-NOT: #define __VAES__ 1 + |

