iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support
[linux/fpc-iii.git] / arch / x86 / include / asm / rmwcc.h
blob033dc7ca49e978918f44204a87e711e532193510
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_RMWcc
3 #define _ASM_X86_RMWcc
5 #define __CLOBBERS_MEM(clb...) "memory", ## clb
7 #if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CONFIG_CC_HAS_ASM_GOTO)
9 /* Use asm goto */
11 #define __GEN_RMWcc(fullop, var, cc, clobbers, ...) \
12 do { \
13 asm_volatile_goto (fullop "; j" #cc " %l[cc_label]" \
14 : : [counter] "m" (var), ## __VA_ARGS__ \
15 : clobbers : cc_label); \
16 return 0; \
17 cc_label: \
18 return 1; \
19 } while (0)
21 #define __BINARY_RMWcc_ARG " %1, "
24 #else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CONFIG_CC_HAS_ASM_GOTO) */
26 /* Use flags output or a set instruction */
28 #define __GEN_RMWcc(fullop, var, cc, clobbers, ...) \
29 do { \
30 bool c; \
31 asm volatile (fullop CC_SET(cc) \
32 : [counter] "+m" (var), CC_OUT(cc) (c) \
33 : __VA_ARGS__ : clobbers); \
34 return c; \
35 } while (0)
37 #define __BINARY_RMWcc_ARG " %2, "
39 #endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CONFIG_CC_HAS_ASM_GOTO) */
41 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
42 __GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM())
44 #define GEN_UNARY_SUFFIXED_RMWcc(op, suffix, var, arg0, cc, clobbers...)\
45 __GEN_RMWcc(op " " arg0 "\n\t" suffix, var, cc, \
46 __CLOBBERS_MEM(clobbers))
48 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
49 __GEN_RMWcc(op __BINARY_RMWcc_ARG arg0, var, cc, \
50 __CLOBBERS_MEM(), vcon (val))
52 #define GEN_BINARY_SUFFIXED_RMWcc(op, suffix, var, vcon, val, arg0, cc, \
53 clobbers...) \
54 __GEN_RMWcc(op __BINARY_RMWcc_ARG arg0 "\n\t" suffix, var, cc, \
55 __CLOBBERS_MEM(clobbers), vcon (val))
57 #endif /* _ASM_X86_RMWcc */