aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/prefetchi-1.c
blob: 03dfdc55e86c9d97bd1ef4b111326f9ca758cfd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-mprefetchi -O2" } */
/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+bar\\(%rip\\)" 2 } } */
/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+bar\\(%rip\\)" 2 } } */

#include <x86intrin.h>

int
bar (int a)
{
  return a + 1;
}

int
foo1 (int b)
{
  _mm_prefetch (bar, _MM_HINT_IT0);
  return bar (b) + 1;
}

int
foo2 (int b)
{
  _mm_prefetch (bar, _MM_HINT_IT1);
  return bar (b) + 1;
}

int
foo3 (int b)
{
  _m_prefetchit0 (bar);
  return bar (b) + 1;
}

int
foo4 (int b)
{
  _m_prefetchit1 (bar);
  return bar (b) + 1;
}