r268481 - [Clang][Builtin][AVX512] Adding intrinsics fot cvt{u}si2s{d|s} cvt{sd|ss}2{ss|sd} instruction set
Michael Zuckerman via cfe-commits
cfe-commits at lists.llvm.org
Wed May 4 01:55:12 PDT 2016
Author: mzuckerm
Date: Wed May 4 03:55:11 2016
New Revision: 268481
URL: http://llvm.org/viewvc/llvm-project?rev=268481&view=rev
Log:
[Clang][Builtin][AVX512] Adding intrinsics fot cvt{u}si2s{d|s} cvt{sd|ss}2{ss|sd} instruction set
Differential Revision: http://reviews.llvm.org/D19765
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=268481&r1=268480&r2=268481&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed May 4 03:55:11 2016
@@ -2259,6 +2259,15 @@ TARGET_BUILTIN(__builtin_ia32_vcvtps2ph2
TARGET_BUILTIN(__builtin_ia32_cvtw2mask512, "UiV32s","","avx512bw")
TARGET_BUILTIN(__builtin_ia32_cvtw2mask128, "UcV8s","","avx512bw,avx512vl")
TARGET_BUILTIN(__builtin_ia32_cvtw2mask256, "UsV16s","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_cvtsd2ss_round_mask, "V4fV4fV4fV2dUcIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtsi2sd64, "V2dV2dLLiIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtsi2ss32, "V4fV4fiIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtsi2ss64, "V4fV4fLLiIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtss2sd_round_mask, "V2dV2dV2dV4fUcIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtusi2sd32, "V2dV2dUi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtusi2sd64, "V2dV2dULLiIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtusi2ss32, "V4fV4fUiIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtusi2ss64, "V4fV4fULLiIi","","avx512f")
#undef BUILTIN
#undef TARGET_BUILTIN
Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=268481&r1=268480&r2=268481&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Wed May 4 03:55:11 2016
@@ -8066,6 +8066,117 @@ _mm512_mask_compressstoreu_epi32 (void *
(__mmask16) __U);
}
+#define _mm_cvt_roundsd_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsd2ss_round_mask ((__v4sf)( __A),\
+ (__v2df)( __B),\
+ (__v4sf) _mm_undefined_ps (),\
+ (__mmask8) -1,\
+ ( __R));\
+})
+
+#define _mm_mask_cvt_roundsd_ss( __W, __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsd2ss_round_mask ((__v4sf)( __A),\
+ (__v2df)( __B),\
+ (__v4sf) __W,\
+ (__mmask8) __U,\
+ ( __R));\
+})
+
+#define _mm_maskz_cvt_roundsd_ss( __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsd2ss_round_mask ((__v4sf)( __A),\
+ (__v2df)( __B),\
+ (__v4sf) _mm_setzero_ps (),\
+ (__mmask8) __U,\
+ ( __R));\
+})
+
+#define _mm_cvt_roundi64_sd( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsi2sd64 ((__v2df)( __A),( __B),( __R));\
+})
+
+#define _mm_cvt_roundsi64_sd( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsi2sd64 ((__v2df)( __A),( __B),( __R));\
+})
+
+#define _mm_cvt_roundsi32_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsi2ss32 ((__v4sf)( __A),( __B),( __R));\
+})
+
+#define _mm_cvt_roundi32_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsi2ss32 ((__v4sf)( __A),( __B),( __R));\
+})
+
+#define _mm_cvt_roundsi64_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsi2ss64 ((__v4sf)( __A),( __B),( __R));\
+})
+
+#define _mm_cvt_roundi64_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtsi2ss64 ((__v4sf)( __A),( __B),( __R));\
+})
+
+#define _mm_cvt_roundss_sd( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtss2sd_round_mask ((__v2df)( __A),\
+ (__v4sf)( __B),\
+ (__v2df) _mm_undefined_pd (),\
+ (__mmask8)-1,\
+ ( __R));\
+})
+
+#define _mm_mask_cvt_roundss_sd(__W, __U,__A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtss2sd_round_mask ((__v2df)( __A),\
+ (__v4sf)( __B),\
+ (__v2df) __W,\
+ (__mmask8) __U,\
+ ( __R));\
+})
+
+#define _mm_maskz_cvt_roundss_sd( __U,__A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtss2sd_round_mask ((__v2df)( __A),\
+ (__v4sf)( __B),\
+ (__v2df) _mm_setzero_pd(),\
+ (__mmask8) __U,\
+ ( __R));\
+})
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_cvtu32_sd (__m128d __A, unsigned __B)
+{
+ return (__m128d) __builtin_ia32_cvtusi2sd32 ((__v2df) __A, __B);
+}
+
+#define _mm_cvt_roundu64_sd( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtusi2sd64 ((__v2df)( __A),( __B),( __R));\
+})
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_cvtu64_sd (__m128d __A, unsigned long long __B)
+{
+ return (__m128d) __builtin_ia32_cvtusi2sd64 ((__v2df) __A, __B,
+ _MM_FROUND_CUR_DIRECTION);
+}
+
+#define _mm_cvt_roundu32_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtusi2ss32 ((__v4sf)( __A),( __B),( __R));\
+})
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_cvtu32_ss (__m128 __A, unsigned __B)
+{
+ return (__m128) __builtin_ia32_cvtusi2ss32 ((__v4sf) __A, __B,
+ _MM_FROUND_CUR_DIRECTION);
+}
+
+#define _mm_cvt_roundu64_ss( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_cvtusi2ss64 ((__v4sf)( __A),( __B),( __R));\
+})
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_cvtu64_ss (__m128 __A, unsigned long long __B)
+{
+ return (__m128) __builtin_ia32_cvtusi2ss64 ((__v4sf) __A, __B,
+ _MM_FROUND_CUR_DIRECTION);
+}
+
#undef __DEFAULT_FN_ATTRS
#endif // __AVX512FINTRIN_H
Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=268481&r1=268480&r2=268481&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed May 4 03:55:11 2016
@@ -5613,3 +5613,118 @@ __m512i test_mm512_castsi256_si512(__m25
return _mm512_castsi256_si512(__A);
}
+
+__m128 test_mm_cvt_roundsd_ss(__m128 __A, __m128d __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundsd_ss
+ // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+ return _mm_cvt_roundsd_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_mask_cvt_roundsd_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128d __B) {
+ // CHECK-LABEL: @test_mm_mask_cvt_roundsd_ss
+ // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+ return _mm_mask_cvt_roundsd_ss(__W, __U, __A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_maskz_cvt_roundsd_ss(__mmask8 __U, __m128 __A, __m128d __B) {
+ // CHECK-LABEL: @test_mm_maskz_cvt_roundsd_ss
+ // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+ return _mm_maskz_cvt_roundsd_ss(__U, __A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_cvt_roundi64_sd(__m128d __A, long long __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundi64_sd
+ // CHECK: @llvm.x86.avx512.cvtsi2sd64
+ return _mm_cvt_roundi64_sd(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_cvt_roundsi64_sd(__m128d __A, long long __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundsi64_sd
+ // CHECK: @llvm.x86.avx512.cvtsi2sd64
+ return _mm_cvt_roundsi64_sd(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_cvt_roundsi32_ss(__m128 __A, int __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundsi32_ss
+ // CHECK: @llvm.x86.avx512.cvtsi2ss32
+ return _mm_cvt_roundsi32_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_cvt_roundi32_ss(__m128 __A, int __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundi32_ss
+ // CHECK: @llvm.x86.avx512.cvtsi2ss32
+ return _mm_cvt_roundi32_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_cvt_roundsi64_ss(__m128 __A, long long __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundsi64_ss
+ // CHECK: @llvm.x86.avx512.cvtsi2ss64
+ return _mm_cvt_roundsi64_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_cvt_roundi64_ss(__m128 __A, long long __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundi64_ss
+ // CHECK: @llvm.x86.avx512.cvtsi2ss64
+ return _mm_cvt_roundi64_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_cvt_roundss_sd(__m128d __A, __m128 __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundss_sd
+ // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+ return _mm_cvt_roundss_sd(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_mask_cvt_roundss_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128 __B) {
+ // CHECK-LABEL: @test_mm_mask_cvt_roundss_sd
+ // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+ return _mm_mask_cvt_roundss_sd(__W, __U, __A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_maskz_cvt_roundss_sd( __mmask8 __U, __m128d __A, __m128 __B) {
+ // CHECK-LABEL: @test_mm_maskz_cvt_roundss_sd
+ // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+ return _mm_maskz_cvt_roundss_sd( __U, __A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_cvtu32_sd(__m128d __A, unsigned __B) {
+ // CHECK-LABEL: @test_mm_cvtu32_sd
+ // CHECK: @llvm.x86.avx512.cvtusi2sd
+ return _mm_cvtu32_sd(__A, __B);
+}
+
+__m128d test_mm_cvt_roundu64_sd(__m128d __A, unsigned long long __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundu64_sd
+ // CHECK: @llvm.x86.avx512.cvtusi642sd
+ return _mm_cvt_roundu64_sd(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128d test_mm_cvtu64_sd(__m128d __A, unsigned long long __B) {
+ // CHECK-LABEL: @test_mm_cvtu64_sd
+ // CHECK: @llvm.x86.avx512.cvtusi642sd
+ return _mm_cvtu64_sd(__A, __B);
+}
+
+__m128 test_mm_cvt_roundu32_ss(__m128 __A, unsigned __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundu32_ss
+ // CHECK: @llvm.x86.avx512.cvtusi2ss
+ return _mm_cvt_roundu32_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_cvtu32_ss(__m128 __A, unsigned __B) {
+ // CHECK-LABEL: @test_mm_cvtu32_ss
+ // CHECK: @llvm.x86.avx512.cvtusi2ss
+ return _mm_cvtu32_ss(__A, __B);
+}
+
+__m128 test_mm_cvt_roundu64_ss(__m128 __A, unsigned long long __B) {
+ // CHECK-LABEL: @test_mm_cvt_roundu64_ss
+ // CHECK: @llvm.x86.avx512.cvtusi642ss
+ return _mm_cvt_roundu64_ss(__A, __B, _MM_FROUND_CUR_DIRECTION);
+}
+
+__m128 test_mm_cvtu64_ss(__m128 __A, unsigned long long __B) {
+ // CHECK-LABEL: @test_mm_cvtu64_ss
+ // CHECK: @llvm.x86.avx512.cvtusi642ss
+ return _mm_cvtu64_ss(__A, __B);
+}
+
More information about the cfe-commits
mailing list