From: "H. Peter Anvin" <hpa@zytor.com>
To: Uros Bizjak <ubizjak@gmail.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Subject: Re: [PATCH] x86/local: Remove trailing semicolon from _ASM_XADD in local_add_return()
Date: Sat, 14 Feb 2026 16:54:34 -0800 [thread overview]
Message-ID: <A67AF00B-8B25-4B19-95F3-5A740FDD41C2@zytor.com> (raw)
In-Reply-To: <20260212105207.18510-1-ubizjak@gmail.com>
On February 12, 2026 2:51:02 AM PST, Uros Bizjak <ubizjak@gmail.com> wrote:
>Remove the trailing semicolon from the inline assembly statement in
>local_add_return().
>
>The _ASM_XADD macro already expands to a complete instruction, making
>the extra semicolon unnecessary. More importantly, the stray semicolon
>causes GCC to treat the inline asm as containing multiple instructions,
>which can skew its internal instruction count estimation and affect
>optimization heuristics.
>
>No functional change intended.
>
>Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
>Cc: Thomas Gleixner <tglx@kernel.org>
>Cc: Ingo Molnar <mingo@kernel.org>
>Cc: Borislav Petkov <bp@alien8.de>
>Cc: Dave Hansen <dave.hansen@linux.intel.com>
>Cc: "H. Peter Anvin" <hpa@zytor.com>
>---
> arch/x86/include/asm/local.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
>index 59aa966dc212..4957018fef3e 100644
>--- a/arch/x86/include/asm/local.h
>+++ b/arch/x86/include/asm/local.h
>@@ -106,7 +106,7 @@ static inline bool local_add_negative(long i, local_t *l)
> static inline long local_add_return(long i, local_t *l)
> {
> long __i = i;
>- asm volatile(_ASM_XADD "%0, %1;"
>+ asm volatile(_ASM_XADD "%0, %1"
> : "+r" (i), "+m" (l->a.counter)
> : : "memory");
> return i + __i;
Are you sure that gcc treats an empty statement or line as something that should be counted? It is awkward as heck if so, and really ought to be fixed in gcc.
next prev parent reply other threads:[~2026-02-15 0:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 10:51 Uros Bizjak
2026-02-15 0:54 ` H. Peter Anvin [this message]
2026-02-15 16:43 ` Uros Bizjak
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-all 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=A67AF00B-8B25-4B19-95F3-5A740FDD41C2@zytor.com \
--to=hpa@zytor.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@kernel.org \
--cc=ubizjak@gmail.com \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®