CCTLib
Calling-context and data-object attribution library for Intel Pin
ins_reuse_simd_loop.c
Go to the documentation of this file.
1 // ins_reuse ISA test: SIMD tight loop.
2 // Two-instruction inline-asm loop with SIMD instructions. Each SIMD op
3 // reuses the same instruction at distance 2, so the reuse histogram
4 // should peak in bin 1 or 2.
5 #include <stdint.h>
6 static volatile uint64_t sink;
7 int main(int argc, char** argv) {
8  (void)argc; (void)argv;
9  uint64_t n = 1000000;
10  __asm__ __volatile__(
11  "vpxor %%ymm0, %%ymm0, %%ymm0\n\t"
12  ".p2align 4\n"
13  "1:\n\t"
14  "vpaddq %%ymm0, %%ymm0, %%ymm0\n\t"
15  "subq $1, %[n]\n\t"
16  "jnz 1b\n\t"
17  : [n] "+r"(n)
18  :
19  : "cc", "ymm0"
20  );
21  sink = n;
22  return 0;
23 }
int main(int argc, char **argv)
static volatile uint64_t sink