[Scummvm-git-logs] scummvm master -> 30952fbcf7ebeb6d8999d36a3d560273e723723e
bluegr
noreply at scummvm.org
Thu Sep 5 04:24:35 UTC 2024
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3da80ddaeb AGS: Use target pragmas instead of compiler flag to prevent ODR problems
8b26ce1c16 GRAPHICS: Add target specifiers for Clang
f001fa7bbc AGS: Add target specifiers for Clang
0942594524 CONFIGURE: Enable back SIMD for clang compiler depending on its version
30952fbcf7 CONFIGURE: Refactor compiler version checks for SIMD instructions sets
Commit: 3da80ddaeb85c73b8b08fcecb19e44f5c05cfc59
https://github.com/scummvm/scummvm/commit/3da80ddaeb85c73b8b08fcecb19e44f5c05cfc59
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-09-05T07:24:29+03:00
Commit Message:
AGS: Use target pragmas instead of compiler flag to prevent ODR problems
This is the same as in PR#5581
Changed paths:
configure
engines/ags/lib/allegro/surface_avx2.cpp
engines/ags/lib/allegro/surface_neon.cpp
engines/ags/lib/allegro/surface_sse2.cpp
engines/ags/module.mk
diff --git a/configure b/configure
index 1399f2d6309..1b65aca283f 100755
--- a/configure
+++ b/configure
@@ -7123,10 +7123,6 @@ case $_host_cpu in
if test "$_ext_neon" = auto ; then
_ext_neon=no
fi
- if test "$_ext_neon" = yes ; then
- # -mfpu=neon doesn't work with aarch64 but neon is available
- add_line_to_config_mk 'NEON_CXXFLAGS = -mfpu=neon'
- fi
_ext_sse2=no
_ext_avx2=no
;;
diff --git a/engines/ags/lib/allegro/surface_avx2.cpp b/engines/ags/lib/allegro/surface_avx2.cpp
index 75a4fb059ee..11bb3ee8145 100644
--- a/engines/ags/lib/allegro/surface_avx2.cpp
+++ b/engines/ags/lib/allegro/surface_avx2.cpp
@@ -19,7 +19,6 @@
*
*/
-#include <immintrin.h>
#include "ags/lib/allegro/gfx.h"
#include "ags/lib/allegro/color.h"
#include "ags/lib/allegro/flood.h"
@@ -28,6 +27,13 @@
#include "common/textconsole.h"
#include "graphics/screen.h"
+#include <immintrin.h>
+
+#ifdef __GNUC__
+#pragma GCC push_options
+#pragma GCC target("avx2")
+#endif
+
namespace AGS3 {
class DrawInnerImpl_AVX2 {
@@ -1003,3 +1009,7 @@ template void BITMAP::drawAVX2<false>(DrawInnerArgs &);
template void BITMAP::drawAVX2<true>(DrawInnerArgs &);
} // namespace AGS3
+
+#ifdef __GNUC__
+#pragma GCC pop_options
+#endif
diff --git a/engines/ags/lib/allegro/surface_neon.cpp b/engines/ags/lib/allegro/surface_neon.cpp
index 0a5205efbd6..d1121b41ee4 100644
--- a/engines/ags/lib/allegro/surface_neon.cpp
+++ b/engines/ags/lib/allegro/surface_neon.cpp
@@ -24,7 +24,6 @@
// Without this ifdef the iOS backend breaks, please do not remove
#ifdef SCUMMVM_NEON
-#include <arm_neon.h>
#include "ags/globals.h"
#include "ags/lib/allegro/color.h"
#include "ags/lib/allegro/flood.h"
@@ -32,6 +31,17 @@
#include "common/textconsole.h"
#include "graphics/screen.h"
+#include <arm_neon.h>
+
+#ifdef __GNUC__
+#pragma GCC push_options
+
+#if !defined(__aarch64__)
+#pragma GCC target("fpu=neon")
+#endif // !defined(__aarch64__)
+
+#endif // __GNUC__
+
namespace AGS3 {
class DrawInnerImpl_NEON {
@@ -964,4 +974,8 @@ template void BITMAP::drawNEON<true>(DrawInnerArgs &);
} // namespace AGS3
+#ifdef __GNUC__
+#pragma GCC pop_options
+#endif
+
#endif // SCUMMVM_NEON
diff --git a/engines/ags/lib/allegro/surface_sse2.cpp b/engines/ags/lib/allegro/surface_sse2.cpp
index 518fb72e4e0..db75c917b77 100644
--- a/engines/ags/lib/allegro/surface_sse2.cpp
+++ b/engines/ags/lib/allegro/surface_sse2.cpp
@@ -19,7 +19,6 @@
*
*/
-#include <emmintrin.h>
#include "ags/ags.h"
#include "ags/globals.h"
#include "ags/lib/allegro/color.h"
@@ -28,6 +27,17 @@
#include "common/textconsole.h"
#include "graphics/screen.h"
+#include <emmintrin.h>
+
+#ifdef __GNUC__
+#pragma GCC push_options
+
+#ifndef __x86_64__
+#pragma GCC target("sse2")
+#endif
+
+#endif
+
namespace AGS3 {
class DrawInnerImpl_SSE2 {
@@ -990,3 +1000,7 @@ template void BITMAP::drawSSE2<false>(DrawInnerArgs &);
template void BITMAP::drawSSE2<true>(DrawInnerArgs &);
} // namespace AGS3
+
+#ifdef __GNUC__
+#pragma GCC pop_options
+#endif
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index f36f545fb99..936b7b59923 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -391,17 +391,14 @@ endif
ifdef SCUMMVM_NEON
MODULE_OBJS += \
lib/allegro/surface_neon.o
-$(MODULE)/lib/allegro/surface_neon.o: CXXFLAGS += $(NEON_CXXFLAGS)
endif
ifdef SCUMMVM_SSE2
MODULE_OBJS += \
lib/allegro/surface_sse2.o
-$(MODULE)/lib/allegro/surface_sse2.o: CXXFLAGS += -msse2
endif
ifdef SCUMMVM_AVX2
MODULE_OBJS += \
lib/allegro/surface_avx2.o
-$(MODULE)/lib/allegro/surface_avx2.o: CXXFLAGS += -mavx2 -mavx -msse2
endif
# This module can be built as a plugin
Commit: 8b26ce1c165ebe04496fcd9c3422b2ea5f5c2b9e
https://github.com/scummvm/scummvm/commit/8b26ce1c165ebe04496fcd9c3422b2ea5f5c2b9e
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-09-05T07:24:29+03:00
Commit Message:
GRAPHICS: Add target specifiers for Clang
This allows to enable back SIMD support when compiling with it
Changed paths:
graphics/blit/blit-avx2.cpp
graphics/blit/blit-neon.cpp
graphics/blit/blit-sse2.cpp
diff --git a/graphics/blit/blit-avx2.cpp b/graphics/blit/blit-avx2.cpp
index 72bebf8726d..0f3134e1cdd 100644
--- a/graphics/blit/blit-avx2.cpp
+++ b/graphics/blit/blit-avx2.cpp
@@ -26,7 +26,9 @@
#include <immintrin.h>
-#ifdef __GNUC__
+#if defined(__clang__)
+#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
+#elif defined(__GNUC__)
#pragma GCC push_options
#pragma GCC target("avx2")
#endif
@@ -307,6 +309,8 @@ void BlendBlit::blitAVX2(Args &args, const TSpriteBlendMode &blendMode, const Al
} // End of namespace Graphics
-#ifdef __GNUC__
+#if defined(__clang__)
+#pragma clang attribute pop
+#elif defined(__GNUC__)
#pragma GCC pop_options
#endif
diff --git a/graphics/blit/blit-neon.cpp b/graphics/blit/blit-neon.cpp
index 52b8c50b617..d35668e0aa0 100644
--- a/graphics/blit/blit-neon.cpp
+++ b/graphics/blit/blit-neon.cpp
@@ -28,14 +28,16 @@
#include <arm_neon.h>
-#ifdef __GNUC__
-#pragma GCC push_options
-
#if !defined(__aarch64__)
+
+#if defined(__clang__)
+#pragma clang attribute push (__attribute__((target("neon"))), apply_to=function)
+#elif defined(__GNUC__)
+#pragma GCC push_options
#pragma GCC target("fpu=neon")
-#endif // !defined(__aarch64__)
+#endif
-#endif // __GNUC__
+#endif // !defined(__aarch64__)
namespace Graphics {
@@ -310,8 +312,14 @@ void BlendBlit::blitNEON(Args &args, const TSpriteBlendMode &blendMode, const Al
} // end of namespace Graphics
-#ifdef __GNUC__
+#if !defined(__aarch64__)
+
+#if defined(__clang__)
+#pragma clang attribute pop
+#elif defined(__GNUC__)
#pragma GCC pop_options
#endif
+#endif // !defined(__aarch64__)
+
#endif // SCUMMVM_NEON
diff --git a/graphics/blit/blit-sse2.cpp b/graphics/blit/blit-sse2.cpp
index fed2f5f7901..c454d88f3b8 100644
--- a/graphics/blit/blit-sse2.cpp
+++ b/graphics/blit/blit-sse2.cpp
@@ -26,15 +26,16 @@
#include <emmintrin.h>
-#ifdef __GNUC__
-#pragma GCC push_options
+#if !defined(__x86_64__)
-#ifndef __x86_64__
+#if defined(__clang__)
+#pragma clang attribute push (__attribute__((target("sse2"))), apply_to=function)
+#elif defined(__GNUC__)
+#pragma GCC push_options
#pragma GCC target("sse2")
#endif
-#endif
-
+#endif // !defined(__x86_64__)
namespace Graphics {
@@ -313,7 +314,12 @@ void BlendBlit::blitSSE2(Args &args, const TSpriteBlendMode &blendMode, const Al
} // End of namespace Graphics
-#ifdef __GNUC__
+#if !defined(__x86_64__)
+
+#if defined(__clang__)
+#pragma clang attribute pop
+#elif defined(__GNUC__)
#pragma GCC pop_options
#endif
+#endif // !defined(__x86_64__)
Commit: f001fa7bbcce64d3b5d992feda27f137425483ab
https://github.com/scummvm/scummvm/commit/f001fa7bbcce64d3b5d992feda27f137425483ab
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-09-05T07:24:29+03:00
Commit Message:
AGS: Add target specifiers for Clang
This allows to enable back SIMD support when compiling with it
Changed paths:
engines/ags/lib/allegro/surface_avx2.cpp
engines/ags/lib/allegro/surface_neon.cpp
engines/ags/lib/allegro/surface_sse2.cpp
diff --git a/engines/ags/lib/allegro/surface_avx2.cpp b/engines/ags/lib/allegro/surface_avx2.cpp
index 11bb3ee8145..e32822c6cd1 100644
--- a/engines/ags/lib/allegro/surface_avx2.cpp
+++ b/engines/ags/lib/allegro/surface_avx2.cpp
@@ -29,7 +29,9 @@
#include <immintrin.h>
-#ifdef __GNUC__
+#if defined(__clang__)
+#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
+#elif defined(__GNUC__)
#pragma GCC push_options
#pragma GCC target("avx2")
#endif
@@ -1010,6 +1012,8 @@ template void BITMAP::drawAVX2<true>(DrawInnerArgs &);
} // namespace AGS3
-#ifdef __GNUC__
+#if defined(__clang__)
+#pragma clang attribute pop
+#elif defined(__GNUC__)
#pragma GCC pop_options
#endif
diff --git a/engines/ags/lib/allegro/surface_neon.cpp b/engines/ags/lib/allegro/surface_neon.cpp
index d1121b41ee4..e66bae657d2 100644
--- a/engines/ags/lib/allegro/surface_neon.cpp
+++ b/engines/ags/lib/allegro/surface_neon.cpp
@@ -33,14 +33,16 @@
#include <arm_neon.h>
-#ifdef __GNUC__
-#pragma GCC push_options
-
#if !defined(__aarch64__)
+
+#if defined(__clang__)
+#pragma clang attribute push (__attribute__((target("neon"))), apply_to=function)
+#elif defined(__GNUC__)
+#pragma GCC push_options
#pragma GCC target("fpu=neon")
-#endif // !defined(__aarch64__)
+#endif
-#endif // __GNUC__
+#endif // !defined(__aarch64__)
namespace AGS3 {
@@ -974,8 +976,14 @@ template void BITMAP::drawNEON<true>(DrawInnerArgs &);
} // namespace AGS3
-#ifdef __GNUC__
+#if !defined(__aarch64__)
+
+#if defined(__clang__)
+#pragma clang attribute pop
+#elif defined(__GNUC__)
#pragma GCC pop_options
#endif
+#endif // !defined(__aarch64__)
+
#endif // SCUMMVM_NEON
diff --git a/engines/ags/lib/allegro/surface_sse2.cpp b/engines/ags/lib/allegro/surface_sse2.cpp
index db75c917b77..511a4a82a69 100644
--- a/engines/ags/lib/allegro/surface_sse2.cpp
+++ b/engines/ags/lib/allegro/surface_sse2.cpp
@@ -29,14 +29,16 @@
#include <emmintrin.h>
-#ifdef __GNUC__
-#pragma GCC push_options
+#if !defined(__x86_64__)
-#ifndef __x86_64__
+#if defined(__clang__)
+#pragma clang attribute push (__attribute__((target("sse2"))), apply_to=function)
+#elif defined(__GNUC__)
+#pragma GCC push_options
#pragma GCC target("sse2")
#endif
-#endif
+#endif // !defined(__x86_64__)
namespace AGS3 {
@@ -1001,6 +1003,12 @@ template void BITMAP::drawSSE2<true>(DrawInnerArgs &);
} // namespace AGS3
-#ifdef __GNUC__
+#if !defined(__x86_64__)
+
+#if defined(__clang__)
+#pragma clang attribute pop
+#elif defined(__GNUC__)
#pragma GCC pop_options
#endif
+
+#endif // !defined(__x86_64__)
Commit: 094259452467acbf6e1214f3a65a17c56fbe60fc
https://github.com/scummvm/scummvm/commit/094259452467acbf6e1214f3a65a17c56fbe60fc
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-09-05T07:24:29+03:00
Commit Message:
CONFIGURE: Enable back SIMD for clang compiler depending on its version
Changed paths:
configure
diff --git a/configure b/configure
index 1b65aca283f..4f56a2d074b 100755
--- a/configure
+++ b/configure
@@ -2282,6 +2282,9 @@ if test "$have_gcc" = yes; then
cxx_version="`echo "${cxx_version}" | sed -e 's/"\([^ ]*\) .*/\1/'`"
cxx_version="clang $cxx_version, ok"
+ _clang_major=`gcc_get_define __clang_major__`
+ _clang_minor=`gcc_get_define __clang_minor__`
+
append_var CXXFLAGS "-Wshadow"
else
cxx_version="GCC $cxx_version, ok"
@@ -7133,7 +7136,35 @@ case $_host_cpu in
;;
esac
-if test "$have_gcc" = yes; then
+if test "$have_clang" = yes; then
+ # Clang has variable support to target gating of intrinsics
+ case $_host_cpu in
+ i[3-6]86)
+ # SSE2 and AVX2 has been target gated since LLVM 5.0
+ if (test $_clang_major -lt 5) || (test $_clang_major -eq 5 && test $_clang_minor -lt 0); then
+ _ext_sse2=no
+ _ext_avx2=no
+ fi
+ ;;
+ arm*)
+ # NEON has been target gated since LLVM 19.1
+ if (test $_clang_major -lt 19) || (test $_clang_major -eq 19 && test $_clang_minor -lt 1); then
+ # But several platforms enables it globally...
+ if ! echo "$CXXFLAGS" | grep -q -e -mfpu=neon; then
+ _ext_neon=no
+ fi
+ fi
+ ;;
+ x86_64 | amd64)
+ # AVX2 has been target gated since LLVM 5.0
+ # x86_64 always supports SSE2, no need of gating
+ if (test $_clang_major -lt 5) || (test $_clang_major -eq 5 && test $_clang_minor -lt 0); then
+ _ext_avx2=no
+ fi
+ ;;
+ # aarch64 always supports NEON, no need of gating
+ esac
+elif test "$have_gcc" = yes; then
# Need 4.9 for pragma target
if (test $_cxx_major -lt 4) || (test $_cxx_major -eq 4 && test $_cxx_minor -lt 9); then
_ext_sse2=no
Commit: 30952fbcf7ebeb6d8999d36a3d560273e723723e
https://github.com/scummvm/scummvm/commit/30952fbcf7ebeb6d8999d36a3d560273e723723e
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-09-05T07:24:29+03:00
Commit Message:
CONFIGURE: Refactor compiler version checks for SIMD instructions sets
Changed paths:
configure
diff --git a/configure b/configure
index 4f56a2d074b..802f484601e 100755
--- a/configure
+++ b/configure
@@ -7105,6 +7105,12 @@ case $_host_cpu in
_ext_avx2=yes
fi
_ext_neon=no
+ # SSE2 is always available on x86_64
+ if !(test "$have_clang" = yes && (test $_clang_major -gt 5) || (test $_clang_major -eq 5 && test $_clang_minor -gt 0)) &&
+ !(test "$have_gcc" = yes && (test $_cxx_major -gt 4) || (test $_cxx_major -eq 4 && test $_cxx_minor -gt 9)); then
+ # Need GCC 4.9+ or Clang 5.0+ for target pragma
+ _ext_avx2=no
+ fi
;;
i[3-6]86)
if test "$_ext_sse2" = auto ; then
@@ -7114,6 +7120,12 @@ case $_host_cpu in
_ext_avx2=no
fi
_ext_neon=no
+ if !(test "$have_clang" = yes && (test $_clang_major -gt 5) || (test $_clang_major -eq 5 && test $_clang_minor -gt 0)) &&
+ !(test "$have_gcc" = yes && (test $_cxx_major -gt 4) || (test $_cxx_major -eq 4 && test $_cxx_minor -gt 9)); then
+ # Need GCC 4.9+ or Clang 5.0+ for target pragma
+ _ext_sse2=no
+ _ext_avx2=no
+ fi
;;
aarch64)
if test "$_ext_neon" = auto ; then
@@ -7121,6 +7133,7 @@ case $_host_cpu in
fi
_ext_sse2=no
_ext_avx2=no
+ # On aarch64 neon is always available and doesn't need a target pragma
;;
arm*)
if test "$_ext_neon" = auto ; then
@@ -7128,6 +7141,11 @@ case $_host_cpu in
fi
_ext_sse2=no
_ext_avx2=no
+ if !(test "$have_clang" = yes && (test $_clang_major -gt 19) || (test $_clang_major -eq 19 && test $_clang_minor -gt 1)) &&
+ !(test "$have_gcc" = yes && (test $_cxx_major -gt 4) || (test $_cxx_major -eq 4 && test $_cxx_minor -gt 9)); then
+ # Need GCC 4.9+ or Clang 19.1+ for target pragma
+ _ext_neon=no
+ fi
;;
*)
_ext_sse2=no
@@ -7136,43 +7154,6 @@ case $_host_cpu in
;;
esac
-if test "$have_clang" = yes; then
- # Clang has variable support to target gating of intrinsics
- case $_host_cpu in
- i[3-6]86)
- # SSE2 and AVX2 has been target gated since LLVM 5.0
- if (test $_clang_major -lt 5) || (test $_clang_major -eq 5 && test $_clang_minor -lt 0); then
- _ext_sse2=no
- _ext_avx2=no
- fi
- ;;
- arm*)
- # NEON has been target gated since LLVM 19.1
- if (test $_clang_major -lt 19) || (test $_clang_major -eq 19 && test $_clang_minor -lt 1); then
- # But several platforms enables it globally...
- if ! echo "$CXXFLAGS" | grep -q -e -mfpu=neon; then
- _ext_neon=no
- fi
- fi
- ;;
- x86_64 | amd64)
- # AVX2 has been target gated since LLVM 5.0
- # x86_64 always supports SSE2, no need of gating
- if (test $_clang_major -lt 5) || (test $_clang_major -eq 5 && test $_clang_minor -lt 0); then
- _ext_avx2=no
- fi
- ;;
- # aarch64 always supports NEON, no need of gating
- esac
-elif test "$have_gcc" = yes; then
- # Need 4.9 for pragma target
- if (test $_cxx_major -lt 4) || (test $_cxx_major -eq 4 && test $_cxx_minor -lt 9); then
- _ext_sse2=no
- _ext_avx2=no
- _ext_neon=no
- fi
-fi
-
define_in_config_if_yes "$_ext_sse2" 'SCUMMVM_SSE2'
echo_n "Enabling x86/amd64 SSE2... "
echo "$_ext_sse2"
More information about the Scummvm-git-logs
mailing list