aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-12-13 16:49:46 -0800
committerChris Robinson <[email protected]>2020-12-13 16:49:46 -0800
commit783904e414024691d47e76a22d8405ca85dd04f2 (patch)
tree92d692d7f6e86e5ff0f610043d7e162f1405e289 /core
parent225d42538d2397e2698b9edb359c360dde3d00a8 (diff)
Avoid compiling different sources for different targets
Simplifies configuration and fixes a potential problem with inline functions. Inline functions that fail to inline will have a callable body generated. If such a body is generated with the SSE4 source, for example, it can generate SSE4 instructions. Calls for that function in other sources can then end up calling the SSE4-generated body outside of any CPU capability check.
Diffstat (limited to 'core')
-rw-r--r--core/mixer/mixer_neon.cpp4
-rw-r--r--core/mixer/mixer_sse.cpp5
-rw-r--r--core/mixer/mixer_sse2.cpp4
-rw-r--r--core/mixer/mixer_sse41.cpp4
4 files changed, 17 insertions, 0 deletions
diff --git a/core/mixer/mixer_neon.cpp b/core/mixer/mixer_neon.cpp
index 3c7ddd4e..cc6dd71d 100644
--- a/core/mixer/mixer_neon.cpp
+++ b/core/mixer/mixer_neon.cpp
@@ -16,6 +16,10 @@ struct BSincTag;
struct FastBSincTag;
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__ARM_NEON)
+#pragma GCC target("fpu=neon")
+#endif
+
namespace {
inline float32x4_t set_f4(float l0, float l1, float l2, float l3)
diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp
index ff722c19..f21ec227 100644
--- a/core/mixer/mixer_sse.cpp
+++ b/core/mixer/mixer_sse.cpp
@@ -15,6 +15,11 @@ struct BSincTag;
struct FastBSincTag;
+/* SSE2 is required for any SSE support. */
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__SSE2__)
+#pragma GCC target("sse2")
+#endif
+
namespace {
constexpr uint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
diff --git a/core/mixer/mixer_sse2.cpp b/core/mixer/mixer_sse2.cpp
index 69fac250..a93a33f9 100644
--- a/core/mixer/mixer_sse2.cpp
+++ b/core/mixer/mixer_sse2.cpp
@@ -30,6 +30,10 @@ struct SSE2Tag;
struct LerpTag;
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__SSE2__)
+#pragma GCC target("sse2")
+#endif
+
template<>
const float *Resample_<LerpTag,SSE2Tag>(const InterpState*, const float *RESTRICT src, uint frac,
uint increment, const al::span<float> dst)
diff --git a/core/mixer/mixer_sse41.cpp b/core/mixer/mixer_sse41.cpp
index cacc9e64..f7839b78 100644
--- a/core/mixer/mixer_sse41.cpp
+++ b/core/mixer/mixer_sse41.cpp
@@ -31,6 +31,10 @@ struct SSE4Tag;
struct LerpTag;
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__SSE4_1__)
+#pragma GCC target("sse4.1")
+#endif
+
template<>
const float *Resample_<LerpTag,SSE4Tag>(const InterpState*, const float *RESTRICT src, uint frac,
uint increment, const al::span<float> dst)