summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-transform.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-28 07:33:11 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-28 07:33:11 +0000
commita75805eb0744ed246089823f3c9b77f6e890e9a0 (patch)
treea76aa441f59535fd8bdbfeb92703378a73e5d240 /gcc/tree-vect-transform.c
parent41b1d2cc881aff58b11757d5408abd2a60251d9c (diff)
downloadgcc-a75805eb0744ed246089823f3c9b77f6e890e9a0.tar.gz
* tree-vect-transform.c (get_initial_def_for_reduction): Use correct
type for DEF and INIT_VAL. Pretend MIN/MAX need epilogue adjustment. * gcc.dg/vect/vect-reduc-1.c: Adjust test to properly validate MIN. * gcc.dg/vect/vect-reduc-1char.c: Likewise. * gcc.dg/vect/vect-reduc-1short.c: Likewise. * gcc.dg/vect/vect-reduc-2.c: Likewise. * gcc.dg/vect/vect-reduc-2char.c: Likewise. * gcc.dg/vect/vect-reduc-2short.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101374 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-transform.c')
-rw-r--r--gcc/tree-vect-transform.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index cdd3acfbb68..852ff19033c 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -727,8 +727,11 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *scalar_def)
switch (code)
{
case PLUS_EXPR:
- def = INTEGRAL_TYPE_P (type) ? integer_zero_node :
- build_real (type, dconst0);
+ if (INTEGRAL_TYPE_P (type))
+ def = build_int_cst (type, 0);
+ else
+ def = build_real (type, dconst0);
+
#ifdef ADJUST_IN_EPILOG
/* All the 'nunits' elements are set to 0. The final result will be
adjusted by 'init_val' at the loop epilog. */
@@ -746,7 +749,7 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *scalar_def)
case MAX_EXPR:
def = init_val;
nelements = nunits;
- need_epilog_adjust = false;
+ need_epilog_adjust = true;
break;
default:
@@ -754,9 +757,7 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *scalar_def)
}
for (i = nelements - 1; i >= 0; --i)
- {
- t = tree_cons (NULL_TREE, def, t);
- }
+ t = tree_cons (NULL_TREE, def, t);
if (nelements == nunits - 1)
{
@@ -771,11 +772,15 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *scalar_def)
else
vec = build_constructor (vectype, t);
- if (need_epilog_adjust)
- *scalar_def = init_val;
- else
- *scalar_def = INTEGRAL_TYPE_P (type) ? integer_zero_node
- : build_real (type, dconst0);
+ if (!need_epilog_adjust)
+ {
+ if (INTEGRAL_TYPE_P (type))
+ init_val = build_int_cst (type, 0);
+ else
+ init_val = build_real (type, dconst0);
+ }
+ *scalar_def = init_val;
+
return vect_init_vector (stmt, vec);
}