summaryrefslogtreecommitdiff
path: root/src/libmpeg2/cpu_state.c
diff options
context:
space:
mode:
authorAndre Pang <athp@users.sourceforge.net>2004-11-06 09:23:15 +0000
committerAndre Pang <athp@users.sourceforge.net>2004-11-06 09:23:15 +0000
commit60635c5d5120e1180fab363b566c9c28e00d548a (patch)
treee150475da551376be0504fd34eeea7b620eef47e /src/libmpeg2/cpu_state.c
parent5a9a7545889b82afffde6a867edd08941d3b4772 (diff)
downloadxine-lib-60635c5d5120e1180fab363b566c9c28e00d548a.tar.gz
xine-lib-60635c5d5120e1180fab363b566c9c28e00d548a.tar.bz2
libmpeg2 compilation fixes for Mac OS X
CVS patchset: 7105 CVS date: 2004/11/06 09:23:15
Diffstat (limited to 'src/libmpeg2/cpu_state.c')
-rw-r--r--src/libmpeg2/cpu_state.c72
1 files changed, 70 insertions, 2 deletions
diff --git a/src/libmpeg2/cpu_state.c b/src/libmpeg2/cpu_state.c
index db876cf98..433a85b85 100644
--- a/src/libmpeg2/cpu_state.c
+++ b/src/libmpeg2/cpu_state.c
@@ -1,6 +1,6 @@
/*
* cpu_state.c
- * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
@@ -40,6 +40,9 @@ static void state_restore_mmx (cpu_state_t * state)
#endif
#if defined (ARCH_PPC) && defined (ENABLE_ALTIVEC)
+
+#ifndef HOST_OS_DARWIN
+
static void state_save_altivec (cpu_state_t * state)
{
asm (" \n"
@@ -97,7 +100,71 @@ static void state_restore_altivec (cpu_state_t * state)
" lvx %v31, %r9, %r3 \n"
);
}
-#endif
+
+#else /* HOST_OS_DARWIN */
+
+#define LI(a,b) "li r" #a "," #b "\n\t"
+#define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t"
+#define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t"
+#define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t"
+#define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t"
+
+static void state_save_altivec (cpu_state_t * state)
+{
+ asm (LI (9, 16)
+ STVX0 (20, 0, 3)
+ LI (11, 32)
+ STVX (21, 9, 3)
+ LI (9, 48)
+ STVX (22, 11, 3)
+ LI (11, 64)
+ STVX (23, 9, 3)
+ LI (9, 80)
+ STVX (24, 11, 3)
+ LI (11, 96)
+ STVX (25, 9, 3)
+ LI (9, 112)
+ STVX (26, 11, 3)
+ LI (11, 128)
+ STVX (27, 9, 3)
+ LI (9, 144)
+ STVX (28, 11, 3)
+ LI (11, 160)
+ STVX (29, 9, 3)
+ LI (9, 176)
+ STVX (30, 11, 3)
+ STVX (31, 9, 3));
+}
+
+static void state_restore_altivec (cpu_state_t * state)
+{
+ asm (LI (9, 16)
+ LVX0 (20, 0, 3)
+ LI (11, 32)
+ LVX (21, 9, 3)
+ LI (9, 48)
+ LVX (22, 11, 3)
+ LI (11, 64)
+ LVX (23, 9, 3)
+ LI (9, 80)
+ LVX (24, 11, 3)
+ LI (11, 96)
+ LVX (25, 9, 3)
+ LI (9, 112)
+ LVX (26, 11, 3)
+ LI (11, 128)
+ LVX (27, 9, 3)
+ LI (9, 144)
+ LVX (28, 11, 3)
+ LI (11, 160)
+ LVX (29, 9, 3)
+ LI (9, 176)
+ LVX (30, 11, 3)
+ LVX (31, 9, 3));
+}
+#endif /* HOST_OS_DARWIN */
+
+#endif /* defined (ARCH_PPC) && defined (ENABLE_ALTIVEC) */
void mpeg2_cpu_state_init (uint32_t mm_accel)
{
@@ -113,3 +180,4 @@ void mpeg2_cpu_state_init (uint32_t mm_accel)
}
#endif
}
+