summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-16 02:05:29 +0000
committerechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-16 02:05:29 +0000
commit195a9d8ba1e3817695824aa0fecc712f2acaf243 (patch)
tree8f84bf067654a45ff68079db3e6fec811a68f301 /gcc/combine.c
parent8741fd12518fae0eb0eaa8e6e6e29e988e023335 (diff)
downloadgcc-195a9d8ba1e3817695824aa0fecc712f2acaf243.tar.gz
2003-05-15 Eric Christopher <echristo@redhat.com>
* combine.c (expand_compound_operation): Make sure that zero_extend operation is profitable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66853 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index bff8b08f5bf..79f0226e8cd 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5802,7 +5802,15 @@ expand_compound_operation (x)
== 0)))
{
rtx temp = gen_rtx_ZERO_EXTEND (GET_MODE (x), XEXP (x, 0));
- return expand_compound_operation (temp);
+ rtx temp2 = expand_compound_operation (temp);
+
+ /* Make sure this is a profitable operation. */
+ if (rtx_cost (x, SET) > rtx_cost (temp2, SET))
+ return temp2;
+ else if (rtx_cost (x, SET) > rtx_cost (temp, SET))
+ return temp;
+ else
+ return x;
}
/* We can optimize some special cases of ZERO_EXTEND. */