combine.c (simplify_logical): Only simplify logical expressions of the form ior(and(x,y),z) by the inverse...

* combine.c (simplify_logical): Only simplify logical expressions
	of the form ior(and(x,y),z) by the inverse distributive law if the
	result is cheaper than the original.

Co-Authored-By: Eric Botcazou <ebotcazou@libertysurf.fr>

From-SVN: r94114
This commit is contained in:
Roger Sayle 2005-01-23 15:43:56 +00:00 committed by Roger Sayle
parent 6ccf2f7d07
commit b975043470
2 changed files with 15 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2005-01-23 Roger Sayle <roger@eyesopen.com>
Eric Botcazou <ebotcazou@libertysurf.fr>
* combine.c (simplify_logical): Only simplify logical expressions
of the form ior(and(x,y),z) by the inverse distributive law if the
result is cheaper than the original.
2005-01-23 Kazu Hirata <kazu@cs.umass.edu>
* alias.c, c-common.h, c-incpath.c, c-incpath.h, expr.c,

View file

@ -5574,26 +5574,28 @@ simplify_logical (rtx x)
if (GET_CODE (op0) == AND)
{
x = apply_distributive_law
rtx tmp = apply_distributive_law
(gen_binary (AND, mode,
gen_binary (IOR, mode, XEXP (op0, 0), op1),
gen_binary (IOR, mode, XEXP (op0, 1),
copy_rtx (op1))));
if (GET_CODE (x) != IOR)
return x;
if (GET_CODE (tmp) != IOR
&& rtx_cost (tmp, SET) < rtx_cost (x, SET))
return tmp;
}
if (GET_CODE (op1) == AND)
{
x = apply_distributive_law
rtx tmp = apply_distributive_law
(gen_binary (AND, mode,
gen_binary (IOR, mode, XEXP (op1, 0), op0),
gen_binary (IOR, mode, XEXP (op1, 1),
copy_rtx (op0))));
if (GET_CODE (x) != IOR)
return x;
if (GET_CODE (tmp) != IOR
&& rtx_cost (tmp, SET) < rtx_cost (x, SET))
return tmp;
}
/* Convert (ior (ashift A CX) (lshiftrt A CY)) where CX+CY equals the