===================================================================
@@ -1714,12 +1714,25 @@ integer_zerop (const_tree expr)
{
STRIP_NOPS (expr);
- return ((TREE_CODE (expr) == INTEGER_CST
- && TREE_INT_CST_LOW (expr) == 0
- && TREE_INT_CST_HIGH (expr) == 0)
- || (TREE_CODE (expr) == COMPLEX_CST
- && integer_zerop (TREE_REALPART (expr))
- && integer_zerop (TREE_IMAGPART (expr))));
+ switch (TREE_CODE (expr))
+ {
+ case INTEGER_CST:
+ return (TREE_INT_CST_LOW (expr) == 0
+ && TREE_INT_CST_HIGH (expr) == 0);
+ case COMPLEX_CST:
+ return (integer_zerop (TREE_REALPART (expr))
+ && integer_zerop (TREE_IMAGPART (expr)));
+ case VECTOR_CST:
+ {
+ tree elt;
+ for (elt = TREE_VECTOR_CST_ELTS (expr); elt; elt = TREE_CHAIN (elt))
+ if (!integer_zerop (TREE_VALUE (elt)))
+ return false;
+ return true;
+ }
+ default:
+ return false;
+ }
}
/* Return 1 if EXPR is the integer constant one or the corresponding
@@ -1730,12 +1743,25 @@ integer_onep (const_tree expr)
{
STRIP_NOPS (expr);
- return ((TREE_CODE (expr) == INTEGER_CST
- && TREE_INT_CST_LOW (expr) == 1
- && TREE_INT_CST_HIGH (expr) == 0)
- || (TREE_CODE (expr) == COMPLEX_CST
- && integer_onep (TREE_REALPART (expr))
- && integer_zerop (TREE_IMAGPART (expr))));
+ switch (TREE_CODE (expr))
+ {
+ case INTEGER_CST:
+ return (TREE_INT_CST_LOW (expr) == 1
+ && TREE_INT_CST_HIGH (expr) == 0);
+ case COMPLEX_CST:
+ return (integer_onep (TREE_REALPART (expr))
+ && integer_zerop (TREE_IMAGPART (expr)));
+ case VECTOR_CST:
+ {
+ tree elt;
+ for (elt = TREE_VECTOR_CST_ELTS (expr); elt; elt = TREE_CHAIN (elt))
+ if (!integer_onep (TREE_VALUE (elt)))
+ return false;
+ return true;
+ }
+ default:
+ return false;
+ }
}
/* Return 1 if EXPR is an integer containing all 1's in as much precision as
@@ -1754,6 +1780,15 @@ integer_all_onesp (const_tree expr)
&& integer_zerop (TREE_IMAGPART (expr)))
return 1;
+ else if (TREE_CODE (expr) == VECTOR_CST)
+ {
+ tree elt;
+ for (elt = TREE_VECTOR_CST_ELTS (expr); elt; elt = TREE_CHAIN (elt))
+ if (!integer_all_onesp (TREE_VALUE (elt)))
+ return 0;
+ return 1;
+ }
+
else if (TREE_CODE (expr) != INTEGER_CST)
return 0;