From 79d652a570805345efea0ee370c0f7f07eada78c Mon Sep 17 00:00:00 2001 From: Cong Hou Date: Tue, 24 Jun 2014 22:58:43 -0400 Subject: tree-vect-patterns.c (vect_recog_sad_pattern): New function for SAD pattern recognition. 2014-06-24 Cong Hou * tree-vect-patterns.c (vect_recog_sad_pattern): New function for SAD pattern recognition. (type_conversion_p): PROMOTION is true if it's a type promotion conversion, and false otherwise. Return true if the given expression is a type conversion one. * tree-vectorizer.h: Adjust the number of patterns. * tree.def: Add SAD_EXPR. * optabs.def: Add sad_optab. * cfgexpand.c (expand_debug_expr): Add SAD_EXPR case. * expr.c (expand_expr_real_2): Likewise. * gimple-pretty-print.c (dump_ternary_rhs): Likewise. * gimple.c (get_gimple_rhs_num_ops): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-cfg.c (estimate_operator_cost): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-loop.c (get_initial_def_for_reduction): Likewise. * config/i386/sse.md: Add SSE2 and AVX2 expand for SAD. * doc/generic.texi: Add document for SAD_EXPR. * doc/md.texi: Add document for ssad and usad. 2014-06-24 Cong Hou * gcc.dg/vect/vect-reduc-sad.c: New. * lib/target-supports.exp (check_effective_target_vect_usad_char): New. From-SVN: r211966 --- gcc/tree.def | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gcc/tree.def') diff --git a/gcc/tree.def b/gcc/tree.def index 299aacc..84ffe93 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -1185,6 +1185,22 @@ DEFTREECODE (DOT_PROD_EXPR, "dot_prod_expr", tcc_expression, 3) with the second argument. */ DEFTREECODE (WIDEN_SUM_EXPR, "widen_sum_expr", tcc_binary, 2) +/* Widening sad (sum of absolute differences). + The first two arguments are of type t1 which should be integer. + The third argument and the result are of type t2, such that t2 is at least + twice the size of t1. Like DOT_PROD_EXPR, SAD_EXPR (arg1,arg2,arg3) is + equivalent to (note we don't have WIDEN_MINUS_EXPR now, but we assume its + behavior is similar to WIDEN_SUM_EXPR): + tmp = WIDEN_MINUS_EXPR (arg1, arg2) + tmp2 = ABS_EXPR (tmp) + arg3 = PLUS_EXPR (tmp2, arg3) + or: + tmp = WIDEN_MINUS_EXPR (arg1, arg2) + tmp2 = ABS_EXPR (tmp) + arg3 = WIDEN_SUM_EXPR (tmp2, arg3) + */ +DEFTREECODE (SAD_EXPR, "sad_expr", tcc_expression, 3) + /* Widening multiplication. The two arguments are of type t1. The result is of type t2, such that t2 is at least twice -- cgit v1.1