diff options
author | Richard Biener <rguenther@suse.de> | 2015-12-18 13:52:11 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-12-18 13:52:11 +0000 |
commit | 0bee0ef9b10dbf100454f792f395bd06bc5df3b0 (patch) | |
tree | 1d66c9a5f8c266d23958ed0591b8399a8418b57f /gcc/tree-vect-patterns.c | |
parent | 3f12f020c62b9f460febb59053e312f5ff298bec (diff) | |
download | gcc-0bee0ef9b10dbf100454f792f395bd06bc5df3b0.zip gcc-0bee0ef9b10dbf100454f792f395bd06bc5df3b0.tar.gz gcc-0bee0ef9b10dbf100454f792f395bd06bc5df3b0.tar.bz2 |
re PR testsuite/68776 (gcc.dg/vect/vect-widen-mult-const-[su]16.c failures since r226675)
2015-12-18 Richard Biener <rguenther@suse.de>
PR testsuite/68776
* tree-vect-patterns.c (struct vect_recog_func): New.
(vect_vect_recog_func_ptrs): Make an array of function name pairs.
(vect_pattern_recog_1): Print the recognized pattern name. Return
true if a pattern was recognized.
(vect_pattern_recog): Adjust. Stop iterating over pattern recognition
functions on a stmt if a pattern was recognized.
* gcc.dg/vect/vect-widen-mult-const-s16.c: Adjust.
* gcc.dg/vect/vect-widen-mult-const-u16.c: Likewise.
From-SVN: r231815
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 4b225fb..8deeedc 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -69,21 +69,28 @@ static gimple *vect_recog_mixed_size_cond_pattern (vec<gimple *> *, tree *, tree *); static gimple *vect_recog_bool_pattern (vec<gimple *> *, tree *, tree *); static gimple *vect_recog_mask_conversion_pattern (vec<gimple *> *, tree *, tree *); -static vect_recog_func_ptr vect_vect_recog_func_ptrs[NUM_PATTERNS] = { - vect_recog_widen_mult_pattern, - vect_recog_widen_sum_pattern, - vect_recog_dot_prod_pattern, - vect_recog_sad_pattern, - vect_recog_pow_pattern, - vect_recog_widen_shift_pattern, - vect_recog_over_widening_pattern, - vect_recog_rotate_pattern, - vect_recog_vector_vector_shift_pattern, - vect_recog_divmod_pattern, - vect_recog_mult_pattern, - vect_recog_mixed_size_cond_pattern, - vect_recog_bool_pattern, - vect_recog_mask_conversion_pattern}; + +struct vect_recog_func +{ + vect_recog_func_ptr fn; + const char *name; +}; +static vect_recog_func vect_vect_recog_func_ptrs[NUM_PATTERNS] = { + { vect_recog_widen_mult_pattern, "widen_mult" }, + { vect_recog_widen_sum_pattern, "widen_sum" }, + { vect_recog_dot_prod_pattern, "dot_prod" }, + { vect_recog_sad_pattern, "sad" }, + { vect_recog_pow_pattern, "pow" }, + { vect_recog_widen_shift_pattern, "widen_shift" }, + { vect_recog_over_widening_pattern, "over_widening" }, + { vect_recog_rotate_pattern, "rotate" }, + { vect_recog_vector_vector_shift_pattern, "vector_vector_shift" }, + { vect_recog_divmod_pattern, "divmod" }, + { vect_recog_mult_pattern, "mult" }, + { vect_recog_mixed_size_cond_pattern, "mixed_size_cond" }, + { vect_recog_bool_pattern, "bool" }, + { vect_recog_mask_conversion_pattern, "mask_conversion" } +}; static inline void append_pattern_def_seq (stmt_vec_info stmt_info, gimple *stmt) @@ -3791,8 +3798,8 @@ vect_mark_pattern_stmts (gimple *orig_stmt, gimple *pattern_stmt, This function also does some bookkeeping, as explained in the documentation for vect_recog_pattern. */ -static void -vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, +static bool +vect_pattern_recog_1 (vect_recog_func *recog_func, gimple_stmt_iterator si, vec<gimple *> *stmts_to_replace) { @@ -3807,9 +3814,9 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, stmts_to_replace->truncate (0); stmts_to_replace->quick_push (stmt); - pattern_stmt = (* vect_recog_func) (stmts_to_replace, &type_in, &type_out); + pattern_stmt = recog_func->fn (stmts_to_replace, &type_in, &type_out); if (!pattern_stmt) - return; + return false; stmt = stmts_to_replace->last (); stmt_info = vinfo_for_stmt (stmt); @@ -3831,13 +3838,13 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, /* Check target support */ type_in = get_vectype_for_scalar_type (type_in); if (!type_in) - return; + return false; if (type_out) type_out = get_vectype_for_scalar_type (type_out); else type_out = type_in; if (!type_out) - return; + return false; pattern_vectype = type_out; if (is_gimple_assign (pattern_stmt)) @@ -3853,14 +3860,14 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, if (!optab || (icode = optab_handler (optab, vec_mode)) == CODE_FOR_nothing || (insn_data[icode].operand[0].mode != TYPE_MODE (type_out))) - return; + return false; } /* Found a vectorizable pattern. */ if (dump_enabled_p ()) { dump_printf_loc (MSG_NOTE, vect_location, - "pattern recognized: "); + "%s pattern recognized: ", recog_func->name); dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0); } @@ -3892,6 +3899,8 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, vect_mark_pattern_stmts (stmt, pattern_stmt, NULL_TREE); } + + return true; } @@ -3980,7 +3989,6 @@ vect_pattern_recog (vec_info *vinfo) unsigned int nbbs; gimple_stmt_iterator si; unsigned int i, j; - vect_recog_func_ptr vect_recog_func; auto_vec<gimple *, 1> stmts_to_replace; gimple *stmt; @@ -4003,11 +4011,9 @@ vect_pattern_recog (vec_info *vinfo) { /* Scan over all generic vect_recog_xxx_pattern functions. */ for (j = 0; j < NUM_PATTERNS; j++) - { - vect_recog_func = vect_vect_recog_func_ptrs[j]; - vect_pattern_recog_1 (vect_recog_func, si, - &stmts_to_replace); - } + if (vect_pattern_recog_1 (&vect_vect_recog_func_ptrs[j], si, + &stmts_to_replace)) + break; } } } @@ -4024,11 +4030,9 @@ vect_pattern_recog (vec_info *vinfo) /* Scan over all generic vect_recog_xxx_pattern functions. */ for (j = 0; j < NUM_PATTERNS; j++) - { - vect_recog_func = vect_vect_recog_func_ptrs[j]; - vect_pattern_recog_1 (vect_recog_func, si, - &stmts_to_replace); - } + if (vect_pattern_recog_1 (&vect_vect_recog_func_ptrs[j], si, + &stmts_to_replace)) + break; } } } |