CCTLib
Calling-context and data-object attribution library for Intel Pin
redspy_partial_qword_then_byte_tp.c
Go to the documentation of this file.
1 // redspy ISA test: partial-overlap redundancy. Write a qword, then write
2 // a byte to the same address with a value that matches the qword's low
3 // byte -- byte 0's value is unchanged (redundant), bytes 1-7 unchanged
4 // too, so the byte write is a redundant single byte.
5 #include <stdint.h>
6 #define WORK_COUNT 20000
7 static volatile uint64_t sink;
8 static uint64_t buf[WORK_COUNT];
9 int main(int argc, char** argv) {
10  (void)argc; (void)argv;
11  for (int i = 0; i < WORK_COUNT; ++i) {
12  uint64_t qval = 0xDEADBEEFCAFEB05AULL; // low byte is 0x5A
13  uint8_t bval = 0x5A; // same as qval's low byte
14  __asm__ __volatile__(
15  "movq %1, (%0)\n\t"
16  "movb %2, (%0)\n\t" // same low byte -- 1 byte of redundancy
17  :
18  : "r"(&buf[i]), "r"(qval), "r"(bval)
19  : "memory");
20  }
21  sink = buf[0];
22  return 0;
23 }
int main(int argc, char **argv)
static uint64_t buf[WORK_COUNT]
static volatile uint64_t sink