Prevent overflow in vredsum test
Change-Id: I7ee477879905368d606d1ced6beb390999cf1af0
diff --git a/softrvv/tests/templates/softrvv_vredsum_test.tpl.cpp b/softrvv/tests/templates/softrvv_vredsum_test.tpl.cpp
index 1c39da3..ccfd8fc 100644
--- a/softrvv/tests/templates/softrvv_vredsum_test.tpl.cpp
+++ b/softrvv/tests/templates/softrvv_vredsum_test.tpl.cpp
@@ -20,7 +20,10 @@
template_helper = vec_test_helpers.VecTemplateHelper(op, 32)
src2, src1, rs1 = template_helper.get_test_inputs(n=5)
dest_type = template_helper.get_np_dest_type()
+## Adjust test values to prohibit overflow
ref_vv = np.zeros(src2.shape, dtype=dest_type)
ref_vv[0] = src2.sum() + src1[0]
+ref_vv[0] = np.clip(ref_vv[0], np.iinfo(dest_type).min,
+ np.iinfo(dest_type).max)
%>\
${tests.test_opmvv_vred(template_helper, src2, src1, ref_vv)}