summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-patterns.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-19 18:19:39 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-19 18:19:39 +0000
commite56043cd2c207982e812ce6fcecb7353dea58363 (patch)
tree01a6f37ad5a9ae6b18bdc20f052b04e19b4255c0 /gcc/tree-vect-patterns.c
parent2e02a1a4548f2ee1ea519c88e68b20621ad16fcc (diff)
downloadgcc-e56043cd2c207982e812ce6fcecb7353dea58363.tar.gz
2010-09-19 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 164348, with some improvements in gcc/melt-runtime.[ch] 2010-09-19 Basile Starynkevitch <basile@starynkevitch.net> [[merged with trunk rev.164348, so improved MELT runtime!]] * gcc/melt-runtime.h: improved comments. (melt_debug_garbcoll, melt_debuggc_eprintf): Moved from melt-runtime.c. (melt_obmag_string): New declaration. (struct meltobject_st, struct meltclosure_st, struct meltroutine_st, struct meltmixbigint_st, struct meltstring_st): using GTY variable_size and @@MELTGTY@@ comment. (melt_mark_special): added debug print. * gcc/melt-runtime.c: Improved comments. Include bversion.h, realmpfr.h, gimple-pretty-print.h. (ggc_force_collect) Declared external. (melt_forward_counter): Added. (melt_obmag_string): New function. (melt_alptr_1, melt_alptr_2, melt_break_alptr_1_at) (melt_break_alptr_2_at, melt_break_alptr_1,melt_break_alptr_1) (melt_allocate_young_gc_zone, melt_free_young_gc_zone): New. (delete_special, meltgc_make_special): Improved debug printf and use melt_break_alptr_1... (ggc_alloc_*) macros defined for backport to GCC 4.5 (melt_forwarded_copy): Don't clear the new destination zone in old GGC heap. (meltgc_add_out_raw_len): Use ggc_alloc_atomic. (meltgc_raw_new_mappointers, meltgc_raw_put_mappointers) (meltgc_raw_remove_mappointers): Corrected length argument to ggc_alloc_cleared_vec_entrypointermelt_st. (melt_really_initialize): Call melt_allocate_young_gc_zone. (melt_initialize): Set flag_plugin_added. (melt_val2passflag): TODO_verify_loops only in GCC 4.5 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@164424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r--gcc/tree-vect-patterns.c55
1 files changed, 37 insertions, 18 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 37b06330f3a..0d5824c9773 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1,5 +1,5 @@
/* Analysis Utilities for Loop Vectorization.
- Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Dorit Nuzman <dorit@il.ibm.com>
This file is part of GCC.
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "target.h"
#include "basic-block.h"
-#include "diagnostic.h"
+#include "gimple-pretty-print.h"
#include "tree-flow.h"
#include "tree-dump.h"
#include "cfgloop.h"
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-data-ref.h"
#include "tree-vectorizer.h"
#include "recog.h"
+#include "diagnostic-core.h"
#include "toplev.h"
/* Function prototypes */
@@ -254,6 +255,11 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
prod_type = half_type;
stmt = SSA_NAME_DEF_STMT (oprnd0);
+
+ /* It could not be the dot_prod pattern if the stmt is outside the loop. */
+ if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
+ return NULL;
+
/* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi
inside the loop (in case we are analyzing an outer-loop). */
if (!is_gimple_assign (stmt))
@@ -362,7 +368,7 @@ vect_recog_widen_mult_pattern (gimple last_stmt,
tree oprnd0, oprnd1;
tree type, half_type0, half_type1;
gimple pattern_stmt;
- tree vectype;
+ tree vectype, vectype_out;
tree dummy;
tree var;
enum tree_code dummy_code;
@@ -405,14 +411,16 @@ vect_recog_widen_mult_pattern (gimple last_stmt,
/* Check target support */
vectype = get_vectype_for_scalar_type (half_type0);
+ vectype_out = get_vectype_for_scalar_type (type);
if (!vectype
- || !supportable_widening_operation (WIDEN_MULT_EXPR, last_stmt, vectype,
+ || !supportable_widening_operation (WIDEN_MULT_EXPR, last_stmt,
+ vectype_out, vectype,
&dummy, &dummy, &dummy_code,
&dummy_code, &dummy_int, &dummy_vec))
return NULL;
*type_in = vectype;
- *type_out = NULL_TREE;
+ *type_out = vectype_out;
/* Pattern supported. Create a stmt to be used to replace the pattern: */
var = vect_recog_temp_ssa_var (type, NULL);
@@ -668,6 +676,8 @@ vect_pattern_recog_1 (
tree pattern_vectype;
tree type_in, type_out;
enum tree_code code;
+ int i;
+ gimple next;
pattern_stmt = (* vect_recog_func) (stmt, &type_in, &type_out);
if (!pattern_stmt)
@@ -677,7 +687,9 @@ vect_pattern_recog_1 (
{
/* No need to check target support (already checked by the pattern
recognition function). */
- pattern_vectype = type_in;
+ if (type_out)
+ gcc_assert (VECTOR_MODE_P (TYPE_MODE (type_out)));
+ pattern_vectype = type_out ? type_out : type_in;
}
else
{
@@ -686,9 +698,16 @@ vect_pattern_recog_1 (
optab optab;
/* Check target support */
- pattern_vectype = get_vectype_for_scalar_type (type_in);
- if (!pattern_vectype)
- return;
+ type_in = get_vectype_for_scalar_type (type_in);
+ if (!type_in)
+ return;
+ if (type_out)
+ type_out = get_vectype_for_scalar_type (type_out);
+ else
+ type_out = type_in;
+ if (!type_out)
+ return;
+ pattern_vectype = type_out;
if (is_gimple_assign (pattern_stmt))
code = gimple_assign_rhs_code (pattern_stmt);
@@ -698,15 +717,11 @@ vect_pattern_recog_1 (
code = CALL_EXPR;
}
- optab = optab_for_tree_code (code, pattern_vectype, optab_default);
- vec_mode = TYPE_MODE (pattern_vectype);
+ optab = optab_for_tree_code (code, type_in, optab_default);
+ vec_mode = TYPE_MODE (type_in);
if (!optab
- || (icode = optab_handler (optab, vec_mode)->insn_code) ==
- CODE_FOR_nothing
- || (type_out
- && (!get_vectype_for_scalar_type (type_out)
- || (insn_data[icode].operand[0].mode !=
- TYPE_MODE (get_vectype_for_scalar_type (type_out))))))
+ || (icode = optab_handler (optab, vec_mode)) == CODE_FOR_nothing
+ || (insn_data[icode].operand[0].mode != TYPE_MODE (type_out)))
return;
}
@@ -729,7 +744,11 @@ vect_pattern_recog_1 (
STMT_VINFO_IN_PATTERN_P (stmt_info) = true;
STMT_VINFO_RELATED_STMT (stmt_info) = pattern_stmt;
- return;
+ /* Patterns cannot be vectorized using SLP, because they change the order of
+ computation. */
+ FOR_EACH_VEC_ELT (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i, next)
+ if (next == stmt)
+ VEC_ordered_remove (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i);
}