Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
howjmay committed Nov 5, 2023
1 parent f33b7f9 commit 12f14fa
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static double next()

static float ranf()
{
return (double) (next() / TWOPOWER64);
return (float) (next() / TWOPOWER64);
}

static float ranf(float low, float high)
Expand Down Expand Up @@ -5943,17 +5943,18 @@ result_t test_mm_sll_epi16(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const int16_t *_a = (const int16_t *) impl.mTestIntPointer1;
__m128i a, b, c;

uint8_t idx;
#define TEST_IMPL(IDX) \
uint16_t d##IDX[8]; \
d##IDX[0] = (IDX > 15) ? 0 : _a[0] << IDX; \
d##IDX[1] = (IDX > 15) ? 0 : _a[1] << IDX; \
d##IDX[2] = (IDX > 15) ? 0 : _a[2] << IDX; \
d##IDX[3] = (IDX > 15) ? 0 : _a[3] << IDX; \
d##IDX[4] = (IDX > 15) ? 0 : _a[4] << IDX; \
d##IDX[5] = (IDX > 15) ? 0 : _a[5] << IDX; \
d##IDX[6] = (IDX > 15) ? 0 : _a[6] << IDX; \
d##IDX[7] = (IDX > 15) ? 0 : _a[7] << IDX; \
idx = IDX; \
d##IDX[0] = (idx > 15) ? 0 : _a[0] << idx; \
d##IDX[1] = (idx > 15) ? 0 : _a[1] << idx; \
d##IDX[2] = (idx > 15) ? 0 : _a[2] << idx; \
d##IDX[3] = (idx > 15) ? 0 : _a[3] << idx; \
d##IDX[4] = (idx > 15) ? 0 : _a[4] << idx; \
d##IDX[5] = (idx > 15) ? 0 : _a[5] << idx; \
d##IDX[6] = (idx > 15) ? 0 : _a[6] << idx; \
d##IDX[7] = (idx > 15) ? 0 : _a[7] << idx; \
\
a = load_m128i(_a); \
b = _mm_set1_epi64x(IDX); \
Expand All @@ -5970,13 +5971,15 @@ result_t test_mm_sll_epi32(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const int32_t *_a = (const int32_t *) impl.mTestIntPointer1;
__m128i a, b, c;
uint8_t idx;

#define TEST_IMPL(IDX) \
uint32_t d##IDX[4]; \
d##IDX[0] = (IDX > 31) ? 0 : _a[0] << IDX; \
d##IDX[1] = (IDX > 31) ? 0 : _a[1] << IDX; \
d##IDX[2] = (IDX > 31) ? 0 : _a[2] << IDX; \
d##IDX[3] = (IDX > 31) ? 0 : _a[3] << IDX; \
idx = IDX; \
d##IDX[0] = (idx > 31) ? 0 : _a[0] << idx; \
d##IDX[1] = (idx > 31) ? 0 : _a[1] << idx; \
d##IDX[2] = (idx > 31) ? 0 : _a[2] << idx; \
d##IDX[3] = (idx > 31) ? 0 : _a[3] << idx; \
\
a = load_m128i(_a); \
b = _mm_set1_epi64x(IDX); \
Expand Down Expand Up @@ -6012,17 +6015,18 @@ result_t test_mm_slli_epi16(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const int16_t *_a = (const int16_t *) impl.mTestIntPointer1;
__m128i a, c;

uint8_t idx;
#define TEST_IMPL(IDX) \
int16_t d##IDX[8]; \
d##IDX[0] = (IDX > 15) ? 0 : _a[0] << IDX; \
d##IDX[1] = (IDX > 15) ? 0 : _a[1] << IDX; \
d##IDX[2] = (IDX > 15) ? 0 : _a[2] << IDX; \
d##IDX[3] = (IDX > 15) ? 0 : _a[3] << IDX; \
d##IDX[4] = (IDX > 15) ? 0 : _a[4] << IDX; \
d##IDX[5] = (IDX > 15) ? 0 : _a[5] << IDX; \
d##IDX[6] = (IDX > 15) ? 0 : _a[6] << IDX; \
d##IDX[7] = (IDX > 15) ? 0 : _a[7] << IDX; \
idx = IDX; \
d##IDX[0] = (idx > 15) ? 0 : _a[0] << idx; \
d##IDX[1] = (idx > 15) ? 0 : _a[1] << idx; \
d##IDX[2] = (idx > 15) ? 0 : _a[2] << idx; \
d##IDX[3] = (idx > 15) ? 0 : _a[3] << idx; \
d##IDX[4] = (idx > 15) ? 0 : _a[4] << idx; \
d##IDX[5] = (idx > 15) ? 0 : _a[5] << idx; \
d##IDX[6] = (idx > 15) ? 0 : _a[6] << idx; \
d##IDX[7] = (idx > 15) ? 0 : _a[7] << idx; \
\
a = load_m128i(_a); \
c = _mm_slli_epi16(a, IDX); \
Expand Down Expand Up @@ -11757,7 +11761,7 @@ static int popcnt_reference(uint64_t a)
result_t test_mm_popcnt_u32(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const uint64_t *a = (const uint64_t *) impl.mTestIntPointer1;
ASSERT_RETURN(popcnt_reference((uint32_t) a[0]) == _mm_popcnt_u32(a[0]));
ASSERT_RETURN(popcnt_reference((uint32_t) a[0]) == _mm_popcnt_u32((unsigned int)a[0]));
return TEST_SUCCESS;
}

Expand Down

0 comments on commit 12f14fa

Please sign in to comment.