From: Rosen Penev <rosenp@gmail.com>
To: x86@kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT
AND 64-BIT)),
llvm@lists.linux.dev (open list:CLANG/LLVM BUILD
SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Subject: [PATCH] x86: checksum_32: allow memory/immediate operands in csum_ipv6_magic
Date: Thu, 3 Sep 2026 17:08:33 -0700 [thread overview]
Message-ID: <20260904000833.2058186-1-rosenp@gmail.com> (raw)
Building nf_synproxy_core.c for i386 with LLVM/Clang fails with
"inline assembly requires more registers than available". The
csum_ipv6_magic() inline asm demands five registers at once: an
early-clobber output for sum plus four "r" inputs (saddr, daddr,
htonl(len), htonl(proto)). i386 only has six GPRs, so under register
pressure at inlined call sites Clang cannot satisfy the constraints.
Relax the register-only "r" constraints on the len and proto operands
to "g" (register, memory, or immediate). Since the asm uses adcl,
which accepts memory and immediate sources for these operands, the
generated checksum is unchanged; the compiler can now fold the constants
to immediates/memory and only three hard registers are needed.
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
arch/x86/include/asm/checksum_32.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/checksum_32.h b/arch/x86/include/asm/checksum_32.h
index 17da95387997..f74873a5e351 100644
--- a/arch/x86/include/asm/checksum_32.h
+++ b/arch/x86/include/asm/checksum_32.h
@@ -159,7 +159,7 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
"adcl $0, %0 ;\n"
: "=&r" (sum)
: "r" (saddr), "r" (daddr),
- "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
+ "g" (htonl(len)), "g" (htonl(proto)), "0" (sum)
: "memory");
return csum_fold(sum);
--
2.55.0
reply other threads:[~2026-09-04 0:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260904000833.2058186-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=tglx@kernel.org \
--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®