summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-generic.c
diff options
context:
space:
mode:
authorMichael Meissner <michael.meissner@amd.com>2008-05-14 20:07:53 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2008-05-14 20:07:53 +0000
commit71d46ca56cb36baa54ec8a1de7cbc0fda9ae3245 (patch)
treeb9a9ff4a7540533104609eb87beb98cc4f84d114 /gcc/tree-vect-generic.c
parent550c9cf0fe26d6da75cfaeea41a766fe69ddee4e (diff)
downloadgcc-71d46ca56cb36baa54ec8a1de7cbc0fda9ae3245.tar.gz
Add SSE5 vector shift/rotate; Update SSE5 vector multiply
Co-Authored-By: Dwarakanath Rajagopal <dwarak.rajagopal@amd.com> Co-Authored-By: Paolo Bonzini <bonzini@gnu.org> From-SVN: r135304
Diffstat (limited to 'gcc/tree-vect-generic.c')
-rw-r--r--gcc/tree-vect-generic.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index a4026d6acf5..8313e54bdbc 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -437,7 +437,28 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
|| code == VEC_UNPACK_FLOAT_LO_EXPR)
type = TREE_TYPE (TREE_OPERAND (rhs, 0));
- op = optab_for_tree_code (code, type);
+ /* Choose between vector shift/rotate by vector and vector shift/rotate by
+ scalar */
+ if (code == LSHIFT_EXPR || code == RSHIFT_EXPR || code == LROTATE_EXPR
+ || code == RROTATE_EXPR)
+ {
+ /* If the 2nd argument is vector, we need a vector/vector shift */
+ if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (TREE_OPERAND (rhs, 1)))))
+ op = optab_for_tree_code (code, type, optab_vector);
+
+ else
+ {
+ /* Try for a vector/scalar shift, and if we don't have one, see if we
+ have a vector/vector shift */
+ op = optab_for_tree_code (code, type, optab_scalar);
+ if (!op
+ || (op->handlers[(int) TYPE_MODE (type)].insn_code
+ == CODE_FOR_nothing))
+ op = optab_for_tree_code (code, type, optab_vector);
+ }
+ }
+ else
+ op = optab_for_tree_code (code, type, optab_default);
/* For widening/narrowing vector operations, the relevant type is of the
arguments, not the widened result. VEC_UNPACK_FLOAT_*_EXPR is
@@ -458,7 +479,7 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
if (op == NULL
&& code == NEGATE_EXPR
&& INTEGRAL_TYPE_P (TREE_TYPE (type)))
- op = optab_for_tree_code (MINUS_EXPR, type);
+ op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
/* For very wide vectors, try using a smaller vector mode. */
compute_type = type;