CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/ext/libpng17/arm/neon.h
Views: 1401
1
/* Compile time options.
2
* =====================
3
* In a multi-arch build the compiler may compile the code several times for the
4
* same object module, producing different binaries for different architectures.
5
* When this happens configure-time setting of the target host options cannot be
6
* done. An example is iOS vs Android compilation of ARM NEON support.
7
*
8
* NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because
9
* this is not possible with certain compilers (Oracle SUN OS CC), as a result
10
* it is necessary to ensure that all extern functions that *might* be used
11
* regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON
12
* below is one example of this behavior because it is controlled by the
13
* presence or not of -mfpu=neon on the GCC command line, it is possible to do
14
* this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely
15
* do this.
16
*/
17
#ifndef PNG_ARM_NEON_OPT
18
/* ARM NEON optimizations are being controlled by the compiler settings,
19
* typically the target FPU. If the FPU supports NEON instructions then the
20
* compiler will define __ARM_NEON and we can rely unconditionally on NEON
21
* instructions not crashing, otherwise we must disable use of NEON
22
* instructions.
23
*
24
* NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
25
* can only be turned on automatically if that is supported too. If
26
* PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
27
* to compile with an appropriate #error if ALIGNED_MEMORY has been turned
28
* off.
29
*
30
* Note that older versions of GCC defined __ARM_NEON__; this is no longer
31
* supported. Also 32-bit ARM versions of GCC required the NEON FPU mode to
32
* be turned on explicitly on the command line. If this is not done (on
33
* 32-bit ARM) NEON code will not be included.
34
*
35
* To disable ARM_NEON optimizations entirely, and skip compiling the
36
* associated assembler code, pass --enable-arm-neon=no to configure
37
* or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS.
38
*/
39
# if defined(__ARM_NEON) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
40
# define PNG_ARM_NEON_OPT 2
41
# else
42
# define PNG_ARM_NEON_OPT 0
43
# endif
44
#endif
45
46
#if PNG_ARM_NEON_OPT > 0
47
/* NEON optimizations are to be at least considered by libpng, so enable the
48
* callbacks to do this.
49
*/
50
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
51
52
/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
53
* if possible - if __ARM_NEON is set and the compiler version is not known
54
* to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
55
* be:
56
*
57
* 1 The intrinsics code (the default with __ARM_NEON)
58
* 2 The hand coded assembler (the default without __ARM_NEON)
59
*
60
* It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
61
* this is *NOT* supported and may cease to work even after a minor revision
62
* to libpng. It *is* valid to do this for testing purposes, e.g. speed
63
* testing or a new compiler, but the results should be communicated to the
64
* libpng implementation list for incorporation in the next minor release.
65
*/
66
# ifndef PNG_ARM_NEON_IMPLEMENTATION
67
# ifdef __ARM_NEON
68
# if defined(__clang__)
69
/* At present it is unknown by the libpng developers which versions
70
* of clang support the intrinsics, however some or perhaps all
71
* versions do not work with the assembler so this may be
72
* irrelevant, so just use the default (do nothing here.)
73
*/
74
# elif defined(__GNUC__)
75
/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
76
* work, so if this *is* GCC, or G++, look for a version >4.5
77
*/
78
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
79
# define PNG_ARM_NEON_IMPLEMENTATION 2
80
# endif /* no GNUC support */
81
# endif /* __GNUC__ */
82
# else /* !defined __ARM_NEON */
83
/* The 'intrinsics' code simply won't compile without compiler support
84
* and that support switches on __ARM_NEON, so use the assembler:
85
*/
86
# define PNG_ARM_NEON_IMPLEMENTATION 2
87
# endif /* __ARM_NEON */
88
# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */
89
90
# ifndef PNG_ARM_NEON_IMPLEMENTATION
91
/* Use the intrinsics code by default. */
92
# define PNG_ARM_NEON_IMPLEMENTATION 1
93
# endif
94
#endif /* PNG_ARM_NEON_OPT > 0 */
95
96
#ifdef PNG_SET_OPTION_SUPPORTED
97
#ifdef PNG_ARM_NEON_API_SUPPORTED
98
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
99
#endif
100
#endif /* SET_OPTION */
101
102
#if PNG_ARM_NEON_OPT > 0
103
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,
104
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
105
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
106
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,
107
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
108
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
109
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_neon,
110
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
111
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
112
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_neon,
113
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
114
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
115
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,
116
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
117
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
118
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,
119
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
120
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
121
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,
122
(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,
123
png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);
124
#endif
125
126