Re: Assembly question

From: Gabriel Paubert (paubert@iram.es)
Date: Fri Apr 26 2002 - 06:37:46 EST


Mark Zealey wrote:

> On Thu, Apr 25, 2002 at 10:32:25AM +0200, Szekeres Istvan wrote:
>
>
>> void p_memset_dword( void *d, int b, int l ) { __asm__ ("rep\n\t"
"stosl\n\t"
>>

>> : : "D" (d), "a" (b), "c" (l) : "memory","edi", "eax", "ecx"
>>
>
> An input or output operand is implicitly clobbered, so it should be
      ^^^^^
I had expected gcc specialists to jump on that one: if you don't
explicitly tell gcc that an input is clobbered, it may reuse it later if
it needs the same value. So the clobbers are necessary...

Your statement about output operands is also incorrect, since clobbered
means that the register has an unknown value, which can not be used for
_anything_, while outputs are results from the statement and they'll
likely be used later (if none of the outputs is ever used and the asm
statement is not marked volatile, gcc will not even bother to emit it).

        Regards,
        Gabriel.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 30 2002 - 22:00:12 EST