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

Guillaume POIRIER poirierg
Fri Oct 20 16:14:16 CEST 2006


Hi,

On 10/20/06, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Oct 20, 2006 at 03:21:57PM +0200, Guillaume Poirier wrote:
> > Diego Biurrun wrote:
[..]
> > > OK.  My point was just that currently CMOV_IS_FAST is defined when
> > > HAVE_CMOV is defined, so they are equal.  This should be done in
> > > configure.  At least add a FIXME note so this is not forgotten.
> >
> > Yes, I agree. I mainly wanted to split patches to the minimum, and let
> > configure define CMOV_IS_FAST in an upcoming patch.
>
> hmm, what use is it to know that CMOV is supprted but so slow that its not
> useable? or is there any cmov based code which is faster then the alternative
> on P4*

>From a _very_ theoretical perspective, if you have a code does smth like this:


do MANY i = 1, n

if (tes) then
         A(i) = B(i)+C(i)
      elseif (logical expression) then
         A(i) = B(i)-C(i)

10  continue

where 'test' is really random so the branch is always incorrectly predicted
Since there aren't any RAW dependency in that code, instruction
latencies do not matter so much, so you could afford to use P4's cmov.

Off course, such code can also be vectorized and made fast without the
need of cmov at all, but that's just an example.

If I haven't goofed up my example, it should illustrate why supporting
cmov and having a fast implementation are 2 things that aren't 1:1.

Guillaume
-- 
With DADVSI (http://en.wikipedia.org/wiki/DADVSI), France finally has
a lead on USA on selling out individuals right to corporations!
Vive la France!




More information about the ffmpeg-devel mailing list