From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.221.65; helo=mail-wr1-f65.google.com; envelope-from=philmd@redhat.com; receiver=edk2-devel@lists.01.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CF84A2116122B for ; Mon, 1 Oct 2018 11:27:55 -0700 (PDT) Received: by mail-wr1-f65.google.com with SMTP id y8-v6so15072985wrh.7 for ; Mon, 01 Oct 2018 11:27:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bOrihKN00WCmF9G1uSP3nqvo6tubWsDuAMKrhTHTcYs=; b=ZtaAAFPE4bwnpyzh/x/EDIYCg0AeDfWLM1WTulBxIbBEr+2yb/FB1TcuNFG84uHFRO OGX7MD06gU5l3TS4dcTdTep+rIrex15vVKMLOcVuzbGDixHyO6BSRRxGh1xTo4kSkeSU sKAR5jP8IQwykriBK86b0b9l6uHehZjwIlLTAoLARgAmF+WegONHNMqFLJHmC7+8RWhO bewD+ckkkVSaxdZ+7G7B8JQfCzmYisVvy6uKfOx6MxPs8O1Ql8Js9ujcHXJ3b9P7w68V eiedUbxdgQ+egt1BDpr3b3xJazx8ZLI8rijqFK8T7OY4f4UR8PFeaNqqHALSoX9BMF0w cTUQ== X-Gm-Message-State: ABuFfoj27vFtHbxK/+BQztif1gEEjR5kOF72C/m7xinw50qDw++NKM0U t2ePmmq+Ekhtu7wp6/kLSLmnxA== X-Google-Smtp-Source: ACcGV60QdRyaqVqWd178yMJY+o3h/D0sHQn1NFEJAzL4IHOnLNlLDUnglJ9Hot1PoSppQ23DvZKQhw== X-Received: by 2002:adf:8919:: with SMTP id s25-v6mr7994756wrs.89.1538418474061; Mon, 01 Oct 2018 11:27:54 -0700 (PDT) Received: from [192.168.2.71] ([80.31.72.241]) by smtp.gmail.com with ESMTPSA id b74-v6sm17680752wma.8.2018.10.01.11.27.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 11:27:53 -0700 (PDT) To: Laszlo Ersek , edk2-devel-01 Cc: Michael D Kinney , Liming Gao References: <20180929222312.32150-1-lersek@redhat.com> <20180929222312.32150-6-lersek@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <79dd02b5-ced7-264f-365d-25222af0f3f0@redhat.com> Date: Mon, 1 Oct 2018 20:27:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180929222312.32150-6-lersek@redhat.com> 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:27:56 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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" >