public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* inline assembler question
@ 2005-05-18  7:31 gumbold
  2005-05-18 14:35 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: gumbold @ 2005-05-18  7:31 UTC (permalink / raw)
  To: gcc-help

Hi

please tell me what it means:
#define MBARRIER() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" ::: 
"memory")
#define UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")

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

* Re: inline assembler question
  2005-05-18  7:31 inline assembler question gumbold
@ 2005-05-18 14:35 ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2005-05-18 14:35 UTC (permalink / raw)
  To: gumbold; +Cc: gcc-help

gumbold <gumbold@bonbon.net> writes:

> please tell me what it means:
> #define MBARRIER() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" :::
> "memory")
> #define UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")

This is where the asm statement is documented:
    http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Extended-Asm.html

If you have a more specific question, ask it.

Ian

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

* Re: inline assembler question
  2001-04-10  5:55 Michael Sänger
@ 2001-04-10 14:22 ` Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2001-04-10 14:22 UTC (permalink / raw)
  To: Michael Sänger; +Cc: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

On Apr 10, 2001, Michael Sänger <michael@vulpine.de> wrote:

> int function(int arg);
> {
> __asm__(" movl arg,%eax ");
> }

> doesn't work because the arg symbol isn't parsed as variable to the asm
> ...

You should read about extended asms in the GCC manual.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* inline assembler question
@ 2001-04-10  5:55 Michael Sänger
  2001-04-10 14:22 ` Alexandre Oliva
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Sänger @ 2001-04-10  5:55 UTC (permalink / raw)
  To: gcc-help

hi there!

courrently I'm workin with gcc using inlineasm instructions for SSE and
MMX.
But there are some things i'd like to know (since i'm new to gcc i
apologize herby for newbee-questions :)

first of all, where is the arg stored?

example:
int function(int arg);
{
__asm__(" movl arg,%eax ");
}

doesn't work because the arg symbol isn't parsed as variable to the asm
...


how to tell in sse the operand-size assumption like the 'quadword ptr'
or 'xmmword ptr' in intel syntax?

example:(in itel-syntax)

float function(float *arg)
{
 __asm mov eax, dword ptr arg
 __asm movups xmm1, xmmword ptr [eax]
}

how wold this function look in gcc?


are operand and operator in the same or oppostie order than in intel
syntax?

how does the asm behave when you have mnemonics with 3 args ?
(like 'shufps' for example...)

Regards,
michael saenger

P.S. I'd be thankful for any help, or even a link to a website(but it
must be a SSE/MMX specific one :)

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

end of thread, other threads:[~2005-05-18 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-18  7:31 inline assembler question gumbold
2005-05-18 14:35 ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2001-04-10  5:55 Michael Sänger
2001-04-10 14:22 ` Alexandre Oliva

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).