This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Changes for if-convert to recognize simple conditional reduction.
- From: Richard Henderson <rth at redhat dot com>
- To: Yuri Rumyantsev <ysrumyan at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Igor Zamyatin <izamyatin at gmail dot com>
- Date: Mon, 28 Apr 2014 13:05:21 -0700
- Subject: Re: Changes for if-convert to recognize simple conditional reduction.
- Authentication-results: sourceware.org; auth=none
- References: <CAEoMCqR1=M6rzTMjVLEpuK1HPdq=vyG_cCGSQy-wWiNmUecZFQ at mail dot gmail dot com>
On 04/17/2014 06:09 AM, Yuri Rumyantsev wrote:
> + /* Build cond expression using COND and constant operand
> + of reduction rhs. */
> + c = fold_build_cond_expr (TREE_TYPE (rhs1),
> + unshare_expr (cond),
> + swap? zero: op1,
> + swap? op1: zero);
Do we recognize somewhere the canonical value for the comparison is -1, and
simplify this further?
E.g.
if (A[i] != 0) num += 1;
_vec_cmp = (_vec_A != _vec_ZERO);
_vec_num -= _vec_cmp;
if (A[i] != 0) num += x;
_vec_cmp = (_vec_A != _vec_ZERO);
_vec_cmp *= _vec_x;
_vec_num -= _vec_cmp;
r~