Re: [FFmpeg-devel] [PATCH 2/2] Don't use CMOV in MMX code

2014-09-15 Thread Calvin Walton
On Fri, 2014-09-12 at 14:53 -0700, Daniel Kang wrote:
> > 
> > >All processors supporing mmx2 also support cmov, so if a test for 
> > mmx2
> succeeds, we can use cmov.
> 
> Since I originally thought mmx => cmov (and apparently am wrong) is 
> there
> official documentation supporting this?
> 

As an example, here's the /proc/cpuinfo contents for my AMD K6 box. 
You'll note that on the flags line it does have 'mmx', but does not 
have 'cmov'. (It also doesn't have 3dnow; that was introduced in later 
chips in the K6 series.)

I'm actually looking into getting FATE running on this box right now, 
we'll see how that goes.

processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 5
model   : 7
model name  : AMD-K6tm w/ multimedia extensions
stepping: 0
cpu MHz : 266.603
cache size  : 64 KB
fdiv_bug: no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 1
wp  : yes
flags   : fpu vme de pse tsc msr cx8 mmx
bogomips: 533.42
clflush size: 32
cache_alignment : 32
address sizes   : 32 bits physical, 32 bits virtual
power management:

-- 
Calvin Walton 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Don't use CMOV in MMX code

2014-09-13 Thread Mikulas Patocka


On Fri, 12 Sep 2014, Daniel Kang wrote:

> > All processors supporing mmx2 also support cmov, so if a test for mmx2 
> > succeeds, we can use cmov.
> Since I originally thought mmx => cmov (and apparently am wrong) is there 
> official documentation supporting this?

There is no official documentation, it is just a historical fact.

MMX2 was introduced in Pentium 3 (it already has CMOV) and in Athlon (it 
also has CMOV).

Mikulas___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Don't use CMOV in MMX code

2014-09-12 Thread Hendrik Leppkes
On Fri, Sep 12, 2014 at 11:53 PM, Daniel Kang 
wrote:
>>All processors supporing mmx2 also support cmov, so if a test for mmx2
> succeeds, we can use cmov.
>
> Since I originally thought mmx => cmov (and apparently am wrong) is there
> official documentation supporting this?

CMOV was introduced in the P6 architecture, which is Pentium Pro, or i686.
MMX came before in P5 already ("Pentium with MMX Technology")
Its probably in Intel's Software Developer’s Manual  somewhere, but I
couldn't find it on a moments notice, only the instruction sets like
MMX/SSE/... are listed very prominently.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Don't use CMOV in MMX code

2014-09-12 Thread Daniel Kang
>All processors supporing mmx2 also support cmov, so if a test for mmx2
succeeds, we can use cmov.

Since I originally thought mmx => cmov (and apparently am wrong) is there
official documentation supporting this?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Don't use CMOV in MMX code

2014-09-12 Thread James Almer
On 12/09/14 4:50 PM, Mikulas Patocka wrote:
> There are MMX processors that don't support CMOV (pentium-mmx, amd-k6, cyrix
> 6x86). Therefore, we must not use cmov in in MMX code.
> 
> All processors supporing mmx2 also support cmov, so if a test for mmx2 
> succeeds,
> we can use cmov.
> 
> ---
>  libavcodec/x86/h264_idct.asm |6 ++
>  1 file changed, 6 insertions(+)
> 
> Index: ffmpeg/libavcodec/x86/h264_idct.asm
> ===
> --- ffmpeg.orig/libavcodec/x86/h264_idct.asm  2014-08-25 03:59:06.376569389 
> +0200
> +++ ffmpeg/libavcodec/x86/h264_idct.asm   2014-08-25 18:47:46.988574579 
> +0200
> @@ -1063,7 +1063,13 @@ cglobal h264_luma_dc_dequant_idct, 3, 4,
>  addt3d, 128 << 16
>  movt1d, 7
>  cmpt0d, t1d
> +%if cpuflag(mmx2)
>  cmovg  t0d, t1d
> +%else
> +jng  .skip_mov
> +movt0d, t1d
> +.skip_mov:
> +%endif
>  inct1d
>  shrt3d, t0b
>  subt1d, t0d

This is not necessary. The check for cmov-enabled CPUs is done in 
h264dsp_init.c 
so this function is not being used on CPUs like the ones you mentioned.

If anything, you could add a second mmx version for said CPUs, but i really 
doubt 
it's worth the increased binary size.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] Don't use CMOV in MMX code

2014-09-12 Thread Mikulas Patocka
There are MMX processors that don't support CMOV (pentium-mmx, amd-k6, cyrix
6x86). Therefore, we must not use cmov in in MMX code.

All processors supporing mmx2 also support cmov, so if a test for mmx2 succeeds,
we can use cmov.

---
 libavcodec/x86/h264_idct.asm |6 ++
 1 file changed, 6 insertions(+)

Index: ffmpeg/libavcodec/x86/h264_idct.asm
===
--- ffmpeg.orig/libavcodec/x86/h264_idct.asm2014-08-25 03:59:06.376569389 
+0200
+++ ffmpeg/libavcodec/x86/h264_idct.asm 2014-08-25 18:47:46.988574579 +0200
@@ -1063,7 +1063,13 @@ cglobal h264_luma_dc_dequant_idct, 3, 4,
 addt3d, 128 << 16
 movt1d, 7
 cmpt0d, t1d
+%if cpuflag(mmx2)
 cmovg  t0d, t1d
+%else
+jng.skip_mov
+movt0d, t1d
+.skip_mov:
+%endif
 inct1d
 shrt3d, t0b
 subt1d, t0d

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel