diff mbox series

[FFmpeg-devel,41/41] avutil/x86/pixelutils_init: Disable overridden functions on x64

Message ID DB6PR0101MB221426ACE3CEF7A9AA2AC39F8FA79@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Superseded
Headers show
Series Stop including superseded functions for x64 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Andreas Rheinhardt June 9, 2022, 11:55 p.m. UTC
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the 8x8 MMX (overridden by MMXEXT) as well as the 16x16 MMXEXT
(overridden by SSE2) sad functions at compile-time for x64.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavutil/x86/pixelutils.asm    | 4 ++++
 libavutil/x86/pixelutils_init.c | 4 ++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/libavutil/x86/pixelutils.asm b/libavutil/x86/pixelutils.asm
index 8b45ead78b..ea79186e19 100644
--- a/libavutil/x86/pixelutils.asm
+++ b/libavutil/x86/pixelutils.asm
@@ -25,6 +25,7 @@ 
 
 SECTION .text
 
+%if ARCH_X86_32
 ;-------------------------------------------------------------------------------
 ; int ff_pixelutils_sad_8x8_mmx(const uint8_t *src1, ptrdiff_t stride1,
 ;                               const uint8_t *src2, ptrdiff_t stride2);
@@ -62,6 +63,7 @@  cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, stride2
     movd        eax, m6
     movzx       eax, ax
     RET
+%endif
 
 ;-------------------------------------------------------------------------------
 ; int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1,
@@ -83,6 +85,7 @@  cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, stride2
     movd        eax, m2
     RET
 
+%if ARCH_X86_32
 ;-------------------------------------------------------------------------------
 ; int ff_pixelutils_sad_16x16_mmxext(const uint8_t *src1, ptrdiff_t stride1,
 ;                                    const uint8_t *src2, ptrdiff_t stride2);
@@ -102,6 +105,7 @@  cglobal pixelutils_sad_16x16, 4,4,0, src1, stride1, src2, stride2
 %endrep
     movd        eax, m2
     RET
+%endif
 
 ;-------------------------------------------------------------------------------
 ; int ff_pixelutils_sad_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
diff --git a/libavutil/x86/pixelutils_init.c b/libavutil/x86/pixelutils_init.c
index 184a3a4a9f..e74d5634d7 100644
--- a/libavutil/x86/pixelutils_init.c
+++ b/libavutil/x86/pixelutils_init.c
@@ -53,9 +53,11 @@  void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
     if (EXTERNAL_MMX(cpu_flags)) {
         sad[2] = ff_pixelutils_sad_8x8_mmx;
     }
+#endif
 
     // The best way to use SSE2 would be to do 2 SADs in parallel,
     // but we'd have to modify the pixelutils API to return SIMD functions.
@@ -65,7 +67,9 @@  void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned)
     // so just use the MMX 8x8 version even when SSE2 is available.
     if (EXTERNAL_MMXEXT(cpu_flags)) {
         sad[2] = ff_pixelutils_sad_8x8_mmxext;
+#if ARCH_X86_32
         sad[3] = ff_pixelutils_sad_16x16_mmxext;
+#endif
     }
 
     if (EXTERNAL_SSE2(cpu_flags)) {