| <%! |
| import vec_test_helpers |
| %>\ |
| <%def name="test_opivf(template_helper, src2, rs1, ref_vf)"> |
| <% |
| src2 = vec_test_helpers.to_carr_str(src2) |
| ref_vf = vec_test_helpers.to_carr_str(ref_vf) |
| %>\ |
| namespace softrvv_${template_helper.op_code}_vf_test { |
| namespace { |
| ${insert_variable_init(template_helper, src2, rs1, ref_vf)} |
| |
| class SoftRvv${template_helper.op_code.capitalize()}Test : public ::testing::Test { |
| protected: |
| void SetUp() override { memset(dest, 0, sizeof(dest)); } |
| }; |
| ${insert_test(template_helper)}\ |
| } // namespace |
| } // namespace softrvv_${op}_vf_test\ |
| </%def>\ |
| |
| <%def name="insert_variable_init(template_helper, src2, rs1, ref_vf)"> |
| <% |
| var_types = template_helper.get_var_types() |
| %>\ |
| ${var_types.src2_type} src2[] = {${src2}}; |
| ${var_types.imm_type} rs1 = ${rs1}; |
| const int kAVL = sizeof(src2)/sizeof(src2[0]); |
| ${var_types.dest_type} dest[kAVL]; |
| |
| ${var_types.dest_type} ref_vf[kAVL] = {${ref_vf}}; |
| </%def>\ |
| |
| <%def name="insert_test(template_helper)"> |
| <% |
| var_types = template_helper.get_var_types() |
| datatypes = template_helper.get_softrvv_template_data_type() |
| %>\ |
| |
| TEST_F(SoftRvv${template_helper.op_code.capitalize()}Test, VF) { |
| softrvv::${template_helper.op_code}_vf(dest, src2, &rs1, kAVL);\ |
| ${insert_check(template_helper, var_types.dest_type, "ref_vf")}\ |
| } |
| </%def>\ |
| |
| <%def name="insert_check(template_helper, dest_type, ref_var)"> |
| % if template_helper.is_destination_mask_register(): |
| assert_vec_mask_eq<${dest_type}>(kAVL, dest, ${ref_var}); |
| % else: |
| assert_vec_elem_eq<${dest_type}>(kAVL, dest, ${ref_var}); |
| % endif |
| </%def>\ |