Skip to content

Commit f15419f

Browse files
authored
Use llrintf over llrint in SSE funcs. NFC (#22894)
These function operate of floats so this is slighlyt more correct and perhaps faster in some cases I guess.
1 parent 2e84cfd commit f15419f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

system/include/compat/emmintrin.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ _mm_cvtsd_si64(__m128d __a)
10081008
// TODO: optimize
10091009
if (isnan(__a[0]) || isinf(__a[0])) return 0x8000000000000000LL;
10101010
long long x = llrint(__a[0]);
1011-
if (x != 0xFFFFFFFF00000000ULL && (x != 0 || fabsf(__a[0]) < 2.f))
1011+
if (x != 0xFFFFFFFF00000000ULL && (x != 0 || fabs(__a[0]) < 2.f))
10121012
return x;
10131013
else
10141014
return 0x8000000000000000LL;
@@ -1018,10 +1018,10 @@ static __inline__ long long __attribute__((__always_inline__, __nodebug__))
10181018
_mm_cvttsd_si64(__m128d __a)
10191019
{
10201020
// TODO: optimize
1021-
float e = __a[0];
1021+
double e = __a[0];
10221022
if (isnan(e) || isinf(e) || e > LLONG_MAX || e < LLONG_MIN) return 0x8000000000000000LL;
10231023
long long x = llrint(e);
1024-
if (x != 0xFFFFFFFF00000000ULL && (x != 0 || fabsf(e) < 2.f))
1024+
if (x != 0xFFFFFFFF00000000ULL && (x != 0 || fabs(e) < 2.f))
10251025
// Use the trapping instruction here since we have explicit bounds checks
10261026
// above
10271027
return __builtin_wasm_trunc_s_i64_f32(e);

system/include/compat/xmmintrin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ static __inline__ long long __attribute__((__always_inline__, __nodebug__, DIAGN
628628
_mm_cvtss_si64(__m128 __a)
629629
{
630630
if (isnan(((__f32x4)__a)[0]) || isinf(((__f32x4)__a)[0])) return 0x8000000000000000LL;
631-
long long x = llrint(((__f32x4)__a)[0]);
631+
long long x = llrintf(((__f32x4)__a)[0]);
632632
if (x != 0xFFFFFFFF00000000ULL && (x != 0 || fabsf(((__f32x4)__a)[0]) < 2.f))
633633
return x;
634634
else
@@ -640,7 +640,7 @@ _mm_cvttss_si64(__m128 __a)
640640
{
641641
float e = ((__f32x4)__a)[0];
642642
if (isnan(e) || isinf(e) || e > LLONG_MAX || e < LLONG_MIN) return 0x8000000000000000LL;
643-
long long x = llrint(e);
643+
long long x = llrintf(e);
644644
if (x != 0xFFFFFFFF00000000ULL && (x != 0 || fabsf(e) < 2.f))
645645
return (long long)e;
646646
else

0 commit comments

Comments
 (0)