From ad95d7f7efc8e5a580c420619997b6c8d1ea1bd3 Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Mon, 31 Jul 2023 12:02:46 +0300 Subject: [PATCH] fix: Fix MSVC warnings --- tests/impl.cpp | 73 ++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/tests/impl.cpp b/tests/impl.cpp index 2bce7dc3..17980806 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -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); @@ -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]; @@ -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); @@ -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]; @@ -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) @@ -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); @@ -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); \ @@ -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 @@ -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; }