From: Andrew Haley <aph@redhat.com>
To: Martin Sustrik <sustrik@imatix.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Should it be reported as a bug? (-O2 and cmpxchg instruction)
Date: Fri, 15 Feb 2008 11:44:00 -0000 [thread overview]
Message-ID: <47B57B04.7070305@redhat.com> (raw)
In-Reply-To: <47B577DD.4080802@imatix.com>
Martin Sustrik wrote:
> Andrew Haley wrote:
>> Please don't top-post.
>>
>> Martin Sustrik wrote:
>>> Andrew,
>>>
>>> Thanks for prompt response. However, I am not sure how to use the
>>> earlyclobber modifier - this is actually the first gcc inline asembly
>>> code I've ever written.
>>>
>>> Do you mean that I should add '&' sign to every operand in input
>>> operand list, or should I add the sign when using the operands or what?
>>
>> Use "=&a" on the first operand.
> Ok, I've modified the code this way:
>
> __asm__ volatile (
> "lock; cmpxchgl %1, %3\n\t"
> "jz 1f\n\t"
> "mov %2, %%eax\n\t"
> "lock; xchgl %%eax, %3\n\t"
> "1:\n\t"
> : "=&a" (oldval)
> : "r" (thenval_), "r" (elseval_), "m" (value), "0" (0)
Ah, maybe I told you wrong: I see that Opernad 0 is also an input. Sorry.
> : "memory", "cc");
>
> However, the generated code is exactly the same as before.
I certainly don't get that. Please post a complete test case, with
assembly output. We also need to know exactly your version of gcc.
Andrew.
next prev parent reply other threads:[~2008-02-15 11:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-15 10:56 Martin Sustrik
2008-02-15 11:00 ` Andrew Haley
2008-02-15 11:21 ` Martin Sustrik
2008-02-15 11:22 ` Andrew Haley
2008-02-15 11:31 ` Martin Sustrik
2008-02-15 11:44 ` Andrew Haley [this message]
2008-02-15 12:05 ` Martin Sustrik
2008-02-15 13:45 ` Andrew Haley
2008-02-15 14:37 ` Martin Sustrik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47B57B04.7070305@redhat.com \
--to=aph@redhat.com \
--cc=gcc-help@gcc.gnu.org \
--cc=sustrik@imatix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).