From: DRC Date: Mon, 5 Dec 2016 18:39:49 +0000 (-0600) Subject: Reorg AltiVec detection code X-Git-Tag: 1.5.2~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=786b649331f06687f70ae290227a84663f2a2ca6;p=libjpeg-turbo Reorg AltiVec detection code + advertise that full AltiVec SIMD acceleration is now available on OpenBSD. The relevant compilers probably all support C99 or GNU's variation of C90 that allows variables to be declared anywhere, but our policy is to conform to the C90 standard, if for no other reason than that it improves code readability. --- diff --git a/ChangeLog.md b/ChangeLog.md index 2740c81..182ee3e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -13,8 +13,8 @@ code in libjpeg-turbo from building. version of TJBench from outputting any reference images (the `-nowrite` switch was accidentally enabled by default.) -4. libjpeg-turbo should now build and run on AmigaOS 4 (with full AltiVec -SIMD acceleration.) +4. libjpeg-turbo should now build and run with full AltiVec SIMD acceleration +on PowerPC-based AmigaOS 4 and OpenBSD systems. 1.5.1 diff --git a/simd/jsimd_powerpc.c b/simd/jsimd_powerpc.c index 8fc0547..47dd746 100644 --- a/simd/jsimd_powerpc.c +++ b/simd/jsimd_powerpc.c @@ -112,6 +112,12 @@ init_simd (void) char *env = NULL; #if !defined(__ALTIVEC__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)) int bufsize = 1024; /* an initial guess for the line buffer size limit */ +#elif defined(__amigaos4__) + uint32 altivec = 0; +#elif defined(__OpenBSD__) + int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC }; + int altivec; + size_t len = sizeof(altivec); #endif if (simd_support != ~0U) @@ -128,14 +134,10 @@ init_simd (void) break; } #elif defined(__amigaos4__) - uint32 altivec = 0; IExec->GetCPUInfoTags(GCIT_VectorUnit, &altivec, TAG_DONE); if(altivec == VECTORTYPE_ALTIVEC) simd_support |= JSIMD_ALTIVEC; #elif defined(__OpenBSD__) - int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC }; - int altivec; - size_t len = sizeof(altivec); if (sysctl(mib, 2, &altivec, &len, NULL, 0) == 0 && altivec != 0) simd_support |= JSIMD_ALTIVEC; #endif