This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] vectorizing conditional expressions (PR tree-optimization/65947)


Just one very small point...

On 19/10/15 09:17, Alan Hayward wrote:

> -  if (check_reduction
> -      && (!commutative_tree_code (code) || !associative_tree_code (code)))
> +  if (check_reduction)
>      {
> -      if (dump_enabled_p ())
> -        report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt,
> -			"reduction: not commutative/associative: ");
> -      return NULL;
> +      if (code != COND_EXPR
> +	  && (!commutative_tree_code (code) || !associative_tree_code (code)))
> +	{
> +	  if (dump_enabled_p ())
> +	    report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt,
> +			    "reduction: not commutative/associative: ");
> +	  return NULL;
> +	}
> +
> +      if (code == COND_EXPR)
> +	*v_reduc_type = COND_REDUCTION;

Wouldn't this be easier written as

if (code == COND_EXPR)
  *v_reduc_type = COND_REDUCTION;
else if (!commutative_tree_code (code) || !associative_tree_code (code))
  {...}

? Your call!

Cheers, Alan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]