Skip to content

Commit

Permalink
Merge pull request #482 from howjmay/vmla_lane
Browse files Browse the repository at this point in the history
test: Add tests for vmla_lane_*
  • Loading branch information
howjmay authored Jul 30, 2024
2 parents d1f1aed + e47c422 commit b82fe37
Showing 1 changed file with 107 additions and 7 deletions.
114 changes: 107 additions & 7 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32341,9 +32341,9 @@ result_t test_vmulq_lane_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {

result_t test_vmla_lane_s16(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const int16_t *_a = (int16_t *)impl.test_cases_int_pointer1;
const int16_t *_b = (int16_t *)impl.test_cases_int_pointer2;
const int16_t *_c = (int16_t *)impl.test_cases_int_pointer3;
const int16_t *_a = (const int16_t *)impl.test_cases_int_pointer1;
const int16_t *_b = (const int16_t *)impl.test_cases_int_pointer2;
const int16_t *_c = (const int16_t *)impl.test_cases_int_pointer3;
int16_t _d[4];
int16x4_t a = vld1_s16(_a);
int16x4_t b = vld1_s16(_b);
Expand All @@ -32366,13 +32366,113 @@ result_t test_vmla_lane_s16(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#endif // ENABLE_TEST_ALL
}

result_t test_vmla_lane_s32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vmla_lane_s32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const int32_t *_a = (const int32_t *)impl.test_cases_int_pointer1;
const int32_t *_b = (const int32_t *)impl.test_cases_int_pointer2;
const int32_t *_c = (const int32_t *)impl.test_cases_int_pointer3;
int32_t _d[4];
int32x2_t a = vld1_s32(_a);
int32x2_t b = vld1_s32(_b);
int32x2_t c = vld1_s32(_c);
int32x2_t d;

#define TEST_IMPL(IDX) \
for (int i = 0; i < 2; i++) { \
_d[i] = _a[i] + _b[i] * _c[IDX]; \
} \
d = vmla_lane_s32(a, b, c, IDX); \
CHECK_RESULT(validate_int32(d, _d[0], _d[1]))

IMM_2_ITER
#undef TEST_IMPL

return TEST_SUCCESS;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vmla_lane_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const float *_a = (const float *)impl.test_cases_float_pointer1;
const float *_b = (const float *)impl.test_cases_float_pointer2;
const float *_c = (const float *)impl.test_cases_float_pointer3;
float _d[4];
float32x2_t a = vld1_f32(_a);
float32x2_t b = vld1_f32(_b);
float32x2_t c = vld1_f32(_c);
float32x2_t d;

#define TEST_IMPL(IDX) \
for (int i = 0; i < 2; i++) { \
_d[i] = _a[i] + _b[i] * _c[IDX]; \
} \
d = vmla_lane_f32(a, b, c, IDX); \
CHECK_RESULT(validate_float_error(d, _d[0], _d[1], 0.0001f))

IMM_2_ITER
#undef TEST_IMPL

return TEST_SUCCESS;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vmla_lane_u16(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const uint16_t *_a = (const uint16_t *)impl.test_cases_int_pointer1;
const uint16_t *_b = (const uint16_t *)impl.test_cases_int_pointer2;
const uint16_t *_c = (const uint16_t *)impl.test_cases_int_pointer3;
uint16_t _d[4];
uint16x4_t a = vld1_u16(_a);
uint16x4_t b = vld1_u16(_b);
uint16x4_t c = vld1_u16(_c);
uint16x4_t d;

#define TEST_IMPL(IDX) \
for (int i = 0; i < 4; i++) { \
_d[i] = _a[i] + _b[i] * _c[IDX]; \
} \
d = vmla_lane_u16(a, b, c, IDX); \
CHECK_RESULT(validate_uint16(d, _d[0], _d[1], _d[2], _d[3]))

IMM_4_ITER
#undef TEST_IMPL

return TEST_SUCCESS;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vmla_lane_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const uint32_t *_a = (const uint32_t *)impl.test_cases_int_pointer1;
const uint32_t *_b = (const uint32_t *)impl.test_cases_int_pointer2;
const uint32_t *_c = (const uint32_t *)impl.test_cases_int_pointer3;
uint32_t _d[4];
uint32x2_t a = vld1_u32(_a);
uint32x2_t b = vld1_u32(_b);
uint32x2_t c = vld1_u32(_c);
uint32x2_t d;

result_t test_vmla_lane_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
#define TEST_IMPL(IDX) \
for (int i = 0; i < 2; i++) { \
_d[i] = _a[i] + _b[i] * _c[IDX]; \
} \
d = vmla_lane_u32(a, b, c, IDX); \
CHECK_RESULT(validate_uint32(d, _d[0], _d[1]))

result_t test_vmla_lane_u16(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
IMM_2_ITER
#undef TEST_IMPL

result_t test_vmla_lane_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
return TEST_SUCCESS;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vmlaq_lane_s16(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
Expand Down

0 comments on commit b82fe37

Please sign in to comment.