[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

@ -1,5 +1,5 @@
Libpng 1.6.7beta04 - October 24, 2013
Libpng 1.6.7beta04 - October 25, 2013
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -80,11 +80,15 @@ Version 1.6.7beta03 [October 19, 2013]
Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
and detect the broken GCC compilers.
Version 1.6.7beta04 [October 24, 2013]
Version 1.6.7beta04 [October 25, 2013]
Allow clang derived from older GCC versions to use ARM intrinsics. This
causes all clang builds that use -mfpu=neon to use the intrinsics code,
not the assembler code. This has only been tested on iOS 7. It may be
necessary to exclude some earlier clang versions but this seems unlikely.
Changed NEON implementation selection mechanism. This allows 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.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4694,11 +4694,15 @@ Version 1.6.7beta03 [October 19, 2013]
Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
and detect the broken GCC compilers.
Version 1.6.7beta04 [October 24, 2013]
Version 1.6.7beta04 [October 25, 2013]
Allow clang derived from older GCC versions to use ARM intrinsics. This
causes all clang builds that use -mfpu=neon to use the intrinsics code,
not the assembler code. This has only been tested on iOS 7. It may be
necessary to exclude some earlier clang versions but this seems unlikely.
Changed NEON implementation selection mechanism. This allows 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.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -25,7 +25,7 @@
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
* for the logic which sets PNG_USE_ARM_NEON_ASM:
*/
#ifdef PNG_USE_ARM_NEON_ASM /* else use arm/filter_neon_intrinsics.c */
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
#ifdef PNG_READ_SUPPORTED
#if PNG_ARM_NEON_OPT > 0
@ -242,4 +242,4 @@ func png_read_filter_row_paeth3_neon, export=1
endfunc
#endif /* PNG_ARM_NEON_OPT > 0 */
#endif /* PNG_READ_SUPPORTED */
#endif /* PNG_USE_ARM_NEON_ASM */
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */

View File

@ -15,7 +15,7 @@
#include "pngpriv.h"
/* This code requires -mfpu=neon on the command line: */
#ifndef PNG_USE_ARM_NEON_ASM /* else use arm/filter_neon.S */
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code */
#include <arm_neon.h>
@ -369,4 +369,4 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
#endif /* PNG_ARM_NEON_OPT > 0 */
#endif /* PNG_READ_SUPPORTED */
#endif /* !PNG_USE_ARM_NEON_ASM */
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */

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