xref: /openbmc/linux/tools/arch/x86/include/asm/rmwcc.h (revision 11696c5e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_ASM_X86_RMWcc
3 #define _TOOLS_LINUX_ASM_X86_RMWcc
4 
5 #define __GEN_RMWcc(fullop, var, cc, ...)				\
6 do {									\
7 	asm_volatile_goto (fullop "; j" cc " %l[cc_label]"		\
8 			: : "m" (var), ## __VA_ARGS__ 			\
9 			: "memory" : cc_label);				\
10 	return 0;							\
11 cc_label:								\
12 	return 1;							\
13 } while (0)
14 
15 #define GEN_UNARY_RMWcc(op, var, arg0, cc) 				\
16 	__GEN_RMWcc(op " " arg0, var, cc)
17 
18 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc)			\
19 	__GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
20 
21 #endif /* _TOOLS_LINUX_ASM_X86_RMWcc */
22