On Wed, 17 Aug 2011, Artem Shinkarov wrote:

> +For the convenience condition in the vector conditional can be just a
> +vector of signed integer type. In that case this vector is implicitly
> +compared with vectors of zeroes. Consider an example:

Where is this bit tested in the testcases added?

> +      if (TREE_CODE (type1) != VECTOR_TYPE
> +       || TREE_CODE (type2) != VECTOR_TYPE)
> +        {
> +          error_at (colon_loc, "vector comparisom arguments must be of "
> +                               "type vector");

"comparison"

> +      /* Avoid C_MAYBE_CONST in VEC_COND_EXPR.  */
> +      sc = c_fully_fold (ifexp, false, &maybe_const);
> +      sc = save_expr (sc);
> +      if (!maybe_const)
> +     ifexp = c_wrap_maybe_const (sc, true);
> +      else
> +     ifexp = sc;

This looks like it's duplicating c_save_expr; that is, like "ifexp = 
c_save_expr (ifexp);" would suffice.

But, it's not clear that it actually achieves the effect described in the 
comment; have you actually tried with function calls, assignments etc. in 
the operands?  The code in build_binary_op uses save_expr rather than 
c_save_expr because it does some intermediate operations before calling 
c_wrap_maybe_const, and if you really want to avoid C_MAYBE_CONST in 
VEC_COND_EXPR then you'll need to continue calling save_expr, as here, but 
delay the call to c_wrap_maybe_const so that the whole VEC_COND_EXPR is 
wrapped if required.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to