From d5a47bf2b30afceff58a624dcc4142c18d70cbf9 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 27 Nov 2025 21:04:33 +0100 Subject: [PATCH] swresample/x86/Makefile: Only compile ASM init files when X86ASM is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Andreas Rheinhardt --- libswresample/resample_dsp.c | 2 +- libswresample/x86/Makefile | 13 ++++++------- libswresample/x86/rematrix_init.c | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libswresample/resample_dsp.c b/libswresample/resample_dsp.c index 611f44373f..96f567fe32 100644 --- a/libswresample/resample_dsp.c +++ b/libswresample/resample_dsp.c @@ -68,7 +68,7 @@ void swri_resample_dsp_init(ResampleContext *c) break; } -#if ARCH_X86 +#if ARCH_X86 && HAVE_X86ASM swri_resample_dsp_x86_init(c); #elif ARCH_ARM swri_resample_dsp_arm_init(c); diff --git a/libswresample/x86/Makefile b/libswresample/x86/Makefile index fa0641f03f..c0655bb8a8 100644 --- a/libswresample/x86/Makefile +++ b/libswresample/x86/Makefile @@ -1,9 +1,8 @@ -X86ASM-OBJS += x86/audio_convert.o\ - x86/rematrix.o\ - x86/resample.o\ - -OBJS += x86/audio_convert_init.o\ - x86/rematrix_init.o\ - x86/resample_init.o\ +X86ASM-OBJS += x86/audio_convert.o \ + x86/audio_convert_init.o \ + x86/rematrix.o \ + x86/rematrix_init.o \ + x86/resample.o \ + x86/resample_init.o \ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o diff --git a/libswresample/x86/rematrix_init.c b/libswresample/x86/rematrix_init.c index 89ec362d62..88f27f5e93 100644 --- a/libswresample/x86/rematrix_init.c +++ b/libswresample/x86/rematrix_init.c @@ -32,7 +32,6 @@ D(float, avx) D(int16, sse2) av_cold int swri_rematrix_init_x86(struct SwrContext *s){ -#if HAVE_X86ASM int mm_flags = av_get_cpu_flags(); int nb_in = s->used_ch_layout.nb_channels; 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)); s->native_simd_one.f = s->native_one.f; } -#endif return 0; }