Small fixes for vmv_v_i test Since negative values are permitted in this test, changing uint -> int. Also allow macro argument to set test_value. Change-Id: I9494b14c77eada390a9409343be48a2751de3c36
diff --git a/tests/vmv_test.cpp b/tests/vmv_test.cpp index 0cc0dd0..e934f7a 100644 --- a/tests/vmv_test.cpp +++ b/tests/vmv_test.cpp
@@ -243,13 +243,13 @@ int32_t avl = AVLS[i]; int vlmax; int vl; - std::tie(vlmax, vl) = vmv_test_setup<uint8_t>(VLMUL::LMUL_M1, avl); + std::tie(vlmax, vl) = vmv_test_setup<int8_t>(VLMUL::LMUL_M1, avl); if (avl > vlmax) { continue; } - uint8_t *ptr_vec_1 = reinterpret_cast<uint8_t *>(test_vector_1); - uint8_t *ptr_vec_2 = reinterpret_cast<uint8_t *>(test_vector_2); - uint8_t test_val = -12; + int8_t *ptr_vec_1 = reinterpret_cast<int8_t *>(test_vector_1); + int8_t *ptr_vec_2 = reinterpret_cast<int8_t *>(test_vector_2); + int8_t test_val = -12; __asm__ volatile("vmv.v.i v8, -12" ::); for (int i = 0; i < vl; i++) { ptr_vec_1[i] = test_val; @@ -259,6 +259,7 @@ } } +// TODO(gkielian): Allow mechanism for multiple tests for same sew,lmul pair #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++) { \ @@ -266,21 +267,21 @@ int vlmax; \ int vl; \ std::tie(vlmax, vl) = \ - vmv_test_setup<uint##_SEW_##_t>(VLMUL::LMUL_M##_LMUL_, avl); \ + vmv_test_setup<int##_SEW_##_t>(VLMUL::LMUL_M##_LMUL_, avl); \ if (avl > vlmax) { \ continue; \ } \ - uint##_SEW_##_t *ptr_vec_1 = \ - reinterpret_cast<uint##_SEW_##_t *>(test_vector_1); \ - uint##_SEW_##_t *ptr_vec_2 = \ - reinterpret_cast<uint##_SEW_##_t *>(test_vector_2); \ - uint##_SEW_##_t test_val = -12; \ - __asm__ volatile("vmv.v.i v8, -12" ::); \ + int##_SEW_##_t *ptr_vec_1 = \ + reinterpret_cast<int##_SEW_##_t *>(test_vector_1); \ + int##_SEW_##_t *ptr_vec_2 = \ + reinterpret_cast<int##_SEW_##_t *>(test_vector_2); \ + int##_SEW_##_t test_val = TEST_VAL; \ + __asm__ volatile("vmv.v.i v8, " #TEST_VAL); \ for (int i = 0; i < vl; i++) { \ ptr_vec_1[i] = test_val; \ } \ __asm__ volatile("vse" #_SEW_ ".v v8, (%0)" : : "r"(ptr_vec_2)); \ - vmv_check<uint##_SEW_##_t>(vlmax); \ + vmv_check<int##_SEW_##_t>(vlmax); \ } \ }