Buildfixes for ARM NEON

This commit is contained in:
twinaphex 2017-01-31 07:58:58 +01:00
parent ed3d75738c
commit 61d67613fb
2 changed files with 30 additions and 23 deletions

View File

@ -32,6 +32,7 @@
#include <audio/conversion/float_to_s16.h>
#if defined(__ARM_NEON__)
static bool float_to_s16_neon_enabled = false;
void convert_float_s16_asm(int16_t *out, const float *in, size_t samples);
#endif
@ -91,14 +92,17 @@ void convert_float_to_s16(int16_t *out,
samples = samples_in;
i = 0;
#elif defined(__ARM_NEON__)
size_t aligned_samples = samples & ~7;
if (aligned_samples)
convert_float_s16_asm(out, in, aligned_samples);
if (float_to_s16_neon_enabled)
{
size_t aligned_samples = samples & ~7;
if (aligned_samples)
convert_float_s16_asm(out, in, aligned_samples);
out = out + aligned_samples;
in = in + aligned_samples;
samples = samples - aligned_samples;
i = 0;
out = out + aligned_samples;
in = in + aligned_samples;
samples = samples - aligned_samples;
i = 0;
}
#elif defined(_MIPS_ARCH_ALLEGREX)
#ifdef DEBUG
@ -147,11 +151,10 @@ void convert_float_to_s16(int16_t *out,
**/
void convert_float_to_s16_init_simd(void)
{
#if defined(__ARM_NEON__)
unsigned cpu = cpu_features_get();
(void)cpu;
#if defined(__ARM_NEON__)
convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ?
convert_float_to_s16_neon : convert_float_to_s16_C;
if (cpu & RETRO_SIMD_NEON)
float_to_s16_neon_enabled = true;
#endif
}

View File

@ -30,6 +30,8 @@
#include <audio/conversion/s16_to_float.h>
#if defined(__ARM_NEON__)
static bool s16_to_float_neon_enabled = false;
/* Avoid potential hard-float/soft-float ABI issues. */
void convert_s16_float_asm(float *out, const int16_t *in,
size_t samples, const float *gain);
@ -98,15 +100,18 @@ void convert_s16_to_float(float *out,
i = 0;
#elif defined(__ARM_NEON__)
size_t aligned_samples = samples & ~7;
if (aligned_samples)
convert_s16_float_asm(out, in, aligned_samples, &gain);
if (s16_to_float_neon_enabled)
{
size_t aligned_samples = samples & ~7;
if (aligned_samples)
convert_s16_float_asm(out, in, aligned_samples, &gain);
/* Could do all conversion in ASM, but keep it simple for now. */
out = out + aligned_samples;
in = in + aligned_samples;
samples = samples - aligned_samples;
i = 0;
/* Could do all conversion in ASM, but keep it simple for now. */
out = out + aligned_samples;
in = in + aligned_samples;
samples = samples - aligned_samples;
i = 0;
}
#elif defined(_MIPS_ARCH_ALLEGREX)
#ifdef DEBUG
@ -175,11 +180,10 @@ void convert_s16_to_float(float *out,
**/
void convert_s16_to_float_init_simd(void)
{
#if defined(__ARM_NEON__)
unsigned cpu = cpu_features_get();
(void)cpu;
#if defined(__ARM_NEON__)
convert_s16_to_float_arm = (cpu & RETRO_SIMD_NEON) ?
convert_s16_to_float_neon : convert_s16_to_float_C;
if (cpu & RETRO_SIMD_NEON)
s16_to_float_neon_enabled = true;
#endif
}