From e27f80b0bba0ca003aa8c77806436b2eb96b6e0a Mon Sep 17 00:00:00 2001 From: myfreeer Date: Wed, 29 Mar 2023 20:16:16 +0800 Subject: [PATCH] simd128: inline _mm_rcp_ps --- include/cglm/simd/wasm.h | 6 ------ include/cglm/simd/wasm/mat4.h | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/cglm/simd/wasm.h b/include/cglm/simd/wasm.h index 0e11735..0259f83 100644 --- a/include/cglm/simd/wasm.h +++ b/include/cglm/simd/wasm.h @@ -40,12 +40,6 @@ _mm_sqrt_ss(glmm_128 __a) return wasm_i32x4_shuffle(__a, wasm_f32x4_sqrt(__a), 4, 1, 2, 3); } -static __inline__ glmm_128 __attribute__((__always_inline__, __nodebug__)) -_mm_rcp_ps(glmm_128 __a) -{ - return (glmm_128)wasm_f32x4_div((glmm_128)wasm_f32x4_splat(1.0f), (glmm_128)__a); -} - #define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ do { \ glmm_128 __row0 = (row0); \ diff --git a/include/cglm/simd/wasm/mat4.h b/include/cglm/simd/wasm/mat4.h index 35d5854..ea1e90e 100644 --- a/include/cglm/simd/wasm/mat4.h +++ b/include/cglm/simd/wasm/mat4.h @@ -286,7 +286,9 @@ glm_mat4_inv_fast_wasm(mat4 mat, mat4 dest) { x1 = wasm_i32x4_shuffle(v2, v3, 0, 0, 4, 4); x0 = wasm_i32x4_shuffle(x0, x1, 0, 2, 4, 6); - x0 = _mm_rcp_ps(glmm_vhadd(wasm_f32x4_mul(x0, r0))); + // x0 = _mm_rcp_ps(glmm_vhadd(wasm_f32x4_mul(x0, r0))); + x0 = wasm_f32x4_div(wasm_f32x4_const_splat(1.0f), + glmm_vhadd(wasm_f32x4_mul(x0, r0))); glmm_store(dest[0], wasm_f32x4_mul(v0, x0)); glmm_store(dest[1], wasm_f32x4_mul(v1, x0));