mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 23:45:26 +07:00
da6d856751
Uses the arch/x86/ kernel code for x86_64/i386, fallbacking to a gcc intrinsics implementation that has been tested in at least sparc64. Will be used for reference counting in tools/perf. Acked-by: David Ahern <dsahern@gmail.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-knfpjowhgyh6x4z0kfuk389j@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
#ifndef _TOOLS_LINUX_ASM_X86_RMWcc
|
|
#define _TOOLS_LINUX_ASM_X86_RMWcc
|
|
|
|
#ifdef CC_HAVE_ASM_GOTO
|
|
|
|
#define __GEN_RMWcc(fullop, var, cc, ...) \
|
|
do { \
|
|
asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \
|
|
: : "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)
|
|
|
|
#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
|
|
__GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
|
|
|
|
#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)
|
|
|
|
#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
|
|
__GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val))
|
|
|
|
#endif /* CC_HAVE_ASM_GOTO */
|
|
|
|
#endif /* _TOOLS_LINUX_ASM_X86_RMWcc */
|