From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Liming Gao <liming.gao@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>
Subject: [PATCH 5/5] MdePkg/BaseSynchronizationLib GCC: simplify IA32 InternalSyncCompareExchange64()
Date: Sun, 30 Sep 2018 00:23:12 +0200 [thread overview]
Message-ID: <20180929222312.32150-6-lersek@redhat.com> (raw)
In-Reply-To: <20180929222312.32150-1-lersek@redhat.com>
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 <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1208
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
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"
--
2.14.1.3.gb7cf6e02401b
next prev parent reply other threads:[~2018-09-29 22:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-29 22:23 [PATCH 0/5] MdePkg/BaseSynchronizationLib GCC: fixes, cleanups Laszlo Ersek
2018-09-29 22:23 ` [PATCH 1/5] MdePkg/BaseSynchronizationLib GCC: fix whitespace and comments Laszlo Ersek
2018-10-01 10:17 ` Philippe Mathieu-Daudé
2018-10-18 2:00 ` Ni, Ruiyu
2018-09-29 22:23 ` [PATCH 2/5] MdePkg/BaseSynchronizationLib GCC: fix InternalSyncCompareExchange16() Laszlo Ersek
2018-10-01 10:26 ` Philippe Mathieu-Daudé
2018-09-29 22:23 ` [PATCH 3/5] MdePkg/BaseSynchronizationLib GCC: fix InternalSyncCompareExchange32() Laszlo Ersek
2018-10-01 10:26 ` Philippe Mathieu-Daudé
2018-09-29 22:23 ` [PATCH 4/5] MdePkg/BaseSynchronizationLib GCC: fix X64 InternalSyncCompareExchange64() Laszlo Ersek
2018-10-01 10:27 ` Philippe Mathieu-Daudé
2018-09-29 22:23 ` Laszlo Ersek [this message]
2018-10-01 18:27 ` [PATCH 5/5] MdePkg/BaseSynchronizationLib GCC: simplify IA32 InternalSyncCompareExchange64() Philippe Mathieu-Daudé
2018-10-01 18:45 ` Laszlo Ersek
2018-09-29 22:35 ` [PATCH 0/5] MdePkg/BaseSynchronizationLib GCC: fixes, cleanups Laszlo Ersek
2018-10-08 13:44 ` Laszlo Ersek
2018-10-15 18:04 ` Laszlo Ersek
2018-10-15 19:29 ` Kinney, Michael D
2018-10-16 1:32 ` Gao, Liming
2018-10-17 17:16 ` Laszlo Ersek
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-list 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=20180929222312.32150-6-lersek@redhat.com \
--to=devel@edk2.groups.io \
/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