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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159410 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manman Ren 2012-06-29 05:19:13 +00:00
Родитель c56b552ff2
Коммит 56c045ed5e
2 изменённых файлов: 178 добавлений и 0 удалений

Просмотреть файл

@ -1087,3 +1087,115 @@ _mm_srlv_epi64(__m128i __X, __m128i __Y)
__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)); })

Просмотреть файл

@ -870,3 +870,69 @@ __m256i test_mm256_mask_i64gather_epi64(__m256i a, int const *b, __m256i c,
// 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);
}