2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / prefetch.c
blob24b7939b99915cf6d8bafe38159102d45d8eff92
1 /* Testcase to check generation of the operand cache prefetch instruction
2 PREF @Rm. */
3 /* { dg-do compile { target { has_pref } } } */
4 /* { dg-options "-O0" } */
5 /* { dg-final { scan-assembler "pref" } } */
7 void
8 opt (void)
10 int *p, wk;
11 int data[100];
13 /* data prefetch , instructions hit the cache. */
15 __builtin_prefetch (&data[0], 0, 0);
16 __builtin_prefetch (&data[0], 0, 1);
17 __builtin_prefetch (&data[0], 0, 2);
18 __builtin_prefetch (&data[0], 0, 3);
19 __builtin_prefetch (&data[0], 1, 0);
20 __builtin_prefetch (&data[0], 1, 1);
21 __builtin_prefetch (&data[0], 1, 2);
22 __builtin_prefetch (&data[0], 1, 3);
25 for (p = &data[0]; p < &data[9]; p++)
27 if (*p > *(p + 1))
29 wk = *p;
30 *p = *(p + 1);
31 *(p + 1) = wk;