"Ronald S. Bultje" <[email protected]> writes:
> From: "Ronald S. Bultje" <[email protected]>
>
> ---
> configure | 5 +++++
> libavutil/internal.h | 5 ++++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index a0c37e2..0ec348e 100755
> --- a/configure
> +++ b/configure
> @@ -1094,6 +1094,7 @@ HAVE_LIST="
> ibm_asm
> inet_aton
> inline_asm
> + intrin_h
> io_h
> isatty
> isinf
> @@ -2646,6 +2647,10 @@ check_cc <<EOF && enable inline_asm
> void foo(void) { __asm__ volatile ("" ::); }
> EOF
>
> +if ! enabled inline_asm; then
> +check_header intrin.h
> +fi
Just check it unconditionally.
> _restrict=
> for restrict_keyword in restrict __restrict__ __restrict; do
> check_cc <<EOF && _restrict=$restrict_keyword && break
> diff --git a/libavutil/internal.h b/libavutil/internal.h
> index 41e8a9a..17355d2 100644
> --- a/libavutil/internal.h
> +++ b/libavutil/internal.h
> @@ -231,7 +231,7 @@ struct AVDictionary {
> # define ONLY_IF_THREADS_ENABLED(x) NULL
> #endif
>
> -#if HAVE_MMX
> +#if HAVE_MMX && HAVE_INLINE_ASM
> /**
> * Empty mmx state.
> * this must be called between any dsp function and float/double code.
> @@ -241,6 +241,9 @@ static av_always_inline void emms_c(void)
> {
> __asm__ volatile ("emms" ::: "memory");
> }
> +#elif HAVE_MMX && HAVE_INTRIN_H
> +#include <intrin.h>
> +#define emms_c _mm_empty
> #else /* HAVE_MMX */
> #define emms_c()
> #endif /* HAVE_MMX */
> --
A little whitespace or indentation would do wonders for the readability
of this.
Unfortunately this approach is a bit too greedy. At least one other
compiler (PGI) has an intrin.h header with something completely
different inside. Checking for _mm_empty() in configure would be more
robust.
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel