Hi,
This patch prevents vectorization of volatile types.
Thanks to Richard for pointing out the API to use.
Bootstrapped with vectorization enabled and tested on x86-64-suse-linux for
4.3, 4.4 and 4.5.
Committed to mainline.
O.K. for 4.4 and 4.3?
Thanks,
Ira
4.5:
ChangeLog:
PR tree-optimization/40542
* tree-vect-stmts.c (vect-analyze-stmt): Don't vectorize volatile
types.
testsuite/ChangeLog:
PR tree-optimization/40542
* gcc.dg/vect/pr40542.c: New test.
Index: tree-vect-stmts.c
===================================================================
+ {
+ if (vect-print-dump-info (REPORT-UNVECTORIZED-LOCATIONS))
+ fprintf (vect-dump, "not vectorized: stmt has volatile operands");
+
+ return false;
+ }
+
/* Skip stmts that do not need to be vectorized. In loops this is
expected
to include:
- the COND-EXPR which is the loop exit condition
Index: testsuite/gcc.dg/vect/pr40542.c
===================================================================
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ d[i] = s[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail
*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
4.4:
ChangeLog:
PR tree-optimization/40542
* tree-vect-analyze.c (vect-determine-vectorization-factor): Don't
vectorize volatile types.
testsuite/ChangeLog:
PR tree-optimization/40542
* gcc.dg/vect/pr40542.c: New test.
Index: tree-vect-analyze.c
===================================================================
+ {
+ if (vect-print-dump-info (REPORT-UNVECTORIZED-LOOPS))
+ fprintf (vect-dump, "not vectorized: stmt has volatile"
+ " operands");
+
+ return false;
+ }
+
gcc-assert (stmt-info);
/* skip stmts which do not need to be vectorized. */
Index: testsuite/gcc.dg/vect/pr40542.c
===================================================================
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ d[i] = s[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail
*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
4.3:
ChangeLog:
PR tree-optimization/40542
* tree-vect-analyze.c (vect-determine-vectorization-factor): Don't
vectorize volatile types.
testsuite/ChangeLog:
PR tree-optimization/40542
* gcc.dg/vect/pr40542.c: New test.
Index: tree-vect-analyze.c
===================================================================
+ {
+ if (vect-print-dump-info (REPORT-UNVECTORIZED-LOOPS))
+ fprintf (vect-dump, "not vectorized: stmt has volatile"
+ " operands");
+
+ return false;
+ }
+
gcc-assert (stmt-info);
/* skip stmts which do not need to be vectorized. */
Index: testsuite/gcc.dg/vect/pr40542.c
===================================================================
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ d[i] = s[i];
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail
*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
Re: patch - Fix PR tree-optimization/40542 - prevent vectorization of volatile types by Richard Guenther on
2009-06-30T11:36:30+00:00
On Tue, 30 Jun 2009, Ira Rosen wrote:
>
> Hi,
>
> This patch prevents vectorization of volatile types.
> Thanks to Richard for pointing out the API to use.
>
> Bootstrapped with vectorization enabled and tested on x86-64-suse-linux for
> 4.3, 4.4 and 4.5.
> Committed to mainline.
> O.K. for 4.4 and 4.3?
Ok.
Thanks,
Richard.
> Thanks,
> Ira
>
> 4.5:
> ChangeLog:
>
> PR tree-optimization/40542
> * tree-vect-stmts.c (vect-analyze-stmt): Don't vectorize volatile
> types.
>
> testsuite/ChangeLog:
>
> PR tree-optimization/40542
> * gcc.dg/vect/pr40542.c: New test.
>
> Index: tree-vect-stmts.c
> ===================================================================
> > + {
> + if (vect-print-dump-info (REPORT-UNVECTORIZED-LOCATIONS))
> + fprintf (vect-dump, "not vectorized: stmt has volatile operands");
> +
> + return false;
> + }
> +
> /* Skip stmts that do not need to be vectorized. In loops this is
> expected
> to include:
> - the COND-EXPR which is the loop exit condition
> Index: testsuite/gcc.dg/vect/pr40542.c
> ===================================================================
> > +{
> + int i;
> +
> + for (i = 0; i < 16; i++)
> + d[i] = s[i];
> +}
> +
> +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail
> *-*-* } } } */
> +/* { dg-final { cleanup-tree-dump "vect" } } */
> +
>
> 4.4:
> ChangeLog:
>
> PR tree-optimization/40542
> * tree-vect-analyze.c (vect-determine-vectorization-factor): Don't
> vectorize volatile types.
>
> testsuite/ChangeLog:
>
> PR tree-optimization/40542
> * gcc.dg/vect/pr40542.c: New test.
>
> Index: tree-vect-analyze.c
> ===================================================================
> > + {
> + if (vect-print-dump-info (REPORT-UNVECTORIZED-LOOPS))
> + fprintf (vect-dump, "not vectorized: stmt has volatile"
> + " operands");
> +
> + return false;
> + }
> +
> gcc-assert (stmt-info);
>
> /* skip stmts which do not need to be vectorized. */
> Index: testsuite/gcc.dg/vect/pr40542.c
> ===================================================================
> > +{
> + int i;
> +
> + for (i = 0; i < 16; i++)
> + d[i] = s[i];
> +}
> +
> +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail
> *-*-* } } } */
> +/* { dg-final { cleanup-tree-dump "vect" } } */
> +
>
> 4.3:
> ChangeLog:
>
> PR tree-optimization/40542
> * tree-vect-analyze.c (vect-determine-vectorization-factor): Don't
> vectorize volatile types.
>
> testsuite/ChangeLog:
>
> PR tree-optimization/40542
> * gcc.dg/vect/pr40542.c: New test.
>
> Index: tree-vect-analyze.c
> ===================================================================
> > + {
> + if (vect-print-dump-info (REPORT-UNVECTORIZED-LOOPS))
> + fprintf (vect-dump, "not vectorized: stmt has volatile"
> + " operands");
> +
> + return false;
> + }
> +
> gcc-assert (stmt-info);
>
> /* skip stmts which do not need to be vectorized. */
> Index: testsuite/gcc.dg/vect/pr40542.c
> ===================================================================
> > +{
> + int i;
> +
> + for (i = 0; i < 16; i++)
> + d[i] = s[i];
> +}
> +
> +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail
> *-*-* } } } */
> +/* { dg-final { cleanup-tree-dump "vect" } } */
> +
>
>