Skip to content

Commit

Permalink
fix: Fix MSVC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
howjmay committed Jul 31, 2023
1 parent 2eede22 commit ad95d7f
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2642,10 +2642,10 @@ result_t test_mm_rsqrt_ps(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const float *_a = (const float *) impl.mTestFloatPointer1;

float f0 = 1 / sqrt(_a[0]);
float f1 = 1 / sqrt(_a[1]);
float f2 = 1 / sqrt(_a[2]);
float f3 = 1 / sqrt(_a[3]);
float f0 = 1 / sqrtf(_a[0]);
float f1 = 1 / sqrtf(_a[1]);
float f2 = 1 / sqrtf(_a[2]);
float f3 = 1 / sqrtf(_a[3]);

__m128 a = load_m128(_a);
__m128 c = _mm_rsqrt_ps(a);
Expand All @@ -2659,7 +2659,7 @@ result_t test_mm_rsqrt_ss(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const float *_a = (const float *) impl.mTestFloatPointer1;

float f0 = 1 / sqrt(_a[0]);
float f0 = 1 / sqrtf(_a[0]);
float f1 = _a[1];
float f2 = _a[2];
float f3 = _a[3];
Expand Down Expand Up @@ -2891,10 +2891,10 @@ result_t test_mm_sqrt_ps(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const float *_a = (const float *) impl.mTestFloatPointer1;

float f0 = sqrt(_a[0]);
float f1 = sqrt(_a[1]);
float f2 = sqrt(_a[2]);
float f3 = sqrt(_a[3]);
float f0 = sqrtf(_a[0]);
float f1 = sqrtf(_a[1]);
float f2 = sqrtf(_a[2]);
float f3 = sqrtf(_a[3]);

__m128 a = load_m128(_a);
__m128 c = _mm_sqrt_ps(a);
Expand All @@ -2914,7 +2914,7 @@ result_t test_mm_sqrt_ss(const SSE2NEONTestImpl &impl, uint32_t iter)
{
const float *_a = (const float *) impl.mTestFloatPointer1;

float f0 = sqrt(_a[0]);
float f0 = sqrtf(_a[0]);
float f1 = _a[1];
float f2 = _a[2];
float f3 = _a[3];
Expand Down Expand Up @@ -3423,7 +3423,7 @@ result_t test_mm_adds_epi8(const SSE2NEONTestImpl &impl, uint32_t iter)
__m128i b = load_m128i(_b);
__m128i c = _mm_adds_epi8(a, b);

return VALIDATE_INT8_M128(c, d);
return VALIDATE_INT8_M128(c, (int8_t) d);
}

result_t test_mm_adds_epu16(const SSE2NEONTestImpl &impl, uint32_t iter)
Expand Down Expand Up @@ -4638,10 +4638,10 @@ result_t test_mm_cvtsd_ss(const SSE2NEONTestImpl &impl, uint32_t iter)
const float *_a = impl.mTestFloatPointer1;
const double *_b = (const double *) impl.mTestFloatPointer2;

float f0 = _b[0];
float f1 = _a[1];
float f2 = _a[2];
float f3 = _a[3];
float f0 = (float) _b[0];
float f1 = (float) _a[1];
float f2 = (float) _a[2];
float f3 = (float) _a[3];

__m128 a = load_m128(_a);
__m128d b = load_m128d(_b);
Expand Down Expand Up @@ -5875,10 +5875,10 @@ result_t test_mm_shufflehi_epi16(const SSE2NEONTestImpl &impl, uint32_t iter)
d##IDX[1] = _a[1]; \
d##IDX[2] = _a[2]; \
d##IDX[3] = _a[3]; \
d##IDX[4] = ((const int64_t *) _a)[1] >> ((IDX & 0x3) * 16); \
d##IDX[5] = ((const int64_t *) _a)[1] >> (((IDX >> 2) & 0x3) * 16); \
d##IDX[6] = ((const int64_t *) _a)[1] >> (((IDX >> 4) & 0x3) * 16); \
d##IDX[7] = ((const int64_t *) _a)[1] >> (((IDX >> 6) & 0x3) * 16); \
d##IDX[4] = (int16_t) (((const int64_t *) _a)[1] >> ((IDX & 0x3) * 16)); \
d##IDX[5] = (int16_t) (((const int64_t *) _a)[1] >> (((IDX >> 2) & 0x3) * 16)); \
d##IDX[6] = (int16_t) (((const int64_t *) _a)[1] >> (((IDX >> 4) & 0x3) * 16)); \
d##IDX[7] = (int16_t) (((const int64_t *) _a)[1] >> (((IDX >> 6) & 0x3) * 16)); \
\
a = load_m128i(_a); \
c = _mm_shufflehi_epi16(a, IDX); \
Expand All @@ -5895,20 +5895,23 @@ result_t test_mm_shufflelo_epi16(const SSE2NEONTestImpl &impl, uint32_t iter)
const int16_t *_a = (const int16_t *) impl.mTestIntPointer1;
__m128i a, c;

#define TEST_IMPL(IDX) \
int16_t d##IDX[8]; \
d##IDX[0] = ((const int64_t *) _a)[0] >> ((IDX & 0x3) * 16); \
d##IDX[1] = ((const int64_t *) _a)[0] >> (((IDX >> 2) & 0x3) * 16); \
d##IDX[2] = ((const int64_t *) _a)[0] >> (((IDX >> 4) & 0x3) * 16); \
d##IDX[3] = ((const int64_t *) _a)[0] >> (((IDX >> 6) & 0x3) * 16); \
d##IDX[4] = _a[4]; \
d##IDX[5] = _a[5]; \
d##IDX[6] = _a[6]; \
d##IDX[7] = _a[7]; \
\
a = load_m128i(_a); \
c = _mm_shufflelo_epi16(a, IDX); \
\
#define TEST_IMPL(IDX) \
int16_t d##IDX[8]; \
d##IDX[0] = (int16_t) (((const int64_t *) _a)[0] >> ((IDX & 0x3) * 16)); \
d##IDX[1] = \
(int16_t) (((const int64_t *) _a)[0] >> (((IDX >> 2) & 0x3) * 16)); \
d##IDX[2] = \
(int16_t) (((const int64_t *) _a)[0] >> (((IDX >> 4) & 0x3) * 16)); \
d##IDX[3] = \
(int16_t) (((const int64_t *) _a)[0] >> (((IDX >> 6) & 0x3) * 16)); \
d##IDX[4] = _a[4]; \
d##IDX[5] = _a[5]; \
d##IDX[6] = _a[6]; \
d##IDX[7] = _a[7]; \
\
a = load_m128i(_a); \
c = _mm_shufflelo_epi16(a, IDX); \
\
CHECK_RESULT(VALIDATE_INT16_M128(c, d##IDX))

IMM_256_ITER
Expand Down Expand Up @@ -6668,9 +6671,9 @@ result_t test_mm_subs_epi8(const SSE2NEONTestImpl &impl, uint32_t iter)
for (int i = 0; i < 16; i++) {
int16_t res = (int16_t) _a[i] - (int16_t) _b[i];
if (res > max)
d[i] = max;
d[i] = (int8_t) max;
else if (res < min)
d[i] = min;
d[i] = (int8_t) min;
else
d[i] = (int8_t) res;
}
Expand Down

0 comments on commit ad95d7f

Please sign in to comment.