aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-18 23:11:55 -0700
committerDamjan Marion <dmarion@me.com>2018-09-24 20:01:10 +0000
commit983cc7da8566fcbe2647ed2d3921e7683bd8d325 (patch)
tree8a6b6f3f55b18c90c542fdcf3577f4452eb62ff8 /src/vppinfra
parent61f702bdd09e569bf9b3ef05d2040de5540fb8db (diff)
svm: march svm_fifo take 2
Change-Id: Ifa4fceef7edbe43d444790a624957db0817064de Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/cpu.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vppinfra/cpu.h b/src/vppinfra/cpu.h
index 110815c9f87..c636cf8639c 100644
--- a/src/vppinfra/cpu.h
+++ b/src/vppinfra/cpu.h
@@ -190,6 +190,35 @@ clib_cpu_march_priority_avx2 ()
#endif
#endif /* included_clib_cpu_h */
+#define CLIB_MARCH_FN_CONSTRUCTOR(fn) \
+static void __clib_constructor \
+CLIB_MARCH_SFX(fn ## _march_constructor) (void) \
+{ \
+ if (CLIB_MARCH_FN_PRIORITY() > fn ## _selected_priority) \
+ { \
+ fn ## _selected = & CLIB_MARCH_SFX (fn ## _ma); \
+ fn ## _selected_priority = CLIB_MARCH_FN_PRIORITY(); \
+ } \
+} \
+
+#ifndef CLIB_MARCH_VARIANT
+#define CLIB_MARCH_FN(fn, rtype, _args...) \
+ static rtype CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (fn ## _ma)(_args); \
+ rtype (*fn ## _selected) (_args) = & CLIB_MARCH_SFX (fn ## _ma); \
+ int fn ## _selected_priority = 0; \
+ static inline rtype CLIB_CPU_OPTIMIZED \
+ CLIB_MARCH_SFX (fn ## _ma)(_args)
+#else
+#define CLIB_MARCH_FN(fn, rtype, _args...) \
+ static rtype CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (fn ## _ma)(_args); \
+ extern int (*fn ## _selected) (_args); \
+ extern int fn ## _selected_priority; \
+ CLIB_MARCH_FN_CONSTRUCTOR (fn) \
+ static rtype CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (fn ## _ma)(_args)
+#endif
+
+#define CLIB_MARCH_FN_SELECT(fn) (* fn ## _selected)
+
format_function_t format_cpu_uarch;
format_function_t format_cpu_model_name;
format_function_t format_cpu_flags;