As seen on ia64 with some of our explicit test cases for V4SI-alike operations.
On ia64 the actual variables get instantiated in TImode, not BLKmode as bits of
this code had been assuming. By checking !vector_mode rather than for BLKmode
directly, we can decompose the V4SI shift into two V2SImode shifts.
Additionally, fix several tests using VECTOR_MODE_P when they meant
VECTOR_TYPE_P.
And since they're shifts, simplify further to VECTOR_INTEGER_TYPE_P.
Bootstrapped and checked on ia64-linux, and x86_64-linux.
r~
commit 64791788b1009469dbbb8709957c2069c77cf400
Author: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Dec 21 00:41:24 2011 +0000
Always simplify vector shifts by scalars.
Also decompose vectors in large integer modes.
* tree-vect-generic.c (expand_vector_operations_1): Correct tests
for vector types -- use the type not the mode. Fix optab selection
for vector shifts by a scalar. Handle over-large integer modes
like BLKmode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182563
138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4304d6e..fbd55ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2011-12-20 Richard Henderson <[email protected]>
+ * tree-vect-generic.c (expand_vector_operations_1): Correct tests
+ for vector types -- use the type not the mode. Fix optab selection
+ for vector shifts by a scalar. Handle over-large integer modes
+ like BLKmode.
+
+2011-12-20 Richard Henderson <[email protected]>
+
* config/arm/arm.md (*arm_xorsi3): Match iorsi3 and perform
post-reload splitting.
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index dc01ce7..469a465 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -796,10 +796,12 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
|| code == LROTATE_EXPR
|| code == RROTATE_EXPR)
{
+ optab opv;
+
/* Check whether we have vector <op> {x,x,x,x} where x
could be a scalar variable or a constant. Transform
vector <op> {x,x,x,x} ==> vector <op> scalar. */
- if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2))))
+ if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
{
tree first;
gimple def_stmt;
@@ -818,17 +820,18 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
}
}
- if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2))))
- op = optab_for_tree_code (code, type, optab_vector);
+ opv = optab_for_tree_code (code, type, optab_vector);
+ if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
+ op = opv;
else
{
op = optab_for_tree_code (code, type, optab_scalar);
/* The rtl expander will expand vector/scalar as vector/vector
if necessary. Don't bother converting the stmt here. */
- if (op == NULL
- || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
- op = optab_for_tree_code (code, type, optab_vector);
+ if (optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing
+ && optab_handler (opv, TYPE_MODE (type)) != CODE_FOR_nothing)
+ return;
}
}
else
@@ -859,14 +862,16 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
/* For very wide vectors, try using a smaller vector mode. */
compute_type = type;
- if (TYPE_MODE (type) == BLKmode && op)
+ if (!VECTOR_MODE_P (TYPE_MODE (type)) && op)
{
tree vector_compute_type
= type_for_widest_vector_mode (TYPE_MODE (TREE_TYPE (type)), op,
TYPE_SATURATING (TREE_TYPE (type)));
if (vector_compute_type != NULL_TREE
&& (TYPE_VECTOR_SUBPARTS (vector_compute_type)
- < TYPE_VECTOR_SUBPARTS (compute_type)))
+ < TYPE_VECTOR_SUBPARTS (compute_type))
+ && (optab_handler (op, TYPE_MODE (vector_compute_type))
+ != CODE_FOR_nothing))
compute_type = vector_compute_type;
}