Commit 5be669c7 by Richard Kenner

(simplify_if_then_else): Convert "a == b ? b : a" to "a".

From-SVN: r10698
parent 05019f83
...@@ -4025,6 +4025,16 @@ simplify_if_then_else (x) ...@@ -4025,6 +4025,16 @@ simplify_if_then_else (x)
if (rtx_equal_p (true, false) && ! side_effects_p (cond)) if (rtx_equal_p (true, false) && ! side_effects_p (cond))
return true; return true;
/* Convert a == b ? b : a to "a". */
if (true_code == EQ && ! side_effects_p (cond)
&& rtx_equal_p (XEXP (cond, 0), false)
&& rtx_equal_p (XEXP (cond, 1), true))
return false;
else if (true_code == NE && ! side_effects_p (cond)
&& rtx_equal_p (XEXP (cond, 0), true)
&& rtx_equal_p (XEXP (cond, 1), false))
return true;
/* Look for cases where we have (abs x) or (neg (abs X)). */ /* Look for cases where we have (abs x) or (neg (abs X)). */
if (GET_MODE_CLASS (mode) == MODE_INT if (GET_MODE_CLASS (mode) == MODE_INT
......
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