------- Comment #2 from pinskia at gmail dot com  2009-03-09 15:57 -------
Subject: Re:  Excessive optimization issue



Sent from my iPhone

On Mar 9, 2009, at 8:36 AM, "rguenth at gcc dot gnu dot org"
<gcc-bugzi...@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #1 from rguenth at gcc dot gnu dot org  2009-03-09  
> 15:36 -------
> You need to specify that the registers are clobbered by the asm.   
> The only
> way to do that is to use output constraints ("+D", "+c", etc.) on  
> proper
> temporaries.
>
>  int lent = len;
>  char *dstt = dst;
>  char *srct = src;
>  __asm__ __volatile__(
>                       "cld\n\t"
>                       "rep movsb"
>                       : "+c" (lent), "+D"(dstt), "+S"(src)
>                      );
> Otherwise GCC thinks the registers still hold the original value.

Oh and mark this inline-ask as clobbering memory.

>
>
>
> -- 
>
> rguenth at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> --- 
> --- 
> ----------------------------------------------------------------------
>             Status|UNCONFIRMED                 |RESOLVED
>         Resolution|                            |INVALID
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39403
>


-- 


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

Reply via email to