Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enable SSE intrinsic acceleration with VMX/VSX for LAME 3.100 on ppc64le (configure with CFLAGS="-O3 -mcpu=power9 -DNO_WARN_X86_INTRINSICS" ./configure)
diff --git a/configure b/configure
index 52dbf02..1354f27 100755
--- a/configure
+++ b/configure
@@ -17226,16 +17226,28 @@ powerpc)
# use internal knowledge of the IEEE 754 layout
$as_echo "#define TAKEHIRO_IEEE754_HACK 1" >>confdefs.h
# The following should not get enabled on a G5. HOWTO check for a G5?
+$as_echo "#define USE_FAST_LOG 1" >>confdefs.h
+
+ ;;
+
+powerpc64le)
+ CPUTYPE="no"
+ if test $ac_cv_header_xmmintrin_h = yes ; then
+ WITH_XMM=yes
+ WITH_VECTOR=yes
+ $as_echo "#define NO_WARN_X86_INTRINSICS 1" >>confdefs.h
+ fi
+
$as_echo "#define USE_FAST_LOG 1" >>confdefs.h
;;
*)
CPUTYPE="no"
;;
esac
diff --git a/configure.in b/configure.in
index 3f9fddb..949bba5 100644
--- a/configure.in
+++ b/configure.in
@@ -705,16 +705,27 @@ powerpc)
CPUTYPE="no"
# use internal knowledge of the IEEE 754 layout
AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
# The following should not get enabled on a G5. HOWTO check for a G5?
AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
;;
+powerpc64le)
+ CPUTYPE="no"
+ if test $ac_cv_header_xmmintrin_h = yes ; then
+ WITH_XMM=yes
+ WITH_VECTOR=yes
+ AC_DEFINE(NO_WARN_X86_INTRINSICS, 1, allow gcc SSE intrinsics on ppc64le)
+ fi
+
+ AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
+ ;;
+
*)
CPUTYPE="no"
;;
esac
# which vector code do we support to build on this machine?
AM_CONDITIONAL(WITH_XMM, test "x${WITH_XMM}" = "xyes")
diff --git a/frontend/get_audio.c b/frontend/get_audio.c
index 1690dbc..b3a5a5c 100644
--- a/frontend/get_audio.c
+++ b/frontend/get_audio.c
@@ -157,17 +157,17 @@ static int
read_32_bits_low_high(FILE * fp)
{
unsigned char bytes[4] = { 0, 0, 0, 0 };
fread(bytes, 1, 4, fp);
{
int32_t const low = bytes[0];
int32_t const medl = bytes[1];
int32_t const medh = bytes[2];
- int32_t const high = (signed char) (bytes[3]);
+ int32_t const high = (unsigned char) (bytes[3]);
return (high << 24) | (medh << 16) | (medl << 8) | low;
}
}
static int
read_16_bits_high_low(FILE * fp)
{
unsigned char bytes[2] = { 0, 0 };
@@ -183,17 +183,17 @@ static int
read_32_bits_high_low(FILE * fp)
{
unsigned char bytes[4] = { 0, 0, 0, 0 };
fread(bytes, 1, 4, fp);
{
int32_t const low = bytes[3];
int32_t const medl = bytes[2];
int32_t const medh = bytes[1];
- int32_t const high = (signed char) (bytes[0]);
+ int32_t const high = (unsigned char) (bytes[0]);
return (high << 24) | (medh << 16) | (medl << 8) | low;
}
}
static void
write_16_bits_low_high(FILE * fp, int val)
{
unsigned char bytes[2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.