loongarch: add lsx simd opt

This commit is contained in:
yuanhecai
2025-08-26 14:21:45 +08:00
parent 9feadb98a9
commit c94458d8f2
11 changed files with 135 additions and 7 deletions

View File

@@ -128,6 +128,16 @@ struct kiss_fft_state{
# define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase))
# define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase))
# define HALF_OF(x) ((x)>>1)
#elif defined(USE_SIMD) && defined(HAVE_LSX)
#define KISS_FFT_COS(phase) ({ \
float __cos_val = cosf(phase); \
(__m128)(__lsx_vldrepl_w(&__cos_val, 0)); \
})
#define KISS_FFT_SIN(phase) ({ \
float __sin_val = sinf(phase); \
(__m128)(__lsx_vldrepl_w(&__sin_val, 0)); \
})
#define HALF_OF(x) ((x) * (__m128)(__lsx_vreplgr2vr_w(0x3F000000))) // 0.5f
#elif defined(USE_SIMD)
# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) )
# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) )