[MPlayer-dev-eng] [PATCH] configure cmov detection

Ivan Kalvachev ikalvachev at gmail.com
Sun Oct 15 20:08:28 CEST 2006


2006/10/15, Diego Biurrun <diego at biurrun.de>:
> On Sun, Oct 15, 2006 at 08:36:23PM +0300, Ivan Kalvachev wrote:
> > To let lavcodecs use cmov for cabac decoder (h264), we need to detect
> > it in configure.
> >
> > I followed the _mmx way of detection.
> >
> > I'm not sure what processors besides i686 support cmov, so I wrote
> > K6-2+ , feel free to correct me.
>
> I think you are trying to say "K6-2 or later" by K6-2+, this is not
> correct, K6-2+ is a processor model.  It does not support cmov, though,
> my K6-III+ does not.

I think I overdid the things.

The whole detection could be simple check if the cpu is 686 or newer.
there is alredy code in libavutil that does this and it does use cmov.
e.g. libavutil.h/internal.h:

 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT)
#define COPY3_IF_LT(x,y,a,b,c,d)\
asm volatile (\
    "cmpl %0, %3        \n\t"\
    "cmovl %3, %0       \n\t"\
    "cmovl %4, %1       \n\t"\
    "cmovl %5, %2       \n\t"\
    : "+r" (x), "+r" (a), "+r" (c)\
    : "r" (y), "r" (b), "r" (d)\
);
#else
...

> > I had also disable cmov for runtime-cpu detection as we need to make
> > the code handle it first.
>
> Hmm?  You mean the runtime-cpudetection routines need to be updated
> first?

of course.

> > --- configure (revision 20241)
> > +++ configure (working copy)
> > @@ -1442,6 +1443,7 @@
> >
> >  if test "$_runtime_cpudetection" = yes ; then
> >    if x86; then
> > +    _cmov=no
> >      _mmx=yes
> >      _3dnow=yes
> >      _3dnowext=yes
>
> This should be set to yes.

Absolutely no. If it is set to yes, then all cases would be compiled
with cmov code,
inlined, etc... and it would fail to run on K6.
When the source have runtime detection for that opcode, then maybe...
;)


> > @@ -8307,6 +8319,7 @@
> >  $_def_mmxext // only define if you have MMX2 (Athlon/PIII/4/CelII)
> >  $_def_sse    // only define if you have SSE (Intel Pentium III/4 or Celeron II)
> >  $_def_sse2   // only define if you have SSE2 (Intel Pentium 4)
> > +$_def_cmov   // only define if you have CMOV (K6-2+, i686+)

I'll remove the k6 from the line



More information about the MPlayer-dev-eng mailing list