changeset 26019:dfdf201e62cc

Replace Alpha MVI compiler workarounds by a proper configure check.
author diego
date Thu, 21 Feb 2008 16:47:05 +0000
parents 92a66676d418
children 93933656cdd0
files configure libmpeg2/cpu_accel.c libmpeg2/idct.c libmpeg2/idct_alpha.c libmpeg2/libmpeg-0.4.1.diff
diffstat 5 files changed, 14 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Thu Feb 21 16:35:00 2008 +0000
+++ b/configure	Thu Feb 21 16:47:05 2008 +0000
@@ -317,7 +317,7 @@
   --enable-libdca           enable libdca support [autodetect]
   --disable-mp3lib          disable builtin mp3lib [enabled]
   --disable-liba52          disable builtin liba52 [enabled]
-  --disable-libmpeg2        disable builtin libmpeg2 [enabled]
+  --disable-libmpeg2        disable builtin libmpeg2 [autodetect]
   --disable-musepack        disable musepack support [autodetect]
   --disable-libamr_nb       disable libamr narrowband [autodetect]
   --disable-libamr_wb       disable libamr wideband [autodetect]
@@ -568,7 +568,7 @@
 _mp3lib=yes
 _liba52=yes
 _libdca=auto
-_libmpeg2=yes
+_libmpeg2=auto
 _faad_internal=auto
 _faad_external=auto
 _faad_fixed=no
@@ -2179,15 +2179,6 @@
     echores "$proc"
     
     _optimizing="$proc"
-
-    echocheck "MVI instruction support in GCC"
-    if test "$_cc_major" -ge "3" && test "$_mvi" = "1" ; then
-        _def_gcc_mvi_support="#define CAN_COMPILE_ALPHA_MVI 1"
-	echores "yes"
-    else
-	_def_gcc_mvi_support="#undef CAN_COMPILE_ALPHA_MVI"
-	echores "no, GCC = `$_cc -dumpversion 2>&1` (must be >= 3), CPU = $proc (must be pca56 or later)"
-    fi
     ;;
 
   mips)
@@ -6039,6 +6030,17 @@
 echores "$_libdca"
 
 echocheck "internal libmpeg2 support"
+if test "$_libmpeg2" = auto ; then
+  _libmpeg2=yes
+  if alpha && test cc_vendor=gnu; then
+    case $cc_version in
+      2*|3.0*|3.1*) # cannot compile MVI instructions
+        _libmpeg2=no
+        _res_comment="broken gcc"
+        ;;
+    esac
+  fi
+fi
 if test "$_libmpeg2" = yes ; then
   _def_libmpeg2='#define USE_LIBMPEG2 1'
   _codecmodules="libmpeg2 $_codecmodules"
@@ -8329,9 +8331,6 @@
    have the instruction. */
 $_def_dcbzl
 
-/* only gcc3 can compile mvi instructions (libmpeg2) */
-$_def_gcc_mvi_support
-
 /* Define this for Cygwin build for win32 */
 $_def_confwin32
 
--- a/libmpeg2/cpu_accel.c	Thu Feb 21 16:35:00 2008 +0000
+++ b/libmpeg2/cpu_accel.c	Thu Feb 21 16:47:05 2008 +0000
@@ -224,7 +224,6 @@
 #ifdef ARCH_ALPHA
 static uint32_t arch_accel (void)
 {
-#ifdef CAN_COMPILE_ALPHA_MVI
     uint64_t no_mvi;
 
     asm volatile ("amask %1, %0"
@@ -232,9 +231,6 @@
 		  : "rI" (256));	/* AMASK_MVI */
     return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
 					 MPEG2_ACCEL_ALPHA_MVI);
-#else
-    return MPEG2_ACCEL_ALPHA;
-#endif
 }
 #endif /* ARCH_ALPHA */
 #endif /* ACCEL_DETECT */
--- a/libmpeg2/idct.c	Thu Feb 21 16:35:00 2008 +0000
+++ b/libmpeg2/idct.c	Thu Feb 21 16:47:05 2008 +0000
@@ -261,14 +261,11 @@
     } else
 #endif
 #ifdef ARCH_ALPHA
