------- Comment #1 from jakub at gcc dot gnu dot org  2009-04-03 08:11 -------
User error, if you don't tell gcc that %edi is clobbered, obviously it can
assume it hasn't.
As rep stosl modifies both %ecx and %edi, you can write e.g.:
int tmp1, tmp2;
asm volatile("xor %%eax,%%eax\n\trep stosl" : "=c" (tmp1), "=D" (tmp2) : "0"
(count), "1" (dst) : "%eax", "cc", "memory");
or:
asm volatile("xor %%eax,%%eax\n\trep stosl" : "+c" (count), "+D" (dst) : :
"%eax", "cc", "memory");
if you don't mind that the count and dst variables will change.
Also note that __builtin_memset (dst, '\0', count); will in most cases
result in more optimal code for your CPU, hardcoding these in assembly is
usually a bad idea.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39620

Reply via email to