CCTLib
Calling-context and data-object attribution library for Intel Pin
footprint_small.c
Go to the documentation of this file.
1
// Footprint victim: SMALL footprint. Load from the SAME 8-byte address
2
// many times. Total instructions high, but unique addresses touched: 1.
3
//
4
// Inline asm so the compiler cannot lift the load out of the loop --
5
// each `movq (%rax), %rax` reads memory anew every iteration.
6
#include <stdint.h>
7
8
static
volatile
uint64_t
sink
;
9
static
uint64_t
buf
[8];
10
11
int
main
(
int
argc,
char
** argv) {
12
(void)argc; (void)argv;
13
buf
[0] = 0xDEADBEEF;
14
volatile
uint64_t* p = &
buf
[0];
15
uint64_t acc = 0;
16
17
for
(
int
i = 0; i < 100000; ++i) {
18
uint64_t v;
19
__asm__ __volatile__ (
"movq (%1), %0"
:
"=r"
(v) :
"r"
(p) :
"memory"
);
20
acc += v;
21
}
22
sink
= acc;
23
return
0;
24
}
main
int main(int argc, char **argv)
Definition:
footprint_small.c:11
buf
static uint64_t buf[8]
Definition:
footprint_small.c:9
sink
static volatile uint64_t sink
Definition:
footprint_small.c:8
tests
gtest
apps
footprint_small.c
Generated on Wed Jul 15 2026 04:51:30 for CCTLib by
1.9.1