summaryrefslogtreecommitdiff
path: root/benchtests/bench-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'benchtests/bench-util.h')
-rw-r--r--benchtests/bench-util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/benchtests/bench-util.h b/benchtests/bench-util.h
index d0e29423aa..00f78d649f 100644
--- a/benchtests/bench-util.h
+++ b/benchtests/bench-util.h
@@ -16,6 +16,13 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+/* Prevent compiler to optimize away call. */
+#define DO_NOT_OPTIMIZE_OUT(value) \
+ ({ \
+ __typeof (value) __v = (value); \
+ asm volatile ("" : : "r,m" (__v) : "memory"); \
+ __v; \
+ })
#ifndef START_ITER
# define START_ITER (100000000)