Skip to content

Commit 7ff3588

Browse files
committed
Refine WebAssembly SIMD backend scope
1 parent 53d0be8 commit 7ff3588

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

kernel/simd/intrin_wasm.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,23 @@ BLAS_FINLINE v_f32 v_mulsub_f32(v_f32 a, v_f32 b, v_f32 c)
3333
BLAS_FINLINE v_f64 v_mulsub_f64(v_f64 a, v_f64 b, v_f64 c)
3434
{ return v_sub_f64(v_mul_f64(a, b), c); }
3535

36+
/***************************
37+
* reduction
38+
***************************/
39+
BLAS_FINLINE float v_sum_f32(v_f32 a)
40+
{
41+
return wasm_f32x4_extract_lane(a, 0)
42+
+ wasm_f32x4_extract_lane(a, 1)
43+
+ wasm_f32x4_extract_lane(a, 2)
44+
+ wasm_f32x4_extract_lane(a, 3);
45+
}
46+
47+
BLAS_FINLINE double v_sum_f64(v_f64 a)
48+
{
49+
return wasm_f64x2_extract_lane(a, 0)
50+
+ wasm_f64x2_extract_lane(a, 1);
51+
}
52+
3653
/***************************
3754
* memory
3855
***************************/

kernel/x86_64/drot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
static void drot_kernel(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT c, FLOAT s)
1313
{
1414
BLASLONG i = 0;
15-
#if V_SIMD_F64 && (V_SIMD > 256 || defined(ARCH_WASM))
15+
#if V_SIMD_F64 && V_SIMD > 256
1616
const int vstep = v_nlanes_f64;
1717
const int unrollx4 = n & (-vstep * 4);
1818
const int unrollx = n & -vstep;

0 commit comments

Comments
 (0)