Merge tag 'pm-4.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[linux/fpc-iii.git] / arch / x86 / include / asm / rmwcc.h
blob661dd305694af8878b8cdcd8b9396b9c7da3b646
1 #ifndef _ASM_X86_RMWcc
2 #define _ASM_X86_RMWcc
4 #if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CC_HAVE_ASM_GOTO)
6 /* Use asm goto */
8 #define __GEN_RMWcc(fullop, var, cc, ...) \
9 do { \
10 asm_volatile_goto (fullop "; j" #cc " %l[cc_label]" \
11 : : "m" (var), ## __VA_ARGS__ \
12 : "memory" : cc_label); \
13 return 0; \
14 cc_label: \
15 return 1; \
16 } while (0)
18 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
19 __GEN_RMWcc(op " " arg0, var, cc)
21 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
22 __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
24 #else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */
26 /* Use flags output or a set instruction */
28 #define __GEN_RMWcc(fullop, var, cc, ...) \
29 do { \
30 bool c; \
31 asm volatile (fullop ";" CC_SET(cc) \
32 : "+m" (var), CC_OUT(cc) (c) \
33 : __VA_ARGS__ : "memory"); \
34 return c; \
35 } while (0)
37 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
38 __GEN_RMWcc(op " " arg0, var, cc)
40 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
41 __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val))
43 #endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */
45 #endif /* _ASM_X86_RMWcc */