[vlc-devel] [RFC] [PATCH] ARM: detect VFP floating point unit

Måns Rullgård mans at mansr.com
Wed Jan 25 17:22:27 CET 2012


Rémi Denis-Courmont <remi at remlab.net> writes:

> This sets HAVE_FPU correctly on ARM targets if VFP instructions are
> enabled. Note that __VFP_FP__ implies the use of the VFP floating point
> format, not the availability of the VFP instructions. Thus software
> floating emulation __SOFTFP__ (i.e. -mfloat-abi=softfp) is excluded
> explicitly.

-mfloat-abi=soft is what defines __SOFTFP__.  The patch is correct, the
 comment above is not.

> Alternatively, HAVE_FPU could be set only when the VFP Procedure
> Calling Standard __ARM_VFP_PCS is enabled (i.e. -mfloat-abi=hard).

That would be a bad idea.  Besides -mfloat-abi=softfp still being the
most widely used, only a few recent gcc versions define __ARM_VFP_PCS.

> ---
>  include/vlc_cpu.h |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h
> index 63cc978..28b67d7 100644
> --- a/include/vlc_cpu.h
> +++ b/include/vlc_cpu.h
> @@ -91,7 +91,12 @@ VLC_API unsigned vlc_CPU( void );
>  #  define HAVE_FPU 1
>
>  # elif defined (__arm__)
> -#  define HAVE_FPU 0 /* revisit later? */
> +#  if defined (__VFP_FP__) && !defined (__SOFTFP__)
> +                           // defined (__ARM_PCS_VFP)

That comment is confusing.

> +#   define HAVE_FPU 1
> +#  else
> +#   define HAVE_FPU 0
> +#  endif
>
>  # elif defined (__sparc__)
>  #  define HAVE_FPU 1
> -- 
> 1.7.8.3
>

-- 
Måns Rullgård
mans at mansr.com




More information about the vlc-devel mailing list