This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: asm ("...") on PPC


   Date: Fri, 25 Feb 2000 10:22:49 +0100 (CET)
   From: Geir Frode Raanes <geirfrs@invalid.ed.ntnu.no>

   asm volatile ("mtctr %3          \n"  /* crt = linjeteller */
		 "\tsubi %0,0,4     \n"  /* ioptr--  */
		 "\tsubi %1,0,4     \n"  /* memptr-- */
		 "10:\tlwzu 9,4(%0) \n"  /* get source [++ioptr] */
		 "\tstwu 9,4(%1)    \n"  /* store target [++memptr] */
		 "\tbdnz+ 10b         "  /* loop until crt == 0 */
		 : "=b" (ioptr), "=b" (memptr)
		 :  "0" (ioptr),  "1" (memptr), "r" (linjeteller)
		 : "r9", "ctr" );

   Here of cause I took the register naming convention suggested by
   Ian Lance Taylor to heart. Though GAS does understand "r9" and
   "ctr" in the 'affected' field. Besides, Windriver use "rX"  for
   register names exclusively in their BSP.

The `affected' field is interpreted by gcc, not by gas.  The whole asm
construct is interpreted by gcc.  gas only sees the string after gcc
performs substitutions on it and writes it to the assembler file.

   But what is the difference between the "b" - base address register,
   and "r" - general register argument restrictions for PowerPC?

`b' does not permit register 0, since most PowerPC instructions which
use register 0 as a base register use the constant 0 rather than the
actual contents of the register.  Register 0 is otherwise a normal
register.

Ian

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]