[cfe-commits] r147253 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/avx2intrin.h test/CodeGen/avx2-builtins.c
Craig Topper
craig.topper at gmail.com
Sat Dec 24 09:20:15 PST 2011
Author: ctopper
Date: Sat Dec 24 11:20:15 2011
New Revision: 147253
URL: http://llvm.org/viewvc/llvm-project?rev=147253&view=rev
Log:
Add last of the AVX2 intrinsics except for gather.
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx2intrin.h
cfe/trunk/test/CodeGen/avx2-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=147253&r1=147252&r2=147253&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sat Dec 24 11:20:15 2011
@@ -575,5 +575,25 @@
BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "")
BUILTIN(__builtin_ia32_permdi256, "V4LLiV4LLiIc", "")
BUILTIN(__builtin_ia32_permti256, "V4LLiV4LLiV4LLiIc", "")
+BUILTIN(__builtin_ia32_extract128i256, "V2LLiV4LLiIc", "")
+BUILTIN(__builtin_ia32_insert128i256, "V4LLiV4LLiV2LLiIc", "")
+BUILTIN(__builtin_ia32_maskloadd256, "V8iV8iC*V8i", "")
+BUILTIN(__builtin_ia32_maskloadq256, "V4LLiV4LLiC*V4LLi", "")
+BUILTIN(__builtin_ia32_maskloadd, "V4iV4iC*V4i", "")
+BUILTIN(__builtin_ia32_maskloadq, "V2LLiV2LLiC*V2LLi", "")
+BUILTIN(__builtin_ia32_maskstored256, "vV8i*V8iV8i", "")
+BUILTIN(__builtin_ia32_maskstoreq256, "vV4LLi*V4LLiV4LLi", "")
+BUILTIN(__builtin_ia32_maskstored, "vV4i*V4iV4i", "")
+BUILTIN(__builtin_ia32_maskstoreq, "vV2LLi*V2LLiV2LLi", "")
+BUILTIN(__builtin_ia32_psllv8si, "V8iV8iV8i", "")
+BUILTIN(__builtin_ia32_psllv4si, "V4iV4iV4i", "")
+BUILTIN(__builtin_ia32_psllv4di, "V4LLiV4LLiV4LLi", "")
+BUILTIN(__builtin_ia32_psllv2di, "V2LLiV2LLiV2LLi", "")
+BUILTIN(__builtin_ia32_psrav8si, "V8iV8iV8i", "")
+BUILTIN(__builtin_ia32_psrav4si, "V4iV4iV4i", "")
+BUILTIN(__builtin_ia32_psrlv8si, "V8iV8iV8i", "")
+BUILTIN(__builtin_ia32_psrlv4si, "V4iV4iV4i", "")
+BUILTIN(__builtin_ia32_psrlv4di, "V4LLiV4LLiV4LLi", "")
+BUILTIN(__builtin_ia32_psrlv2di, "V2LLiV2LLiV2LLi", "")
#undef BUILTIN
Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=147253&r1=147252&r2=147253&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Sat Dec 24 11:20:15 2011
@@ -180,7 +180,7 @@
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpeq_epi64(__m256i a, __m256i b)
{
- return (__m256i)((__v4di)a == (__v4di)b);
+ return (__m256i)(a == b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
@@ -204,7 +204,7 @@
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpgt_epi64(__m256i a, __m256i b)
{
- return (__m256i)((__v4di)a > (__v4di)b);
+ return (__m256i)(a > b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
@@ -832,9 +832,126 @@
#define _mm256_permute4x64_epi64(V, M) __extension__ ({ \
__m256i __V = (V); \
- (__m256i)__builtin_ia32_permdi256((__v4di)__V, (M)); })
+ (__m256i)__builtin_ia32_permdi256(__V, (M)); })
#define _mm256_permute2x128_si256(V1, V2, M) __extension__ ({ \
__m256i __V1 = (V1); \
__m256i __V2 = (V2); \
- (__m256i)__builtin_ia32_permti256((__v4di)__V1, (__v4di)__V2, (M)); })
+ (__m256i)__builtin_ia32_permti256(__V1, __V2, (M)); })
+
+#define _mm256_extracti128_si256(A, O) __extension__ ({ \
+ __m256i __A = (A); \
+ (__m128i)__builtin_ia32_extract128i256(__A, (O)); })
+
+#define _mm256_inserti128_si256(V1, V2, O) __extension__ ({ \
+ __m256i __V1 = (V1); \
+ __m128i __V2 = (V2); \
+ (__m256i)__builtin_ia32_insert128i256(__V1, __V2, (O)); })
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_maskload_epi32(int const *__X, __m256i __M)
+{
+ return (__m256i)__builtin_ia32_maskloadd256((const __v8si *)__X, (__v8si)__M);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_maskload_epi64(long long const *__X, __m256i __M)
+{
+ return (__m256i)__builtin_ia32_maskloadq256((const __v4di *)__X, __M);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maskload_epi32(int const *__X, __m128i __M)
+{
+ return (__m128i)__builtin_ia32_maskloadd((const __v4si *)__X, (__v4si)__M);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_maskload_epi64(long long const *__X, __m128i __M)
+{
+ return (__m128i)__builtin_ia32_maskloadq((const __v2di *)__X, (__v2di)__M);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm256_maskstore_epi32(int *__X, __m256i __M, __m256i __Y)
+{
+ __builtin_ia32_maskstored256((__v8si *)__X, (__v8si)__M, (__v8si)__Y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm256_maskstore_epi64(long long *__X, __m256i __M, __m256i __Y)
+{
+ __builtin_ia32_maskstoreq256((__v4di *)__X, __M, __Y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_maskstore_epi32(int *__X, __m128i __M, __m128i __Y)
+{
+ __builtin_ia32_maskstored((__v4si *)__X, (__v4si)__M, (__v4si)__Y);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_mm_maskstore_epi64(long long *__X, __m128i __M, __m128i __Y)
+{
+ __builtin_ia32_maskstoreq(( __v2di *)__X, __M, __Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sllv_epi32(__m256i __X, __m256i __Y)
+{
+ return (__m256i)__builtin_ia32_psllv8si((__v8si)__X, (__v8si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sllv_epi32(__m128i __X, __m128i __Y)
+{
+ return (__m128i)__builtin_ia32_psllv4si((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_sllv_epi64(__m256i __X, __m256i __Y)
+{
+ return (__m256i)__builtin_ia32_psllv4di(__X, __Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_sllv_epi64(__m128i __X, __m128i __Y)
+{
+ return (__m128i)__builtin_ia32_psllv2di(__X, __Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srav_epi32(__m256i __X, __m256i __Y)
+{
+ return (__m256i)__builtin_ia32_psrav8si((__v8si)__X, (__v8si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srav_epi32(__m128i __X, __m128i __Y)
+{
+ return (__m128i)__builtin_ia32_psrav4si((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srlv_epi32(__m256i __X, __m256i __Y)
+{
+ return (__m256i)__builtin_ia32_psrlv8si((__v8si)__X, (__v8si)__Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srlv_epi32(__m128i __X, __m128i __Y)
+{
+ return (__m128i)__builtin_ia32_psrlv4si((__v4si)__X, (__v4si)__Y);
+}
+
+static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
+_mm256_srlv_epi64(__m256i __X, __m256i __Y)
+{
+ return (__m256i)__builtin_ia32_psrlv4di(__X, __Y);
+}
+
+static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
+_mm_srlv_epi64(__m128i __X, __m128i __Y)
+{
+ return (__m128i)__builtin_ia32_psrlv2di(__X, __Y);
+}
Modified: cfe/trunk/test/CodeGen/avx2-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=147253&r1=147252&r2=147253&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx2-builtins.c Sat Dec 24 11:20:15 2011
@@ -680,3 +680,103 @@
// CHECK: @llvm.x86.avx2.vperm2i128
return _mm256_permute2x128_si256(a, b, 94);
}
+
+__m128i test_mm256_extracti128_si256(__m256i a) {
+ // CHECK: @llvm.x86.avx2.vextracti128
+ return _mm256_extracti128_si256(a, 1);
+}
+
+__m256i test_mm256_inserti128_si256(__m256i a, __m128i b) {
+ // CHECK: @llvm.x86.avx2.vinserti128
+ return _mm256_inserti128_si256(a, b, 1);
+}
+
+__m256i test_mm256_maskload_epi32(int const *a, __m256i m) {
+ // CHECK: @llvm.x86.avx2.maskload.d.256
+ return _mm256_maskload_epi32(a, m);
+}
+
+__m256i test_mm256_maskload_epi64(long long const *a, __m256i m) {
+ // CHECK: @llvm.x86.avx2.maskload.q.256
+ return _mm256_maskload_epi64(a, m);
+}
+
+__m128i test_mm_maskload_epi32(int const *a, __m128i m) {
+ // CHECK: @llvm.x86.avx2.maskload.d
+ return _mm_maskload_epi32(a, m);
+}
+
+__m128i test_mm_maskload_epi64(long long const *a, __m128i m) {
+ // CHECK: @llvm.x86.avx2.maskload.q
+ return _mm_maskload_epi64(a, m);
+}
+
+void test_mm256_maskstore_epi32(int *a, __m256i m, __m256i b) {
+ // CHECK: @llvm.x86.avx2.maskstore.d.256
+ _mm256_maskstore_epi32(a, m, b);
+}
+
+void test_mm256_maskstore_epi64(long long *a, __m256i m, __m256i b) {
+ // CHECK: @llvm.x86.avx2.maskstore.q.256
+ _mm256_maskstore_epi64(a, m, b);
+}
+
+void test_mm_maskstore_epi32(int *a, __m128i m, __m128i b) {
+ // CHECK: @llvm.x86.avx2.maskstore.d
+ _mm_maskstore_epi32(a, m, b);
+}
+
+void test_mm_maskstore_epi64(long long *a, __m128i m, __m128i b) {
+ // CHECK: @llvm.x86.avx2.maskstore.q
+ _mm_maskstore_epi64(a, m, b);
+}
+
+__m256i test_mm256_sllv_epi32(__m256i a, __m256i b) {
+ // CHECK: @llvm.x86.avx2.psllv.d.256
+ return _mm256_sllv_epi32(a, b);
+}
+
+__m128i test_mm_sllv_epi32(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.avx2.psllv.d
+ return _mm_sllv_epi32(a, b);
+}
+
+__m256i test_mm256_sllv_epi64(__m256i a, __m256i b) {
+ // CHECK: @llvm.x86.avx2.psllv.q.256
+ return _mm256_sllv_epi64(a, b);
+}
+
+__m128i test_mm_sllv_epi64(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.avx2.psllv.q
+ return _mm_sllv_epi64(a, b);
+}
+
+__m256i test_mm256_srav_epi32(__m256i a, __m256i b) {
+ // CHECK: @llvm.x86.avx2.psrav.d.256
+ return _mm256_srav_epi32(a, b);
+}
+
+__m128i test_mm_srav_epi32(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.avx2.psrav.d
+ return _mm_srav_epi32(a, b);
+}
+
+__m256i test_mm256_srlv_epi32(__m256i a, __m256i b) {
+ // CHECK: @llvm.x86.avx2.psrlv.d.256
+ return _mm256_srlv_epi32(a, b);
+}
+
+__m128i test_mm_srlv_epi32(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.avx2.psrlv.d
+ return _mm_srlv_epi32(a, b);
+}
+
+__m256i test_mm256_srlv_epi64(__m256i a, __m256i b) {
+ // CHECK: @llvm.x86.avx2.psrlv.q.256
+ return _mm256_srlv_epi64(a, b);
+}
+
+__m128i test_mm_srlv_epi64(__m128i a, __m128i b) {
+ // CHECK: @llvm.x86.avx2.psrlv.q
+ return _mm_srlv_epi64(a, b);
+}
More information about the cfe-commits
mailing list