summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-29 21:55:47 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-29 21:55:47 +0000
commit5c205353eae8e4bed899635efd29ae9322e246d4 (patch)
treee755e23b8c84859e189788b0f53371eb79533cf9 /gcc/testsuite/gcc.dg/tree-ssa
parent55cb441751477d3a0cfba330de34109fe9b07ec7 (diff)
downloadgcc-5c205353eae8e4bed899635efd29ae9322e246d4.tar.gz
* tree-vectorizer.h (DR_MISALIGNMENT): Cast aux to integer.
(SET_DR_MISALIGNMENT): New. * tree-vect-analyze.c (vect_compute_data_ref_alignment, vect_update_misalignment_for_peel, vect_enhance_data_refs_alignment): Use SET_DR_MISALIGNMENT. * tree-predcom.c (split_data_refs_to_components): Cast dr->aux from pointer. * tree-data-ref.c (create_data_ref, compute_all_dependences, find_loop_nest): Export. * tree-data-ref.h (struct data_reference): Change aux field to pointer. (create_data_ref, compute_all_dependences, find_loop_nest): Declare. * tree-ssa-loop-prefetch.c: Include tree-data-ref.h. (L1_CACHE_SIZE_BYTES, L2_CACHE_SIZE_BYTES, NONTEMPORAL_FRACTION): New macros. (struct mem_ref): Add field reuse_distance. (find_or_create_group, record_ref): Use XNEW instead of xcalloc. Initialize reuse_distance field. (issue_prefetch_ref): Select temporality of prefetch according to reuse_distance. (volume_of_references, volume_of_dist_vector, add_subscript_strides, self_reuse_distance, determine_loop_nest_reuse): New functions. (loop_prefetch_arrays): Call determine_loop_nest_reuse. (tree_ssa_prefetch_arrays): Dump L2 cache size. * Makefile.in (tree-ssa-loop-prefetch.o): Add TREE_DATA_REF_H dependency. * gcc.dg/tree-ssa/prefetch-6.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125172 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/prefetch-6.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-6.c b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-6.c
new file mode 100644
index 00000000000..44f65bffb20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-6.c
@@ -0,0 +1,54 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details" } */
+
+#define N 1000
+#define K 900
+
+double a[N][N];
+
+double test(void)
+{
+ unsigned i, j;
+ double sum = 0;
+
+ /* Here, we should use non-temporal prefetch instruction. */
+ for (i = 0; i < K; i++)
+ for (j = 0; j < K; j++)
+ sum += a[i][j];
+
+ /* Here, we should not use non-temporal prefetch instruction, since the
+ value of a[i+10][j] is reused in L2 cache. */
+ for (i = 0; i < K; i++)
+ for (j = 0; j < K; j++)
+ sum += a[i][j] * a[i + 10][j];
+
+ /* Here, we should use non-temporal prefetch instruction, since the
+ value of a[i+100][j] is too far to be reused in L2 cache. */
+ for (i = 0; i < K; i++)
+ for (j = 0; j < K; j++)
+ sum += a[i][j] * a[i + 100][j];
+
+ /* Here, temporal prefetches should be used, since the volume of the
+ memory accesses is smaller than L2 cache. */
+ for (i = 0; i < 100; i++)
+ for (j = 0; j < 100; j++)
+ sum += a[i][j] * a[i + 100][j];
+
+ /* Temporal prefetches should be used here (even though the accesses to
+ a[j][i] are independent, the same cache line is almost always hit
+ every N iterations). */
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ sum += a[j][i];
+
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "Issued prefetch" 5 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 3 "aprefetch" } } */
+
+/* { dg-final { scan-assembler-times "prefetcht" 5 } } */
+/* { dg-final { scan-assembler-times "prefetchnta" 3 } } */
+
+/* { dg-final { cleanup-tree-dump "aprefetch" } } */