Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
benchmark
test
state_assembly_test.cc
Go to the documentation of this file.
1
#include <benchmark/benchmark.h>
2
3
#ifdef __clang__
4
#pragma clang diagnostic ignored "-Wreturn-type"
5
#endif
6
7
// clang-format off
8
extern
"C"
{
9
extern
int
ExternInt
;
10
benchmark::State
&
GetState
();
11
void
Fn
();
12
}
13
// clang-format on
14
15
using
benchmark::State
;
16
17
// CHECK-LABEL: test_for_auto_loop:
18
extern
"C"
int
test_for_auto_loop
() {
19
State
&
S
=
GetState
();
20
int
x
= 42;
21
// CHECK: [[CALL:call(q)*]] _ZN9benchmark5State16StartKeepRunningEv
22
// CHECK-NEXT: testq %rbx, %rbx
23
// CHECK-NEXT: je [[LOOP_END:.*]]
24
25
for
(
auto
_
:
S
) {
26
// CHECK: .L[[LOOP_HEAD:[a-zA-Z0-9_]+]]:
27
// CHECK-GNU-NEXT: subq $1, %rbx
28
// CHECK-CLANG-NEXT: {{(addq \$1, %rax|incq %rax|addq \$-1, %rbx)}}
29
// CHECK-NEXT: jne .L[[LOOP_HEAD]]
30
benchmark::DoNotOptimize
(
x
);
31
}
32
// CHECK: [[LOOP_END]]:
33
// CHECK: [[CALL]] _ZN9benchmark5State17FinishKeepRunningEv
34
35
// CHECK: movl $101, %eax
36
// CHECK: ret
37
return
101;
38
}
39
40
// CHECK-LABEL: test_while_loop:
41
extern
"C"
int
test_while_loop
() {
42
State
&
S
=
GetState
();
43
int
x
= 42;
44
45
// CHECK: j{{(e|mp)}} .L[[LOOP_HEADER:[a-zA-Z0-9_]+]]
46
// CHECK-NEXT: .L[[LOOP_BODY:[a-zA-Z0-9_]+]]:
47
while
(
S
.KeepRunning()) {
48
// CHECK-GNU-NEXT: subq $1, %[[IREG:[a-z]+]]
49
// CHECK-CLANG-NEXT: {{(addq \$-1,|decq)}} %[[IREG:[a-z]+]]
50
// CHECK: movq %[[IREG]], [[DEST:.*]]
51
benchmark::DoNotOptimize
(
x
);
52
}
53
// CHECK-DAG: movq [[DEST]], %[[IREG]]
54
// CHECK-DAG: testq %[[IREG]], %[[IREG]]
55
// CHECK-DAG: jne .L[[LOOP_BODY]]
56
// CHECK-DAG: .L[[LOOP_HEADER]]:
57
58
// CHECK: cmpb $0
59
// CHECK-NEXT: jne .L[[LOOP_END:[a-zA-Z0-9_]+]]
60
// CHECK: [[CALL:call(q)*]] _ZN9benchmark5State16StartKeepRunningEv
61
62
// CHECK: .L[[LOOP_END]]:
63
// CHECK: [[CALL]] _ZN9benchmark5State17FinishKeepRunningEv
64
65
// CHECK: movl $101, %eax
66
// CHECK: ret
67
return
101;
68
}
S
#define S(s)
benchmark::DoNotOptimize
BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const &value)
Definition:
benchmark/include/benchmark/benchmark.h:375
ExternInt
int ExternInt
gmock_output_test._
_
Definition:
bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
GetState
benchmark::State & GetState()
x
int x
Definition:
bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
test_for_auto_loop
int test_for_auto_loop()
Definition:
state_assembly_test.cc:18
benchmark::State
Definition:
benchmark/include/benchmark/benchmark.h:503
test_while_loop
int test_while_loop()
Definition:
state_assembly_test.cc:41
Fn
void Fn()
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:22