aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1998-03-25 16:20:08 -0800
committerRichard Henderson <rth@gcc.gnu.org>1998-03-25 16:20:08 -0800
commit6f28d3e98257593850baca079e60a59eae47bc9f (patch)
treefa5c337155be729a7812e5f418eaaf7d3d5d0442 /gcc/combine.c
parent7eea64437a974d93e6a99163ecb3d1b97d1c7e0d (diff)
downloadgcc-6f28d3e98257593850baca079e60a59eae47bc9f.zip
gcc-6f28d3e98257593850baca079e60a59eae47bc9f.tar.gz
gcc-6f28d3e98257593850baca079e60a59eae47bc9f.tar.bz2
* combine.c (make_compound_operation): Simplify (subreg (*_extend) 0).
From-SVN: r18836
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 8cb32dc..4bef563 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6038,6 +6038,23 @@ make_compound_operation (x, in_code)
return newer;
}
+
+ /* If this is a paradoxical subreg, and the new code is a sign or
+ zero extension, omit the subreg and widen the extension. If it
+ is a regular subreg, we can still get rid of the subreg by not
+ widening so much, or in fact removing the extension entirely. */
+ if ((GET_CODE (tem) == SIGN_EXTEND
+ || GET_CODE (tem) == ZERO_EXTEND)
+ && subreg_lowpart_p (x))
+ {
+ if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (tem))
+ || (GET_MODE_SIZE (mode) >
+ GET_MODE_SIZE (GET_MODE (XEXP (tem, 0)))))
+ tem = gen_rtx_combine (GET_CODE (tem), mode, XEXP (tem, 0));
+ else
+ tem = gen_lowpart_for_combine (mode, XEXP (tem, 0));
+ return tem;
+ }
break;
default: