[PATCH] arm: Don't require a runtime check function for targets with unconditional NEON

Martin Storsjö <[email protected]> Tue, 11 Oct 2022 13:38:05 +0300
Newsgroups gmane.comp.graphics.png.devel
Message-ID <[email protected]>
If the compiler is set up to unconditionally use NEON instructions
anywhere, we don't need any function for runtime detection.

This fixes building for non-Linux OSes with unconditionally
available NEON, such as iOS and Windows.
---
 pngpriv.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pngpriv.h b/pngpriv.h
index 2e426cf47..2f033bae8 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -171,6 +171,12 @@
 #              define PNG_ARM_NEON_IMPLEMENTATION 2
 #           endif /* no GNUC support */
 #        endif /* __GNUC__ */
+
+         /* If __ARM_NEON__ or __ARM_NEON is defined, the compiler is free to
+          * use NEON anywhere in generated code, and thus, no runtime check
+          * is needed. */
+#        undef PNG_ARM_NEON_CHECK_SUPPORTED
+
 #     else /* !defined __ARM_NEON__ */
          /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
           */
-- 
2.37.0 (Apple Git-136)