[cfe-commits] r159410 - in /cfe/trunk: lib/Headers/avx2intrin.h test/CodeGen/avx2-builtins.c

Manman Ren mren at apple.com
Thu Jun 28 22:19:14 PDT 2012


Author: mren
Date: Fri Jun 29 00:19:13 2012
New Revision: 159410

URL: http://llvm.org/viewvc/llvm-project?rev=159410&view=rev
Log:
X86: add more GATHER intrinsics in Clang

Support the following intrinsics:
  _mm_i32gather_pd, _mm256_i32gather_pd,
  _mm_i64gather_pd, _mm256_i64gather_pd,
  _mm_i32gather_ps, _mm256_i32gather_ps,
  _mm_i64gather_ps, _mm256_i64gather_ps,
  _mm_i32gather_epi64, _mm256_i32gather_epi64,
  _mm_i64gather_epi64, _mm256_i64gather_epi64,
  _mm_i32gather_epi32, _mm256_i32gather_epi32,
  _mm_i64gather_epi32, _mm256_i64gather_epi32

Modified:
    cfe/trunk/lib/Headers/avx2intrin.h
    cfe/trunk/test/CodeGen/avx2-builtins.c

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=159410&r1=159409&r2=159410&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Fri Jun 29 00:19:13 2012
@@ -1087,3 +1087,115 @@
   __m256i __mask = (mask); \
   (__m256i)__builtin_ia32_gatherq_q256((__v4di)__a, (const __v4di *)__m, \
              (__v4di)__i, (__v4di)__mask, (s)); })
+
+#define _mm_i32gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128d)__builtin_ia32_gatherd_pd((__v2df)_mm_setzero_pd(), \
+             (const __v2df *)__m, (__v4si)__i, \
+             (__v2df)_mm_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm256_i32gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  (__m256d)__builtin_ia32_gatherd_pd256((__v4df)_mm256_setzero_pd(), \
+             (const __v4df *)__m, (__v4si)__i, \
+             (__v4df)_mm256_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm_i64gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128d)__builtin_ia32_gatherq_pd((__v2df)_mm_setzero_pd(), \
+             (const __v2df *)__m, (__v2di)__i, \
+             (__v2df)_mm_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm256_i64gather_pd(m, i, s) __extension__ ({ \
+  double const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256d)__builtin_ia32_gatherq_pd256((__v4df)_mm256_setzero_pd(), \
+             (const __v4df *)__m, (__v4di)__i, \
+             (__v4df)_mm256_set1_pd((double)(long long int)-1), (s)); })
+
+#define _mm_i32gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128)__builtin_ia32_gatherd_ps((__v4sf)_mm_setzero_ps(), \
+             (const __v4sf *)__m, (__v4si)__i, \
+             (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
+
+#define _mm256_i32gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256)__builtin_ia32_gatherd_ps256((__v8sf)_mm256_setzero_ps(), \
+             (const __v8sf *)__m, (__v8si)__i, \
+             (__v8sf)_mm256_set1_ps((float)(int)-1), (s)); })
+
+#define _mm_i64gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128)__builtin_ia32_gatherq_ps((__v4sf)_mm_setzero_ps(), \
+             (const __v4sf *)__m, (__v2di)__i, \
+             (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
+
+#define _mm256_i64gather_ps(m, i, s) __extension__ ({ \
+  float const *__m = (m); \
+  __m256i __i = (i); \
+  (__m128)__builtin_ia32_gatherq_ps256((__v4sf)_mm_setzero_ps(), \
+             (const __v4sf *)__m, (__v4di)__i, \
+             (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
+
+#define _mm_i32gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherd_d((__v4si)_mm_setzero_si128(), \
+            (const __v4si *)__m, (__v4si)__i, \
+            (__v4si)_mm_set1_epi32(-1), (s)); })
+
+#define _mm256_i32gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256i)__builtin_ia32_gatherd_d256((__v8si)_mm256_setzero_si256(), \
+            (const __v8si *)__m, (__v8si)__i, \
+            (__v8si)_mm256_set1_epi32(-1), (s)); })
+
+#define _mm_i64gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherq_d((__v4si)_mm_setzero_si128(), \
+            (const __v4si *)__m, (__v2di)__i, \
+            (__v4si)_mm_set1_epi32(-1), (s)); })
+
+#define _mm256_i64gather_epi32(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  (__m128i)__builtin_ia32_gatherq_d256((__v4si)_mm_setzero_si128(), \
+            (const __v4si *)__m, (__v4di)__i, \
+            (__v4si)_mm_set1_epi32(-1), (s)); })
+
+#define _mm_i32gather_epi64(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherd_q((__v2di)_mm_setzero_si128(), \
+             (const __v2di *)__m, (__v4si)__i, \
+             (__v2di)_mm_set1_epi64x(-1), (s)); })
+
+#define _mm256_i32gather_epi64(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m256i)__builtin_ia32_gatherd_q256((__v4di)_mm256_setzero_si256(), \
+             (const __v4di *)__m, (__v4si)__i, \
+             (__v4di)_mm256_set1_epi64x(-1), (s)); })
+
+#define _mm_i64gather_epi64(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m128i __i = (i); \
+  (__m128i)__builtin_ia32_gatherq_q((__v2di)_mm_setzero_si128(), \
+             (const __v2di *)__m, (__v2di)__i, \
+             (__v2di)_mm_set1_epi64x(-1), (s)); })
+
+#define _mm256_i64gather_epi64(m, i, s) __extension__ ({ \
+  int const *__m = (m); \
+  __m256i __i = (i); \
+  (__m256i)__builtin_ia32_gatherq_q256((__v4di)_mm256_setzero_si256(), \
+             (const __v4di *)__m, (__v4di)__i, \
+             (__v4di)_mm256_set1_epi64x(-1), (s)); })

