This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][RFC] Allow element-size vector shifts of float vectors
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 Apr 2009 17:11:36 +0200 (CEST)
- Subject: [PATCH][RFC] Allow element-size vector shifts of float vectors
On ppc fast-math-vect-reduc-5.c for example ICEs with
fast-math-vect-reduc-5.c:13: error: type mismatch in vector shift
expression
vector float
vector float
unsigned int
vect_var_.61_95 = vect_var_.59_94 v>> 64;
in general vector shifts of floating point vectors do not make sense.
In absence of any generic tree level vector permutation / extraction
machinery the following patch allows these shifts if the shifting
amount results in a permutation of the elements.
Bootstrap and regtest in progress.
Richard.
2009-04-29 Richard Guenther <rguenther@suse.de>
* tree-cfg.c (verify_gimple_assign_binary): Allow vector
shifts of floating point vectors if the shift amount is
a constant multiple of the element size.
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c (revision 146972)
--- gcc/tree-cfg.c (working copy)
*************** verify_gimple_assign_binary (gimple stmt
*** 3560,3566 ****
{
if (TREE_CODE (rhs1_type) != VECTOR_TYPE
|| !(INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
! || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type)))
|| (!INTEGRAL_TYPE_P (rhs2_type)
&& (TREE_CODE (rhs2_type) != VECTOR_TYPE
|| !INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type))))
--- 3560,3567 ----
{
if (TREE_CODE (rhs1_type) != VECTOR_TYPE
|| !(INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
! || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type))
! || SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type)))
|| (!INTEGRAL_TYPE_P (rhs2_type)
&& (TREE_CODE (rhs2_type) != VECTOR_TYPE
|| !INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type))))
*************** verify_gimple_assign_binary (gimple stmt
*** 3572,3577 ****
--- 3573,3588 ----
debug_generic_expr (rhs2_type);
return true;
}
+ /* For shifting a vector of floating point components we
+ only allow shifting by a constant multiple of the element size. */
+ if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type))
+ && (TREE_CODE (rhs2) != INTEGER_CST
+ || !div_if_zero_remainder (EXACT_DIV_EXPR, rhs2,
+ TYPE_SIZE (TREE_TYPE (rhs1_type)))))
+ {
+ error ("non-element sized vector shift of floating point vector");
+ return true;
+ }
return false;
}