From: Christopher Dykes Date: Fri, 1 Jul 2016 01:21:53 +0000 (-0700) Subject: Use asm_volatile_memory() for portable memory barriors in LifoSemTests X-Git-Tag: 2016.07.26~94 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b9d8fba1f5714d3ba7372721dc1aff2d5413e37c;p=folly.git Use asm_volatile_memory() for portable memory barriors in LifoSemTests Summary: The portability headers exist for a reason, so use them. Reviewed By: yfeldblum Differential Revision: D3507031 fbshipit-source-id: f88c8ed37e648d38231c1d923c1d69d551beabff --- diff --git a/folly/test/LifoSemTests.cpp b/folly/test/LifoSemTests.cpp index d06f2e09..09234c9e 100644 --- a/folly/test/LifoSemTests.cpp +++ b/folly/test/LifoSemTests.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -319,7 +320,7 @@ BENCHMARK(single_thread_lifo_post, iters) { LifoSem sem; for (size_t n = 0; n < iters; ++n) { sem.post(); - asm volatile ("":::"memory"); + asm_volatile_memory(); } } @@ -327,7 +328,7 @@ BENCHMARK(single_thread_lifo_wait, iters) { LifoSem sem(iters); for (size_t n = 0; n < iters; ++n) { sem.wait(); - asm volatile ("":::"memory"); + asm_volatile_memory(); } } @@ -335,9 +336,9 @@ BENCHMARK(single_thread_lifo_postwait, iters) { LifoSem sem; for (size_t n = 0; n < iters; ++n) { sem.post(); - asm volatile ("":::"memory"); + asm_volatile_memory(); sem.wait(); - asm volatile ("":::"memory"); + asm_volatile_memory(); } } @@ -345,7 +346,7 @@ BENCHMARK(single_thread_lifo_trywait, iters) { LifoSem sem; for (size_t n = 0; n < iters; ++n) { EXPECT_FALSE(sem.tryWait()); - asm volatile ("":::"memory"); + asm_volatile_memory(); } }