2013-09-11 13:19:24 +00:00
|
|
|
#ifndef _ASM_X86_RMWcc
|
|
|
|
#define _ASM_X86_RMWcc
|
|
|
|
|
|
|
|
#ifdef CC_HAVE_ASM_GOTO
|
|
|
|
|
|
|
|
#define __GEN_RMWcc(fullop, var, cc, ...) \
|
|
|
|
do { \
|
2013-10-10 08:16:30 +00:00
|
|
|
asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \
|
2013-09-11 13:19:24 +00:00
|
|
|
: : "m" (var), ## __VA_ARGS__ \
|
|
|
|
: "memory" : cc_label); \
|
|
|
|
return 0; \
|
|
|
|
cc_label: \
|
|
|
|
return 1; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
|
|
|
|
__GEN_RMWcc(op " " arg0, var, cc)
|
|
|
|
|
2013-12-04 22:31:28 +00:00
|
|
|
#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
|
|
|
|
__GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
|
2013-09-11 13:19:24 +00:00
|
|
|
|
|
|
|
#else /* !CC_HAVE_ASM_GOTO */
|
|
|
|
|
|
|
|
#define __GEN_RMWcc(fullop, var, cc, ...) \
|
|
|
|
do { \
|
|
|
|
char c; \
|
|
|
|
asm volatile (fullop "; set" cc " %1" \
|
|
|
|
: "+m" (var), "=qm" (c) \
|
|
|
|
: __VA_ARGS__ : "memory"); \
|
|
|
|
return c != 0; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
|
|
|
|
__GEN_RMWcc(op " " arg0, var, cc)
|
|
|
|
|
2013-12-04 22:31:28 +00:00
|
|
|
#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
|
|
|
|
__GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val))
|
2013-09-11 13:19:24 +00:00
|
|
|
|
|
|
|
#endif /* CC_HAVE_ASM_GOTO */
|
|
|
|
|
|
|
|
#endif /* _ASM_X86_RMWcc */
|