Skip to content

Commit

Permalink
Reorg AltiVec detection code
Browse files Browse the repository at this point in the history
+ 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.
  • Loading branch information
dcommander committed Dec 5, 2016
1 parent f4ba09b commit 786b649
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions simd/jsimd_powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 786b649

Please sign in to comment.