| #include "benchmark/benchmark.h" |
| std::uint64_t double_up(const std::uint64_t x) __attribute__((const)); |
| std::uint64_t double_up(const std::uint64_t x) { return x * 2; } |
| // Using DoNotOptimize on types like BitRef seem to cause a lot of problems |
| // with the inline assembly on both GCC and Clang. |
| static unsigned char arr[2] = {}; |
| BitRef(int i, unsigned char& b) : index(i), byte(b) {} |
| // this test verifies compilation of DoNotOptimize() for some types |
| benchmark::DoNotOptimize(buffer8); |
| benchmark::DoNotOptimize(buffer20); |
| char buffer1024[1024] = ""; |
| benchmark::DoNotOptimize(buffer1024); |
| benchmark::DoNotOptimize(&buffer1024[0]); |
| benchmark::DoNotOptimize(x); |
| benchmark::DoNotOptimize(&x); |
| benchmark::DoNotOptimize(x += 42); |
| benchmark::DoNotOptimize(double_up(x)); |
| benchmark::DoNotOptimize(BitRef::Make()); |
| BitRef lval = BitRef::Make(); |
| benchmark::DoNotOptimize(lval); |