diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-06-08 15:38:40 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2016-06-08 15:41:20 -0400 |
commit | ff3554b409b82d349f71e9d7082648b7b0a1a5bb (patch) | |
tree | bf0166f5e2be0455efb82ba62c1532baa6e41555 | |
parent | 18fe58229d80c7f4f138a07e84ba608e1ebd232b (diff) |
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>
-rw-r--r-- | arch/x86/include/asm/asm.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index f5063b6659eb..7acb51c49fec 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h | |||
@@ -42,6 +42,18 @@ | |||
42 | #define _ASM_SI __ASM_REG(si) | 42 | #define _ASM_SI __ASM_REG(si) |
43 | #define _ASM_DI __ASM_REG(di) | 43 | #define _ASM_DI __ASM_REG(di) |
44 | 44 | ||
45 | /* | ||
46 | * Macros to generate condition code outputs from inline assembly, | ||
47 | * The output operand must be type "bool". | ||
48 | */ | ||
49 | #ifdef __GCC_ASM_FLAG_OUTPUTS__ | ||
50 | # define CC_SET(c) "\n\t/* output condition code " #c "*/\n" | ||
51 | # define CC_OUT(c) "=@cc" #c | ||
52 | #else | ||
53 | # define CC_SET(c) "\n\tset" #c " %[_cc_" #c "]\n" | ||
54 | # define CC_OUT(c) [_cc_ ## c] "=qm" | ||
55 | #endif | ||
56 | |||
45 | /* Exception table entry */ | 57 | /* Exception table entry */ |
46 | #ifdef __ASSEMBLY__ | 58 | #ifdef __ASSEMBLY__ |
47 | # define _ASM_EXTABLE_HANDLE(from, to, handler) \ | 59 | # define _ASM_EXTABLE_HANDLE(from, to, handler) \ |