simd128: inline _mm_set_ps

This commit is contained in:
myfreeer
2023-03-19 11:56:59 +08:00
parent 03c7bee863
commit be76d96e8f
4 changed files with 5 additions and 12 deletions

View File

@@ -55,12 +55,6 @@ _mm_movelh_ps(glmm_128 __a, glmm_128 __b)
return wasm_i32x4_shuffle(__a, __b, 0, 1, 4, 5);
}
static __inline__ glmm_128 __attribute__((__always_inline__, __nodebug__))
_mm_set_ps(float __z, float __y, float __x, float __w)
{
return (glmm_128)wasm_f32x4_make(__w, __x, __y, __z);
}
static inline glmm_128 __attribute__((__always_inline__, __nodebug__))
_mm_sqrt_ss(glmm_128 __a)
{

View File

@@ -91,8 +91,7 @@ glm_inv_tr_wasm(mat4 mat) {
r1 = glmm_load(mat[1]);
r2 = glmm_load(mat[2]);
r3 = glmm_load(mat[3]);
x1 = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
x1 = wasm_f32x4_const(0.0f, 0.0f, 0.0f, 1.0f);
_MM_TRANSPOSE4_PS(r0, r1, r2, x1);
x2 = glmm_shuff1(r3, 0, 0, 0, 0);

View File

@@ -153,7 +153,7 @@ glm_mat4_det_wasm(mat4 mat) {
_mm_shuffle_ps(x0, x1, _MM_SHUFFLE(2, 2, 3, 1)),
x2);
x2 = wasm_v128_xor(x2, _mm_set_ps(-0.f, 0.f, -0.f, 0.f));
x2 = wasm_v128_xor(x2, wasm_f32x4_const(0.f, -0.f, 0.f, -0.f));
return glmm_hadd(wasm_f32x4_mul(x2, r0));
}
@@ -166,7 +166,7 @@ glm_mat4_inv_fast_wasm(mat4 mat, mat4 dest) {
t0, t1, t2, t3, t4, t5,
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9;
x8 = wasm_f32x4_make(-0.f, 0.f, -0.f, 0.f);
x8 = wasm_f32x4_const(-0.f, 0.f, -0.f, 0.f);
x9 = glmm_shuff1(x8, 2, 1, 2, 1);
/* 127 <- 0 */
@@ -302,7 +302,7 @@ glm_mat4_inv_wasm(mat4 mat, mat4 dest) {
t0, t1, t2, t3, t4, t5,
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9;
x8 = _mm_set_ps(-0.f, 0.f, -0.f, 0.f);
x8 = wasm_f32x4_const(0.f, -0.f, 0.f, -0.f);
x9 = glmm_shuff1(x8, 2, 1, 2, 1);
/* 127 <- 0 */

View File

@@ -26,7 +26,7 @@ glm_quat_mul_wasm(versor p, versor q, versor dest) {
xp = glmm_load(p); /* 3 2 1 0 */
xq = glmm_load(q);
x1 = _mm_set_ps(-0.f, 0.f, -0.f, 0.f); /* TODO: _mm_set1_ss() + shuff ? */
x1 = wasm_f32x4_const(0.f, -0.f, 0.f, -0.f); /* TODO: _mm_set1_ss() + shuff ? */
r = wasm_f32x4_mul(glmm_splat_w(xp), xq);
x2 = _mm_unpackhi_ps(x1, x1);