Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simd, sse: use 0x80000000 insteaf of -0.f to fix fastmath on msvc #291

Merged
merged 4 commits into from
Apr 22, 2023

Conversation

recp
Copy link
Owner

@recp recp commented Apr 21, 2023

fixes #289

Now we have global macro for sign masks:

#define GLMM_NEGZEROf 0x80000000 /*  0x80000000 ---> -0.0f  */

#define GLMM__SIGNMASKf(X, Y, Z, W)                                           \
   _mm_castsi128_ps(_mm_set_epi32(X, Y, Z, W))
  /* _mm_set_ps(X, Y, Z, W); */

#define glmm_float32x4_SIGNMASK_PNPN GLMM__SIGNMASKf(0, GLMM_NEGZEROf, 0, GLMM_NEGZEROf)
#define glmm_float32x4_SIGNMASK_NPNP GLMM__SIGNMASKf(GLMM_NEGZEROf, 0, GLMM_NEGZEROf, 0)
#define glmm_float32x4_SIGNMASK_NPPN GLMM__SIGNMASKf(GLMM_NEGZEROf, 0, 0, GLMM_NEGZEROf)

#define glmm_float32x4_SIGNMASK_NEG _mm_set1_ps(GLMM_NEGZEROf)

for instance:
_mm_set_ps(-0.f, 0.f, -0.f, 0.f) -> glmm_float32x4_SIGNMASK_NPNP
_mm_set_ps(0.f, -0.f, 0.f, -0.f) -> glmm_float32x4_SIGNMASK_PNPN

@recp recp mentioned this pull request Apr 21, 2023
@recp
Copy link
Owner Author

recp commented Apr 21, 2023

@myfreeer we also need wasm update to use these macros ( or better names can be used if we get enough feedbacks ):

#define glmm_float32x4_SIGNMASK_PNPN ...
#define glmm_float32x4_SIGNMASK_NPNP ...
#define glmm_float32x4_SIGNMASK_NPPN ...
 ...

I can leave this update to you if you'd like :)

myfreeer added a commit to myfreeer/cglm that referenced this pull request Apr 22, 2023
@recp recp merged commit e2e9235 into master Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in glm_mat4_inv_sse2
1 participant