aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2007-06-10 22:39:22 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-06-10 20:39:22 +0000
commit79f5e442625680fbd5c12517419e990609bb2810 (patch)
treeaa6fde364b39cc3fab0e7d98faf468b947ade3d2 /gcc/testsuite/gcc.dg
parent6bdff197e6b8397129441e85a53fbb3c738c3d57 (diff)
downloadgcc-79f5e442625680fbd5c12517419e990609bb2810.zip
gcc-79f5e442625680fbd5c12517419e990609bb2810.tar.gz
gcc-79f5e442625680fbd5c12517419e990609bb2810.tar.bz2
tree-data-ref.c (dr_analyze_alias): Handle case smt is NULL.
* tree-data-ref.c (dr_analyze_alias): Handle case smt is NULL. * tree-predcom.c (mark_virtual_ops_for_renaming): Exported. * tree-ssa-loop-prefetch.c: Include optabs.h. (FENCE_FOLLOWING_MOVNT): New macro. (struct mem_ref): Add independent_p and storent_p fields. (record_ref): Initalize the new fields. (gather_memory_references_ref): Return true if the reference could be analysed. (gather_memory_references): Check whether all memory accesses in loop were recorded. (should_issue_prefetch_p): Return false for nontemporal stores. (nontemporal_store_p, mark_nontemporal_store, emit_mfence_after_loop, may_use_storent_in_loop_p, mark_nontemporal_stores): New functions. (determine_loop_nest_reuse): Detect independent memory references. (loop_prefetch_arrays): Call mark_nontemporal_stores. * tree-flow.h (mark_virtual_ops_for_renaming): Declare. * Makefile.in (tree-ssa-loop-prefetch.o): Add OPTABS_H dependency. * config/i386/i386.h (x86_mfence): Declare. (FENCE_FOLLOWING_MOVNT): Return x86_mfence. * config/i386/i386.c (x86_mfence): New variable. (ix86_init_mmx_sse_builtins): Initialize x86_mfence. * tree-pretty-print.c (dump_generic_node): Mark nontemporal stores. * optabs.c (init_optabs): Initialize storent_optab. * optabs.h (enum optab_index): Add OTI_storent. (storent_optab): Declare. * genopinit.c (optabs): Add initialization for storent_optab. * tree.h (MOVE_NONTEMPORAL): New macro. * expr.c (expand_assignment, store_expr, store_constructor_field, store_constructor, store_field, expand_expr_real_1): Propagate nontemporality of the expanded store. (emit_storent_insn): New function. * expr.h (expand_assignment, store_expr): Declaration changed. * function.c (assign_parm_setup_reg): Pass false as nontemporality to expand_assignment. * stmt.c (expand_asm_expr): Ditto. * calls.c (initialize_argument_information): Pass false as nontemporality to store_expr. * config/i386/sse.md (storentv4sf, storentv2df, storentv2di, storentsi): New. * gcc.dg/tree-ssa/prefetch-7.c: New test. From-SVN: r125604
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c
new file mode 100644
index 0000000..510dee0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c
@@ -0,0 +1,59 @@
+/* { 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 --param max-unrolled-insns=1 -fdump-tree-aprefetch-details -fdump-tree-final_cleanup" } */
+
+#define K 1000000
+int a[K], b[K];
+
+void test(int *p)
+{
+ unsigned i;
+
+ /* Nontemporal store should be used for a. */
+ for (i = 0; i < K; i++)
+ a[i] = 0;
+
+ /* Nontemporal store should be used for a, nontemporal prefetch for b. */
+ for (i = 0; i < K; i++)
+ a[i] = b[i];
+
+ /* Nontemporal store should not be used here (only write and read temporal
+ prefetches). */
+ for (i = 0; i < K - 10000; i++)
+ a[i + 10000] = a[i];
+
+ /* Nontemporal store should not be used here (only write and read nontemporal
+ prefetches). */
+ for (i = 0; i < K - 100000; i++)
+ a[i + 100000] = a[i];
+
+ /* Nontemporal store should be used neither for a nor for p, as we do not know
+ whether they alias or not. */
+ for (i = 0; i < K; i++)
+ {
+ a[i] = 0;
+ *p++ = 1;
+ }
+
+ /* Nontemporal store should not be used for a, as we do not know whether its
+ value will be reused or not. */
+ for (i = 0; i < 1000; i++)
+ a[i] = 0;
+}
+
+/* { dg-final { scan-tree-dump-times "Issued prefetch" 5 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 3 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "nontemporal store" 2 "aprefetch" } } */
+
+/* { dg-final { scan-tree-dump-times "builtin_prefetch" 8 "final_cleanup" } } */
+/* { dg-final { scan-tree-dump-times "=\\{nt\\}" 2 "final_cleanup" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_ia32_mfence" 2 "final_cleanup" } } */
+
+/* { dg-final { scan-assembler-times "prefetchw" 5 } } */
+/* { dg-final { scan-assembler-times "prefetcht" 1 } } */
+/* { dg-final { scan-assembler-times "prefetchnta" 2 } } */
+/* { dg-final { scan-assembler-times "movnti" 2 } } */
+/* { dg-final { scan-assembler-times "mfence" 2 } } */
+
+/* { dg-final { cleanup-tree-dump "aprefetch" } } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */