blob: 22a24866ad142b9b8a112aa17d73bc9d2dcae12e [file] [log] [blame]
#ifndef SOFTRVV_VMADD_VNMSUB_H
#define SOFTRVV_VMADD_VNMSUB_H
#include <stddef.h>
#include <stdint.h>
namespace softrvv {
template <typename T1, typename T2>
void vmadd_vv(T1 *vd, T2 *vs1, const T2 *vs2, int32_t avl) {
for (int32_t idx = 0; idx < avl; idx++) {
vd[idx] = (vs1[idx] * vd[idx]) + vs2[idx];
}
}
template <typename T1, typename T2>
void vmadd_vx(T1 *vd, const T2 *rs1, const T2 *vs2, int32_t avl) {
for (int32_t idx = 0; idx < avl; idx++) {
vd[idx] = (*rs1 * vd[idx]) + vs2[idx];
}
}
template <typename T1, typename T2>
void vnmsub_vv(T1 *vd, T2 *vs1, const T2 *vs2, int32_t avl) {
for (int32_t idx = 0; idx < avl; idx++) {
vd[idx] = -(vs1[idx] * vd[idx]) + vs2[idx];
}
}
template <typename T1, typename T2>
void vnmsub_vx(T1 *vd, const T2 *rs1, const T2 *vs2, int32_t avl) {
for (int32_t idx = 0; idx < avl; idx++) {
vd[idx] = -(*rs1 * vd[idx]) + vs2[idx];
}
}
} // namespace softrvv
#endif // SOFTRVV_VMADD_VNMSUB_H