Skip to content

Commit

Permalink
neon64 implementation of ftoi
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Nov 16, 2024
1 parent 7650c0a commit 059640b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions include/deadbeef/fastftoi.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@ static __inline void fpu_restore(fpu_control fpu){

#endif /* Special MSVC x64 implementation */

#if defined(__aarch64__)

# define FPU_CONTROL

#include <arm_neon.h>

typedef int16_t fpu_control;

static inline int ftoi(float f) {
float32x2_t fvec = vld1_f32(&f);
int32x2_t ivec = vcvt_s32_f32(fvec);
return vget_lane_s32(ivec, 0);
}

static inline void fpu_setround(fpu_control *fpu){
}

static inline void fpu_restore(fpu_control fpu){
}

#endif

/* If no special implementation was found for the current compiler / platform,
use the default implementation here: */
Expand Down

0 comments on commit 059640b

Please sign in to comment.