[MPlayer-dev-eng] [PATCH] 'Warning: missing operand; zero assumed' fixes

Trent Piepho xyzzy at speakeasy.org
Fri Jan 26 23:56:27 CET 2007


On Fri, 26 Jan 2007, Dmitry Antipov wrote:
> This patch tries to fix all warning messages like the following
> (note {standard input} due to '-pipe'):
>
> {standard input}: Assembler messages:
> {standard input}:13: Warning: missing operand; zero assumed
>
> With as from binutils 2.17.50 and gcc 4.1.1, the only code where
> this takes place is mp3lib/dct64_MMX.c; Intel C reports a few more.

-        : "=m"(*tmp0)
-        : "r"(pix-3*stride), "r"(pix), "r"((long)stride),
+        :: "r"(tmp0), "r"(pix-3*stride), "r"(pix), "r"((long)stride),
           "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1),
           "m"(mm_bone)
+       : "memory"

This results in slower asm code.  Adding the "memory" clobber removes all
kinds of optimizations.  It also requires another register, and there is
plenty of asm code in lavc that is one register away from not compiling.
If you have code like this:

void foo(...)
{
   int x;
   asm("..." : "=m"(x));    /* one */
   asm("..." : : "=r"(&x)); /* two*/
}

The code in "one" can use an address like 4(%esp) that doesn't need any
extra registers.  The code in "two" would require gcc to emit
"lea 4(%esp),%eax" or equivalent and then use %eax as the register.

A better solution for this function would be to change the output operands
to "=m"(tmp0[0]), "=m"(tmp0[1])

Then in the asm code, %0 stays %0 and 8+%0 will change to %1.  gcc is smart
enough to use the same registers for %0 and %1.

All your changes look like this have this problem.  If you change
"=m"(stack_variable) to "=r"(&stack_variable) you use an extra register.



More information about the MPlayer-dev-eng mailing list