Clean up GCC compiler warnings. * Test vectors should be sized for max LMUL. Change-Id: Ib276377b56a13eb6c8923ae48c366040ef079362
diff --git a/tests/include/test_v_helpers.h b/tests/include/test_v_helpers.h index 2ba95a0..82818f0 100644 --- a/tests/include/test_v_helpers.h +++ b/tests/include/test_v_helpers.h
@@ -5,7 +5,7 @@ namespace test_v_helpers { -const uint32_t AVLS[] = {1, 4, 3, 2, 16, 8, 5, 17, +const int32_t AVLS[] = {1, 4, 3, 2, 16, 8, 5, 17, 32, 36, 64, 55, 100, 321, 256, 128, 512, 623, 1024, 1100, 1543, 2048, 3052, 4096, 5555, 8192, 10241, 16384, 24325, 32768};
diff --git a/tests/vmv_test.cpp b/tests/vmv_test.cpp index 5be1303..0cc0dd0 100644 --- a/tests/vmv_test.cpp +++ b/tests/vmv_test.cpp
@@ -12,8 +12,9 @@ namespace vmv_test { namespace { -const int VLEN = 512u; -const int MAXVL_BYTES = VLEN / sizeof(uint8_t); +const int LMUL_MAX = 8; +const int VLEN = 512; +const int MAXVL_BYTES = VLEN / sizeof(uint8_t) * LMUL_MAX; using namespace test_v_helpers; @@ -31,7 +32,7 @@ } template <typename T> -static std::tuple<int, int> vmv_test_setup(VLMUL lmul, uint32_t avl) { +static std::tuple<int, int> vmv_test_setup(VLMUL lmul, int32_t avl) { // Clear all vector registers zero_vector_registers(); @@ -70,7 +71,7 @@ TEST_F(VmvTest, vmv_demo) { for (int i = 0; i < AVL_COUNT; i++) { - uint32_t avl = AVLS[i]; + int32_t avl = AVLS[i]; int vlmax; int vl; std::tie(vlmax, vl) = vmv_test_setup<uint8_t>(VLMUL::LMUL_M1, avl); @@ -88,16 +89,16 @@ // TODO(henryherman): clang vle intrinsic uses vs1r.v (unsupported in renode) TEST_F(VmvTest, DISABLED_intrinsic_vmv_demo) { for (int i = 0; i < AVL_COUNT; i++) { - uint32_t avl = AVLS[i]; + int32_t avl = AVLS[i]; int vlmax; int vl; std::tie(vlmax, vl) = vmv_test_setup<uint8_t>(VLMUL::LMUL_M1, avl); if (avl > vlmax) { continue; } - vint8m1_t vec1 = vle8_v_i8m1(test_vector_1, vl); + vint8m1_t vec1 = vle8_v_i8m1(reinterpret_cast<int8_t *>(test_vector_1), vl); vint8m1_t vec2 = vmv_v_v_i8m1(vec1, vl); - uint8_t *ptr_vec_2 = reinterpret_cast<uint8_t *>(test_vector_2); + int8_t *ptr_vec_2 = reinterpret_cast<int8_t *>(test_vector_2); vse8_v_i8m1(ptr_vec_2, vec2, vl); vmv_check<uint8_t>(vlmax); } @@ -106,7 +107,7 @@ #define DEFINE_TEST_VMV_V_V_I_INTRINSIC(_SEW_, _LMUL_) \ TEST_F(VmvTest, DISABLED_intrinsic_vmv_v_v_i##_SEW_##m##_LMUL_) { \ for (int i = 0; i < AVL_COUNT; i++) { \ - uint32_t avl = AVLS[i]; \ + int32_t avl = AVLS[i]; \ int vlmax; \ int vl; \ std::tie(vlmax, vl) = \ @@ -114,11 +115,11 @@ if (avl > vlmax) { \ continue; \ } \ - vint##_SEW_##m##_LMUL_##_t vec1 = \ - vle##_SEW_##_v_i##_SEW_##m##_LMUL_(test_vector_1, vl); \ + vint##_SEW_##m##_LMUL_##_t vec1 = vle##_SEW_##_v_i##_SEW_##m##_LMUL_( \ + reinterpret_cast<int##_SEW_##_t *>(test_vector_1), vl); \ vint##_SEW_##m##_LMUL_##_t vec2 = vmv_v_v_i##_SEW_##m##_LMUL_(vec1, vl); \ - uint##_SEW_##_t *ptr_vec_2 = \ - reinterpret_cast<uint##_SEW_##_t *>(test_vector_2); \ + int##_SEW_##_t *ptr_vec_2 = \ + reinterpret_cast<int##_SEW_##_t *>(test_vector_2); \ vse##_SEW_##_v_i##_SEW_##m##_LMUL_(ptr_vec_2, vec2, vl); \ vmv_check<uint##_SEW_##_t>(vlmax); \ } \ @@ -142,7 +143,7 @@ #define DEFINE_TEST_VMV_V_V_I(_SEW_, _LMUL_) \ TEST_F(VmvTest, vmv_v_v_i##_SEW_##m##_LMUL_) { \ for (int i = 0; i < AVL_COUNT; i++) { \ - uint32_t avl = AVLS[i]; \ + int32_t avl = AVLS[i]; \ int vlmax; \ int vl; \ std::tie(vlmax, vl) = \ @@ -178,7 +179,7 @@ TEST_F(VmvTest, vmv_v_x_demo) { for (int i = 0; i < AVL_COUNT; i++) { - uint32_t avl = AVLS[i]; + int32_t avl = AVLS[i]; int vlmax; int vl; std::tie(vlmax, vl) = vmv_test_setup<uint8_t>(VLMUL::LMUL_M1, avl); @@ -200,7 +201,7 @@ #define DEFINE_TEST_VMV_V_X_I(_SEW_, _LMUL_, TEST_VAL) \ TEST_F(VmvTest, vmv_v_x_e##_SEW_##m##_LMUL_) { \ for (int i = 0; i < AVL_COUNT; i++) { \ - uint32_t avl = AVLS[i]; \ + int32_t avl = AVLS[i]; \ int vlmax; \ int vl; \ std::tie(vlmax, vl) = \ @@ -239,7 +240,7 @@ TEST_F(VmvTest, vmv_v_i_demo) { for (int i = 0; i < AVL_COUNT; i++) { - uint32_t avl = AVLS[i]; + int32_t avl = AVLS[i]; int vlmax; int vl; std::tie(vlmax, vl) = vmv_test_setup<uint8_t>(VLMUL::LMUL_M1, avl); @@ -261,7 +262,7 @@ #define DEFINE_TEST_VMV_V_I_I(_SEW_, _LMUL_, TEST_VAL) \ TEST_F(VmvTest, vmv_v_i_e##_SEW_##m##_LMUL_) { \ for (int i = 0; i < AVL_COUNT; i++) { \ - uint32_t avl = AVLS[i]; \ + int32_t avl = AVLS[i]; \ int vlmax; \ int vl; \ std::tie(vlmax, vl) = \