+2007-02-11 Roger Sayle <roger@eyesopen.com>
+
+ * simplify-rtx.c (simplify_relational_operation_1): Optimize
+ comparisons of POPCOUNT against zero.
+ (simplify_const_relational_operation): Likewise.
+
2007-02-11 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* doc/invoke.texi (Wextra): Delete outdated paragraph.
simplify_gen_binary (XOR, cmp_mode,
XEXP (op0, 1), op1));
+ if (op0code == POPCOUNT && op1 == const0_rtx)
+ switch (code)
+ {
+ case EQ:
+ case LE:
+ case LEU:
+ /* (eq (popcount x) (const_int 0)) -> (eq x (const_int 0)). */
+ return simplify_gen_relational (EQ, mode, GET_MODE (XEXP (op0, 0)),
+ XEXP (op0, 0), const0_rtx);
+
+ case NE:
+ case GT:
+ case GTU:
+ /* (ne (popcount x) (const_int 0)) -> (ne x (const_int 0)). */
+ return simplify_gen_relational (EQ, mode, GET_MODE (XEXP (op0, 0)),
+ XEXP (op0, 0), const0_rtx);
+
+ default:
+ break;
+ }
+
return NULL_RTX;
}
if (GET_CODE (tem) == ABS)
return const0_rtx;
}
+
+ /* Optimize popcount (x) < 0. */
+ if (GET_CODE (trueop0) == POPCOUNT && trueop1 == const0_rtx)
+ return const_true_rtx;
break;
case GE:
if (GET_CODE (tem) == ABS)
return const_true_rtx;
}
+
+ /* Optimize popcount (x) >= 0. */
+ if (GET_CODE (trueop0) == POPCOUNT && trueop1 == const0_rtx)
+ return const_true_rtx;
break;
case UNGE:
+2007-02-11 Roger Sayle <roger@eyesopen.com>
+
+ * gcc.target/ia64/builtin-popcount-1.c: New test case.
+ * gcc.target/ia64/builtin-popcount-2.c: Likewise.
+
2007-02-11 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/30478