CCTLib
Calling-context and data-object attribution library for Intel Pin
deadspy_movnti_tp.c
Go to the documentation of this file.
1 // Deadspy ISA edge case: non-temporal MOVNTI store.
2 // Non-temporal stores bypass the cache hierarchy but are still WRITES
3 // from the ISA's perspective. Deadspy should track them the same as any
4 // other store. Two back-to-back MOVNTI to the same address makes the
5 // first dead.
6 #include <stdint.h>
7 #define WORK_COUNT 10000
8 static volatile uint64_t sink;
9 static uint64_t buf[WORK_COUNT] __attribute__((aligned(16)));
10 int main(int argc, char** argv) {
11  (void)argc; (void)argv;
12  for (int i = 0; i < WORK_COUNT; ++i) {
13  uint64_t v1 = 0x1234, v2 = 0x5678;
14  __asm__ __volatile__(
15  "movnti %[v1], (%[p])\n\t"
16  "movnti %[v2], (%[p])\n\t" // dead
17  "sfence\n\t" // required after MOVNT to enforce order
18  :
19  : [p] "r"(&buf[i]), [v1] "r"(v1), [v2] "r"(v2)
20  : "memory");
21  }
22  sink = buf[0];
23  return 0;
24 }
#define WORK_COUNT
int main(int argc, char **argv)
static volatile uint64_t sink
static uint64_t buf[WORK_COUNT] __attribute__((aligned(16)))
static uint64_t buf[ITERS]