From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C82BA21962301 for ; Mon, 1 Oct 2018 11:45:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 403C73084295; Mon, 1 Oct 2018 18:45:12 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-123-68.rdu2.redhat.com [10.10.123.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 552436CA38; Mon, 1 Oct 2018 18:45:08 +0000 (UTC) To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , edk2-devel-01 Cc: Michael D Kinney , Liming Gao References: <20180929222312.32150-1-lersek@redhat.com> <20180929222312.32150-6-lersek@redhat.com> <79dd02b5-ced7-264f-365d-25222af0f3f0@redhat.com> From: Laszlo Ersek Message-ID: Date: Mon, 1 Oct 2018 20:45:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <79dd02b5-ced7-264f-365d-25222af0f3f0@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 01 Oct 2018 18:45:12 +0000 (UTC) Subject: Re: [PATCH 5/5] MdePkg/BaseSynchronizationLib GCC: simplify IA32 InternalSyncCompareExchange64() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2018 18:45:13 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 10/01/18 20:27, Philippe Mathieu-Daudé wrote: > On 30/09/2018 00:23, Laszlo Ersek wrote: >> The IA32 variant of InternalSyncCompareExchange64() is correct, but we can >> simplify it. We don't need to load the lower 32 bits of ExchangeValue into >> EBX in two steps (first into a general register, then into EBX); we can >> ask GCC to populate EBX like that itself. >> >> Cc: Liming Gao >> Cc: Michael D Kinney >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1208 >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Laszlo Ersek > > Reviewed-by: Philippe Mathieu-Daudé > >> --- >> MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c >> index 44188e265af2..af39bdeb516c 100644 >> --- a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c >> +++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c >> @@ -193,14 +193,11 @@ InternalSyncCompareExchange64 ( >> ) >> { >> __asm__ __volatile__ ( >> - "push %%ebx \n\t" >> - "movl %2,%%ebx \n\t" >> "lock \n\t" >> "cmpxchg8b (%1) \n\t" >> - "pop %%ebx \n\t" >> : "+A" (CompareValue) // %0 >> : "S" (Value), // %1 >> - "r" ((UINT32) ExchangeValue), // %2 >> + "b" ((UINT32) ExchangeValue), // %2 >> "c" ((UINT32) (ExchangeValue >> 32)) // %3 >> : "memory", >> "cc" >> Thank you for the review! Laszlo