mirror of
https://github.com/guezoloic/t3dsr.git
synced 2026-01-25 07:34:23 +00:00
feat(mat4): add arm to transpose function
This commit is contained in:
@@ -253,8 +253,37 @@ Mat4f_t* mat4f_tpo_r(Mat4f_t *__restrict out)
|
|||||||
_mm_store_ps(&out->m[3 * MAT_DIM], r3);
|
_mm_store_ps(&out->m[3 * MAT_DIM], r3);
|
||||||
|
|
||||||
|
|
||||||
#elif defined (SIMD_ARCH)
|
#elif defined (SIMD_ARCH)
|
||||||
#else
|
float32x4_t row[4];
|
||||||
|
for (int i = 0; i < MAT_DIM; i++) {
|
||||||
|
row[i] = vld1q_f32(&clone.m[i * MAT_DIM]);
|
||||||
|
}
|
||||||
|
|
||||||
|
float32x4x2_t t01 = vtrnq_f32(row[0], row[1]);
|
||||||
|
float32x4x2_t t23 = vtrnq_f32(row[2], row[3]);
|
||||||
|
|
||||||
|
float32x2_t r0_low = vget_low_f32(t01.val[0]);
|
||||||
|
float32x2_t r0_high = vget_low_f32(t23.val[0]);
|
||||||
|
float32x4_t r0 = vcombine_f32(r0_low, r0_high);
|
||||||
|
|
||||||
|
float32x2_t r1_low = vget_low_f32(t01.val[1]);
|
||||||
|
float32x2_t r1_high = vget_low_f32(t23.val[1]);
|
||||||
|
float32x4_t r1 = vcombine_f32(r1_low, r1_high);
|
||||||
|
|
||||||
|
float32x2_t r2_low = vget_high_f32(t01.val[0]);
|
||||||
|
float32x2_t r2_high = vget_high_f32(t23.val[0]);
|
||||||
|
float32x4_t r2 = vcombine_f32(r2_low, r2_high);
|
||||||
|
|
||||||
|
float32x2_t r3_low = vget_high_f32(t01.val[1]);
|
||||||
|
float32x2_t r3_high = vget_high_f32(t23.val[1]);
|
||||||
|
float32x4_t r3 = vcombine_f32(r3_low, r3_high);
|
||||||
|
|
||||||
|
vst1q_f32(&out->m[0 * MAT_DIM], r0);
|
||||||
|
vst1q_f32(&out->m[1 * MAT_DIM], r1);
|
||||||
|
vst1q_f32(&out->m[2 * MAT_DIM], r2);
|
||||||
|
vst1q_f32(&out->m[3 * MAT_DIM], r3);
|
||||||
|
#else
|
||||||
|
|
||||||
for(int i = 0; i < MAT_DIM; i++) {
|
for(int i = 0; i < MAT_DIM; i++) {
|
||||||
int dim_i = i * MAT_DIM;
|
int dim_i = i * MAT_DIM;
|
||||||
|
|
||||||
@@ -262,7 +291,7 @@ Mat4f_t* mat4f_tpo_r(Mat4f_t *__restrict out)
|
|||||||
out->m[dim_i + j] = clone.m[(j * MAT_DIM) + i];
|
out->m[dim_i + j] = clone.m[(j * MAT_DIM) + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user