From db9d96840d7d8e003da0c9d7322fcd3bb0248c74 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Fri, 18 Oct 2013 15:28:00 -0500 Subject: [PATCH] [libpng16] Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h and detect the broken GCC compilers. --- ANNOUNCE | 6 ++++-- CHANGES | 4 +++- arm/filter_neon.S | 7 ++++--- arm/filter_neon_intrinsics.c | 4 ++-- pngpriv.h | 24 ++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 194f875ab..972a97b4d 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.7beta03 - October 17, 2013 +Libpng 1.6.7beta03 - October 18, 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. @@ -72,12 +72,14 @@ Version 1.6.7beta02 [October 12, 2013] Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always removing the 1.14 'compile' script but never checking for it. -Version 1.6.7beta03 [October 17, 2013] +Version 1.6.7beta03 [October 18, 2013] Added ARMv8 support (James Yu ). Added file arm/filter_neon_intrinsics.c; enable with configuration flag PNG_ARM_NEON_INTRINSICS. Revised pngvalid to generate size images with as many filters as it can manage, limited by the number of rows. + Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h + and detect the broken GCC compilers. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index a6e5efbdf..e72da9717 100644 --- a/CHANGES +++ b/CHANGES @@ -4686,12 +4686,14 @@ Version 1.6.7beta02 [October 12, 2013] Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always removing the 1.14 'compile' script but never checking for it. -Version 1.6.7beta03 [October 17, 2013] +Version 1.6.7beta03 [October 18, 2013] Added ARMv8 support (James Yu ). Added file arm/filter_neon_intrinsics.c; enable with configuration flag PNG_ARM_NEON_INTRINSICS. Revised pngvalid to generate size images with as many filters as it can manage, limited by the number of rows. + Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h + and detect the broken GCC compilers. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/arm/filter_neon.S b/arm/filter_neon.S index d77ba59ca..917ea1c52 100644 --- a/arm/filter_neon.S +++ b/arm/filter_neon.S @@ -22,9 +22,10 @@ /* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for * ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it - * only works if -mfpu=neon is specified on the GCC command line. + * 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: */ -#ifndef __ARM_NEON__ /* else use arm/filter_neon_intrinsics.c */ +#ifdef PNG_USE_ARM_NEON_ASM /* else use arm/filter_neon_intrinsics.c */ #ifdef PNG_READ_SUPPORTED #if PNG_ARM_NEON_OPT > 0 @@ -241,4 +242,4 @@ func png_read_filter_row_paeth3_neon, export=1 endfunc #endif /* PNG_ARM_NEON_OPT > 0 */ #endif /* PNG_READ_SUPPORTED */ -#endif /* !__ARM_NEON__ */ +#endif /* PNG_USE_ARM_NEON_ASM */ diff --git a/arm/filter_neon_intrinsics.c b/arm/filter_neon_intrinsics.c index dc93beae7..0754fe671 100644 --- a/arm/filter_neon_intrinsics.c +++ b/arm/filter_neon_intrinsics.c @@ -15,7 +15,7 @@ #include "pngpriv.h" /* This code requires -mfpu=neon on the command line: */ -#ifdef __ARM_NEON__ /* else use arm/filter_neon.S */ +#ifndef PNG_USE_ARM_NEON_ASM /* else use arm/filter_neon.S */ #include @@ -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 /* __ARM_NEON__ */ +#endif /* !PNG_USE_ARM_NEON_ASM */ diff --git a/pngpriv.h b/pngpriv.h index 04b7d6261..44fcf26aa 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -128,6 +128,30 @@ # 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. + */ +# ifndef __ARM_NEON__ + /* The 'intrinsics' code simply won't compile without this -mfpu=neon: */ +# define PNG_USE_ARM_NEON_ASM +# endif +#endif + + /* Put compiler specific checks below: */ +#ifndef PNG_USE_ARM_NEON_ASM +# ifdef __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 +#endif + /* 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 * so PNG_BUILD_DLL must be set.