r261755 - [CLANG] [AVX512] [BUILTIN] Adding PSHUF{L|H}W{128|256|512} builtin to clang .
Michael Zuckerman via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 24 09:39:35 PST 2016
Author: mzuckerm
Date: Wed Feb 24 11:39:35 2016
New Revision: 261755
URL: http://llvm.org/viewvc/llvm-project?rev=261755&view=rev
Log:
[CLANG] [AVX512] [BUILTIN] Adding PSHUF{L|H}W{128|256|512} builtin to clang .
Differential Revision: http://reviews.llvm.org/D17539
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/test/CodeGen/avx512bw-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=261755&r1=261754&r2=261755&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Feb 24 11:39:35 2016
@@ -1632,6 +1632,12 @@ TARGET_BUILTIN(__builtin_ia32_prorvd128_
TARGET_BUILTIN(__builtin_ia32_prorvd256_mask, "V8iV8iV8iV8iUc","","avx512vl")
TARGET_BUILTIN(__builtin_ia32_prorvq128_mask, "V2LLiV2LLiV2LLiV2LLiUc","","avx512vl")
TARGET_BUILTIN(__builtin_ia32_prorvq256_mask, "V4LLiV4LLiV4LLiV4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshufhw512_mask, "V32sV32sIiV32sUi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_pshuflw512_mask, "V32sV32sIiV32sUi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_pshufhw128_mask, "V8sV8sIiV8sUc","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshufhw256_mask, "V16sV16sIiV16sUs","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshuflw128_mask, "V8sV8sIiV8sUc","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshuflw256_mask, "V16sV16sIiV16sUs","","avx512bw,avx512vl")
#undef BUILTIN
#undef TARGET_BUILTIN
Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=261755&r1=261754&r2=261755&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Wed Feb 24 11:39:35 2016
@@ -1589,6 +1589,54 @@ _mm512_maskz_cvtepu8_epi16 (__mmask32 __
(__v32hi)(__m512i)(b), \
(p), (__mmask32)(m)); })
+#define _mm512_shufflehi_epi16( __A, __imm) __extension__ ({ \
+__builtin_ia32_pshufhw512_mask ((__v32hi)( __A),\
+ ( __imm),\
+ (__v32hi)\
+ _mm512_setzero_hi (),\
+ (__mmask32) -1);\
+})
+
+#define _mm512_mask_shufflehi_epi16( __W, __U, __A ,__imm) __extension__ ({ \
+__builtin_ia32_pshufhw512_mask ((__v32hi) (__A),\
+ (__imm),\
+ (__v32hi)( __W),\
+ (__mmask32)( __U));\
+})
+
+
+#define _mm512_maskz_shufflehi_epi16( __U, __A ,__imm) __extension__ ({ \
+__builtin_ia32_pshufhw512_mask ((__v32hi) (__A),\
+ (__imm),\
+ (__v32hi)\
+ _mm512_setzero_hi (),\
+ (__mmask32)( __U));\
+})
+
+#define _mm512_shufflelo_epi16( __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw512_mask ((__v32hi)( __A),\
+ ( __imm),\
+ (__v32hi)\
+ _mm512_setzero_hi (),\
+ (__mmask32) -1);\
+})
+
+
+#define _mm512_mask_shufflelo_epi16( __W, __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw512_mask ((__v32hi) (__A),\
+ (__imm),\
+ (__v32hi)( __W),\
+ (__mmask32)( __U));\
+})
+
+
+#define _mm512_maskz_shufflelo_epi16( __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw512_mask ((__v32hi) (__A),\
+ (__imm),\
+ (__v32hi)\
+ _mm512_setzero_hi (),\
+ (__mmask32)( __U));\
+})
#undef __DEFAULT_FN_ATTRS
Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=261755&r1=261754&r2=261755&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Wed Feb 24 11:39:35 2016
@@ -31,6 +31,11 @@
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512bw")))
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm_setzero_hi(void){
+ return (__m128i){ 0LL, 0LL };
+}
+
/* Integer compare */
static __inline__ __mmask16 __DEFAULT_FN_ATTRS
@@ -2401,6 +2406,67 @@ _mm256_maskz_cvtepu8_epi16 (__mmask16 __
(__v16hi)(__m256i)(b), \
(p), (__mmask16)(m)); })
+#define _mm_mask_shufflehi_epi16( __W, __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshufhw128_mask ((__v8hi) __A, (__imm),\
+ (__v8hi)( __W),\
+ (__mmask8)( __U));\
+})
+
+#define _mm_maskz_shufflehi_epi16( __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshufhw128_mask ((__v8hi)( __A),( __imm),\
+ (__v8hi)\
+ _mm_setzero_hi (),\
+ (__mmask8)( __U));\
+})
+
+
+#define _mm256_mask_shufflehi_epi16( __W, __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshufhw256_mask ((__v16hi) (__A),\
+ (__imm),\
+ (__v16hi)( __W),\
+ (__mmask16)( __U));\
+})
+
+
+#define _mm256_maskz_shufflehi_epi16( __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshufhw256_mask ((__v16hi) (__A),\
+ (__imm),\
+ (__v16hi)\
+ _mm256_setzero_si256 (),\
+ (__mmask16)( __U));\
+})
+
+
+#define _mm_mask_shufflelo_epi16( __W, __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw128_mask ((__v8hi) __A, (__imm),\
+ (__v8hi)( __W),\
+ (__mmask8)( __U));\
+})
+
+#define _mm_maskz_shufflelo_epi16( __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw128_mask ((__v8hi)( __A),( __imm),\
+ (__v8hi)\
+ _mm_setzero_hi (),\
+ (__mmask8)( __U));\
+})
+
+
+#define _mm256_mask_shufflelo_epi16( __W, __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw256_mask ((__v16hi) (__A),\
+ (__imm),\
+ (__v16hi)( __W),\
+ (__mmask16)( __U));\
+})
+
+
+#define _mm256_maskz_shufflelo_epi16( __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_pshuflw256_mask ((__v16hi) (__A),\
+ (__imm),\
+ (__v16hi)\
+ _mm256_setzero_si256 (),\
+ (__mmask16)( __U));\
+})
+
#undef __DEFAULT_FN_ATTRS
#endif /* __AVX512VLBWINTRIN_H */
Modified: cfe/trunk/test/CodeGen/avx512bw-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512bw-builtins.c?rev=261755&r1=261754&r2=261755&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512bw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512bw-builtins.c Wed Feb 24 11:39:35 2016
@@ -1076,3 +1076,41 @@ __m512i test_mm512_maskz_cvtepu8_epi16(_
// CHECK: @llvm.x86.avx512.mask.pmovzxb.w.512
return _mm512_maskz_cvtepu8_epi16(__U, __A);
}
+
+__m512i test_mm512_shufflehi_epi16(__m512i __A) {
+ // CHECK-LABEL: @test_mm512_shufflehi_epi16
+ // CHECK: @llvm.x86.avx512.mask.pshufh.w.512
+ return _mm512_shufflehi_epi16(__A, 5);
+}
+
+__m512i test_mm512_mask_shufflehi_epi16(__m512i __W, __mmask32 __U, __m512i __A) {
+ // CHECK-LABEL: @test_mm512_mask_shufflehi_epi16
+ // CHECK: @llvm.x86.avx512.mask.pshufh.w.512
+ return _mm512_mask_shufflehi_epi16(__W, __U, __A, 5);
+}
+
+__m512i test_mm512_maskz_shufflehi_epi16(__mmask32 __U, __m512i __A) {
+ // CHECK-LABEL: @test_mm512_maskz_shufflehi_epi16
+ // CHECK: @llvm.x86.avx512.mask.pshufh.w.512
+ return _mm512_maskz_shufflehi_epi16(__U, __A, 5);
+}
+
+__m512i test_mm512_shufflelo_epi16(__m512i __A) {
+ // CHECK-LABEL: @test_mm512_shufflelo_epi16
+ // CHECK: @llvm.x86.avx512.mask.pshufl.w.512
+ return _mm512_shufflelo_epi16(__A, 5);
+}
+
+__m512i test_mm512_mask_shufflelo_epi16(__m512i __W, __mmask32 __U, __m512i __A) {
+ // CHECK-LABEL: @test_mm512_mask_shufflelo_epi16
+ // CHECK: @llvm.x86.avx512.mask.pshufl.w.512
+ return _mm512_mask_shufflelo_epi16(__W, __U, __A, 5);
+}
+
+__m512i test_mm512_maskz_shufflelo_epi16(__mmask32 __U, __m512i __A) {
+ // CHECK-LABEL: @test_mm512_maskz_shufflelo_epi16
+ // CHECK: @llvm.x86.avx512.mask.pshufl.w.512
+ return _mm512_maskz_shufflelo_epi16(__U, __A, 5);
+}
+
+
More information about the cfe-commits
mailing list