public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* inline assembly help
@ 2000-01-01 12:16 johnnydoeslinux
  2000-04-01  0:00 ` johnnydoeslinux
  0 siblings, 1 reply; 5+ messages in thread
From: johnnydoeslinux @ 2000-01-01 12:16 UTC (permalink / raw)
  To: gcc-help

Does anybody have a better place than the GNU docs for info on
using the
"asm" keyword? I am trying to use the "C expression Operands"
but
between the Gnu docs and looking at code examples(undocumented)
I an
ready to blow out a vein!!

ARRRRRGGGGGHHHH!!!


flobro



----------------------------------------------------------------
Get your free email from AltaVista at http://altavista.iname.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* inline assembly help
  2000-01-01 12:16 inline assembly help johnnydoeslinux
@ 2000-04-01  0:00 ` johnnydoeslinux
  0 siblings, 0 replies; 5+ messages in thread
From: johnnydoeslinux @ 2000-04-01  0:00 UTC (permalink / raw)
  To: gcc-help

Does anybody have a better place than the GNU docs for info on
using the
"asm" keyword? I am trying to use the "C expression Operands"
but
between the Gnu docs and looking at code examples(undocumented)
I an
ready to blow out a vein!!

ARRRRRGGGGGHHHH!!!


flobro



----------------------------------------------------------------
Get your free email from AltaVista at http://altavista.iname.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Inline Assembly Help
  2010-03-17  6:16 Inline Assembly Help Brian O'Mahoney
@ 2010-03-17  6:20 ` Manjunath S M
  0 siblings, 0 replies; 5+ messages in thread
From: Manjunath S M @ 2010-03-17  6:20 UTC (permalink / raw)
  To: gcc-help


Hi Brian,

I would like to tell you that your question has been answered in the GCC 
documentation for inline assembly.

Your first question related to operand numbering,

Operands corresponding to the C expressions are represented by %0, %1 ...
etc.
In the assembler template, each operand is referenced by numbers. 
Numbering is done as follows. If there are a total of n operands (both input
and output inclusive), 
then the first output operand is numbered 0, continuing in increasing order, 
and the last input operand is numbered n-1. 

Now getting back to your question, a single variable may serve as both the
input 
and the output operand.

Such cases may be specified in "asm" by using matching constraints. 
asm ("incl %0" :"=a"(var):"0"(var)); 

For more information on the same kindly refer 
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

Regards
Manjunath S M


Brian O'Mahoney-4 wrote:
> 
> A very simple question, but no-where explicitly documented, when using 
> extended assembly, how are operand numbers ie %n relate to input and
> output 
> constraint-lists ?
> 
> Do they independently count from zero, in each constraint list? What if an 
> operand is in & out put?
> 
> Thanks, Brian
> 
> -- 
> Greetings (mit freundlichen Grüßen), Brian.
> 
> Dr. Brian O'Mahoney Email: omb@teraflex.ch
> 
> 

-- 
View this message in context: http://old.nabble.com/Inline-Assembly-Help-tp27926516p27927993.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Inline Assembly Help
@ 2010-03-17  6:16 Brian O'Mahoney
  2010-03-17  6:20 ` Manjunath S M
  0 siblings, 1 reply; 5+ messages in thread
From: Brian O'Mahoney @ 2010-03-17  6:16 UTC (permalink / raw)
  To: gcc-help

A very simple question, but no-where explicitly documented, when using 
extended assembly, how are operand numbers ie %n relate to input and output 
constraint-lists ?

Do they independently count from zero, in each constraint list? What if an 
operand is in & out put?

Thanks, Brian

-- 
Greetings (mit freundlichen Grüßen), Brian.

Dr. Brian O'Mahoney Email: omb@teraflex.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Inline assembly help
@ 2004-04-18 18:58 James Philbin
  0 siblings, 0 replies; 5+ messages in thread
From: James Philbin @ 2004-04-18 18:58 UTC (permalink / raw)
  To: gcc-help

Hi,

Trying to compile the following inline asm statement:

        asm("fmull %[twopi]\n\t" 		\
	    "fsincos\n\t" 			\
	    "fadd	%%st(0), %%st(0) \n\t" 	\
	    "fxch \n\t"				\
	    "fadd	%%st(0), %%st(0)\n\t"	\
	    "fxch	%%st(2) \n\t" 		\
	    "fld1 \n\t" 			\
	    "fsub	%%st(1), %%st(0) \n\t" 	\
	    "fld	%%st(1) \n\t" 		\
	    "fmul	%%st(1), %%st(0) \n\t" 	\
	    "fsqrt \n\t" 			\
	    "fmul	%%st(0), %%st(3) \n\t" 	\
	    "fmulp	%%st(0), %%st(4) \n\t"	\
	    "fsub	%%st(1), %%st(0) \n\t" 	\
	    "fstpl	%[zt] \n\t" 		\
	    "fstp	%%st(0) \n\t" 		\
	    "fstpl	%[xt] \n\t" 		\
	    "fstpl	%[yt]" 			\
	    :[xt] "=m" (x),			\
	     [yt] "=m" (y),			\
	     [zt] "=m" (z)  			\
	    :[twopi] "F" (2*M_PI), 		\
	     "t" (drand48()), 			\
	     "u" (drand48()));

g++ errors with:

/tmp/cc7QJhi7.s: Assembler messages:
/tmp/cc7QJhi7.s:29: Error: junk `.28318530717958623199593e+0' after
expression
make: *** [light.o] Error 1

The .2831... is obviously the last part of 2*M_PI, so it seems to think
it's a integer imm?

Many thanks,
James

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-17  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-01 12:16 inline assembly help johnnydoeslinux
2000-04-01  0:00 ` johnnydoeslinux
2004-04-18 18:58 Inline " James Philbin
2010-03-17  6:16 Inline Assembly Help Brian O'Mahoney
2010-03-17  6:20 ` Manjunath S M

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).