[FFmpeg-devel] [PATCH] Fix compilation on clang 2.8, which doesn't support 3dnow inline asm.

Janne Grunau janne-ffmpeg
Fri Feb 11 19:53:30 CET 2011


On Fri, Feb 11, 2011 at 01:40:12PM -0500, Ronald S. Bultje wrote:
> ---
>  configure                       |    7 ++++---
>  libavcodec/x86/cavsdsp_mmx.c    |    4 ++++
>  libavcodec/x86/dsputil_mmx.c    |   39 ++++++++++++++++++++++++++++++++-------
>  libavcodec/x86/dsputilenc_mmx.c |    4 ++++
>  libavcodec/x86/fmtconvert_mmx.c |   10 ++++++++++
>  libavcodec/x86/h264_qpel_mmx.c  |    2 ++
>  libswscale/rgb2rgb.c            |    4 ++++
>  7 files changed, 60 insertions(+), 10 deletions(-)
> 
> diff --git a/configure b/configure
> index a3ca15d..7703c80 100755
> --- a/configure
> +++ b/configure
> @@ -2649,9 +2649,10 @@ int main(void) {
>  }
>  EOF
>  
> -    # check whether binutils is new enough to compile SSSE3/MMX2
> -    enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
> -    enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
> +    # check whether binutils is new enough to compile SSSE3/MMX2/3dnow

if you change this line please s/is new enough to compile/supports/

> +    enabled ssse3    && check_asm ssse3    '"pabsw  %xmm0, %xmm0"'
> +    enabled mmx2     && check_asm mmx2     '"pmaxub  %mm0, %mm1"'
> +    enabled amd3dnow && check_asm amd3dnow '"pavgusb %mm0, %mm1"'
>  
>      check_asm bswap '"bswap %%eax" ::: "%eax"'
>  
> diff --git a/libavcodec/x86/cavsdsp_mmx.c b/libavcodec/x86/cavsdsp_mmx.c
> index 0f5fdaa..e17d18c 100644
> --- a/libavcodec/x86/cavsdsp_mmx.c
> +++ b/libavcodec/x86/cavsdsp_mmx.c
> @@ -425,8 +425,10 @@ static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, ui
>  "pavgb " #temp ", " #a "          \n\t"\
>  "mov" #size " " #a ", " #b "      \n\t"
>  
> +#if HAVE_AMD3DNOW
>  QPEL_CAVS(put_,       PUT_OP, 3dnow)
>  QPEL_CAVS(avg_, AVG_3DNOW_OP, 3dnow)
> +#endif
>  QPEL_CAVS(put_,       PUT_OP, mmx2)
>  QPEL_CAVS(avg_,  AVG_MMX2_OP, mmx2)
>  
> @@ -476,5 +478,7 @@ void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx)
>      int mm_flags = av_get_cpu_flags();
>  
>      if (mm_flags & AV_CPU_FLAG_MMX2)  ff_cavsdsp_init_mmx2 (c, avctx);
> +#if HAVE_AMD3DNOW
>      if (mm_flags & AV_CPU_FLAG_3DNOW) ff_cavsdsp_init_3dnow(c, avctx);
> +#endif

would it be cleaner if we don't set AV_CPU_FLAG_3DNOW in mm_flags if
no can't compile code for it?

Janne



More information about the ffmpeg-devel mailing list