break;
case FFS:
- /* (ffs (*_extend <X>)) = (ffs <X>) */
+ /* (ffs (*_extend <X>)) = (*_extend (ffs <X>)). */
if (GET_CODE (op) == SIGN_EXTEND
|| GET_CODE (op) == ZERO_EXTEND)
- return simplify_gen_unary (FFS, mode, XEXP (op, 0),
- GET_MODE (XEXP (op, 0)));
+ {
+ temp = simplify_gen_unary (FFS, GET_MODE (XEXP (op, 0)),
+ XEXP (op, 0), GET_MODE (XEXP (op, 0)));
+ return simplify_gen_unary (GET_CODE (op), mode, temp,
+ GET_MODE (temp));
+ }
break;
case POPCOUNT:
switch (GET_CODE (op))
{
case BSWAP:
- case ZERO_EXTEND:
- /* (popcount (zero_extend <X>)) = (popcount <X>) */
+ /* (popcount (bswap <X>)) = (popcount <X>). */
return simplify_gen_unary (POPCOUNT, mode, XEXP (op, 0),
GET_MODE (XEXP (op, 0)));
+ case ZERO_EXTEND:
+ /* (popcount (zero_extend <X>)) = (zero_extend (popcount <X>)). */
+ temp = simplify_gen_unary (POPCOUNT, GET_MODE (XEXP (op, 0)),
+ XEXP (op, 0), GET_MODE (XEXP (op, 0)));
+ return simplify_gen_unary (ZERO_EXTEND, mode, temp,
+ GET_MODE (temp));
+
case ROTATE:
case ROTATERT:
/* Rotations don't affect popcount. */
{
case NOT:
case BSWAP:
- case ZERO_EXTEND:
- case SIGN_EXTEND:
return simplify_gen_unary (PARITY, mode, XEXP (op, 0),
GET_MODE (XEXP (op, 0)));
+ case ZERO_EXTEND:
+ case SIGN_EXTEND:
+ temp = simplify_gen_unary (PARITY, GET_MODE (XEXP (op, 0)),
+ XEXP (op, 0), GET_MODE (XEXP (op, 0)));
+ return simplify_gen_unary (GET_CODE (op), mode, temp,
+ GET_MODE (temp));
+
case ROTATE:
case ROTATERT:
/* Rotations don't affect parity. */