[Ffmpeg-devel] [PATCH] protect cmov asm sections with HAVE_CMOV

Michael Niedermayer michaelni
Fri Oct 20 10:32:38 CEST 2006


Hi

On Fri, Oct 20, 2006 at 10:03:51AM +0200, Diego Biurrun wrote:
> On Fri, Oct 20, 2006 at 09:49:24AM +0200, Guillaume POIRIER wrote:
> > Now that configure script is able to "detect" if CMOV is supported, I
> > guess it's time to use it where appropriate, which is just what this
> > patch is supposed to do.
> > 
> > Note that with this patch, CMOV_IS_FAST == HAVE_CMOV, but since we
> > (can) know (after having done some benchmark) on which CPU CMOV is
> > actually fast (pretty much all of them except netburst processors), we
> > can make configure set CMOV_IS_FAST if HAVE_CMOV==1 && !CMPU=P4 or
> > smth like that.
> > Thoughts?
> 
> Patch looks fine except for
> 
> > --- libavcodec/cabac.h	(revision 6742)
> > +++ libavcodec/cabac.h	(working copy)
> > @@ -32,7 +32,9 @@
> >  #define CABAC_BITS 16
> >  #define CABAC_MASK ((1<<CABAC_BITS)-1)
> >  #define BRANCHLESS_CABAC_DECODER 1
> > +#ifdef HAVE_CMOV
> >  #define CMOV_IS_FAST 1
> > +#endif
> >  //#define ARCH_X86_DISABLED 1
> >  
> > @@ -454,7 +456,7 @@
> >  
> > -#if (defined CMOV_IS_FAST  && __CPU__ >= 686)
> > +#if defined CMOV_IS_FAST
> 
> This is rather silly IMO, I'd say just replace it by HAVE_CMOV.
> Are there benchmarks proving that this really is slower on some
> processors?  Then configue should deal with this as well.

well my docs say
                latency     throughput
CMOV on P4E     9.5 cycles  1/3 per cycle
ADD  on P4E     1   cycle   4   per cycle (not true AFAIK)
CMOV on PM      2   cycles  2/3 per cycle
ADD  on PM      1   cycle   2   per cycle
CMOV on AMD64   1   cycle   3   per cycle
ADD  on AMD64   1   cycle   3   per cycle

so the relative speed of CMOV relative to other instructions differs
alot depending on CPU

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list