From 397d609107b5d1b2552ef1c32072a14679c5cf7c Mon Sep 17 00:00:00 2001 From: Alexander Orlov Date: Thu, 18 Jul 2024 20:57:10 +0200 Subject: [PATCH 1/4] fix test_mm_dp_pd test --- tests/impl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/impl.cpp b/tests/impl.cpp index ecd4635f..028359e9 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -8386,10 +8386,12 @@ result_t test_mm_cvtepu8_epi64(const SSE2NEONTestImpl &impl, uint32_t iter) #define MM_DP_PD_TEST_CASE_WITH(imm8) \ do { \ - const double *_a = (const double *) impl.mTestFloatPointer1; \ - const double *_b = (const double *) impl.mTestFloatPointer2; \ + const double _a[] = {impl.mTestFloatPointer1[0], \ + impl.mTestFloatPointer1[1]}; \ + const double _b[] = {impl.mTestFloatPointer2[0], \ + impl.mTestFloatPointer2[1]}; \ const int imm = imm8; \ - double d[2]; \ + double d[2] = {0}; \ double sum = 0; \ for (size_t i = 0; i < 2; i++) \ sum += ((imm) & (1 << (i + 4))) ? _a[i] * _b[i] : 0; \ From dbba28ebead45b5ec0d17baa326070ecbe7c3714 Mon Sep 17 00:00:00 2001 From: Alexander Orlov Date: Thu, 18 Jul 2024 21:38:22 +0200 Subject: [PATCH 2/4] code style fix --- tests/impl.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/impl.cpp b/tests/impl.cpp index 028359e9..26ff8169 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -5877,7 +5877,7 @@ result_t test_mm_shuffle_epi32(const SSE2NEONTestImpl &impl, uint32_t iter) int32_t _d[4]; #define TEST_IMPL(IDX) \ - _d[0] = _a[((IDX) &0x3)]; \ + _d[0] = _a[((IDX) & 0x3)]; \ _d[1] = _a[((IDX >> 2) & 0x3)]; \ _d[2] = _a[((IDX >> 4) & 0x3)]; \ _d[3] = _a[((IDX >> 6) & 0x3)]; \ @@ -8384,24 +8384,24 @@ result_t test_mm_cvtepu8_epi64(const SSE2NEONTestImpl &impl, uint32_t iter) return validateInt64(ret, i0, i1); } -#define MM_DP_PD_TEST_CASE_WITH(imm8) \ - do { \ - const double _a[] = {impl.mTestFloatPointer1[0], \ - impl.mTestFloatPointer1[1]}; \ - const double _b[] = {impl.mTestFloatPointer2[0], \ - impl.mTestFloatPointer2[1]}; \ - const int imm = imm8; \ - double d[2] = {0}; \ - double sum = 0; \ - for (size_t i = 0; i < 2; i++) \ - sum += ((imm) & (1 << (i + 4))) ? _a[i] * _b[i] : 0; \ - for (size_t i = 0; i < 2; i++) \ - d[i] = (imm & (1 << i)) ? sum : 0; \ - __m128d a = load_m128d(_a); \ - __m128d b = load_m128d(_b); \ - __m128d ret = _mm_dp_pd(a, b, imm); \ - if (validateDouble(ret, d[0], d[1]) != TEST_SUCCESS) \ - return TEST_FAIL; \ +#define MM_DP_PD_TEST_CASE_WITH(imm8) \ + do { \ + const double _a[] = {impl.mTestFloatPointer1[0], \ + impl.mTestFloatPointer1[1]}; \ + const double _b[] = {impl.mTestFloatPointer2[0], \ + impl.mTestFloatPointer2[1]}; \ + const int imm = imm8; \ + double d[2] = {0}; \ + double sum = 0; \ + for (size_t i = 0; i < 2; i++) \ + sum += ((imm) & (1 << (i + 4))) ? _a[i] * _b[i] : 0; \ + for (size_t i = 0; i < 2; i++) \ + d[i] = (imm & (1 << i)) ? sum : 0; \ + __m128d a = load_m128d(_a); \ + __m128d b = load_m128d(_b); \ + __m128d ret = _mm_dp_pd(a, b, imm); \ + if (validateDouble(ret, d[0], d[1]) != TEST_SUCCESS) \ + return TEST_FAIL; \ } while (0) #define GENERATE_MM_DP_PD_TEST_CASES \ From 3055c54a3633c703dbbce2021592e33fec19f6a1 Mon Sep 17 00:00:00 2001 From: Alexander Orlov Date: Thu, 18 Jul 2024 20:57:10 +0200 Subject: [PATCH 3/4] fix test_mm_dp_pd test --- tests/impl.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/impl.cpp b/tests/impl.cpp index ecd4635f..26ff8169 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -5877,7 +5877,7 @@ result_t test_mm_shuffle_epi32(const SSE2NEONTestImpl &impl, uint32_t iter) int32_t _d[4]; #define TEST_IMPL(IDX) \ - _d[0] = _a[((IDX) &0x3)]; \ + _d[0] = _a[((IDX) & 0x3)]; \ _d[1] = _a[((IDX >> 2) & 0x3)]; \ _d[2] = _a[((IDX >> 4) & 0x3)]; \ _d[3] = _a[((IDX >> 6) & 0x3)]; \ @@ -8384,22 +8384,24 @@ result_t test_mm_cvtepu8_epi64(const SSE2NEONTestImpl &impl, uint32_t iter) return validateInt64(ret, i0, i1); } -#define MM_DP_PD_TEST_CASE_WITH(imm8) \ - do { \ - const double *_a = (const double *) impl.mTestFloatPointer1; \ - const double *_b = (const double *) impl.mTestFloatPointer2; \ - const int imm = imm8; \ - double d[2]; \ - double sum = 0; \ - for (size_t i = 0; i < 2; i++) \ - sum += ((imm) & (1 << (i + 4))) ? _a[i] * _b[i] : 0; \ - for (size_t i = 0; i < 2; i++) \ - d[i] = (imm & (1 << i)) ? sum : 0; \ - __m128d a = load_m128d(_a); \ - __m128d b = load_m128d(_b); \ - __m128d ret = _mm_dp_pd(a, b, imm); \ - if (validateDouble(ret, d[0], d[1]) != TEST_SUCCESS) \ - return TEST_FAIL; \ +#define MM_DP_PD_TEST_CASE_WITH(imm8) \ + do { \ + const double _a[] = {impl.mTestFloatPointer1[0], \ + impl.mTestFloatPointer1[1]}; \ + const double _b[] = {impl.mTestFloatPointer2[0], \ + impl.mTestFloatPointer2[1]}; \ + const int imm = imm8; \ + double d[2] = {0}; \ + double sum = 0; \ + for (size_t i = 0; i < 2; i++) \ + sum += ((imm) & (1 << (i + 4))) ? _a[i] * _b[i] : 0; \ + for (size_t i = 0; i < 2; i++) \ + d[i] = (imm & (1 << i)) ? sum : 0; \ + __m128d a = load_m128d(_a); \ + __m128d b = load_m128d(_b); \ + __m128d ret = _mm_dp_pd(a, b, imm); \ + if (validateDouble(ret, d[0], d[1]) != TEST_SUCCESS) \ + return TEST_FAIL; \ } while (0) #define GENERATE_MM_DP_PD_TEST_CASES \ From 2dee78184eca34dd8d87c68a950f44c7baf7fdda Mon Sep 17 00:00:00 2001 From: Alexander Orlov Date: Thu, 18 Jul 2024 21:53:40 +0200 Subject: [PATCH 4/4] format with clang-format 12 --- tests/impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/impl.cpp b/tests/impl.cpp index 26ff8169..7b52ba52 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -5877,7 +5877,7 @@ result_t test_mm_shuffle_epi32(const SSE2NEONTestImpl &impl, uint32_t iter) int32_t _d[4]; #define TEST_IMPL(IDX) \ - _d[0] = _a[((IDX) & 0x3)]; \ + _d[0] = _a[((IDX) &0x3)]; \ _d[1] = _a[((IDX >> 2) & 0x3)]; \ _d[2] = _a[((IDX >> 4) & 0x3)]; \ _d[3] = _a[((IDX >> 6) & 0x3)]; \