if (TREE_CODE (arg0) == BIT_XOR_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0))
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0),
- build_int_cst (TREE_TYPE (arg0), 0));
+ build_zero_cst (TREE_TYPE (arg0)));
/* Likewise (X ^ Y) == X becomes Y == 0. X has no side-effects. */
if (TREE_CODE (arg0) == BIT_XOR_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)
&& reorder_operands_p (TREE_OPERAND (arg0, 1), arg1))
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 1),
- build_int_cst (TREE_TYPE (arg0), 0));
+ build_zero_cst (TREE_TYPE (arg0)));
/* (X ^ C1) op C2 can be rewritten as X op (C1 ^ C2). */
if (TREE_CODE (arg0) == BIT_XOR_EXPR
BIT_XOR_EXPR, itype,
arg00, arg10),
arg01),
- build_int_cst (itype, 0));
+ build_zero_cst (itype));
if (operand_equal_p (arg01, arg10, 0))
return fold_build2_loc (loc, code, type,
BIT_XOR_EXPR, itype,
arg00, arg11),
arg01),
- build_int_cst (itype, 0));
+ build_zero_cst (itype));
if (operand_equal_p (arg00, arg11, 0))
return fold_build2_loc (loc, code, type,
BIT_XOR_EXPR, itype,
arg01, arg10),
arg00),
- build_int_cst (itype, 0));
+ build_zero_cst (itype));
if (operand_equal_p (arg00, arg10, 0))
return fold_build2_loc (loc, code, type,
BIT_XOR_EXPR, itype,
arg01, arg11),
arg00),
- build_int_cst (itype, 0));
+ build_zero_cst (itype));
}
if (TREE_CODE (arg0) == BIT_XOR_EXPR
--- /dev/null
+/* PR tree-optimization/53410 */
+
+typedef int V __attribute__((vector_size (4 * sizeof (int))));
+typedef unsigned int W __attribute__((vector_size (4 * sizeof (int))));
+
+void
+f1 (V *p)
+{
+ *p = (*p & ((V) { 1, 1, 1, 1 })) ^ ((V) { 1, 1, 1, 1});
+}
+
+void
+f2 (V *p)
+{
+ *p = (*p ^ ((V) { 1, 1, 1, 1 })) & ((V) { 1, 1, 1, 1});
+}
+
+void
+f3 (V *p)
+{
+ *p = (~*p) & ((V) { 1, 1, 1, 1 });
+}
+
+void
+f4 (V *p, V *q)
+{
+ *p = (*p ^ *q) == *q;
+}
+
+void
+f5 (V *p, V *q)
+{
+ *p = (*p ^ *q) == *p;
+}
+
+void
+f6 (V *p, V *q, V *r)
+{
+ *p = (*p & *r) == (*q & *r);
+}
+
+void
+f7 (V *p, V *q, V *r)
+{
+ *p = (*p & *r) == (*r & *q);
+}
+
+void
+f8 (V *p, V *q, V *r)
+{
+ *p = (*r & *p) == (*q & *r);
+}
+
+void
+f9 (V *p, V *q, V *r)
+{
+ *p = (*r & *p) == (*r & *q);
+}
+
+void
+f10 (W *p, W *q)
+{
+ *p = *p < (((const W) { 1U, 1U, 1U, 1U }) << *q);
+}