public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix PR tree-optimization/50412
@ 2011-09-18 11:39 Ira Rosen
  2011-09-23 22:17 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Ira Rosen @ 2011-09-18 11:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: Patch Tracking

Hi,

Strided accesses of single element or with gaps may require creation
of epilogue loop. At the moment we don't support peeling for outer
loops, therefore, we should not allow such strided accesses in outer
loops.

Bootstrapped and tested on powerpc64-suse-linux.
Committed to trunk.

Now testing for 4.6.
OK for 4.6 when the testing completes?

Thanks,
Ira

ChangeLog:

        PR tree-optimization/50412
        * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
        acceses that require epilogue loop if vectorizing outer loop.

testsuite/ChangeLog:

        PR tree-optimization/50412
        * gfortran.dg/vect/pr50412.f90: New.



Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c       (revision 178939)
+++ tree-vect-data-refs.c       (working copy)
@@ -2060,7 +2060,11 @@ vect_analyze_group_access (struct data_reference *
   HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step);
   HOST_WIDE_INT stride, last_accessed_element = 1;
   bool slp_impossible = false;
+  struct loop *loop = NULL;

+  if (loop_vinfo)
+    loop = LOOP_VINFO_LOOP (loop_vinfo);
+
   /* For interleaving, STRIDE is STEP counted in elements, i.e., the
size of the
      interleaving group (including gaps).  */
   stride = dr_step / type_size;
@@ -2090,11 +2094,18 @@ vect_analyze_group_access (struct data_reference *

          if (loop_vinfo)
            {
-             LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
-
              if (vect_print_dump_info (REPORT_DETAILS))
                fprintf (vect_dump, "Data access with gaps requires scalar "
                                    "epilogue loop");
+              if (loop->inner)
+                {
+                  if (vect_print_dump_info (REPORT_DETAILS))
+                    fprintf (vect_dump, "Peeling for outer loop is not"
+                                        " supported");
+                  return false;
+                }
+
+              LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
            }

          return true;
@@ -2277,10 +2288,17 @@ vect_analyze_group_access (struct data_reference *
       /* There is a gap in the end of the group.  */
       if (stride - last_accessed_element > 0 && loop_vinfo)
        {
-         LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
          if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "Data access with gaps requires scalar "
                                "epilogue loop");
+          if (loop->inner)
+            {
+              if (vect_print_dump_info (REPORT_DETAILS))
+                fprintf (vect_dump, "Peeling for outer loop is not supported");
+              return false;
+            }
+
+          LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
        }
     }
Index: testsuite/gfortran.dg/vect/pr50412.f90
===================================================================
--- testsuite/gfortran.dg/vect/pr50412.f90      (revision 0)
+++ testsuite/gfortran.dg/vect/pr50412.f90      (revision 0)
@@ -0,0 +1,12 @@
+! { dg-do compile }
+
+      DOUBLE PRECISION AK,AI,AAE
+      COMMON/com/AK(36),AI(4,4),AAE(8,4),ii,jj
+      DO 20 II=1,4
+        DO 21 JJ=1,4
+          AK(n)=AK(n)-AAE(I,II)*AI(II,JJ)
+   21   CONTINUE
+   20 CONTINUE
+      END
+
+! { dg-final { cleanup-tree-dump "vect" } }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Fix PR tree-optimization/50412
  2011-09-18 11:39 [patch] Fix PR tree-optimization/50412 Ira Rosen
@ 2011-09-23 22:17 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-09-23 22:17 UTC (permalink / raw)
  To: Ira Rosen; +Cc: gcc-patches, Patch Tracking

On Sun, Sep 18, 2011 at 11:00 AM, Ira Rosen <ira.rosen@linaro.org> wrote:
> Hi,
>
> Strided accesses of single element or with gaps may require creation
> of epilogue loop. At the moment we don't support peeling for outer
> loops, therefore, we should not allow such strided accesses in outer
> loops.
>
> Bootstrapped and tested on powerpc64-suse-linux.
> Committed to trunk.
>
> Now testing for 4.6.
> OK for 4.6 when the testing completes?

Ok.

Thanks,
Richard.

> Thanks,
> Ira
>
> ChangeLog:
>
>        PR tree-optimization/50412
>        * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
>        acceses that require epilogue loop if vectorizing outer loop.
>
> testsuite/ChangeLog:
>
>        PR tree-optimization/50412
>        * gfortran.dg/vect/pr50412.f90: New.
>
>
>
> Index: tree-vect-data-refs.c
> ===================================================================
> --- tree-vect-data-refs.c       (revision 178939)
> +++ tree-vect-data-refs.c       (working copy)
> @@ -2060,7 +2060,11 @@ vect_analyze_group_access (struct data_reference *
>   HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step);
>   HOST_WIDE_INT stride, last_accessed_element = 1;
>   bool slp_impossible = false;
> +  struct loop *loop = NULL;
>
> +  if (loop_vinfo)
> +    loop = LOOP_VINFO_LOOP (loop_vinfo);
> +
>   /* For interleaving, STRIDE is STEP counted in elements, i.e., the
> size of the
>      interleaving group (including gaps).  */
>   stride = dr_step / type_size;
> @@ -2090,11 +2094,18 @@ vect_analyze_group_access (struct data_reference *
>
>          if (loop_vinfo)
>            {
> -             LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
> -
>              if (vect_print_dump_info (REPORT_DETAILS))
>                fprintf (vect_dump, "Data access with gaps requires scalar "
>                                    "epilogue loop");
> +              if (loop->inner)
> +                {
> +                  if (vect_print_dump_info (REPORT_DETAILS))
> +                    fprintf (vect_dump, "Peeling for outer loop is not"
> +                                        " supported");
> +                  return false;
> +                }
> +
> +              LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
>            }
>
>          return true;
> @@ -2277,10 +2288,17 @@ vect_analyze_group_access (struct data_reference *
>       /* There is a gap in the end of the group.  */
>       if (stride - last_accessed_element > 0 && loop_vinfo)
>        {
> -         LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
>          if (vect_print_dump_info (REPORT_DETAILS))
>            fprintf (vect_dump, "Data access with gaps requires scalar "
>                                "epilogue loop");
> +          if (loop->inner)
> +            {
> +              if (vect_print_dump_info (REPORT_DETAILS))
> +                fprintf (vect_dump, "Peeling for outer loop is not supported");
> +              return false;
> +            }
> +
> +          LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
>        }
>     }
> Index: testsuite/gfortran.dg/vect/pr50412.f90
> ===================================================================
> --- testsuite/gfortran.dg/vect/pr50412.f90      (revision 0)
> +++ testsuite/gfortran.dg/vect/pr50412.f90      (revision 0)
> @@ -0,0 +1,12 @@
> +! { dg-do compile }
> +
> +      DOUBLE PRECISION AK,AI,AAE
> +      COMMON/com/AK(36),AI(4,4),AAE(8,4),ii,jj
> +      DO 20 II=1,4
> +        DO 21 JJ=1,4
> +          AK(n)=AK(n)-AAE(I,II)*AI(II,JJ)
> +   21   CONTINUE
> +   20 CONTINUE
> +      END
> +
> +! { dg-final { cleanup-tree-dump "vect" } }
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-23 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-18 11:39 [patch] Fix PR tree-optimization/50412 Ira Rosen
2011-09-23 22:17 ` Richard Guenther

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).