1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

dnn: prefer to use v_fma() instead of v_c += v_a * v_b

This commit is contained in:
Alexander Alekhin
2020-12-05 11:51:03 +00:00
parent 12a36b5a94
commit 00f36a3149
2 changed files with 31 additions and 26 deletions
@@ -241,16 +241,18 @@ public:
#if CV_SIMD128
for( ; i <= nw - 4; i += 4, wptr += 4*wstep )
{
v_float32x4 vs0 = v_setall_f32(0.f), vs1 = v_setall_f32(0.f);
v_float32x4 vs2 = v_setall_f32(0.f), vs3 = v_setall_f32(0.f);
v_float32x4 vs0 = v_setall_f32(0.f);
v_float32x4 vs1 = v_setall_f32(0.f);
v_float32x4 vs2 = v_setall_f32(0.f);
v_float32x4 vs3 = v_setall_f32(0.f);
for( k = 0; k < vecsize; k += 4 )
{
v_float32x4 v = v_load_aligned(sptr + k);
vs0 += v*v_load_aligned(wptr + k);
vs1 += v*v_load_aligned(wptr + wstep + k);
vs2 += v*v_load_aligned(wptr + wstep*2 + k);
vs3 += v*v_load_aligned(wptr + wstep*3 + k);
vs0 = v_fma(v, v_load_aligned(wptr + k), vs0);
vs1 = v_fma(v, v_load_aligned(wptr + wstep + k), vs1);
vs2 = v_fma(v, v_load_aligned(wptr + wstep*2 + k), vs2);
vs3 = v_fma(v, v_load_aligned(wptr + wstep*3 + k), vs3);
}
v_float32x4 s = v_reduce_sum4(vs0, vs1, vs2, vs3);