Linux 4.1.18
[linux/fpc-iii.git] / arch / x86 / include / asm / rmwcc.h
blob8f7866a5b9a41df67475892353979c005ce8c09b
1 #ifndef _ASM_X86_RMWcc
2 #define _ASM_X86_RMWcc
4 #ifdef CC_HAVE_ASM_GOTO
6 #define __GEN_RMWcc(fullop, var, cc, ...) \
7 do { \
8 asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \
9 : : "m" (var), ## __VA_ARGS__ \
10 : "memory" : cc_label); \
11 return 0; \
12 cc_label: \
13 return 1; \
14 } while (0)
16 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
17 __GEN_RMWcc(op " " arg0, var, cc)
19 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
20 __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
22 #else /* !CC_HAVE_ASM_GOTO */
24 #define __GEN_RMWcc(fullop, var, cc, ...) \
25 do { \
26 char c; \
27 asm volatile (fullop "; set" cc " %1" \
28 : "+m" (var), "=qm" (c) \
29 : __VA_ARGS__ : "memory"); \
30 return c != 0; \
31 } while (0)
33 #define GEN_UNARY_RMWcc(op, var, arg0, cc) \
34 __GEN_RMWcc(op " " arg0, var, cc)
36 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
37 __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val))
39 #endif /* CC_HAVE_ASM_GOTO */
41 #endif /* _ASM_X86_RMWcc */