aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <uros@kss-loka.si>2005-09-14 11:27:01 +0200
committerDorit Nuzman <dorit@gcc.gnu.org>2005-09-14 09:27:01 +0000
commitb2d16a23f1f032c1104db7bb015535b9735aa94a (patch)
treed59e962d2c903927a3d0d8e3491f60047dbda90b
parent816fa80a8f1dd56131f17538216c7115be986833 (diff)
downloadgcc-b2d16a23f1f032c1104db7bb015535b9735aa94a.zip
gcc-b2d16a23f1f032c1104db7bb015535b9735aa94a.tar.gz
gcc-b2d16a23f1f032c1104db7bb015535b9735aa94a.tar.bz2
re PR middle-end/22480 (ICE in convert_move, at expr.c:390 with -ftree-vectorize)
2005-09-14 Uros Bizjak <uros@kss-loka.si> PR middle-end/22480 * tree-vect-transform.c (vectorizable_operation): Return false for scalar shift operations and for vector shift operations with non-invariant shift arguments. Use scalar tree operand op1 as a shift operand when vector shift insn pattern uses scalar shift operand. * Makefile.in (tree-vect-transform.o): Depend on recog.h. From-SVN: r104264
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/testsuite/ChangeLog5
-rwxr-xr-xgcc/testsuite/gcc.dg/vect/pr22480.c30
-rw-r--r--gcc/tree-vect-transform.c45
5 files changed, 89 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a0da848..191cdc2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2005-09-14 Uros Bizjak <uros@kss-loka.si>
+
+ PR middle-end/22480
+ * tree-vect-transform.c (vectorizable_operation): Return false for
+ scalar shift operations and for vector shift operations with
+ non-invariant shift arguments. Use scalar tree operand op1 as
+ a shift operand when vector shift insn pattern uses scalar shift
+ operand.
+ * Makefile.in (tree-vect-transform.o): Depend on recog.h.
+
2005-09-14 Olivier Hainque <hainque@adacore.com>
* gimplify.c (gimplify_init_ctor_eval): Don't discard a zero-sized
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f260f37..fded53d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1959,7 +1959,7 @@ tree-vect-analyze.o: tree-vect-analyze.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
tree-vectorizer.h $(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) tree-chrec.h
tree-vect-transform.o: tree-vect-transform.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) \
+ coretypes.h $(TM_H) $(GGC_H) $(OPTABS_H) $(RECOG_H) $(TREE_H) $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
$(TIMEVAR_H) $(CFGLOOP_H) $(TARGET_H) tree-pass.h $(EXPR_H) \
tree-vectorizer.h $(TREE_DATA_REF_H) $(SCEV_H) langhooks.h toplev.h \
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fda2fb3..271f368 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-14 Uros Bizjak <uros@kss-loka.si>
+
+ PR middle-end/22480
+ * gcc.dg/vect/pr22480.c: New test.
+
2005-09-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/19358
diff --git a/gcc/testsuite/gcc.dg/vect/pr22480.c b/gcc/testsuite/gcc.dg/vect/pr22480.c
new file mode 100755
index 0000000..ddf657f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr22480.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+void
+test_1 (void)
+{
+ static unsigned int bm[16];
+ int j;
+ for (j = 0; j < 16; j++)
+ bm[j] <<= 8;
+}
+
+void
+test_2 (int a)
+{
+ static unsigned int bm[16];
+ int j;
+ for (j = 0; j < 16; j++)
+ bm[j] <<= a;
+}
+
+void
+test_3 (void)
+{
+ static unsigned bm[16];
+ int am[16];
+ int j;
+ for (j = 0; j < 16;j++)
+ bm[j] <<= am[j];
+}
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index f498adb..4084e5a 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -35,6 +35,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "cfgloop.h"
#include "expr.h"
#include "optabs.h"
+#include "recog.h"
#include "tree-data-ref.h"
#include "tree-chrec.h"
#include "tree-scalar-evolution.h"
@@ -1409,6 +1410,8 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
int op_type;
tree op;
optab optab;
+ int icode;
+ enum machine_mode optab_op2_mode;
tree def, def_stmt;
enum vect_def_type dt;
@@ -1464,7 +1467,8 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
return false;
}
vec_mode = TYPE_MODE (vectype);
- if (optab->handlers[(int) vec_mode].insn_code == CODE_FOR_nothing)
+ icode = (int) optab->handlers[(int) vec_mode].insn_code;
+ if (icode == CODE_FOR_nothing)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "op not supported by target.");
@@ -1486,6 +1490,25 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
return false;
}
+ if (code == LSHIFT_EXPR || code == RSHIFT_EXPR)
+ {
+ /* FORNOW: not yet supported. */
+ if (!VECTOR_MODE_P (vec_mode))
+ return false;
+
+ /* Invariant argument is needed for a vector shift
+ by a scalar shift operand. */
+ optab_op2_mode = insn_data[icode].operand[2].mode;
+ if (! (VECTOR_MODE_P (optab_op2_mode)
+ || dt == vect_constant_def
+ || dt == vect_invariant_def))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "operand mode requires invariant argument.");
+ return false;
+ }
+ }
+
if (!vec_stmt) /* transformation not required. */
{
STMT_VINFO_TYPE (stmt_info) = op_vec_info_type;
@@ -1508,7 +1531,25 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (op_type == binary_op)
{
op1 = TREE_OPERAND (operation, 1);
- vec_oprnd1 = vect_get_vec_def_for_operand (op1, stmt, NULL);
+
+ if (code == LSHIFT_EXPR || code == RSHIFT_EXPR)
+ {
+ /* Vector shl and shr insn patterns can be defined with
+ scalar operand 2 (shift operand). In this case, use
+ constant or loop invariant op1 directly, without
+ extending it to vector mode first. */
+
+ optab_op2_mode = insn_data[icode].operand[2].mode;
+ if (!VECTOR_MODE_P (optab_op2_mode))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "operand 1 using scalar mode.");
+ vec_oprnd1 = op1;
+ }
+ }
+
+ if (!vec_oprnd1)
+ vec_oprnd1 = vect_get_vec_def_for_operand (op1, stmt, NULL);
}
/* Arguments are ready. create the new vector stmt. */