delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/11/23:48:35

Date: Thu, 12 Jun 1997 15:50:22 -0700
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: Inline asm
To: Calin Andrian <candrian AT pcnet DOT pcnet DOT ro>
Cc: djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <33A07D2D.D22@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <16 AT candrian DOT pcnet DOT ro>

Calin Andrian wrote:
> 
> mlsoftware AT aol DOT com (Mlsoftware) wrote:
> >
> >#define quad_memcpy(src, dest, numwords) \
> >__asm__ __volatile__ ( \
> >  "cld\n\t" \
> >  "rep\n\t" \
> >  "movsl" \
> >  : : "S" (src), "D" (dest), "c" (numwords) \
> >  : "%ecx", "%esi", "%edi" )
> 
> Here comes the question: Isn't this inline redundant ? The docs say
> that you have to specify what _unknown_to_the_compiler_ registers
> you clobber. In the above inline, all "clobbered" registers are,
> in fact, input registers - so the compiler should know they change.
> 
> Can anybody state this for sure ? (I did use similar inlines for
> rep/insw and rep/outsw and they seem to work without specifying any
> clobbered registers.)

Yeah, I can (from experience).  GCC does NOT know they are clobbered
exectly BECAUSE they are input registers. If they were output register,
that would be another matter.  I had some weird bugs due to making the
same assumption as you.

Bill
-- 
Leave others their otherness.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019