[vlc-commits] contrib: lame: Use __attribute__((target("sse"))) instead of #pragma GCC target("sse")

Martin Storsjö git at videolan.org
Fri Oct 12 09:06:51 CEST 2018


vlc | branch: master | Martin Storsjö <martin at martin.st> | Fri Oct 12 10:02:22 2018 +0300| [e335c759dd2fa885ddf967f69256785a0cd7c02c] | committer: Martin Storsjö

contrib: lame: Use __attribute__((target("sse"))) instead of #pragma GCC target("sse")

Clang doesn't support the pragma, but does support the attribute.
Update the existing patch to do things this way.

With previous versions of lame, this hasn't been an issue, because
if one doesn't pass any -march flag, clang defaults to pentium4 as
target for i386 targets, and there both sse and sse2 are available
by default.

Since lame 3.100, lame now passes -march=i686 even for clang, which
disables SSE by default, requiring the per-function enabling to
actually work.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e335c759dd2fa885ddf967f69256785a0cd7c02c
---

 contrib/src/lame/sse.patch | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/contrib/src/lame/sse.patch b/contrib/src/lame/sse.patch
index e67f5966da..f092c1006f 100644
--- a/contrib/src/lame/sse.patch
+++ b/contrib/src/lame/sse.patch
@@ -10,21 +10,31 @@ In file included from xmm_quantize_sub.c:37:0:
 xmm_quantize_sub.c:65:18: error: called from here
      const __m128 vec_fabs_mask = _mm_loadu_ps(&fabs_mask._float[0]);
                   ^
---- lame/libmp3lame/vector/xmm_quantize_sub.c.orig	2018-10-04 13:48:32.286892400 +0200
-+++ lame/libmp3lame/vector/xmm_quantize_sub.c	2018-10-04 13:49:23.640116100 +0200
-@@ -35,6 +35,7 @@
- #ifdef HAVE_XMMINTRIN_H
+--- lame/libmp3lame/vector/xmm_quantize_sub.c.orig	2018-10-12 09:58:30.173001621 +0300
++++ lame/libmp3lame/vector/xmm_quantize_sub.c	2018-10-12 09:57:39.850108435 +0300
+@@ -53,10 +53,13 @@
  
- #include <xmmintrin.h>
-+#pragma GCC target("sse")
+ /* make sure functions with SSE instructions maintain their own properly aligned stack */
+ #if defined (__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)))
+-#define SSE_FUNCTION __attribute__((force_align_arg_pointer))
++#define REALIGN __attribute__((force_align_arg_pointer))
++#define TARGET(x) __attribute__((target(x)))
+ #else
+-#define SSE_FUNCTION
++#define REALIGN
++#define TARGET(x)
+ #endif
++#define SSE_FUNCTION REALIGN TARGET("sse")
  
- typedef union {
-     int32_t _i_32[4]; /* unions are initialized by its first member */
-@@ -132,6 +133,7 @@ store4(__m128 v, float* f0, float* f1, f
+ 
+ SSE_FUNCTION void
+@@ -132,6 +135,9 @@
  }
  
  
-+#pragma GCC target("sse2")
++#undef SSE_FUNCTION
++#define SSE_FUNCTION REALIGN TARGET("sse2")
++
  SSE_FUNCTION void
  fht_SSE2(FLOAT * fz, int n)
  {



More information about the vlc-commits mailing list