diff options
author | Eric Christopher <echristo@redhat.com> | 2003-05-16 02:05:29 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gcc.gnu.org> | 2003-05-16 02:05:29 +0000 |
commit | 3dcd7d459532baf13446d089777a29142b0fb5e2 (patch) | |
tree | 8f84bf067654a45ff68079db3e6fec811a68f301 /gcc/combine.c | |
parent | c1fefa090bce9d5d6effe6001e14ea89b179b3f9 (diff) | |
download | gcc-3dcd7d459532baf13446d089777a29142b0fb5e2.zip gcc-3dcd7d459532baf13446d089777a29142b0fb5e2.tar.gz gcc-3dcd7d459532baf13446d089777a29142b0fb5e2.tar.bz2 |
combine.c (expand_compound_operation): Make sure that zero_extend operation is profitable.
2003-05-15 Eric Christopher <echristo@redhat.com>
* combine.c (expand_compound_operation): Make sure
that zero_extend operation is profitable.
From-SVN: r66853
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index bff8b08..79f0226 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. */ |