Modified: cfe/trunk/test/CodeGen/avx2-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=159410&r1=159409&r2=159410&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx2-builtins.c Fri Jun 29 00:19:13 2012
@@ -870,3 +870,69 @@
   // CHECK: @llvm.x86.avx2.gather.q.q.256
   return _mm256_mask_i64gather_epi64(a, b, c, d, 2);
 }
+
+__m128d test_mm_i32gather_pd(double const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.pd
+  return _mm_i32gather_pd(b, c, 2);
+}
+__m256d test_mm256_i32gather_pd(double const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.pd.256
+  return _mm256_i32gather_pd(b, c, 2);
+}
+__m128d test_mm_i64gather_pd(double const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.pd
+  return _mm_i64gather_pd(b, c, 2);
+}
+__m256d test_mm256_i64gather_pd(double const *b, __m256i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.pd.256
+  return _mm256_i64gather_pd(b, c, 2);
+}
+__m128 test_mm_i32gather_ps(float const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.ps
+  return _mm_i32gather_ps(b, c, 2);
+}
+__m256 test_mm256_i32gather_ps(float const *b, __m256i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.ps.256
+  return _mm256_i32gather_ps(b, c, 2);
+}
+__m128 test_mm_i64gather_ps(float const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.ps
+  return _mm_i64gather_ps(b, c, 2);
+}
+__m128 test_mm256_i64gather_ps(float const *b, __m256i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.ps.256
+  return _mm256_i64gather_ps(b, c, 2);
+}
+
+__m128i test_mm_i32gather_epi32(int const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.d
+  return _mm_i32gather_epi32(b, c, 2);
+}
+__m256i test_mm256_i32gather_epi32(int const *b, __m256i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.d.256
+  return _mm256_i32gather_epi32(b, c, 2);
+}
+__m128i test_mm_i64gather_epi32(int const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.d
+  return _mm_i64gather_epi32(b, c, 2);
+}
+__m128i test_mm256_i64gather_epi32(int const *b, __m256i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.d.256
+  return _mm256_i64gather_epi32(b, c, 2);
+}
+__m128i test_mm_i32gather_epi64(int const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.q
+  return _mm_i32gather_epi64(b, c, 2);
+}
+__m256i test_mm256_i32gather_epi64(int const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.d.q.256
+  return _mm256_i32gather_epi64(b, c, 2);
+}
+__m128i test_mm_i64gather_epi64(int const *b, __m128i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.q
+  return _mm_i64gather_epi64(b, c, 2);
+}
+__m256i test_mm256_i64gather_epi64(int const *b, __m256i c) {
+  // CHECK: @llvm.x86.avx2.gather.q.q.256
+  return _mm256_i64gather_epi64(b, c, 2);
+}





More information about the cfe-commits mailing list