Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1417813
| From | "tip-bot for H. Peter Anvin" <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:x86/asm] x86, asm: define CC_SET() and CC_OUT() macros |
| Date | 2016-06-08 21:50 +0200 |
| Message-ID | <rHREe-4nR-37@gated-at.bofh.it> (permalink) |
| References | <rHRuy-4jK-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: ff3554b409b82d349f71e9d7082648b7b0a1a5bb Gitweb: http://git.kernel.org/tip/ff3554b409b82d349f71e9d7082648b7b0a1a5bb Author: H. Peter Anvin <hpa@zytor.com> AuthorDate: Wed, 8 Jun 2016 12:38:40 -0700 Committer: H. Peter Anvin <hpa@linux.intel.com> CommitDate: Wed, 8 Jun 2016 12:41:20 -0700 x86, asm: define CC_SET() and CC_OUT() macros The CC_SET() and CC_OUT() macros can be used together to take advantage of the new __GCC_ASM_FLAG_OUTPUTS__ feature in gcc 6+ while remaining backwards compatible. CC_SET() generates a SET instruction on older compilers; CC_OUT() makes sure the output is received in the correct variable. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1465414726-197858-5-git-send-email-hpa@linux.intel.com Reviewed-by: Andy Lutomirski <luto@kernel.org> Reviewed-by: Borislav Petkov <bp@suse.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> --- arch/x86/include/asm/asm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index f5063b6..7acb51c 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -42,6 +42,18 @@ #define _ASM_SI __ASM_REG(si) #define _ASM_DI __ASM_REG(di) +/* + * 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) "=@cc" #c +#else +# define CC_SET(c) "\n\tset" #c " %[_cc_" #c "]\n" +# define CC_OUT(c) [_cc_ ## c] "=qm" +#endif + /* Exception table entry */ #ifdef __ASSEMBLY__ # define _ASM_EXTABLE_HANDLE(from, to, handler) \
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/10] x86: use gcc 6+ asm flag output feature "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:40 +0200
[PATCH v2 10/10] x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:40 +0200
[tip:x86/asm] x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h "tip-bot for H. Peter Anvin" <tipbot@zytor.com> - 2016-06-08 22:00 +0200
Re: [PATCH v2 10/10] x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h Borislav Petkov <bp@alien8.de> - 2016-06-09 17:50 +0200
[PATCH v2 04/10] x86, asm: define CC_SET() and CC_OUT() macros "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:40 +0200
[tip:x86/asm] x86, asm: define CC_SET() and CC_OUT() macros "tip-bot for H. Peter Anvin" <tipbot@zytor.com> - 2016-06-08 21:50 +0200
[PATCH v2 06/10] x86, asm: Use CC_SET()/CC_OUT() in <asm/bitops.h> "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:50 +0200
[PATCH v2 02/10] x86, asm: use bool for bitops and other assembly outputs "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:50 +0200
[PATCH v2 08/10] x86, asm: Use CC_SET()/CC_OUT() in <asm/rwsem.h> "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:50 +0200
[PATCH v2 07/10] x86, asm: Use CC_SET()/CC_OUT() in <asm/percpu.h> "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:50 +0200
[PATCH v2 05/10] x86, asm: change GEN_*_RMWcc() to use CC_SET()/CC_OUT() "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:50 +0200
[PATCH v2 03/10] x86, asm: change the GEN_*_RMWcc() macros to not quote the condition "H. Peter Anvin" <hpa@linux.intel.com> - 2016-06-08 21:50 +0200
Re: [PATCH v2 00/10] x86: use gcc 6+ asm flag output feature "H. Peter Anvin" <hpa@zytor.com> - 2016-06-08 23:40 +0200
csiph-web