From: Craig Topper Date: Sun, 1 Feb 2015 21:34:11 +0000 (+0000) Subject: [X86] Add the AVX512 exp2a23 intrinsics. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6501d6820eda08d8f52c1539ba91bc5331a508c2;p=clang [X86] Add the AVX512 exp2a23 intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227769 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index c5897124ed..a246c25169 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -838,6 +838,8 @@ BUILTIN(__builtin_ia32_rcp28sd_mask, "V2dV2dV2dV2dUcIi", "") BUILTIN(__builtin_ia32_rcp28ss_mask, "V4fV4fV4fV4fUcIi", "") BUILTIN(__builtin_ia32_rcp28pd_mask, "V8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_rcp28ps_mask, "V16fV16fV16fUsIi", "") +BUILTIN(__builtin_ia32_exp2pd_mask, "V8dV8dV8dUcIi", "") +BUILTIN(__builtin_ia32_exp2ps_mask, "V16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_cvttps2dq512_mask, "V16iV16fV16iUsIi", "") BUILTIN(__builtin_ia32_cvttps2udq512_mask, "V16iV16fV16iUsIi", "") BUILTIN(__builtin_ia32_cvttpd2dq512_mask, "V8iV8dV8iUcIi", "") diff --git a/lib/Headers/avx512erintrin.h b/lib/Headers/avx512erintrin.h index 323f4f0d67..57c61aa0e1 100644 --- a/lib/Headers/avx512erintrin.h +++ b/lib/Headers/avx512erintrin.h @@ -28,6 +28,55 @@ #define __AVX512ERINTRIN_H +// exp2a23 +#define _mm512_exp2a23_round_pd(A, R) __extension__ ({ \ + (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \ + (__v8df)_mm512_setzero_pd(), \ + (__mmask8)-1, (R)); }) + +#define _mm512_mask_exp2a23_round_pd(S, M, A, R) __extension__ ({ \ + (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \ + (__v8df)(__m512d)(S), \ + (__mmask8)(M), (R)); }) + +#define _mm512_maskz_exp2a23_round_pd(M, A, R) __extension__ ({ \ + (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \ + (__v8df)_mm512_setzero_pd(), \ + (__mmask8)(M), (R)); }) + +#define _mm512_exp2a23_pd(A) \ + _mm512_exp2a23_round_pd((A), _MM_FROUND_CUR_DIRECTION) + +#define _mm512_mask_exp2a23_pd(S, M, A) \ + _mm512_mask_exp2a23_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION) + +#define _mm512_maskz_exp2a23_pd(M, A) \ + _mm512_maskz_exp2a23_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION) + +#define _mm512_exp2a23_round_ps(A, R) __extension__ ({ \ + (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \ + (__v16sf)_mm512_setzero_ps(), \ + (__mmask8)-1, (R)); }) + +#define _mm512_mask_exp2a23_round_ps(S, M, A, R) __extension__ ({ \ + (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \ + (__v16sf)(__m512)(S), \ + (__mmask8)(M), (R)); }) + +#define _mm512_maskz_exp2a23_round_ps(M, A, R) __extension__ ({ \ + (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \ + (__v16sf)_mm512_setzero_ps(), \ + (__mmask8)(M), (R)); }) + +#define _mm512_exp2a23_ps(A) \ + _mm512_exp2a23_round_ps((A), _MM_FROUND_CUR_DIRECTION) + +#define _mm512_mask_exp2a23_ps(S, M, A) \ + _mm512_mask_exp2a23_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION) + +#define _mm512_maskz_exp2a23_ps(M, A) \ + _mm512_maskz_exp2a23_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION) + // rsqrt28 #define _mm512_rsqrt28_round_pd(A, R) __extension__ ({ \ (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \ diff --git a/test/CodeGen/avx512er-builtins.c b/test/CodeGen/avx512er-builtins.c index 4aa8c30acb..993f177a11 100644 --- a/test/CodeGen/avx512er-builtins.c +++ b/test/CodeGen/avx512er-builtins.c @@ -271,3 +271,76 @@ __m128d test_mm_maskz_rcp28_sd(__mmask8 m, __m128d a, __m128d b) { // CHECK: @llvm.x86.avx512.rcp28.sd return _mm_maskz_rcp28_sd(m, a, b); } + +__m512d test_mm512_exp2a23_round_pd(__m512d a) { + // CHECK-LABEL: @test_mm512_exp2a23_round_pd + // CHECK: @llvm.x86.avx512.exp2.pd + return _mm512_exp2a23_round_pd(a, _MM_FROUND_TO_NEAREST_INT); +} + +__m512d test_mm512_mask_exp2a23_round_pd(__m512d s, __mmask8 m, __m512d a) { + // check-label: @test_mm512_mask_exp2a23_round_pd + // check: @llvm.x86.avx512.exp2.pd + return _mm512_mask_exp2a23_round_pd(s, m, a, _MM_FROUND_TO_NEAREST_INT); +} + +__m512d test_mm512_maskz_exp2a23_round_pd(__mmask8 m, __m512d a) { + // check-label: @test_mm512_maskz_exp2a23_round_pd + // check: @llvm.x86.avx512.exp2.pd + return _mm512_maskz_exp2a23_round_pd(m, a, _MM_FROUND_TO_NEAREST_INT); +} + +__m512d test_mm512_exp2a23_pd(__m512d a) { + // CHECK-LABEL: @test_mm512_exp2a23_pd + // CHECK: @llvm.x86.avx512.exp2.pd + return _mm512_exp2a23_pd(a); +} + +__m512d test_mm512_mask_exp2a23_pd(__m512d s, __mmask8 m, __m512d a) { + // check-label: @test_mm512_mask_exp2a23_pd + // check: @llvm.x86.avx512.exp2.pd + return _mm512_mask_exp2a23_pd(s, m, a); +} + +__m512d test_mm512_maskz_exp2a23_pd(__mmask8 m, __m512d a) { + // check-label: @test_mm512_maskz_exp2a23_pd + // check: @llvm.x86.avx512.exp2.pd + return _mm512_maskz_exp2a23_pd(m, a); +} + +__m512 test_mm512_exp2a23_round_ps(__m512 a) { + // CHECK-LABEL: @test_mm512_exp2a23_round_ps + // CHECK: @llvm.x86.avx512.exp2.ps + return _mm512_exp2a23_round_ps(a, _MM_FROUND_TO_NEAREST_INT); +} + +__m512 test_mm512_mask_exp2a23_round_ps(__m512 s, __mmask16 m, __m512 a) { + // CHECK-LABEL: @test_mm512_mask_exp2a23_round_ps + // CHECK: @llvm.x86.avx512.exp2.ps + return _mm512_mask_exp2a23_round_ps(s, m, a, _MM_FROUND_TO_NEAREST_INT); +} + +__m512 test_mm512_maskz_exp2a23_round_ps(__mmask16 m, __m512 a) { + // CHECK-LABEL: @test_mm512_maskz_exp2a23_round_ps + // CHECK: @llvm.x86.avx512.exp2.ps + return _mm512_maskz_exp2a23_round_ps(m, a, _MM_FROUND_TO_NEAREST_INT); +} + +__m512 test_mm512_exp2a23_ps(__m512 a) { + // CHECK-LABEL: @test_mm512_exp2a23_ps + // CHECK: @llvm.x86.avx512.exp2.ps + return _mm512_exp2a23_ps(a); +} + +__m512 test_mm512_mask_exp2a23_ps(__m512 s, __mmask16 m, __m512 a) { + // CHECK-LABEL: @test_mm512_mask_exp2a23_ps + // CHECK: @llvm.x86.avx512.exp2.ps + return _mm512_mask_exp2a23_ps(s, m, a); +} + +__m512 test_mm512_maskz_exp2a23_ps(__mmask16 m, __m512 a) { + // CHECK-LABEL: @test_mm512_maskz_exp2a23_ps + // CHECK: @llvm.x86.avx512.exp2.ps + return _mm512_maskz_exp2a23_ps(m, a); +} +