From 99edd1888221b15b6a85767e0e12cb57a829923d Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 6 Nov 2001 12:49:01 +0000 Subject: [PATCH] Fixes to properly conditionally compile architecture-dependent code Original commit message from CVS: Fixes to properly conditionally compile architecture-dependent code --- libs/resample/Makefile.am | 12 +++++++++++- libs/resample/dtos.c | 10 ++++++---- libs/resample/resample.h | 9 +++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/libs/resample/Makefile.am b/libs/resample/Makefile.am index 02c664d83a..fa31cb0823 100644 --- a/libs/resample/Makefile.am +++ b/libs/resample/Makefile.am @@ -15,5 +15,15 @@ test_SOURCES = test.c test_LDADD = libresample.la -CFLAGS += -O2 -ffast-math +if HAVE_CPU_I386 +ARCHCFLAGS = -march=i486 +else +if HAVE_CPU_PPC +ARCHCFLAGS = -Wa,-m7400 +else +ARCHCFLAGS = +endif +endif + +CFLAGS += -O2 -ffast-math $(ARCHCFLAGS) diff --git a/libs/resample/dtos.c b/libs/resample/dtos.c index ce4a1c01c6..c02d0ef157 100644 --- a/libs/resample/dtos.c +++ b/libs/resample/dtos.c @@ -29,12 +29,12 @@ #define short_to_double_table -#define short_to_double_altivec +//#define short_to_double_altivec #define short_to_double_unroll #ifdef short_to_double_table -float ints_high[256]; -float ints_low[256]; +static float ints_high[256]; +static float ints_low[256]; void conv_double_short_table(double *dest, short *src, int n) { @@ -94,7 +94,7 @@ void conv_double_short_ref(double *dest, short *src, int n) } } -#ifdef short_to_double_altivec +#ifdef HAVE_CPU_PPC static union { int i[4]; float f[4]; } av_tmp __attribute__ ((__aligned__ (16))); void conv_double_short_altivec(double *dest, short *src, int n) @@ -141,6 +141,7 @@ void conv_short_double_ref(short *dest, double *src, int n) } } +#ifdef HAVE_CPU_PPC void conv_short_double_ppcasm(short *dest, double *src, int n) { int tmp[2]; @@ -168,5 +169,6 @@ void conv_short_double_ppcasm(short *dest, double *src, int n) : "r9", "r5" ); } +#endif diff --git a/libs/resample/resample.h b/libs/resample/resample.h index e5347f0868..4c1b2a5297 100644 --- a/libs/resample/resample.h +++ b/libs/resample/resample.h @@ -133,13 +133,22 @@ double functable_window_dboxcar(void *p, double x); void conv_double_short_table(double *dest, short *src, int n); void conv_double_short_unroll(double *dest, short *src, int n); void conv_double_short_ref(double *dest, short *src, int n); +#ifdef HAVE_CPU_PPC void conv_double_short_altivec(double *dest, short *src, int n); +#endif void conv_short_double_ref(short *dest, double *src, int n); +#ifdef HAVE_CPU_PPC void conv_short_double_ppcasm(short *dest, double *src, int n); +#endif +#ifdef HAVE_CPU_PPC #define conv_double_short conv_double_short_table #define conv_short_double conv_short_double_ppcasm +#else +#define conv_double_short conv_double_short_ref +#define conv_short_double conv_short_double_ref +#endif #endif /* __RESAMPLE_H__ */