* Fix PR tree-optimization / 31946 :
@ 2007-08-02 20:16 Ramana Radhakrishnan
2007-08-03 4:20 ` Ramana Radhakrishnan
0 siblings, 1 reply; 2+ messages in thread
From: Ramana Radhakrishnan @ 2007-08-02 20:16 UTC (permalink / raw)
To: gcc-patches; +Cc: Dorit Nuzman
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
Hi,
I am currently testing this patch to fix PR 31946 for less stricter
peeling-for-alignment. It fixes the peeling limits for the testcases
mentioned in the PR. I am bootstrapping on an x86-32 box currently and
running the regression suite.
cheers
Ramana
--
Ramana Radhakrishnan
:ADDPATCH autovect: PR tree-optimization/31946
2007-08-03 Ramana Radhakrishnan <ramana.r@gmail.com>
PR tree-optimization/31946
* tree-vect-analyze.c (return_peeling_factor_for_data_reference):
New. Refactor code for calculation of peeling factor for a data
reference.
(vect_enhance_data_refs_alignment): Refactor
calculation of peeling factor. Peel by data reference that allows
for the maximum peeling factor.
[-- Attachment #2: pr31946-patch --]
[-- Type: application/octet-stream, Size: 5072 bytes --]
Index: ChangeLog
===================================================================
--- ChangeLog (revision 127165)
+++ ChangeLog (working copy)
@@ -1,3 +1,12 @@
+2007-08-03 Ramana Radhakrishnan <ramana.r@gmail.com>
+
+ PR tree-optimization/31946
+ * tree-vect-analyze.c (return_peeling_factor_for_data_reference): New. Refactor
+ code for calculation of peeling factor for a data reference.
+ (vect_enhance_data_refs_alignment): Refactor
+ calculation of peeling factor. Peel by data reference that allows
+ for the maximum peeling factor.
+
2007-08-02 Steve Ellcey <sje@cup.hp.com>
* config/ia64/constraints.md ("U"): Make constraint vector only.
Index: tree-vect-analyze.c
===================================================================
--- tree-vect-analyze.c (revision 127165)
+++ tree-vect-analyze.c (working copy)
@@ -1449,6 +1449,52 @@
return true;
}
+/* Function that returns the peeling factor for a given data reference. The peeling
+ factor cannot be determined as given in the comment above vect_enhance_data_refs_alignment.
+*/
+
+
+
+static int
+return_peeling_factor_for_data_reference (struct data_reference * dr0)
+{
+ tree stmt = DR_STMT (dr0);
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ int nelements = TYPE_VECTOR_SUBPARTS (vectype);
+ int mis;
+ int npeel = 0;
+
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "--> In return peeling factor for data references \n");
+
+ if (known_alignment_for_access_p (dr0))
+ {
+ /* Since it's known at compile time, compute the number of iterations
+ in the peeled loop (the peeling factor) for use in updating
+ DR_MISALIGNMENT values. The peeling factor is the vectorization
+ factor minus the misalignment as an element count. */
+ mis = DR_MISALIGNMENT (dr0);
+ mis /= GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr0))));
+ npeel = nelements - mis;
+
+ /* For interleaved data access every iteration accesses all the
+ members of the group, therefore we divide the number of iterations
+ by the group size. */
+ stmt_info = vinfo_for_stmt (DR_STMT (dr0));
+ if (DR_GROUP_FIRST_DR (stmt_info))
+ npeel /= DR_GROUP_SIZE (stmt_info);
+
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "Peeling factor is %d", npeel);
+ }
+
+ return npeel;
+
+}
+
+
+
/* Function vect_enhance_data_refs_alignment
This pass will use loop versioning and loop peeling in order to enhance
@@ -1547,6 +1593,8 @@
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
enum dr_alignment_support supportable_dr_alignment;
struct data_reference *dr0 = NULL;
+ int max_peelfactor_sofar = 0;
+ int current_peelfactor = 0;
struct data_reference *dr;
unsigned int i;
bool do_peeling = false;
@@ -1611,11 +1659,16 @@
if (!DR_IS_READ (dr) && !aligned_access_p (dr))
{
do_peeling = vector_alignment_reachable_p (dr);
- if (do_peeling)
- dr0 = dr;
+ current_peelfactor = return_peeling_factor_for_data_reference (dr);
+
+ if (do_peeling && (current_peelfactor > max_peelfactor_sofar))
+ {
+ dr0 = dr;
+ max_peelfactor_sofar = current_peelfactor;
+ }
+
if (!do_peeling && vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "vector alignment may not be reachable");
- break;
}
}
@@ -1627,34 +1680,17 @@
if (do_peeling)
{
- int mis;
- int npeel = 0;
+
+ int npeel = max_peelfactor_sofar;
tree stmt = DR_STMT (dr0);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
- int nelements = TYPE_VECTOR_SUBPARTS (vectype);
- if (known_alignment_for_access_p (dr0))
- {
- /* Since it's known at compile time, compute the number of iterations
- in the peeled loop (the peeling factor) for use in updating
- DR_MISALIGNMENT values. The peeling factor is the vectorization
- factor minus the misalignment as an element count. */
- mis = DR_MISALIGNMENT (dr0);
- mis /= GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr0))));
- npeel = nelements - mis;
- /* For interleaved data access every iteration accesses all the
- members of the group, therefore we divide the number of iterations
- by the group size. */
- stmt_info = vinfo_for_stmt (DR_STMT (dr0));
- if (DR_GROUP_FIRST_DR (stmt_info))
- npeel /= DR_GROUP_SIZE (stmt_info);
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "Try peeling by %d", npeel);
- }
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "Try peeling by %d", npeel);
+
/* Ensure that all data refs can be vectorized after the peel. */
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix PR tree-optimization / 31946 :
2007-08-02 20:16 Fix PR tree-optimization / 31946 : Ramana Radhakrishnan
@ 2007-08-03 4:20 ` Ramana Radhakrishnan
0 siblings, 0 replies; 2+ messages in thread
From: Ramana Radhakrishnan @ 2007-08-03 4:20 UTC (permalink / raw)
To: gcc-patches; +Cc: Dorit Nuzman
Hi,
>
> I am currently testing this patch to fix PR 31946 for less stricter
> peeling-for-alignment. It fixes the peeling limits for the testcases
> mentioned in the PR. I am bootstrapping on an x86-32 box currently and
> running the regression suite.
The patch broke bootstrap for fortran. I've tested an updated patch
that fixes that . However the testsuite needs to be fixed for the
fallout with this patch as it allows for vectorization with different
peeling limits for the testcases mentioned in the PR .
I'll submit a complete patch once I have worked through the test fails
but that will have to be much later this the evening.
cheers
Raman
>
>
> cheers
> Ramana
>
>
> --
> Ramana Radhakrishnan
>
> :ADDPATCH autovect: PR tree-optimization/31946
>
> 2007-08-03 Ramana Radhakrishnan <ramana.r@gmail.com>
>
> PR tree-optimization/31946
> * tree-vect-analyze.c (return_peeling_factor_for_data_reference):
> New. Refactor code for calculation of peeling factor for a data
> reference.
> (vect_enhance_data_refs_alignment): Refactor
> calculation of peeling factor. Peel by data reference that allows
> for the maximum peeling factor.
>
>
--
Ramana Radhakrishnan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-03 4:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-02 20:16 Fix PR tree-optimization / 31946 : Ramana Radhakrishnan
2007-08-03 4:20 ` Ramana Radhakrishnan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).