Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / prefetch-7.c
blob9e453a7c08aa8ca9b78bd8bb99a3f0dc0f2e109e
1 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
2 /* { dg-require-effective-target ilp32 } */
3 /* { dg-require-effective-target sse2 } */
4 /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=athlon" } } */
5 /* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */
7 #define K 1000000
8 int a[K];
10 void test(int *p)
12 unsigned i;
14 /* Nontemporal store should not be used here (only write and read temporal
15 prefetches). */
16 for (i = 0; i < K - 10000; i++)
17 a[i + 10000] = a[i];
19 /* Nontemporal store should not be used here (only write and read nontemporal
20 prefetches). */
21 for (i = 0; i < K - 100000; i++)
22 a[i + 100000] = a[i];
24 /* Nontemporal store should be used neither for a nor for p, as we do not know
25 whether they alias or not. */
26 for (i = 0; i < K; i++)
28 a[i] = 0;
29 *p++ = 1;
32 /* Nontemporal store should not be used for a, as we do not know whether its
33 value will be reused or not. */
34 for (i = 0; i < 1000; i++)
35 a[i] = 0;
38 /* { dg-final { scan-tree-dump-times "Issued prefetch" 5 "aprefetch" } } */
39 /* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 2 "aprefetch" } } */
40 /* { dg-final { scan-tree-dump-times "a nontemporal store" 0 "aprefetch" } } */
42 /* { dg-final { scan-tree-dump-times "builtin_prefetch" 7 "optimized" } } */
44 /* { dg-final { scan-assembler-times "prefetchw" 5 } } */
45 /* { dg-final { scan-assembler-times "prefetcht" 1 } } */
46 /* { dg-final { scan-assembler-times "prefetchnta" 1 } } */
48 /* { dg-final { cleanup-tree-dump "aprefetch" } } */
49 /* { dg-final { cleanup-tree-dump "optimized" } } */