Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
# endif
#endif

#if defined(__aarch64__) || defined(_M_ARM64)
# define HAVE_NEON_INTRINSICS
#endif

#ifdef HAVE_SSE2_INTRINSICS
#ifdef HAVE_IMMINTRIN_H
#include <immintrin.h>
Expand All @@ -44,6 +48,10 @@
#endif
#endif /* HAVE_SSE2_INTRINSICS */

#if defined(HAVE_NEON_INTRINSICS)
#include <arm_neon.h>
#endif /* HAVE_NEON_INTRINSICS */

#include <math.h>

#ifdef HAVE_VISIBILITY
Expand Down Expand Up @@ -214,6 +222,18 @@ psf_lrint (double x)
return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
}

#elif defined(HAVE_NEON_INTRINSICS)

static inline int psf_lrintf (float x)
{
return vcvts_s32_f32(x);
} /* psf_lrintf */

static inline int psf_lrint (double x)
{
return (int) vcvtd_s64_f64(x);
} /* psf_lrint */

#else

static inline int psf_lrintf (float x)
Expand Down