[libpng16] Changed NEON implementation selection mechanism to allow assembler

or intrinsics to be turned on during the build by defining
PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1).  The
default is "undefined" and the build type is selected in pngpriv.h.
This commit is contained in:
John Bowler
2013-10-25 16:11:57 -05:00
committed by Glenn Randers-Pehrson
parent bb9adfdad9
commit fd8bba4b80
5 changed files with 53 additions and 32 deletions

View File

@@ -126,36 +126,49 @@
* callbacks to do this.
*/
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
#endif
#ifndef PNG_USE_ARM_NEON_ASM
/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
* if possible - if __ARM_NEON__ is set and the compiler version is not known
* to be broken. ASM code can be forced by -DPNG_USE_ARM_NEON_ASM on the
* command line.
* to be broken. This is control by PNG_ARM_NEON_IMPLEMENTATION which can
* be:
*
* 1 The intrinsics code (the default with __ARM_NEON__)
* 2 The hand coded assembler (the default without __ARM_NEON__)
*
* It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
* this is *NOT* supported and may cease to work even after a minor revision
* to libpng. It *is* valid to do this for testing purposes, e.g. speed
* testing or a new compiler, but the results should be communicated to the
* libpng implementation list for incorporation in the next minor release.
*/
# ifndef __ARM_NEON__
/* The 'intrinsics' code simply won't compile without this -mfpu=neon: */
# define PNG_USE_ARM_NEON_ASM
# endif
#endif
# ifndef PNG_ARM_NEON_IMPLEMENTATION
# ifdef __ARM_NEON__
# if defined(__clang__)
/* At present it is unknown by the libpng developers which versions
* of clang support the intrinsics, however some or perhaps all
* versions do not work with the assembler so this may be
* irrelevant, so just use the default (do nothing here.)
*/
# elif defined(__GNUC__)
/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
* work, so if this *is* GCC, or G++, look for a version >4.5
*/
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
# define PNG_ARM_NEON_IMPLEMENTATION 2
# endif /* no GNUC support */
# endif /* __GNUC__ */
# else /* !__ARM_NEON__ */
/* The 'intrinsics' code simply won't compile without this -mfpu=neon:
*/
# define PNG_ARM_NEON_IMPLEMENTATION 2
# endif /* !__ARM_NEON */
# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */
/* Put compiler specific checks below: */
#ifndef PNG_USE_ARM_NEON_ASM
# if defined(__clang__)
/* At present it is unknown by the libpng developers which versions of
* clang support the intrinsics, however some or perhaps all versions
* do not work with the assembler so this may be irrelevant.
*/
# elif defined(__GNUC__)
/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to work,
* so if this *is* GCC, or G++, look for a version >4.5
*/
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
# define PNG_USE_ARM_NEON_ASM
# endif
# endif /* __GNUC__ */
#endif
# ifndef PNG_ARM_NEON_IMPLEMENTATION
/* Use the intrinsics code by default. */
# define PNG_ARM_NEON_IMPLEMENTATION 1
# endif
#endif /* PNG_ARM_NEON_OPT > 0 */
/* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If