From 62fafdbf9ce3f19b233a72f64d5523491d9a7d6c Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 21 Mar 2017 12:46:13 +0000 Subject: [PATCH] [X86][AVX512] Add _mm512_cvtsd_f64 and _mm512_cvtss_f32 intrinsics (PR32305) Differential Revision: https://reviews.llvm.org/D31155 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298364 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/avx512fintrin.h | 12 ++++++++++++ test/CodeGen/avx512f-builtins.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/Headers/avx512fintrin.h b/lib/Headers/avx512fintrin.h index 2877d708c6..35972f7503 100644 --- a/lib/Headers/avx512fintrin.h +++ b/lib/Headers/avx512fintrin.h @@ -4229,6 +4229,18 @@ _mm512_maskz_cvtpd_epu32 (__mmask8 __U, __m512d __A) _MM_FROUND_CUR_DIRECTION); } +static __inline__ double __DEFAULT_FN_ATTRS +_mm512_cvtsd_f64(__m512d __a) +{ + return __a[0]; +} + +static __inline__ float __DEFAULT_FN_ATTRS +_mm512_cvtss_f32(__m512 __a) +{ + return __a[0]; +} + /* Unpack and Interleave */ static __inline __m512d __DEFAULT_FN_ATTRS diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index 7da441d42c..b25df327fb 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -7259,6 +7259,18 @@ __m512i test_mm512_maskz_cvtps_epu32 (__mmask16 __U, __m512 __A) return _mm512_maskz_cvtps_epu32( __U, __A); } +double test_mm512_cvtsd_f64(__m512d A) { + // CHECK-LABEL: test_mm512_cvtsd_f64 + // CHECK: extractelement <8 x double> %{{.*}}, i32 0 + return _mm512_cvtsd_f64(A); +} + +float test_mm512_cvtss_f32(__m512 A) { + // CHECK-LABEL: test_mm512_cvtss_f32 + // CHECK: extractelement <16 x float> %{{.*}}, i32 0 + return _mm512_cvtss_f32(A); +} + __m512d test_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { // CHECK-LABEL: @test_mm512_mask_max_pd -- 2.40.0