From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9695 invoked by alias); 15 Feb 2008 11:44:26 -0000 Received: (qmail 9684 invoked by uid 22791); 15 Feb 2008 11:44:25 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Feb 2008 11:44:07 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m1FBi50A028510; Fri, 15 Feb 2008 06:44:05 -0500 Received: from [10.11.14.58] (vpn-14-58.rdu.redhat.com [10.11.14.58]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m1FBi4fs010202; Fri, 15 Feb 2008 06:44:04 -0500 Message-ID: <47B57B04.7070305@redhat.com> Date: Fri, 15 Feb 2008 11:44:00 -0000 From: Andrew Haley User-Agent: Thunderbird 1.5.0.12 (X11/20071019) MIME-Version: 1.0 To: Martin Sustrik CC: gcc-help@gcc.gnu.org Subject: Re: Should it be reported as a bug? (-O2 and cmpxchg instruction) References: <47B56FAA.6040504@imatix.com> <47B5709B.10407@redhat.com> <47B57583.7030206@imatix.com> <47B575EF.3050200@redhat.com> <47B577DD.4080802@imatix.com> In-Reply-To: <47B577DD.4080802@imatix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg00181.txt.bz2 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.