Re: [PATCH] arm: Don't require a runtime check function for targets with unconditional NEON
Cosmin Truta <[email protected]> Tue, 11 Oct 2022 15:11:18 +0300
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CAAoVtZy0jaiQgnx-izvC+y5Hhxu9LE-KaDG54ObeDy8KEhNP=A@mail.gmail.com> |
Hello, and thank you for your contribution. There are already other errors
in the existing code in pngpriv.h.
For example, earlier on, PNG_ARM_NEON_OPT is set to 2 exactly under the
conditions that you're mentioning. (See the lines 130-133.) The real bug is
behind the conflict of PNG_ARM_NEON_OPT being equal to 2 on one hand, and
PNG_ARM_NEON_CHECK_SUPPORTED being enabled on the other hand. These two
conflicting conditions should be in fact mutually exclusive.
The same error exists in the hardware optimizations of other processors
also, and it needs to be fixed globally.
I propose introducing a preprocessor assertion, something like this:
#if (PNG_ARM_NEON_OPT > 1) && \
defined(PNG_ARM_NEON_CHECK_SUPPORTED)
#error Assertion failed blah blah blah
#endif
Sincerely,
Cosmin
On Tue, Oct 11, 2022 at 1:39 PM Martin Storsjö <[email protected]> wrote:
> 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)
>
>
>
> _______________________________________________
> png-mng-implement mailing list
> png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/png-mng-implement
>
_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement