1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_ASM_X86_RMWcc
3 #define _TOOLS_LINUX_ASM_X86_RMWcc
5 #ifdef CONFIG_CC_HAS_ASM_GOTO
7 #define __GEN_RMWcc(fullop, var, cc, ...) \
9 asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \
10 : : "m" (var), ## __VA_ARGS__ \
11 : "memory" : cc_label); \
17 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
18 __GEN_RMWcc(op " " arg0, var, cc)
20 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
21 __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
23 #else /* !CONFIG_CC_HAS_ASM_GOTO */
25 #define __GEN_RMWcc(fullop, var, cc, ...) \
28 asm volatile (fullop "; set" cc " %1" \
29 : "+m" (var), "=qm" (c) \
30 : __VA_ARGS__ : "memory"); \
34 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
35 __GEN_RMWcc(op " " arg0, var, cc)
37 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
38 __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val))
40 #endif /* CONFIG_CC_HAS_ASM_GOTO */
42 #endif /* _TOOLS_LINUX_ASM_X86_RMWcc */