This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add VEC_COND_EXPR node
- From: Roger Sayle <roger at eyesopen dot com>
- To: Devang Patel <dpatel at apple dot com>, Richard Henderson <rth at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 21 Sep 2004 20:17:21 -0600 (MDT)
- Subject: Re: [PATCH] Add VEC_COND_EXPR node
On Tue, 21 Sep 2004, Richard Henderson wrote:
> On Thu, Sep 16, 2004 at 09:47:49AM -0700, Devang Patel wrote:
> > + DEFTREECODE (VEC_COND_EXPR, "cond_expr", 'e', 3)
> ^^^
> typo.
>
> Otherwise ok.
Hi Devang,
Would it possible to add some documentation for vec_cond_expr to
c-tree.texi? I'm a bit concerned about the change of sematics for
the Boolean expressions that serve as the initial operand of ?:.
For example, previously Boolean expression always returned a
scalar Boolean value but in the new scheme they return the equivalent
of a vector of Bool.
Hence if A = VEC_COND_EXPR ( X < Y, B, C )
means for(i=0; i<N; i++) A[i] = X[i] < Y[i] ? B[i] : C[i];
then we'll run into problems with EQ_EXPR and NE_EXPR when X and Y
are vector constants. Equality and inequality is already defined
for vectors, even though the other relational operators aren't.
A = VEC_COND_EXPR (X == Y, B, C)
probably intends to mean:
for(i=0; i<N; i++) A[i] = X[i] == Y[i] ? B[i] : C[i];
but if tree-ssa propagates VECTOR_CSTS into the equality expression,
we may constant fold the equality operator to false, based upon whether
any of the elements of VECTOR_CST X differs from VECTOR_CST Y.
A = VEC_COND_EXPR (false, B, C)
which ultimately, one would hope would be folded to A = C.
My apologies if these issues were considered and resolved when this
topic was discussed on the gcc list, but unfortunately keeping up
with gcc-patches is hard enough. Has anyone considered VEC_LT_EXPR,
VEC_GE_EXPR, VEC_EQ_EXPR, etc...?
Roger
--