1 #include <benchmark/benchmark.h>
4 #pragma clang diagnostic ignored "-Wreturn-type"
10 extern int ExternInt2
;
11 extern int ExternInt3
;
14 // CHECK-LABEL: test_basic:
15 extern "C" void test_basic() {
17 benchmark::DoNotOptimize(&x
);
19 benchmark::ClobberMemory();
20 // CHECK: leaq [[DEST:[^,]+]], %rax
21 // CHECK: movl $101, [[DEST]]
25 // CHECK-LABEL: test_redundant_store:
26 extern "C" void test_redundant_store() {
28 benchmark::ClobberMemory();
30 // CHECK-DAG: ExternInt
35 // CHECK-LABEL: test_redundant_read:
36 extern "C" void test_redundant_read() {
38 benchmark::DoNotOptimize(&x
);
40 benchmark::ClobberMemory();
42 // CHECK: leaq [[DEST:[^,]+]], %rax
43 // CHECK: ExternInt(%rip)
44 // CHECK: movl %eax, [[DEST]]
45 // CHECK-NOT: ExternInt2
49 // CHECK-LABEL: test_redundant_read2:
50 extern "C" void test_redundant_read2() {
52 benchmark::DoNotOptimize(&x
);
54 benchmark::ClobberMemory();
56 benchmark::ClobberMemory();
57 // CHECK: leaq [[DEST:[^,]+]], %rax
58 // CHECK: ExternInt(%rip)
59 // CHECK: movl %eax, [[DEST]]
60 // CHECK: ExternInt2(%rip)
61 // CHECK: movl %eax, [[DEST]]