-#ifdef CAN_COMPILE_ALPHA_MVI
     if (accel & MPEG2_ACCEL_ALPHA_MVI) {
 	mpeg2_idct_copy = mpeg2_idct_copy_mvi;
 	mpeg2_idct_add = mpeg2_idct_add_mvi;
 	mpeg2_idct_alpha_init ();
-    } else
-#endif
-    if (accel & MPEG2_ACCEL_ALPHA) {
+    } else if (accel & MPEG2_ACCEL_ALPHA) {
 	int i;
 
 	mpeg2_idct_copy = mpeg2_idct_copy_alpha;
--- a/libmpeg2/idct_alpha.c	Thu Feb 21 16:35:00 2008 +0000
+++ b/libmpeg2/idct_alpha.c	Thu Feb 21 16:47:05 2008 +0000
@@ -161,7 +161,6 @@
     block[8*7] = (a0 - b0) >> 17;
 }
 
-#ifdef CAN_COMPILE_ALPHA_MVI
 void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, const int stride)
 {
     uint64_t clampmask;
@@ -294,7 +293,6 @@
 	stq (p7, dest + 7 * stride);
     }
 }
-#endif
 
 void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, const int stride)
 {
--- a/libmpeg2/libmpeg-0.4.1.diff	Thu Feb 21 16:35:00 2008 +0000
+++ b/libmpeg2/libmpeg-0.4.1.diff	Thu Feb 21 16:47:05 2008 +0000
@@ -79,24 +79,6 @@
  #endif
      asm volatile ("mtspr 256, %0\n\t"
  		  VAND (0, 0, 0)
-@@ -195,6 +222,7 @@
- #ifdef ARCH_ALPHA
- static inline uint32_t arch_accel (void)
- {
-+#ifdef CAN_COMPILE_ALPHA_MVI
-     uint64_t no_mvi;
- 
-     asm volatile ("amask %1, %0"
-@@ -202,6 +230,9 @@
- 		  : "rI" (256));	/* AMASK_MVI */
-     return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
- 					 MPEG2_ACCEL_ALPHA_MVI);
-+#else
-+    return MPEG2_ACCEL_ALPHA;
-+#endif
- }
- #endif /* ARCH_ALPHA */
- #endif /* ACCEL_DETECT */
 @@ -212,7 +243,7 @@
  
      accel = 0;
@@ -233,40 +215,6 @@
  	mpeg2_idct_copy = mpeg2_idct_copy_mmx;
  	mpeg2_idct_add = mpeg2_idct_add_mmx;
  	mpeg2_idct_mmx_init ();
-@@ -254,11 +261,14 @@
-     } else
- #endif
- #ifdef ARCH_ALPHA
-+#ifdef CAN_COMPILE_ALPHA_MVI
-     if (accel & MPEG2_ACCEL_ALPHA_MVI) {
- 	mpeg2_idct_copy = mpeg2_idct_copy_mvi;
- 	mpeg2_idct_add = mpeg2_idct_add_mvi;
- 	mpeg2_idct_alpha_init ();
--    } else if (accel & MPEG2_ACCEL_ALPHA) {
-+    } else
-+#endif
-+    if (accel & MPEG2_ACCEL_ALPHA) {
- 	int i;
- 
- 	mpeg2_idct_copy = mpeg2_idct_copy_alpha;
---- libmpeg2/idct_alpha.c	2006-06-16 20:12:26.000000000 +0200
-+++ libmpeg2/idct_alpha.c	2006-06-16 20:12:50.000000000 +0200
-@@ -157,6 +161,7 @@
-     block[8*7] = (a0 - b0) >> 17;
- }
- 
-+#ifdef CAN_COMPILE_ALPHA_MVI
- void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, const int stride)
- {
-     uint64_t clampmask;
-@@ -289,6 +294,7 @@
- 	stq (p7, dest + 7 * stride);
-     }
- }
-+#endif
- 
- void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, const int stride)
- {
 --- libmpeg2/idct_mmx.c	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/idct_mmx.c	2006-06-16 20:12:50.000000000 +0200
 @@ -23,7 +27,7 @@