From bf2448ba958588b7cfd71e00c6f6d99f915720e6 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 30 Apr 2021 13:03:55 +0200 Subject: extra/openal: redone SSE(2) patching (thanks, KitsuWhooa) --- extra/openal/PKGBUILD | 28 ++++----- extra/openal/openal-i486.patch | 53 ----------------- extra/openal/openal-i686.patch | 115 +++++++++++++++++++++---------------- extra/openal/openal-pentium4.patch | 43 -------------- 4 files changed, 75 insertions(+), 164 deletions(-) delete mode 100644 extra/openal/openal-i486.patch delete mode 100644 extra/openal/openal-pentium4.patch diff --git a/extra/openal/PKGBUILD b/extra/openal/PKGBUILD index 2e982053..4318ba27 100644 --- a/extra/openal/PKGBUILD +++ b/extra/openal/PKGBUILD @@ -1,37 +1,29 @@ # disable Intel micro-optimizations and intrinsics per platform -source+=('openal-pentium4.patch' 'openal-i686.patch' 'openal-i486.patch') +# patch done by KitsuWhooa, thanks (see https://github.com/kcat/openal-soft/pull/559) +source+=('openal-i686.patch') sha512sums+=( - 'bba897b5c1f39775ec28c4e92e3ef0e3e69d62c9463cacd6841c704e7ff5130860cef7f16e464593491dcb50a0036c487188939a989780b5a5c7321f735ae820' - '7fdbf5efa7fb223666592d1d78e684798e29a46e7948f379d8b8e3f527c42f1875539722cfacb88182a3187dfb334de3aea012298a6ab111d3c06abd8d41c9b4' - '54423f4a45a90570e5331c98916dcb7442bc97b39c1161c0dad2450da829f8866e9c95098b84b4f9fabce34f44df3c1b9f43d257672c7d210236160548ac081f' + '41e4134fea907d2f9b95eb496fde5eb7ce4bd8bfa1ad97c8d1a88b4454846195a1725c5bab047981e795d25eb29959e07fa349b212c24bbc86c06a597ac43e78' ) if [ "$CARCH" = 'pentium4' ]; then eval "$( - declare -f prepare | \ - sed ' - /git/ a \ - patch -p1 -i "$srcdir/openal-pentium4.patch" - ' + declare -f build | \ + sed '/cmake .*openal-soft/ s/;$/ -DALSOFT_CPUEXT_SSE4_1=0 -DALSOFT_CPUEXT_SSE3=0;/' )" fi if [ "$CARCH" = 'i686' ]; then eval "$( declare -f prepare | \ - sed ' - /git/ a \ - patch -p1 -i "$srcdir/openal-i686.patch" - ' + sed '/cd openal-soft/ a patch -p1 -i \"$srcdir/openal-i686.patch\"' + declare -f build | \ + sed '/cmake .*openal-soft/ s/;$/ -DALSOFT_CPUEXT_SSE4_1=0 -DALSOFT_CPUEXT_SSE3=0 -DALSOFT_CPUEXT_SSE2=0;/' )" fi if [ "$CARCH" = 'i486' ]; then eval "$( - declare -f prepare | \ - sed ' - /git/ a \ - patch -p1 -i "$srcdir/openal-i486.patch" - ' + declare -f build | \ + sed '/cmake .*openal-soft/ s/;$/ -DALSOFT_CPUEXT_SSE4_1=0 -DALSOFT_CPUEXT_SSE3=0 -DALSOFT_CPUEXT_SSE2=0 -DALSOFT_CPUEXT_SSE=0;/' )" fi diff --git a/extra/openal/openal-i486.patch b/extra/openal/openal-i486.patch deleted file mode 100644 index f59cf4f4..00000000 --- a/extra/openal/openal-i486.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -rauN openal/CMakeLists.txt openal-i486-patch/CMakeLists.txt ---- openal/CMakeLists.txt 2019-12-12 17:07:05.966917263 +0100 -+++ openal-i486-patch/CMakeLists.txt 2019-12-12 19:13:29.678013351 +0100 -@@ -307,28 +307,28 @@ - SET(SSE4_1_SWITCH "") - SET(FPU_NEON_SWITCH "") - --CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) --IF(HAVE_MSSE2_SWITCH) -- SET(SSE2_SWITCH "-msse2") --ENDIF() --CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) --IF(HAVE_MSSE3_SWITCH) -- SET(SSE3_SWITCH "-msse3") --ENDIF() --CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) --IF(HAVE_MSSE4_1_SWITCH) -- SET(SSE4_1_SWITCH "-msse4.1") --ENDIF() --CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) --IF(HAVE_MFPU_NEON_SWITCH) -- SET(FPU_NEON_SWITCH "-mfpu=neon") --ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) -+#~ IF(HAVE_MSSE2_SWITCH) -+ #~ SET(SSE2_SWITCH "-msse2") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) -+#~ IF(HAVE_MSSE3_SWITCH) -+ #~ SET(SSE3_SWITCH "-msse3") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) -+#~ IF(HAVE_MSSE4_1_SWITCH) -+ #~ SET(SSE4_1_SWITCH "-msse4.1") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) -+#~ IF(HAVE_MFPU_NEON_SWITCH) -+ #~ SET(FPU_NEON_SWITCH "-mfpu=neon") -+#~ ENDIF() - --CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}") --CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}") --CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}") --CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}") --CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}") -+#~ CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}") -+#~ CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}") -+#~ CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}") -+#~ CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}") -+#~ CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}") - - SET(SSE_FLAGS ) - SET(FPMATH_SET "0") diff --git a/extra/openal/openal-i686.patch b/extra/openal/openal-i686.patch index 44261849..4a42844d 100644 --- a/extra/openal/openal-i686.patch +++ b/extra/openal/openal-i686.patch @@ -1,53 +1,68 @@ -diff -rauN openal/CMakeLists.txt openal-i686-patch/CMakeLists.txt ---- openal/CMakeLists.txt 2019-12-12 17:07:05.966917263 +0100 -+++ openal-i686-patch/CMakeLists.txt 2019-12-12 19:11:43.256675497 +0100 -@@ -307,28 +307,28 @@ - SET(SSE4_1_SWITCH "") - SET(FPU_NEON_SWITCH "") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0cf0613d..53b325db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -369,20 +369,25 @@ set(HAVE_SSE3 0) + set(HAVE_SSE4_1 0) + set(HAVE_NEON 0) --CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) --IF(HAVE_MSSE2_SWITCH) -- SET(SSE2_SWITCH "-msse2") --ENDIF() --CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) --IF(HAVE_MSSE3_SWITCH) -- SET(SSE3_SWITCH "-msse3") --ENDIF() --CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) --IF(HAVE_MSSE4_1_SWITCH) -- SET(SSE4_1_SWITCH "-msse4.1") --ENDIF() --CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) --IF(HAVE_MFPU_NEON_SWITCH) -- SET(FPU_NEON_SWITCH "-mfpu=neon") --ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) -+#~ IF(HAVE_MSSE2_SWITCH) -+ #~ SET(SSE2_SWITCH "-msse2") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) -+#~ IF(HAVE_MSSE3_SWITCH) -+ #~ SET(SSE3_SWITCH "-msse3") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) -+#~ IF(HAVE_MSSE4_1_SWITCH) -+ #~ SET(SSE4_1_SWITCH "-msse4.1") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) -+#~ IF(HAVE_MFPU_NEON_SWITCH) -+ #~ SET(FPU_NEON_SWITCH "-mfpu=neon") -+#~ ENDIF() +-# Check for SSE+SSE2 support ++# Check for SSE support + option(ALSOFT_REQUIRE_SSE "Require SSE support" OFF) +-option(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF) +-if(HAVE_XMMINTRIN_H AND HAVE_EMMINTRIN_H) ++if(HAVE_XMMINTRIN_H) + option(ALSOFT_CPUEXT_SSE "Enable SSE support" ON) +- option(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON) +- if(ALSOFT_CPUEXT_SSE AND ALSOFT_CPUEXT_SSE2) ++ if(ALSOFT_CPUEXT_SSE) + set(HAVE_SSE 1) +- set(HAVE_SSE2 1) + endif() + endif() + if(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE) + message(FATAL_ERROR "Failed to enabled required SSE CPU extensions") + endif() ++ ++option(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF) ++if(HAVE_EMMINTRIN_H) ++ option(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON) ++ if(HAVE_SSE AND ALSOFT_CPUEXT_SSE2) ++ set(HAVE_SSE2 1) ++ endif() ++endif() + if(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2) + message(FATAL_ERROR "Failed to enable required SSE2 CPU extensions") + endif() +@@ -758,9 +763,13 @@ set(ALC_OBJS --CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}") --CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}") --CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}") --CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}") --CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}") -+#~ CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}") -+#~ CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}") -+#~ CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}") -+#~ CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}") -+#~ CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}") + # Include SIMD mixers + set(CPU_EXTS "Default") ++if(HAVE_SSE) ++ set(CORE_OBJS ${CORE_OBJS} core/mixer/mixer_sse.cpp) ++ set(CPU_EXTS "${CPU_EXTS}, SSE") ++endif() + if(HAVE_SSE2) +- set(CORE_OBJS ${CORE_OBJS} core/mixer/mixer_sse.cpp core/mixer/mixer_sse2.cpp) +- set(CPU_EXTS "${CPU_EXTS}, SSE, SSE2") ++ set(CORE_OBJS ${CORE_OBJS} core/mixer/mixer_sse2.cpp) ++ set(CPU_EXTS "${CPU_EXTS}, SSE2") + endif() + if(HAVE_SSE3) + set(CORE_OBJS ${CORE_OBJS} core/mixer/mixer_sse3.cpp) +diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp +index 23caf797..c0fd8fa1 100644 +--- a/core/mixer/mixer_sse.cpp ++++ b/core/mixer/mixer_sse.cpp +@@ -15,9 +15,8 @@ struct BSincTag; + struct FastBSincTag; - SET(SSE_FLAGS ) - SET(FPMATH_SET "0") + +-/* SSE2 is required for any SSE support. */ +-#if defined(__GNUC__) && !defined(__clang__) && !defined(__SSE2__) +-#pragma GCC target("sse2") ++#if defined(__GNUC__) && !defined(__clang__) && !defined(__SSE__) ++#pragma GCC target("sse") + #endif + + namespace { diff --git a/extra/openal/openal-pentium4.patch b/extra/openal/openal-pentium4.patch deleted file mode 100644 index a5a39e44..00000000 --- a/extra/openal/openal-pentium4.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff -rauN openal/CMakeLists.txt openal-pentium4-patch/CMakeLists.txt ---- openal/CMakeLists.txt 2019-12-12 17:07:05.966917263 +0100 -+++ openal-pentium4-patch/CMakeLists.txt 2019-12-12 19:10:50.689347069 +0100 -@@ -311,24 +311,24 @@ - IF(HAVE_MSSE2_SWITCH) - SET(SSE2_SWITCH "-msse2") - ENDIF() --CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) --IF(HAVE_MSSE3_SWITCH) -- SET(SSE3_SWITCH "-msse3") --ENDIF() --CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) --IF(HAVE_MSSE4_1_SWITCH) -- SET(SSE4_1_SWITCH "-msse4.1") --ENDIF() --CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) --IF(HAVE_MFPU_NEON_SWITCH) -- SET(FPU_NEON_SWITCH "-mfpu=neon") --ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) -+#~ IF(HAVE_MSSE3_SWITCH) -+ #~ SET(SSE3_SWITCH "-msse3") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) -+#~ IF(HAVE_MSSE4_1_SWITCH) -+ #~ SET(SSE4_1_SWITCH "-msse4.1") -+#~ ENDIF() -+#~ CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) -+#~ IF(HAVE_MFPU_NEON_SWITCH) -+ #~ SET(FPU_NEON_SWITCH "-mfpu=neon") -+#~ ENDIF() - - CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}") - CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}") --CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}") --CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}") --CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}") -+#~ CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}") -+#~ CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}") -+#~ CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}") - - SET(SSE_FLAGS ) - SET(FPMATH_SET "0") -- cgit v1.2.3-70-g09d2