[MPlayer-dev-eng] Why cpuid so complex?
Guillaume POIRIER
poirierg at gmail.com
Sun Apr 23 09:24:03 CEST 2006
Hi,
On 4/23/06, Zuxy Meng <zuxy.meng at gmail.com> wrote:
> Hi,
>
> MPlayer always uses cpuid in a ways like this:
>
> __asm __volatile
> ("mov %%"REG_b", %%"REG_S"\n\t"
> "cpuid\n\t"
> "xchg %%"REG_b", %%"REG_S
> : "=a" (p[0]), "=S" (p[1]),
> "=c" (p[2]), "=d" (p[3])
> : "0" (ax));
> Or
>
> asm("push %%ebx; "
> "movl %4,%%eax; " CPUID
> "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3; "
> "pop %%ebx"
> : "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
> : "g" (func)
> : "%eax", "%ecx", "%edx");
>
> Why not the much simpler way, e.g.
>
> __asm __volatile(
> "cpuid;"
> : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3])
> : "0" (ax)
> );
>
> Saving ebx by hand sometimes breaks in icc and gcc -O, and what
> problem would the last way cause?
icc supports inline ASM? I didn't know, but it's good news! Anyway,
the way current asm is written clearly shows that the author didn't
know what to expect from inline asm (IMHO).
Guillaume
--
I am disillusioned enough to know that no man's opinion on any subject
is worth a damn unless backed up with enough genuine information to
make him really know what he's talking about.
-- H. P. Lovecraft (about the flamewars on FFmpeg and MPlayer-dev mailing lists)
http://www.brainyquote.com/quotes/quotes/h/hplovecr278144.html
More information about the MPlayer-dev-eng
mailing list