diff options
author | mm <mm@FreeBSD.org> | 2011-03-29 20:53:51 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2011-03-29 20:53:51 +0000 |
commit | 24a0f968ca05de3f4d12a803e9141af94f6d0aee (patch) | |
tree | 8dd18f9d0a6d8b9d0b38d505e33d37244cd1c655 /contrib/gcc/tree-vect-analyze.c | |
parent | 9d571f70778884c98026689ff71368ffa7c1cb9d (diff) | |
download | FreeBSD-src-24a0f968ca05de3f4d12a803e9141af94f6d0aee.zip FreeBSD-src-24a0f968ca05de3f4d12a803e9141af94f6d0aee.tar.gz |
Upgrade of base gcc and libstdc++ to the last GPLv2-licensed revision
(rev. 127959 of gcc-4_2-branch).
Resolved GCC bugs:
c++: 17763, 29365, 30535, 30917, 31337, 31941, 32108, 32112, 32346,
32898, 32992
debug: 32610, 32914
libstdc++: 33084, 33128
middle-end: 32563
rtl-optimization: 33148
tree-optimization: 25413, 32723
target: 32218
Tested by: pointyhat (miwi)
Obtained from: gcc (gcc-4_2-branch up to rev. 127959)
PR: gnu/153298, gnu/153959, gnu/154385
MFC after: 1 month
Diffstat (limited to 'contrib/gcc/tree-vect-analyze.c')
-rw-r--r-- | contrib/gcc/tree-vect-analyze.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/contrib/gcc/tree-vect-analyze.c b/contrib/gcc/tree-vect-analyze.c index f247cd9..17cb9de 100644 --- a/contrib/gcc/tree-vect-analyze.c +++ b/contrib/gcc/tree-vect-analyze.c @@ -25,6 +25,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "tm.h" #include "ggc.h" #include "tree.h" +#include "target.h" #include "basic-block.h" #include "diagnostic.h" #include "tree-flow.h" @@ -911,6 +912,57 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo) } +/* Function vector_alignment_reachable_p + + Return true if vector alignment for DR is reachable by peeling + a few loop iterations. Return false otherwise. */ + +static bool +vector_alignment_reachable_p (struct data_reference *dr) +{ + tree stmt = DR_STMT (dr); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + tree vectype = STMT_VINFO_VECTYPE (stmt_info); + + /* If misalignment is known at the compile time then allow peeling + only if natural alignment is reachable through peeling. */ + if (known_alignment_for_access_p (dr) && !aligned_access_p (dr)) + { + HOST_WIDE_INT elmsize = + int_cst_value (TYPE_SIZE_UNIT (TREE_TYPE (vectype))); + if (vect_print_dump_info (REPORT_DETAILS)) + { + fprintf (vect_dump, "data size =" HOST_WIDE_INT_PRINT_DEC, elmsize); + fprintf (vect_dump, ". misalignment = %d. ", DR_MISALIGNMENT (dr)); + } + if (DR_MISALIGNMENT (dr) % elmsize) + { + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "data size does not divide the misalignment.\n"); + return false; + } + } + + if (!known_alignment_for_access_p (dr)) + { + tree type = (TREE_TYPE (DR_REF (dr))); + tree ba = DR_BASE_OBJECT (dr); + bool is_packed = false; + + if (ba) + is_packed = contains_packed_reference (ba); + + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "Unknown misalignment, is_packed = %d",is_packed); + if (targetm.vectorize.vector_alignment_reachable (type, is_packed)) + return true; + else + return false; + } + + return true; +} + /* Function vect_enhance_data_refs_alignment This pass will use loop versioning and loop peeling in order to enhance @@ -1056,8 +1108,11 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) if (!DR_IS_READ (dr) && !aligned_access_p (dr)) { - dr0 = dr; - do_peeling = true; + do_peeling = vector_alignment_reachable_p (dr); + if (do_peeling) + dr0 = dr; + if (!do_peeling && vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "vector alignment may not be reachable"); break; } |