swresample/x86/Makefile: Only compile ASM init files when X86ASM is enabled

To do so, simply add these init files to X86ASM-OBJS instead of OBJS
in the Makefile. The former is already used for the actual assembly
files, but using them for the C init files just works, because the build
system uses file extensions to derive whether it is a C or a NASM file.

This avoids compiling unused function stubs and also reduces our
reliance on DCE: We don't add %if checks to the asm files except
for AVX, AVX2, FMA3, FMA4, XOP and AVX512, so all the MMX-SSE4
functions will be available. It also allows to remove HAVE_X86ASM checks
in these init files.

(x86/ops.c has already been put in X86ASM-OBJS.)

Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-11-27 21:04:33 +01:00
parent 7356981bec
commit d5a47bf2b3
3 changed files with 7 additions and 10 deletions

View File

@@ -68,7 +68,7 @@ void swri_resample_dsp_init(ResampleContext *c)
break; break;
} }
#if ARCH_X86 #if ARCH_X86 && HAVE_X86ASM
swri_resample_dsp_x86_init(c); swri_resample_dsp_x86_init(c);
#elif ARCH_ARM #elif ARCH_ARM
swri_resample_dsp_arm_init(c); swri_resample_dsp_arm_init(c);

View File

@@ -1,9 +1,8 @@
X86ASM-OBJS += x86/audio_convert.o\ X86ASM-OBJS += x86/audio_convert.o \
x86/rematrix.o\ x86/audio_convert_init.o \
x86/resample.o\ x86/rematrix.o \
x86/rematrix_init.o \
OBJS += x86/audio_convert_init.o\ x86/resample.o \
x86/rematrix_init.o\ x86/resample_init.o \
x86/resample_init.o\
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o

View File

@@ -32,7 +32,6 @@ D(float, avx)
D(int16, sse2) D(int16, sse2)
av_cold int swri_rematrix_init_x86(struct SwrContext *s){ av_cold int swri_rematrix_init_x86(struct SwrContext *s){
#if HAVE_X86ASM
int mm_flags = av_get_cpu_flags(); int mm_flags = av_get_cpu_flags();
int nb_in = s->used_ch_layout.nb_channels; int nb_in = s->used_ch_layout.nb_channels;
int nb_out = s->out.ch_count; int nb_out = s->out.ch_count;
@@ -79,7 +78,6 @@ av_cold int swri_rematrix_init_x86(struct SwrContext *s){
memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float)); memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float));
s->native_simd_one.f = s->native_one.f; s->native_simd_one.f = s->native_one.f;
} }
#endif
return 0; return 0;
} }