* [PATCH] Fix up ICE with reduction % (PR tree-optimization/55955)
@ 2013-01-14 20:49 Jakub Jelinek
2013-01-15 9:25 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-01-14 20:49 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
For *SHIFT_EXPR/*ROTATE_EXPR with VECTOR_TYPE types, optab_for_tree_code
requires us to decide if we want optab_vector or optab_scalar. It is likely
not worth it to handle these four, they would fail soon anyway.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2013-01-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/55955
* tree-vect-loop.c (vectorizable_reduction): Give up early on
*SHIFT_EXPR and *ROTATE_EXPR codes.
* gcc.c-torture/compile/pr55955.c: New test.
--- gcc/tree-vect-loop.c.jj 2013-01-11 09:02:55.000000000 +0100
+++ gcc/tree-vect-loop.c 2013-01-14 12:21:29.359018748 +0100
@@ -4776,6 +4776,17 @@ vectorizable_reduction (gimple stmt, gim
{
/* 4. Supportable by target? */
+ if (code == LSHIFT_EXPR || code == RSHIFT_EXPR
+ || code == LROTATE_EXPR || code == RROTATE_EXPR)
+ {
+ /* Shifts and rotates are only supported by vectorizable_shifts,
+ not vectorizable_reduction. */
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "unsupported shift or rotation.");
+ return false;
+ }
+
/* 4.1. check support for the operation in the loop */
optab = optab_for_tree_code (code, vectype_in, optab_default);
if (!optab)
--- gcc/testsuite/gcc.c-torture/compile/pr55955.c.jj 2013-01-14 12:23:28.273324350 +0100
+++ gcc/testsuite/gcc.c-torture/compile/pr55955.c 2013-01-14 12:23:14.000000000 +0100
@@ -0,0 +1,12 @@
+/* PR tree-optimization/55955 */
+
+int b;
+
+void
+foo (int x)
+{
+ int a;
+ for (a = x; a < 2; a++)
+ for (b = 0; b < 2; b++)
+ *(unsigned short *) 0x100000UL %= 46;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix up ICE with reduction % (PR tree-optimization/55955)
2013-01-14 20:49 [PATCH] Fix up ICE with reduction % (PR tree-optimization/55955) Jakub Jelinek
@ 2013-01-15 9:25 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-01-15 9:25 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Mon, 14 Jan 2013, Jakub Jelinek wrote:
> Hi!
>
> For *SHIFT_EXPR/*ROTATE_EXPR with VECTOR_TYPE types, optab_for_tree_code
> requires us to decide if we want optab_vector or optab_scalar. It is likely
> not worth it to handle these four, they would fail soon anyway.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2013-01-14 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/55955
> * tree-vect-loop.c (vectorizable_reduction): Give up early on
> *SHIFT_EXPR and *ROTATE_EXPR codes.
>
> * gcc.c-torture/compile/pr55955.c: New test.
>
> --- gcc/tree-vect-loop.c.jj 2013-01-11 09:02:55.000000000 +0100
> +++ gcc/tree-vect-loop.c 2013-01-14 12:21:29.359018748 +0100
> @@ -4776,6 +4776,17 @@ vectorizable_reduction (gimple stmt, gim
> {
> /* 4. Supportable by target? */
>
> + if (code == LSHIFT_EXPR || code == RSHIFT_EXPR
> + || code == LROTATE_EXPR || code == RROTATE_EXPR)
> + {
> + /* Shifts and rotates are only supported by vectorizable_shifts,
> + not vectorizable_reduction. */
> + if (dump_enabled_p ())
> + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
> + "unsupported shift or rotation.");
> + return false;
> + }
> +
> /* 4.1. check support for the operation in the loop */
> optab = optab_for_tree_code (code, vectype_in, optab_default);
> if (!optab)
> --- gcc/testsuite/gcc.c-torture/compile/pr55955.c.jj 2013-01-14 12:23:28.273324350 +0100
> +++ gcc/testsuite/gcc.c-torture/compile/pr55955.c 2013-01-14 12:23:14.000000000 +0100
> @@ -0,0 +1,12 @@
> +/* PR tree-optimization/55955 */
> +
> +int b;
> +
> +void
> +foo (int x)
> +{
> + int a;
> + for (a = x; a < 2; a++)
> + for (b = 0; b < 2; b++)
> + *(unsigned short *) 0x100000UL %= 46;
> +}
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-15 9:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 20:49 [PATCH] Fix up ICE with reduction % (PR tree-optimization/55955) Jakub Jelinek
2013-01-15 9:25 ` Richard Biener
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).