Commit 3ad2180a by Richard Kenner

(subst, apply_distributive_law): Use INTEGRAL_MODE_P and FLOAT_MODE_P.

(reversible_comparison_p): Likewise.
Can reverse if MODE_COMPLEX_INT or MODE_PARTIAL_INT.

From-SVN: r4779
parent ae1ae48c
...@@ -2945,7 +2945,7 @@ subst (x, from, to, in_dest, unique_copy) ...@@ -2945,7 +2945,7 @@ subst (x, from, to, in_dest, unique_copy)
|| code == MULT || code == AND || code == IOR || code == XOR || code == MULT || code == AND || code == IOR || code == XOR
|| code == DIV || code == UDIV || code == DIV || code == UDIV
|| code == SMAX || code == SMIN || code == UMAX || code == UMIN) || code == SMAX || code == SMIN || code == UMAX || code == UMIN)
&& GET_MODE_CLASS (mode) == MODE_INT) && INTEGRAL_MODE_P (mode))
{ {
if (GET_CODE (XEXP (x, 0)) == code) if (GET_CODE (XEXP (x, 0)) == code)
{ {
...@@ -3235,7 +3235,7 @@ subst (x, from, to, in_dest, unique_copy) ...@@ -3235,7 +3235,7 @@ subst (x, from, to, in_dest, unique_copy)
/* (neg (minus X Y)) can become (minus Y X). */ /* (neg (minus X Y)) can become (minus Y X). */
if (GET_CODE (XEXP (x, 0)) == MINUS if (GET_CODE (XEXP (x, 0)) == MINUS
&& (GET_MODE_CLASS (mode) != MODE_FLOAT && (! FLOAT_MODE_P (mode)
/* x-y != -(y-x) with IEEE floating point. */ /* x-y != -(y-x) with IEEE floating point. */
|| TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)) || TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT))
{ {
...@@ -3330,7 +3330,7 @@ subst (x, from, to, in_dest, unique_copy) ...@@ -3330,7 +3330,7 @@ subst (x, from, to, in_dest, unique_copy)
/* In IEEE floating point, x-0 is not the same as x. */ /* In IEEE floating point, x-0 is not the same as x. */
if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
|| GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_INT) || ! FLOAT_MODE_P (GET_MODE (XEXP (x, 0))))
&& XEXP (x, 1) == CONST0_RTX (GET_MODE (XEXP (x, 0)))) && XEXP (x, 1) == CONST0_RTX (GET_MODE (XEXP (x, 0))))
return XEXP (x, 0); return XEXP (x, 0);
break; break;
...@@ -3703,7 +3703,7 @@ subst (x, from, to, in_dest, unique_copy) ...@@ -3703,7 +3703,7 @@ subst (x, from, to, in_dest, unique_copy)
/* Look for MIN or MAX. */ /* Look for MIN or MAX. */
if (GET_MODE_CLASS (mode) == MODE_INT if (! FLOAT_MODE_P (mode)
&& GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<' && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
&& rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)) && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1))
&& rtx_equal_p (XEXP (XEXP (x, 0), 1), XEXP (x, 2)) && rtx_equal_p (XEXP (XEXP (x, 0), 1), XEXP (x, 2))
...@@ -5773,7 +5773,7 @@ apply_distributive_law (x) ...@@ -5773,7 +5773,7 @@ apply_distributive_law (x)
/* Distributivity is not true for floating point. /* Distributivity is not true for floating point.
It can change the value. So don't do it. It can change the value. So don't do it.
-- rms and moshier@world.std.com. */ -- rms and moshier@world.std.com. */
if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) if (FLOAT_MODE_P (GET_MODE (x)))
return x; return x;
/* The outer operation can only be one of the following: */ /* The outer operation can only be one of the following: */
...@@ -8923,12 +8923,14 @@ reversible_comparison_p (x) ...@@ -8923,12 +8923,14 @@ reversible_comparison_p (x)
switch (GET_MODE_CLASS (GET_MODE (XEXP (x, 0)))) switch (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))))
{ {
case MODE_INT: case MODE_INT:
case MODE_PARTIAL_INT:
case MODE_COMPLEX_INT:
return 1; return 1;
case MODE_CC: case MODE_CC:
x = get_last_value (XEXP (x, 0)); x = get_last_value (XEXP (x, 0));
return (x && GET_CODE (x) == COMPARE return (x && GET_CODE (x) == COMPARE
&& GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_INT); && ! FLOAT_MODE_P (GET_MODE (XEXP (x, 0))));
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment