summaryrefslogtreecommitdiffstats
path: root/mp3lib
diff options
context:
space:
mode:
Diffstat (limited to 'mp3lib')
-rw-r--r--mp3lib/Makefile8
-rw-r--r--mp3lib/dct64_sse.c9
-rw-r--r--mp3lib/decod386.c5
-rw-r--r--mp3lib/decode_MMX.c2
-rw-r--r--mp3lib/sr1.c5
5 files changed, 28 insertions, 1 deletions
diff --git a/mp3lib/Makefile b/mp3lib/Makefile
index 2889e9c72f..b25fbdbf75 100644
--- a/mp3lib/Makefile
+++ b/mp3lib/Makefile
@@ -9,9 +9,17 @@ CFLAGS = -I.. $(OPTFLAGS)
SRCS = sr1.c
ifeq ($(TARGET_ARCH_X86_32),yes)
SRCS += decode_i586.c
+# Darwin can't compile tabinit_MMX.c. However, we need costab_mmx from
+# decode_mmx.c for dct64_sse.c.
+ifeq ($(TARGET_OS),Darwin)
+ifeq ($(TARGET_MMX),yes)
+SRCS += decode_MMX.c
+endif
+else
ifeq ($(TARGET_MMX),yes)
SRCS += decode_MMX.c dct64_MMX.c tabinit_MMX.c
endif
+endif
ifeq ($(TARGET_3DNOW),yes)
SRCS += dct36_3dnow.c dct64_3dnow.c
endif
diff --git a/mp3lib/dct64_sse.c b/mp3lib/dct64_sse.c
index 5fb8839dbe..65a6e5469b 100644
--- a/mp3lib/dct64_sse.c
+++ b/mp3lib/dct64_sse.c
@@ -298,6 +298,13 @@ void dct64_sse(real *a,real *b,real *c)
To do saturation efficiently in x86 we can use fist(t)(p),
pf2iw, or packssdw. We use fist(p) here.
*/
+
+#ifdef SYS_DARWIN
+#define FFREEP "fstp %%st(0)\n\t"
+#else
+#define FFREEP "ffreep %%st(0)\n\t"
+#endif /* SYS_DARWIN */
+
asm(
"flds %0\n\t"
"flds (%2)\n\t"
@@ -426,7 +433,7 @@ void dct64_sse(real *a,real *b,real *c)
"fist 480(%4)\n\t"
"fadds 92(%1)\n\t"
"fistp 416(%4)\n\t"
- "ffreep %%st(0)\n\t"
+ FFREEP
:
:"m"(costab_mmx[30]), "r"(b1), "r"(b2), "r"(a), "r"(b)
:"memory"
diff --git a/mp3lib/decod386.c b/mp3lib/decod386.c
index 6752146755..bd93932353 100644
--- a/mp3lib/decod386.c
+++ b/mp3lib/decod386.c
@@ -19,6 +19,11 @@
#include "config.h"
+/* Can't compile MMX assembly on Darwin */
+#ifdef SYS_DARWIN
+#undef HAVE_MMX
+#endif /* SYS_DARWIN */
+
#if 0
/* old WRITE_SAMPLE */
/* is portable */
diff --git a/mp3lib/decode_MMX.c b/mp3lib/decode_MMX.c
index 7fd9e477f5..f4340dc83d 100644
--- a/mp3lib/decode_MMX.c
+++ b/mp3lib/decode_MMX.c
@@ -48,6 +48,7 @@ unsigned long __attribute__((aligned(16))) costab_mmx[] =
1060439283,
};
+#ifndef SYS_DARWIN
static int temp; // buggy gcc 3.x fails if this is moved into the function :(
void synth_1to1_MMX_s(real *bandPtr, int channel, short *samples,
short *buffs, int *bo)
@@ -246,3 +247,4 @@ __asm __volatile(
:"m"(bandPtr),"m"(channel),"m"(samples),"m"(buffs),"m"(bo), "m"(temp)
:"memory","%edi","%esi","%ebx","%esp");
}
+#endif /* SYS_DARWIN */
diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c
index e5e6395290..3847e8e6b5 100644
--- a/mp3lib/sr1.c
+++ b/mp3lib/sr1.c
@@ -31,6 +31,11 @@
#include "libvo/fastmemcpy.h"
+// Can't compile MMX assembly on Darwin
+#ifdef SYS_DARWIN
+#undef HAVE_MMX
+#endif /* SYS_DARWIN */
+
#ifdef ARCH_X86_32
#define CAN_COMPILE_X86_ASM
#endif