1 #include <benchmark/benchmark.h>
4 #pragma clang diagnostic ignored "-Wreturn-type"
10 extern int ExternInt2
;
11 extern int ExternInt3
;
15 // CHECK-LABEL: test_basic:
16 extern "C" void test_basic() {
18 benchmark::DoNotOptimize(&x
);
20 benchmark::ClobberMemory();
21 // CHECK: leaq [[DEST:[^,]+]], %rax
22 // CHECK: movl $101, [[DEST]]
26 // CHECK-LABEL: test_redundant_store:
27 extern "C" void test_redundant_store() {
29 benchmark::ClobberMemory();
31 // CHECK-DAG: ExternInt
36 // CHECK-LABEL: test_redundant_read:
37 extern "C" void test_redundant_read() {
39 benchmark::DoNotOptimize(&x
);
41 benchmark::ClobberMemory();
43 // CHECK: leaq [[DEST:[^,]+]], %rax
44 // CHECK: ExternInt(%rip)
45 // CHECK: movl %eax, [[DEST]]
46 // CHECK-NOT: ExternInt2
50 // CHECK-LABEL: test_redundant_read2:
51 extern "C" void test_redundant_read2() {
53 benchmark::DoNotOptimize(&x
);
55 benchmark::ClobberMemory();
57 benchmark::ClobberMemory();
58 // CHECK: leaq [[DEST:[^,]+]], %rax
59 // CHECK: ExternInt(%rip)
60 // CHECK: movl %eax, [[DEST]]
61 // CHECK: ExternInt2(%rip)
62 // CHECK: movl %eax, [[DEST]]