annotate gcc/testsuite/gcc.dg/tree-ssa/prefetch-5.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -fprefetch-loop-arrays -march=amdfam10 --param min-insn-to-prefetch-ratio=5 -fdump-tree-aprefetch-details" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 /* These are common idioms for writing variable-length arrays at the end
kono
parents:
diff changeset
5 of structures. We should not deduce anything about the number of iterations
kono
parents:
diff changeset
6 of the loops from them. */
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 struct tail0
kono
parents:
diff changeset
9 {
kono
parents:
diff changeset
10 int xxx;
kono
parents:
diff changeset
11 int yyy[0];
kono
parents:
diff changeset
12 };
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 int loop0 (int n, struct tail0 *x)
kono
parents:
diff changeset
15 {
kono
parents:
diff changeset
16 int i, s = 0;
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 for (i = 0; i < n; i++)
kono
parents:
diff changeset
19 s += x->yyy[i];
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 return s;
kono
parents:
diff changeset
22 }
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 struct tail1
kono
parents:
diff changeset
25 {
kono
parents:
diff changeset
26 int xxx;
kono
parents:
diff changeset
27 int yyy[1];
kono
parents:
diff changeset
28 };
kono
parents:
diff changeset
29 int loop1 (int n, struct tail1 *x)
kono
parents:
diff changeset
30 {
kono
parents:
diff changeset
31 int i, s = 0;
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 for (i = 0; i < n; i++)
kono
parents:
diff changeset
34 s += x->yyy[i];
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 return s;
kono
parents:
diff changeset
37 }
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 /* It is unlikely that this should be a tail array. We may deduce that most
kono
parents:
diff changeset
40 likely, the loop iterates about 5 times, and the array is not worth prefetching. */
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 struct tail5
kono
parents:
diff changeset
43 {
kono
parents:
diff changeset
44 int xxx;
kono
parents:
diff changeset
45 int yyy[5];
kono
parents:
diff changeset
46 };
kono
parents:
diff changeset
47 int loop5 (int n, struct tail5 *x)
kono
parents:
diff changeset
48 {
kono
parents:
diff changeset
49 int i, s = 0;
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 for (i = 0; i < n; i++)
kono
parents:
diff changeset
52 s += x->yyy[i];
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 return s;
kono
parents:
diff changeset
55 }
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 /* Until we are able to track likely upper bounds, we can't really work out that
kono
parents:
diff changeset
58 small trailing arrays should not be prefetched. */
kono
parents:
diff changeset
59 /* { dg-final { scan-tree-dump-times "Issued prefetch" 2 "aprefetch" } } */
kono
parents:
diff changeset
60 /* { dg-final { scan-tree-dump-times "Not prefetching" 1 "aprefetch" } } */