34 for (
i = 0;
i < tail_idx;
i +=
sizeof(
Vector8))
42 for (;
i < nelem;
i++)
66 for (
i = 0;
i < tail_idx;
i +=
sizeof(
Vector8))
74 for (;
i < nelem;
i++)
109pg_lfind32_simd_helper(
const Vector32 keys,
const uint32 *base)
111 const uint32 nelem_per_vector =
sizeof(Vector32) /
sizeof(
uint32);
125 vector32_load(&vals1, base);
126 vector32_load(&vals2, &base[nelem_per_vector]);
127 vector32_load(&vals3, &base[nelem_per_vector * 2]);
128 vector32_load(&vals4, &base[nelem_per_vector * 3]);
131 result1 = vector32_eq(keys, vals1);
132 result2 = vector32_eq(keys, vals2);
133 result3 = vector32_eq(keys, vals3);
134 result4 = vector32_eq(keys, vals4);
137 tmp1 = vector32_or(result1, result2);
138 tmp2 = vector32_or(result3, result4);
139 result = vector32_or(tmp1, tmp2);
142 return vector32_is_highbit_set(result);
162 const Vector32 keys = vector32_broadcast(
key);
163 const uint32 nelem_per_vector =
sizeof(Vector32) /
sizeof(
uint32);
164 const uint32 nelem_per_iteration = 4 * nelem_per_vector;
167 const uint32 tail_idx = nelem & ~(nelem_per_iteration - 1);
169#if defined(USE_ASSERT_CHECKING)
177 if (nelem < nelem_per_iteration)
185 if (pg_lfind32_simd_helper(keys, &base[
i]))
187 Assert(assert_result ==
true);
191 i += nelem_per_iteration;
193 }
while (
i < tail_idx);
201 Assert(assert_result == pg_lfind32_simd_helper(keys, &base[nelem - nelem_per_iteration]));
202 return pg_lfind32_simd_helper(keys, &base[nelem - nelem_per_iteration]);
#define Assert(condition)
static bool pg_lfind8_le(uint8 key, uint8 *base, uint32 nelem)
static bool pg_lfind32(uint32 key, const uint32 *base, uint32 nelem)
static bool pg_lfind8(uint8 key, uint8 *base, uint32 nelem)
static bool pg_lfind32_one_by_one_helper(uint32 key, const uint32 *base, uint32 nelem)
static bool vector8_has_le(const Vector8 v, const uint8 c)
static void vector8_load(Vector8 *v, const uint8 *s)
static bool vector8_has(const Vector8 v, const uint8 c)