This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Patch to correct extended asm multi-insn examples in extend.texi


This was wrong and seems to be have been deduced empirically
rather than actual knowledge.  I suggest using newline-tab in
these examples, since that's what GCC uses itself, unless much
hair is applied in the port.  I think it is still valid to
mention semicolon since it is commonly used, but also to warn
for it not being universal (or even universal GNU).

Ok to commit?

	* extend.texi (Extended Asm): Do not say that semicolon is always
	a valid line-breaking character for GNU assemblers.  Use
	newline-tab as the most commonly supported syntax.  Use
	newline-tab rather than semicolon in multi-insn examples.

cd ~/egcs/gcc/gcc/
rsh saur -l hp "(cd ~/egcs/gcc/gcc/; cvs diff extend.texi 2>/dev/null)"
Index: extend.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/extend.texi,v
retrieving revision 1.91
diff -c -p -r1.91 extend.texi
*** extend.texi	2001/01/27 21:29:53	1.91
--- extend.texi	2001/02/02 17:33:23
*************** inputs or outputs of the @code{asm}, as 
*** 2959,2975 ****
  not count as a side-effect of the @code{asm}.
  
  You can put multiple assembler instructions together in a single
! @code{asm} template, separated either with newlines (written as
! @samp{\n}) or with semicolons if the assembler allows such semicolons.
! The GNU assembler allows semicolons and most Unix assemblers seem to do
! so.  The input operands are guaranteed not to use any of the clobbered
  registers, and neither will the output operands' addresses, so you can
  read and write the clobbered registers as many times as you like.  Here
  is an example of multiple instructions in a template; it assumes the
  subroutine @code{_foo} accepts arguments in registers 9 and 10:
  
  @example
! asm ("movl %0,r9;movl %1,r10;call _foo"
       : /* no outputs */
       : "g" (from), "g" (to)
       : "r9", "r10");
--- 2959,2978 ----
  not count as a side-effect of the @code{asm}.
  
  You can put multiple assembler instructions together in a single
! @code{asm} template, separated by the characters normally used in assembly
! code for the system.  A combination that works in most places is a newline
! to break the line, plus a tab character to move to the instruction field
! (written as @samp{\n\t}).  Sometimes semicolons can be used, if the
! assembler allows semicolons as a line-breaking character.  Note that some
! assembler dialects use semicolons to start a comment.
! The input operands are guaranteed not to use any of the clobbered
  registers, and neither will the output operands' addresses, so you can
  read and write the clobbered registers as many times as you like.  Here
  is an example of multiple instructions in a template; it assumes the
  subroutine @code{_foo} accepts arguments in registers 9 and 10:
  
  @example
! asm ("movl %0,r9\n\tmovl %1,r10\n\tcall _foo"
       : /* no outputs */
       : "g" (from), "g" (to)
       : "r9", "r10");
*************** instruction, you must include a branch a
*** 2987,2993 ****
  construct, as follows:
  
  @example
! asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
       : "g" (result)
       : "g" (input));
  @end example
--- 2990,2996 ----
  construct, as follows:
  
  @example
! asm ("clr %0\n\tfrob %1\n\tbeq 0f\n\tmov #1,%0\n0:"
       : "g" (result)
       : "g" (input));
  @end example

brgds, H-P


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