diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-23 15:43:56 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-23 15:43:56 +0000 |
commit | 9ab662fc958300c6735a7d8245e185d761d34477 (patch) | |
tree | bcf4c83c4d6cd68bd4c7ba659abafda685abfe03 /gcc | |
parent | 9b67edb73614642b91225abbbfbb580d49a267bc (diff) | |
download | gcc-9ab662fc958300c6735a7d8245e185d761d34477.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94114 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/combine.c | 14 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce737615e63..68bc9493ac3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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, diff --git a/gcc/combine.c b/gcc/combine.c index dca4d971a1e..0baeb981500 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -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 |