CCTLib
Calling-context and data-object attribution library for Intel Pin
deadspy_addressing_tp.c
Go to the documentation of this file.
1 // deadspy ISA test: various addressing modes for the killer store.
2 // Verifies deadspy attributes correctly regardless of how the memory
3 // operand is encoded (indexed, [reg+idx*8+disp]).
4 #include <stdint.h>
5 #define WORK_COUNT 20000
6 static volatile uint64_t sink;
7 static uint64_t buf[WORK_COUNT + 32];
8 int main(int argc, char** argv) {
9  (void)argc; (void)argv;
10  for (int i = 0; i < WORK_COUNT; ++i) {
11  uint64_t idx = (uint64_t)i;
12  uint64_t v1 = 0x1, v2 = 0x2;
13  __asm__ __volatile__(
14  "movq %2, (%0, %1, 8)\n\t" // [reg+idx*8] -- first 8B write
15  "movq %3, 0(%0, %1, 8)\n\t" // [reg+idx*8+disp8=0] -- same addr, dead
16  :
17  : "r"(buf), "r"(idx), "r"(v1), "r"(v2)
18  : "memory");
19  }
20  sink = buf[0];
21  return 0;
22 }
static uint64_t buf[WORK_COUNT+32]
#define WORK_COUNT
int main(int argc, char **argv)
static volatile uint64_t sink