aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJohn Carr <jfc@mit.edu>1998-02-01 01:49:32 +0000
committerJeff Law <law@gcc.gnu.org>1998-01-31 18:49:32 -0700
commit6e0ef100dad74b006895619fbaf1fac7aeff06ee (patch)
tree82fd0412e3cc32ed274e427aafbfb4113ea2baa2 /gcc/combine.c
parent8821a725d65a1509cb76153f32e4bdcddb4a30dc (diff)
downloadgcc-6e0ef100dad74b006895619fbaf1fac7aeff06ee.zip
gcc-6e0ef100dad74b006895619fbaf1fac7aeff06ee.tar.gz
gcc-6e0ef100dad74b006895619fbaf1fac7aeff06ee.tar.bz2
combine.c (simplify_shift_const): (lshiftrt (truncate (lshiftrt))) is (truncate (lshiftrt)).
* combine.c (simplify_shift_const): (lshiftrt (truncate (lshiftrt))) is (truncate (lshiftrt)). From-SVN: r17570
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 3bcea7d..017cf12 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8787,6 +8787,28 @@ simplify_shift_const (x, code, result_mode, varop, count)
continue;
}
break;
+
+ case TRUNCATE:
+ /* Change (lshiftrt (truncate (lshiftrt))) to (truncate (lshiftrt))
+ if the truncate does not affect the value. */
+ if (code == LSHIFTRT
+ && GET_CODE (XEXP (varop, 0)) == LSHIFTRT
+ && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
+ && (INTVAL (XEXP (XEXP (varop, 0), 1))
+ >= (GET_MODE_BITSIZE (GET_MODE (XEXP (varop, 0))) - GET_MODE_BITSIZE (varop))))
+ {
+ rtx varop_inner = XEXP (varop, 0);
+
+ varop_inner = gen_rtx_combine (LSHIFTRT,
+ GET_MODE (varop_inner),
+ XEXP (varop_inner, 0),
+ GEN_INT (count + INTVAL (XEXP (varop_inner, 1))));
+ varop = gen_rtx_combine (TRUNCATE, GET_MODE (varop),
+ varop_inner);
+ count = 0;
+ continue;
+ }
+ break;
default:
break;