From 51570d92571f5f2be89d63036b793332606e1f64 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 17 Nov 2024 17:55:32 +0300
Subject: [PATCH] build system: disable 3dNow! support by default
Closes: https://github.com/libsdl-org/SDL/issues/11472.
---
CMakeLists.txt | 2 +-
configure | 48 +++++++++++++++++++-------------------
configure.ac | 54 +++++++++++++++++++++----------------------
include/SDL_cpuinfo.h | 2 ++
4 files changed, 54 insertions(+), 52 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10af989e6431b..f99fc49b347f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -412,7 +412,7 @@ dep_option(SDL_SSE "Use SSE assembly routines" ON "SDL_ASSEMBLY;
dep_option(SDL_SSE2 "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_SSE3 "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
-dep_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+dep_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" OFF "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF)
dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
dep_option(SDL_ARMNEON "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
diff --git a/configure b/configure
index 9816298f6cb3e..d0b709851912d 100755
--- a/configure
+++ b/configure
@@ -1672,7 +1672,7 @@ Optional Features:
--enable-ssemath Allow GCC to use SSE floating point math
[default=maybe]
--enable-mmx use MMX assembly routines [default=yes]
- --enable-3dnow use 3DNow! assembly routines [default=yes]
+ --enable-3dnow use 3DNow! assembly routines [default=no]
--enable-sse use SSE assembly routines [default=yes]
--enable-sse2 use SSE2 assembly routines [default=maybe]
--enable-sse3 use SSE3 assembly routines [default=maybe]
@@ -20699,7 +20699,7 @@ if test ${enable_3dnow+y}
then :
enableval=$enable_3dnow;
else $as_nop
- enable_3dnow=yes
+ enable_3dnow=no
fi
if test x$enable_3dnow = xyes; then
@@ -21088,7 +21088,7 @@ printf "%s\n" "#define HAVE_ALTIVEC_H 1" >>confdefs.h
fi
fi
- # Check whether --enable-lsx was given.
+# Check whether --enable-lsx was given.
if test ${enable_lsx+y}
then :
enableval=$enable_lsx;
@@ -21096,20 +21096,20 @@ else $as_nop
enable_lsx=yes
fi
- if test x$enable_lsx = xyes; then
- save_CFLAGS="$CFLAGS"
- have_gcc_lsx=no
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlsx option" >&5
+if test x$enable_lsx = xyes; then
+ save_CFLAGS="$CFLAGS"
+ have_gcc_lsx=no
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlsx option" >&5
printf %s "checking for GCC -mlsx option... " >&6; }
- lsx_CFLAGS="-mlsx"
- CFLAGS="$save_CFLAGS $lsx_CFLAGS"
+ lsx_CFLAGS="-mlsx"
+ CFLAGS="$save_CFLAGS $lsx_CFLAGS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
- #ifndef __loongarch_sx
- #error Assembler CPP flag not enabled
- #endif
+ #ifndef __loongarch_sx
+ #error Assembler CPP flag not enabled
+ #endif
int
main (void)
@@ -21124,19 +21124,19 @@ then :
have_gcc_lsx=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lsx" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lsx" >&5
printf "%s\n" "$have_gcc_lsx" >&6; }
- CFLAGS="$save_CFLAGS"
+ CFLAGS="$save_CFLAGS"
- if test x$have_gcc_lsx = xyes; then
- EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS"
- SUMMARY_math="${SUMMARY_math} lsx"
- fi
+ if test x$have_gcc_lsx = xyes; then
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS"
+ SUMMARY_math="${SUMMARY_math} lsx"
fi
+fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lsxintrin.h" >&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lsxintrin.h" >&5
printf %s "checking for lsxintrin.h... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <lsxintrin.h>
int
@@ -21154,13 +21154,13 @@ else $as_nop
have_lsxintrin_h_hdr=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lsxintrin_h_hdr" >&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lsxintrin_h_hdr" >&5
printf "%s\n" "$have_lsxintrin_h_hdr" >&6; }
- if test x$have_lsxintrin_h_hdr = xyes; then
+if test x$have_lsxintrin_h_hdr = xyes; then
printf "%s\n" "#define HAVE_LSXINTRIN_H 1" >>confdefs.h
- fi
+fi
CheckOSS()
{
diff --git a/configure.ac b/configure.ac
index 0cd458f5985d8..63de15939a775 100644
--- a/configure.ac
+++ b/configure.ac
@@ -698,8 +698,8 @@ dnl Check for various instruction support
fi
AC_ARG_ENABLE(3dnow,
-[AS_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [default=yes]])],
- , enable_3dnow=yes)
+[AS_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [default=no]])],
+ , enable_3dnow=no)
if test x$enable_3dnow = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_3dnow=no
@@ -906,37 +906,37 @@ dnl Check for various instruction support
fi
fi
- AC_ARG_ENABLE(lsx,
+AC_ARG_ENABLE(lsx,
[AS_HELP_STRING([--enable-lsx], [use LSX assembly routines [default=yes]])],
, enable_lsx=yes)
- if test x$enable_lsx = xyes; then
- save_CFLAGS="$CFLAGS"
- have_gcc_lsx=no
- AC_MSG_CHECKING(for GCC -mlsx option)
- lsx_CFLAGS="-mlsx"
- CFLAGS="$save_CFLAGS $lsx_CFLAGS"
+if test x$enable_lsx = xyes; then
+ save_CFLAGS="$CFLAGS"
+ have_gcc_lsx=no
+ AC_MSG_CHECKING(for GCC -mlsx option)
+ lsx_CFLAGS="-mlsx"
+ CFLAGS="$save_CFLAGS $lsx_CFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #ifndef __loongarch_sx
- #error Assembler CPP flag not enabled
- #endif
- ]], [])], [have_gcc_lsx=yes], [])
- AC_MSG_RESULT($have_gcc_lsx)
- CFLAGS="$save_CFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #ifndef __loongarch_sx
+ #error Assembler CPP flag not enabled
+ #endif
+ ]], [])], [have_gcc_lsx=yes], [])
+ AC_MSG_RESULT($have_gcc_lsx)
+ CFLAGS="$save_CFLAGS"
- if test x$have_gcc_lsx = xyes; then
- EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS"
- SUMMARY_math="${SUMMARY_math} lsx"
- fi
+ if test x$have_gcc_lsx = xyes; then
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS"
+ SUMMARY_math="${SUMMARY_math} lsx"
fi
+fi
- AC_MSG_CHECKING(for lsxintrin.h)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lsxintrin.h>]])],
- [have_lsxintrin_h_hdr=yes],[have_lsxintrin_h_hdr=no])
- AC_MSG_RESULT($have_lsxintrin_h_hdr)
- if test x$have_lsxintrin_h_hdr = xyes; then
- AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ])
- fi
+AC_MSG_CHECKING(for lsxintrin.h)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lsxintrin.h>]])],
+ [have_lsxintrin_h_hdr=yes],[have_lsxintrin_h_hdr=no])
+AC_MSG_RESULT($have_lsxintrin_h_hdr)
+if test x$have_lsxintrin_h_hdr = xyes; then
+ AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ])
+fi
dnl See if the OSS audio interface is supported
CheckOSS()
diff --git a/include/SDL_cpuinfo.h b/include/SDL_cpuinfo.h
index b9d0958ff026f..e4d74640c1076 100644
--- a/include/SDL_cpuinfo.h
+++ b/include/SDL_cpuinfo.h
@@ -59,9 +59,11 @@ _m_prefetch(void *__P)
#ifndef __MMX__
#define __MMX__
#endif
+/*
#ifndef __3dNOW__
#define __3dNOW__
#endif
+*/
#endif
#ifndef __SSE__
#define __SSE__