[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: jpeg-turbo 6.2 and ppc G3



On Wed, Jul 06, 2016 at 11:25:34AM +0200, Riccardo Mottola wrote:
> Hi,
> 
> 
> Mathieu Malaterre wrote:
> >Well it does not work -yet- at least on ppc32 with gcc 6.1.1:
> >
> >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71777
> >
> >But I would report the bug anyway to libjpegturbo. Riccardo, could you do that?
> 
> reported upstream:
> 
> https://github.com/libjpeg-turbo/libjpeg-turbo/issues/88
> 
> I did not include a patch proposal, since you already say it won't work!

Actually it appears it will, but it requires gcc that was built against
glibc 2.23 which just entered unstable.  Before glibc 2.23, gcc on
powerpc does not supprot those builtins.

I will try to do a patch that does getauxvec of AT_HWCAP directly instead
to get altivec support since that has been supported for a lot longer.

This one works for me:

diff -r -u libjpeg-turbo-1.5.0.orig/simd/jsimd_powerpc.c libjpeg-turbo-1.5.0/simd/jsimd_powerpc.c
--- libjpeg-turbo-1.5.0.orig/simd/jsimd_powerpc.c       2016-06-07 17:33:40.000000000 +0000
+++ libjpeg-turbo-1.5.0/simd/jsimd_powerpc.c    2016-07-06 17:32:53.000000000 +0000
@@ -21,6 +21,7 @@
 #include "../jdct.h"
 #include "../jsimddct.h"
 #include "jsimd.h"
+#include <sys/auxv.h>
 
 static unsigned int simd_support = ~0;
 
@@ -32,7 +33,10 @@
   if (simd_support != ~0U)
     return;
 
-  simd_support = JSIMD_ALTIVEC;
+  if (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC)
+    simd_support = JSIMD_ALTIVEC;
+  else
+    simd_support = 0;
 
   /* Force different settings through environment variables */
   env = getenv("JSIMD_FORCENONE");



It is probably linux only, but I can't find a user space way to detect
this safely, so it might be as good as it gets.

-- 
Len Sorensen


Reply to: