\f
/* Negate a CONST_INT rtx, truncating (because a conversion from a
- maximally negative number can overflow). */
+ maximally negative number can overflow). */
static rtx
neg_const_int (mode, i)
enum machine_mode mode;
case SQRT:
case FLOAT_EXTEND:
case FLOAT_TRUNCATE:
+ case SS_TRUNCATE:
+ case US_TRUNCATE:
return 0;
default:
case DIV:
if (trueop1 == CONST1_RTX (mode))
- return op0;
+ {
+ /* On some platforms DIV uses narrower mode than its
+ operands. */
+ rtx x = gen_lowpart_common (mode, op0);
+ if (x)
+ return x;
+ else if (mode != GET_MODE (op0) && GET_MODE (op0) != VOIDmode)
+ return gen_lowpart_SUBREG (mode, op0);
+ else
+ return op0;
+ }
/* In IEEE floating point, 0/x is not always 0. */
if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
return op0;
break;
+ case SS_PLUS:
+ case US_PLUS:
+ case SS_MINUS:
+ case US_MINUS:
+ /* ??? There are simplifications that can be done. */
+ return 0;
+
default:
abort ();
}
if (n_ops != 7)
{
ops[n_ops].op = constm1_rtx;
- ops[n_ops].neg = this_neg;
+ ops[n_ops++].neg = this_neg;
ops[i].op = XEXP (this_op, 0);
ops[i].neg = !this_neg;
changed = 1;
&& ! (GET_CODE (tem) == CONST
&& GET_CODE (XEXP (tem, 0)) == ncode
&& XEXP (XEXP (tem, 0), 0) == lhs
- && XEXP (XEXP (tem, 0), 1) == rhs))
+ && XEXP (XEXP (tem, 0), 1) == rhs)
+ /* Don't allow -x + -1 -> ~x simplifications in the
+ first pass. This allows us the chance to combine
+ the -1 with other constants. */
+ && ! (first
+ && GET_CODE (tem) == NOT
+ && XEXP (tem, 0) == rhs))
{
lneg &= rneg;
if (GET_CODE (tem) == NEG)