Skip to content
19 changes: 8 additions & 11 deletions kernel/riscv64/axpy_rvv.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,15 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
}

} else if( 0 == inc_y ) {
BLASLONG stride_x = inc_x * sizeof(FLOAT);
size_t in_vl = VSETVL(n);
vy = VFMVVF_FLOAT( y[0], in_vl );

for (size_t vl; n > 0; n -= vl, x += vl*inc_x) {
vl = VSETVL(n);
vx = VLSEV_FLOAT(x, stride_x, vl);
vy = VFMACCVF_FLOAT(vy, da, vx, vl);
/* Zero output stride is an ordered update of one scalar. Do not
broadcast its initial value into every reduction lane. */
for (BLASLONG k = 0; k < n; ++k) {
#if defined(DOUBLE)
y[0] = __builtin_fma(da, x[k * inc_x], y[0]);
#else
y[0] = __builtin_fmaf(da, x[k * inc_x], y[0]);
#endif
}
FLOAT_V_M1_T vres = VFMVVF_FLOAT_M1( 0.0f, 1 );
vres = VFREDSUMVS_FLOAT( vy, vres, in_vl );
VSEV_FLOAT_M1(y, vres, 1);
} else {
BLASLONG stride_x = inc_x * sizeof(FLOAT);
BLASLONG stride_y = inc_y * sizeof(FLOAT);
Expand Down
Loading