From 7307b1cbbe54212bd29c9d9b3c80411118ad0882 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Fri, 21 Apr 2023 20:36:50 +0300 Subject: [PATCH] simd, sse: use 0x80000000 insteaf of -0.f to fix fastmath on msvc --- include/cglm/simd/x86.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/cglm/simd/x86.h b/include/cglm/simd/x86.h index 5227785..58dc0fd 100644 --- a/include/cglm/simd/x86.h +++ b/include/cglm/simd/x86.h @@ -65,11 +65,12 @@ #define glmm_float32x4_SIGNMASK_NPPN GLMM__SIGNMASKf(GLMM_NEGZEROf, 0, 0, GLMM_NEGZEROf) #define glmm_float32x4_SIGNMASK_NEG _mm_set1_ps(GLMM_NEGZEROf) +#define glmm_float32x8_SIGNMASK_NEG _mm256_castsi256_ps(_mm256_set1_epi32(GLMM_NEGZEROf)); static inline __m128 glmm_abs(__m128 x) { - return _mm_andnot_ps(_mm_set1_ps(0x80000000/*-0.0f*/), x); + return _mm_andnot_ps(glmm_float32x4_SIGNMASK_NEG, x); } static inline @@ -269,7 +270,7 @@ glmm_fnmsub(__m128 a, __m128 b, __m128 c) { return _mm_fnmsub_ps(a, b, c); #else return _mm_xor_ps(_mm_add_ps(_mm_mul_ps(a, b), c), - _mm_set1_ps(0x80000000/*-0.0f*/)); + glmm_float32x4_SIGNMASK_NEG); #endif } @@ -311,7 +312,7 @@ glmm256_fnmsub(__m256 a, __m256 b, __m256 c) { return _mm256_fmsub_ps(a, b, c); #else return _mm256_xor_ps(_mm256_sub_ps(_mm256_mul_ps(a, b), c), - _mm256_set1_ps(0x80000000/*-0.0f*/)); + glmm_float32x8_SIGNMASK_NEG); #endif } #endif