On Tue, Dec 09, 2014 at 08:26:56PM +0100, Marc Glisse wrote:
> >@@ -426,7 +426,8 @@ negate_expr_p (tree t)
> >
> >    case VECTOR_CST:
> >      {
> >-    if (FLOAT_TYPE_P (TREE_TYPE (type)) || TYPE_OVERFLOW_WRAPS (type))
> >+    if (FLOAT_TYPE_P (TREE_TYPE (type))
> >+        || (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type)))
> >       return true;
> 
> type is a vector type, so INTEGRAL_TYPE_P (type) is always false I think.
 
I guess that's true.

> >
> >     int count = TYPE_VECTOR_SUBPARTS (type), i;
> >@@ -558,7 +559,8 @@ fold_negate_expr (location_t loc, tree t)
> >    case INTEGER_CST:
> >      tem = fold_negate_const (t, type);
> >      if (TREE_OVERFLOW (tem) == TREE_OVERFLOW (t)
> >-      || (!TYPE_OVERFLOW_TRAPS (type)
> >+      || (INTEGRAL_TYPE_P (type)
> 
> Can that be false for an INTEGER_CST?
 
Seems that I was too eager here adding checks.  (Or maybe I really saw
an ICE here.)

> >@@ -10074,7 +10085,8 @@ fold_binary_loc (location_t loc,
> >       /* Reassociate (plus (plus (mult) (foo)) (mult)) as
> >          (plus (plus (mult) (mult)) (foo)) so that we can
> >          take advantage of the factoring cases below.  */
> >-      if (TYPE_OVERFLOW_WRAPS (type)
> >+      if (INTEGRAL_TYPE_P (type)
> >+          && TYPE_OVERFLOW_WRAPS (type)
> >           && (((TREE_CODE (arg0) == PLUS_EXPR
> >                 || TREE_CODE (arg0) == MINUS_EXPR)
> >                && TREE_CODE (arg1) == MULT_EXPR)
> 
> Is there a particular reason to disable this for vectors? Note that we are
> already in a !FLOAT_TYPE_P block.

> Again, why disable this for vectors?
> (Btw tree_unary_nonnegative_warnv_p seems wrong for ABS of an integer vector)
> 
> I am stopping here. I think by default you should allow integer vectors.
> A new macro that accepts both scalar and vector integer types would be
> helpful (like FLOAT_TYPE_P).

Yeah, let me prepare another version.  Thanks,

        Marek

Reply via email to