static inline bool avxcontains(hashset_t * set, uint64_t target) { __m256i vtarget = _mm256_set1_epi64x(target); __m256i vlocation = _mm256_and_si256(avxhash(vtarget, set->vmultiplier),set->sizemask); __m256i svalue = _mm256_i64gather_epi64((const long long int *) set->data,vlocation,8); __m256i eq = _mm256_cmpeq_epi64(vtarget,svalue); return _mm256_testz_si256(eq,eq) == 0; }
void static avx2_test (void) { long long i; union256i_q idx; union256i_q res; long long s1[4], res_ref[4] = { 0 }; for (i = 0; i < 4; ++i) { /* Set some stuff */ s1[i] = 1983 * (i + 1) * (i + 2); /* About to gather in reverse order, divide by 2 to demonstrate scale */ idx.a[i] = (32 - (i + 1) * 8) >> 1; } res.x = _mm256_i64gather_epi64 ((long long int *) s1, idx.x, 2); compute_i64gatherq256 (s1, idx.a, 2, res_ref); if (check_union256i_q (res, res_ref) != 0) abort (); }
__m256i test_mm256_i64gather_epi64(long long const *b, __m256i c) { // CHECK-LABEL: test_mm256_i64gather_epi64 // CHECK: call <4 x i64> @llvm.x86.avx2.gather.q.q.256(<4 x i64> undef, i8* %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, i8 2) return _mm256_i64gather_epi64(b, c, 2); }
__m256i test_mm256_i64gather_epi64(long long const *b, __m256i c) { // CHECK: @llvm.x86.avx2.gather.q.q.256 return _mm256_i64gather_epi64(b, c, 2); }
void extern avx2_test (void) { x = _mm256_i64gather_epi64 (base, idx, 1); }