r271499 - [X86][AVX512] add intrinsics of Scalar FP to integer
Asaf Badouh via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 01:11:40 PDT 2016
Author: abadouh
Date: Thu Jun 2 03:11:35 2016
New Revision: 271499
URL: http://llvm.org/viewvc/llvm-project?rev=271499&view=rev
Log:
[X86][AVX512] add intrinsics of Scalar FP to integer
Differential Revision: http://reviews.llvm.org/D20861
Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=271499&r1=271498&r2=271499&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu Jun 2 03:11:35 2016
@@ -9331,6 +9331,33 @@ _mm512_mask_compressstoreu_epi32 (void *
(__v4sf)_mm_setzero_ps(), \
(__mmask8)(U), (int)(R)); })
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_cvtsd_ss (__m128 W, __mmask8 U, __m128 A, __m128d B)
+{
+ return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(A),
+ (__v2df)(B),
+ (__v4sf)(W),
+ (__mmask8)(U), _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_cvtsd_ss (__mmask8 U, __m128 A, __m128d B)
+{
+ return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(A),
+ (__v2df)(B),
+ (__v4sf)_mm_setzero_ps(),
+ (__mmask8)(U), _MM_FROUND_CUR_DIRECTION);
+}
+
+#define _mm_cvtss_i32 _mm_cvtss_si32
+#define _mm_cvtss_i64 _mm_cvtss_si64
+#define _mm_cvtsd_i32 _mm_cvtsd_si32
+#define _mm_cvtsd_i64 _mm_cvtsd_si64
+#define _mm_cvti32_sd _mm_cvtsi32_sd
+#define _mm_cvti64_sd _mm_cvtsi64_sd
+#define _mm_cvti32_ss _mm_cvtsi32_ss
+#define _mm_cvti64_ss _mm_cvtsi64_ss
+
#define _mm_cvt_roundi64_sd(A, B, R) __extension__ ({ \
(__m128d)__builtin_ia32_cvtsi2sd64((__v2df)(__m128d)(A), (long long)(B), \
(int)(R)); })
@@ -9372,6 +9399,24 @@ _mm512_mask_compressstoreu_epi32 (void *
(__mmask8)(U), (int)(R)); })
static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_cvtss_sd (__m128d W, __mmask8 U, __m128d A, __m128 B)
+{
+ return __builtin_ia32_cvtss2sd_round_mask((__v2df)(A),
+ (__v4sf)(B),
+ (__v2df)(W),
+ (__mmask8)(U), _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_cvtss_sd (__mmask8 U, __m128d A, __m128 B)
+{
+ return __builtin_ia32_cvtss2sd_round_mask((__v2df)(A),
+ (__v4sf)(B),
+ (__v2df)_mm_setzero_pd(),
+ (__mmask8)(U), _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_cvtu32_sd (__m128d __A, unsigned __B)
{
return (__m128d) __builtin_ia32_cvtusi2sd32 ((__v2df) __A, __B);
Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=271499&r1=271498&r2=271499&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu Jun 2 03:11:35 2016
@@ -7266,3 +7266,80 @@ __m512 test_mm512_setr_ps (float __A, fl
return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
__I, __J, __K, __L, __M, __N, __O, __P);
}
+
+int test_mm_cvtss_i32(__m128 A) {
+ // CHECK-LABEL: test_mm_cvtss_i32
+ // CHECK: call i32 @llvm.x86.sse.cvtss2si(<4 x float> %{{.*}})
+ return _mm_cvtss_i32(A);
+}
+
+long long test_mm_cvtss_i64(__m128 A) {
+ // CHECK-LABEL: test_mm_cvtss_i64
+ // CHECK: call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %{{.*}})
+ return _mm_cvtss_i64(A);
+}
+
+__m128d test_mm_cvti32_sd(__m128d A, int B) {
+ // CHECK-LABEL: test_mm_cvti32_sd
+ // CHECK: sitofp i32 %{{.*}} to double
+ // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
+ return _mm_cvti32_sd(A, B);
+}
+
+__m128d test_mm_cvti64_sd(__m128d A, long long B) {
+ // CHECK-LABEL: test_mm_cvti64_sd
+ // CHECK: sitofp i64 %{{.*}} to double
+ // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
+ return _mm_cvti64_sd(A, B);
+}
+
+__m128 test_mm_cvti32_ss(__m128 A, int B) {
+ // CHECK-LABEL: test_mm_cvti32_ss
+ // CHECK: sitofp i32 %{{.*}} to float
+ // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+ return _mm_cvti32_ss(A, B);
+}
+
+__m128 test_mm_cvti64_ss(__m128 A, long long B) {
+ // CHECK-LABEL: test_mm_cvti64_ss
+ // CHECK: sitofp i64 %{{.*}} to float
+ // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+ return _mm_cvti64_ss(A, B);
+}
+
+int test_mm_cvtsd_i32(__m128d A) {
+ // CHECK-LABEL: test_mm_cvtsd_i32
+ // CHECK: call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %{{.*}})
+ return _mm_cvtsd_i32(A);
+}
+
+long long test_mm_cvtsd_i64(__m128d A) {
+ // CHECK-LABEL: test_mm_cvtsd_i64
+ // CHECK: call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %{{.*}})
+ return _mm_cvtsd_i64(A);
+}
+
+__m128d test_mm_mask_cvtss_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128 __B) {
+ // CHECK-LABEL: @test_mm_mask_cvtss_sd
+ // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+ return _mm_mask_cvtss_sd(__W, __U, __A, __B);
+}
+
+__m128d test_mm_maskz_cvtss_sd( __mmask8 __U, __m128d __A, __m128 __B) {
+ // CHECK-LABEL: @test_mm_maskz_cvtss_sd
+ // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+ return _mm_maskz_cvtss_sd( __U, __A, __B);
+}
+
+__m128 test_mm_mask_cvtsd_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128d __B) {
+ // CHECK-LABEL: @test_mm_mask_cvtsd_ss
+ // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+ return _mm_mask_cvtsd_ss(__W, __U, __A, __B);
+}
+
+__m128 test_mm_maskz_cvtsd_ss(__mmask8 __U, __m128 __A, __m128d __B) {
+ // CHECK-LABEL: @test_mm_maskz_cvtsd_ss
+ // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+ return _mm_maskz_cvtsd_ss(__U, __A, __B);
+}
+
More information about the cfe-commits
mailing list