From 60635c5d5120e1180fab363b566c9c28e00d548a Mon Sep 17 00:00:00 2001 From: Andre Pang Date: Sat, 6 Nov 2004 09:23:15 +0000 Subject: libmpeg2 compilation fixes for Mac OS X CVS patchset: 7105 CVS date: 2004/11/06 09:23:15 --- src/libmpeg2/cpu_state.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) (limited to 'src/libmpeg2/cpu_state.c') 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 + * Copyright (C) 2000-2003 Michel Lespinasse * Copyright (C) 1999-2000 Aaron Holtzman * * 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 } + -- cgit v1.2.3