]> granicus.if.org Git - libjpeg-turbo/commitdiff
Reorg AltiVec detection code
authorDRC <information@libjpeg-turbo.org>
Mon, 5 Dec 2016 18:39:49 +0000 (12:39 -0600)
committerDRC <information@virtualgl.org>
Mon, 5 Dec 2016 19:14:19 +0000 (13:14 -0600)
+ 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.

ChangeLog.md
simd/jsimd_powerpc.c

index 2740c81865aaf39215423461b88b0a758fafd483..182ee3ef72ce9457362cd8b77848999548ffa21f 100644 (file)
@@ -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
index 8fc054780c62a60d55e8fb76c80d697a3e89aad1..47dd746f0dcf39ec3ff5f4268910d1bb43194089 100644 (file)
@@ -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