From nobody Wed Dec 17 20:41:30 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A5682066C2 for ; Fri, 14 Mar 2025 21:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741988517; cv=none; b=qChsBf3JPlQ61ntGk6dkDgcSImyGMN2DHIICyg3p5AyoBu2DKffLjdS82ZcEQ9SwOehQ1Ik0hkc9PUClHfCsFRCTr5ldxG1yS5RlROqhwdDpaZAxMkqACYyPGGO2Ugr9kkPnb37Wpffup4jWDnK4u0CIA0saxexb/xIki5fkWpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741988517; c=relaxed/simple; bh=9bFRJxqvYNWVyNVhYDN2ROid6vXuKvJ2yw7P62LLCcA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xr3p0p5UfFf5fc/XWQymvhS9bigsYCESq9zaeHal3PNf1qu70uCc/RKApOJoX9DpG8KSFpURelwcoNPhCQBa0vOs5NWEeDcB4wi2vsMybpGfkn/Ia5lle08B/GL3NtfRMKBP3GpYW3hHIPdwg//bnF+tsXNmzakVXH+LYMiybtg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kUp7OH/3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kUp7OH/3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F30C4CEF7; Fri, 14 Mar 2025 21:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741988516; bh=9bFRJxqvYNWVyNVhYDN2ROid6vXuKvJ2yw7P62LLCcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUp7OH/39b6sNPnYwE4gpkcHGGW9Tfhh3jWiBFOG61hF8PW+liIFkZhRjq9Hucrz7 RjS+4ZISBZz6JtGxpobwJNxhthALCDeZv3k3TPbY9JGieRsmcYh6MVC5x0DZUssbJV ww1N/lOughfmuevn48V/bTXyVty27fdbaCl08mdns23bRAvbdLDbQAf7jXprcltNLI RiSMi1dYR6mhqgoXGLHVGZ5LYSGgiwp/FYTFN5K2DkStrBZKAfb6TA/tlpEMYjVgZD PLRT19y/k+QzgTDexDuKQR71Ua8NgPVKMYmcLk5z1EJjJBIkh6FUs6PEP1FLkQZady yeYOXE9veAnvg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Peter Zijlstra , Borislav Petkov , "H. Peter Anvin" , Uros Bizjak , Andrew Cooper , Ingo Molnar Subject: [PATCH 05/20] x86/asm: Always use flag output operands Date: Fri, 14 Mar 2025 14:41:18 -0700 Message-ID: <9bd607a5a8b79f1349f09b4e92270aeb8acd6b43.1741988314.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On x86, __GCC_ASM_FLAG_OUTPUTS__ is supported starting with GCC 6.0 and Clang 9. Now that the GCC minimum version on x86 has been bumped to 8.1 with the following commit: commit a3e8fe814ad1 ("x86/build: Raise the minimum GCC version to 8.1") the flag output operand support can be assumed everywhere. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/asm.h | 9 ++------- arch/x86/include/asm/rmwcc.h | 22 ---------------------- tools/arch/x86/include/asm/asm.h | 5 ----- tools/perf/bench/find-bit-bench.c | 4 ---- 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 975ae7a9397e..fdebd4356860 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -131,13 +131,8 @@ static __always_inline __pure void *rip_rel_ptr(void *= p) * Macros to generate condition code outputs from inline assembly, * The output operand must be type "bool". */ -#ifdef __GCC_ASM_FLAG_OUTPUTS__ -# define CC_SET(c) "\n\t/* output condition code " #c "*/\n" -# define CC_OUT(c) "=3D@cc" #c -#else -# define CC_SET(c) "\n\tset" #c " %[_cc_" #c "]\n" -# define CC_OUT(c) [_cc_ ## c] "=3Dqm" -#endif +#define CC_SET(c) "\n\t/* output condition code " #c "*/\n" +#define CC_OUT(c) "=3D@cc" #c =20 #ifdef __KERNEL__ =20 diff --git a/arch/x86/include/asm/rmwcc.h b/arch/x86/include/asm/rmwcc.h index 363266cbcada..a54303e3dfa1 100644 --- a/arch/x86/include/asm/rmwcc.h +++ b/arch/x86/include/asm/rmwcc.h @@ -6,26 +6,6 @@ =20 #define __CLOBBERS_MEM(clb...) "memory", ## clb =20 -#ifndef __GCC_ASM_FLAG_OUTPUTS__ - -/* Use asm goto */ - -#define __GEN_RMWcc(fullop, _var, cc, clobbers, ...) \ -({ \ - bool c =3D false; \ - asm goto (fullop "; j" #cc " %l[cc_label]" \ - : : [var] "m" (_var), ## __VA_ARGS__ \ - : clobbers : cc_label); \ - if (0) { \ -cc_label: c =3D true; \ - } \ - c; \ -}) - -#else /* defined(__GCC_ASM_FLAG_OUTPUTS__) */ - -/* Use flags output or a set instruction */ - #define __GEN_RMWcc(fullop, _var, cc, clobbers, ...) \ ({ \ bool c; \ @@ -35,8 +15,6 @@ cc_label: c =3D true; \ c; \ }) =20 -#endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) */ - #define GEN_UNARY_RMWcc_4(op, var, cc, arg0) \ __GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM()) =20 diff --git a/tools/arch/x86/include/asm/asm.h b/tools/arch/x86/include/asm/= asm.h index 3ad3da9a7d97..f66cf34f6197 100644 --- a/tools/arch/x86/include/asm/asm.h +++ b/tools/arch/x86/include/asm/asm.h @@ -112,13 +112,8 @@ * Macros to generate condition code outputs from inline assembly, * The output operand must be type "bool". */ -#ifdef __GCC_ASM_FLAG_OUTPUTS__ # define CC_SET(c) "\n\t/* output condition code " #c "*/\n" # define CC_OUT(c) "=3D@cc" #c -#else -# define CC_SET(c) "\n\tset" #c " %[_cc_" #c "]\n" -# define CC_OUT(c) [_cc_ ## c] "=3Dqm" -#endif =20 #ifdef __KERNEL__ =20 diff --git a/tools/perf/bench/find-bit-bench.c b/tools/perf/bench/find-bit-= bench.c index 7e25b0e413f6..99d36dff9d86 100644 --- a/tools/perf/bench/find-bit-bench.c +++ b/tools/perf/bench/find-bit-bench.c @@ -37,7 +37,6 @@ static noinline void workload(int val) accumulator++; } =20 -#if (defined(__i386__) || defined(__x86_64__)) && defined(__GCC_ASM_FLAG_O= UTPUTS__) static bool asm_test_bit(long nr, const unsigned long *addr) { bool oldbit; @@ -48,9 +47,6 @@ static bool asm_test_bit(long nr, const unsigned long *ad= dr) =20 return oldbit; } -#else -#define asm_test_bit test_bit -#endif =20 static int do_for_each_set_bit(unsigned int num_bits) { --=20 2.48.1