public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: Re: [PATCH 1/5] MdePkg/BaseSynchronizationLib GCC: fix whitespace and comments
Date: Mon, 1 Oct 2018 12:17:41 +0200	[thread overview]
Message-ID: <7fb47836-f8dc-b9dc-923d-8e4d2ec1f7fb@redhat.com> (raw)
In-Reply-To: <20180929222312.32150-2-lersek@redhat.com>

On 30/09/2018 00:23, Laszlo Ersek wrote:
> The "GccInline.c" files have some inconsistent whitespace, and missing (or
> incorrect) operand comments. Fix and unify them.
> 
> This patch doesn't change behavior.
> 
> 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>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c | 35 ++++++-------
>  MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c  | 53 +++++++++-----------
>  2 files changed, 39 insertions(+), 49 deletions(-)
> 
> diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
> index fa2be7f4b35c..1976720ac636 100644
> --- a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
> +++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
> @@ -39,7 +39,7 @@ InternalSyncIncrement (
>      "movl    $1, %%eax  \n\t"
>      "lock               \n\t"
>      "xadd    %%eax, %1  \n\t"
> -    "inc     %%eax          "
> +    "inc     %%eax      \n\t"
>      : "=a" (Result),          // %0
>        "+m" (*Value)           // %1
>      :                         // no inputs that aren't also outputs
> @@ -48,7 +48,6 @@ InternalSyncIncrement (
>      );
>  
>    return Result;
> -
>  }
>  
>  
> @@ -76,10 +75,10 @@ InternalSyncDecrement (
>      "movl    $-1, %%eax  \n\t"
>      "lock                \n\t"
>      "xadd    %%eax, %1   \n\t"
> -    "dec     %%eax                  "
> -    : "=a" (Result),          // %0
> -      "+m" (*Value)           // %1
> -    :                         // no inputs that aren't also outputs
> +    "dec     %%eax       \n\t"
> +    : "=a" (Result),           // %0
> +      "+m" (*Value)            // %1
> +    :                          // no inputs that aren't also outputs
>      : "memory",
>        "cc"
>      );
> @@ -87,6 +86,7 @@ InternalSyncDecrement (
>    return Result;
>  }
>  
> +
>  /**
>    Performs an atomic compare exchange operation on a 16-bit unsigned integer.
>  
> @@ -113,15 +113,13 @@ InternalSyncCompareExchange16 (
>    IN      UINT16                    ExchangeValue
>    )
>  {
> -
>    __asm__ __volatile__ (
> -    "                     \n\t"
>      "lock                 \n\t"
>      "cmpxchgw    %1, %2   \n\t"
> -    : "=a" (CompareValue)
> -    : "q"  (ExchangeValue),
> -      "m"  (*Value),
> -      "0"  (CompareValue)
> +    : "=a" (CompareValue)       // %0
> +    : "q"  (ExchangeValue),     // %1
> +      "m"  (*Value),            // %2
> +      "0"  (CompareValue)       // %3
>      : "memory",
>        "cc"
>      );
> @@ -129,6 +127,7 @@ InternalSyncCompareExchange16 (
>    return CompareValue;
>  }
>  
> +
>  /**
>    Performs an atomic compare exchange operation on a 32-bit unsigned integer.
>  
> @@ -155,15 +154,13 @@ InternalSyncCompareExchange32 (
>    IN      UINT32                    ExchangeValue
>    )
>  {
> -
>    __asm__ __volatile__ (
> -    "                     \n\t"
>      "lock                 \n\t"
>      "cmpxchgl    %1, %2   \n\t"
> -    : "=a" (CompareValue)     // %0
> -    : "q"  (ExchangeValue),   // %1
> -      "m"  (*Value),          // %2
> -      "0"  (CompareValue)     // %4
> +    : "=a" (CompareValue)       // %0
> +    : "q"  (ExchangeValue),     // %1
> +      "m"  (*Value),            // %2
> +      "0"  (CompareValue)       // %3
>      : "memory",
>        "cc"
>      );
> @@ -171,6 +168,7 @@ InternalSyncCompareExchange32 (
>    return CompareValue;
>  }
>  
> +
>  /**
>    Performs an atomic compare exchange operation on a 64-bit unsigned integer.
>  
> @@ -197,7 +195,6 @@ InternalSyncCompareExchange64 (
>    )
>  {
>    __asm__ __volatile__ (
> -    "                       \n\t"
>      "push        %%ebx      \n\t"
>      "movl        %2,%%ebx   \n\t"
>      "lock                   \n\t"
> diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
> index ab7efe23c4db..0212798d7a27 100644
> --- a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
> +++ b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
> @@ -39,7 +39,7 @@ InternalSyncIncrement (
>      "movl    $1, %%eax  \n\t"
>      "lock               \n\t"
>      "xadd    %%eax, %1  \n\t"
> -    "inc     %%eax          "
> +    "inc     %%eax      \n\t"
>      : "=a" (Result),          // %0
>        "+m" (*Value)           // %1
>      :                         // no inputs that aren't also outputs
> @@ -75,10 +75,10 @@ InternalSyncDecrement (
>      "movl    $-1, %%eax  \n\t"
>      "lock                \n\t"
>      "xadd    %%eax, %1   \n\t"
> -    "dec     %%eax                  "
> -    : "=a" (Result),          // %0
> -      "+m" (*Value)           // %1
> -    :                         // no inputs that aren't also outputs
> +    "dec     %%eax       \n\t"
> +    : "=a" (Result),           // %0
> +      "+m" (*Value)            // %1
> +    :                          // no inputs that aren't also outputs
>      : "memory",
>        "cc"
>      );
> @@ -113,16 +113,14 @@ InternalSyncCompareExchange16 (
>    IN      UINT16                    ExchangeValue
>    )
>  {
> -
> -
>    __asm__ __volatile__ (
>      "lock                 \n\t"
> -    "cmpxchgw    %3, %1       "
> -    : "=a" (CompareValue),
> -      "=m" (*Value)
> -    : "a"  (CompareValue),
> -      "r"  (ExchangeValue),
> -      "m"  (*Value)
> +    "cmpxchgw    %3, %1   \n\t"
> +    : "=a" (CompareValue),      // %0
> +      "=m" (*Value)             // %1
> +    : "a"  (CompareValue),      // %2
> +      "r"  (ExchangeValue),     // %3
> +      "m"  (*Value)             // %4
>      : "memory",
>        "cc"
>      );
> @@ -157,16 +155,14 @@ InternalSyncCompareExchange32 (
>    IN      UINT32                    ExchangeValue
>    )
>  {
> -
> -
>    __asm__ __volatile__ (
>      "lock                 \n\t"
> -    "cmpxchgl    %3, %1       "
> -    : "=a" (CompareValue),    // %0
> -      "=m" (*Value)           // %1
> -    : "a"  (CompareValue),    // %2
> -      "r"  (ExchangeValue),   // %3
> -      "m"  (*Value)
> +    "cmpxchgl    %3, %1   \n\t"
> +    : "=a" (CompareValue),      // %0
> +      "=m" (*Value)             // %1
> +    : "a"  (CompareValue),      // %2
> +      "r"  (ExchangeValue),     // %3
> +      "m"  (*Value)             // %4
>      : "memory",
>        "cc"
>      );
> @@ -200,20 +196,17 @@ InternalSyncCompareExchange64 (
>    IN      UINT64                    ExchangeValue
>    )
>  {
> -
>    __asm__ __volatile__ (
>      "lock                 \n\t"
> -    "cmpxchgq    %3, %1       "
> -    : "=a" (CompareValue),    // %0
> -      "=m" (*Value)           // %1
> -    : "a"  (CompareValue),    // %2
> -      "r"  (ExchangeValue),   // %3
> -      "m"  (*Value)
> +    "cmpxchgq    %3, %1   \n\t"
> +    : "=a" (CompareValue),      // %0
> +      "=m" (*Value)             // %1
> +    : "a"  (CompareValue),      // %2
> +      "r"  (ExchangeValue),     // %3
> +      "m"  (*Value)             // %4
>      : "memory",
>        "cc"
>      );
>  
>    return CompareValue;
>  }
> -
> -
> 


  reply	other threads:[~2018-10-01 10:17 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é [this message]
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 ` [PATCH 5/5] MdePkg/BaseSynchronizationLib GCC: simplify IA32 InternalSyncCompareExchange64() Laszlo Ersek
2018-10-01 18:27   ` 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=7fb47836-f8dc-b9dc-923d-8e4d2ec1f7fb@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