aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-09-19 04:48:37 +0000
committerRichard Stallman <rms@gnu.org>1992-09-19 04:48:37 +0000
commite8d76a395e5f1d93a17f4a353b8c80e620cb1597 (patch)
tree14cefde7cd92b9311058c81e6e37f2b5c1215ba8 /gcc
parentf0c70ef08a3cce8fe2642fd47973cb05532faff5 (diff)
downloadgcc-e8d76a395e5f1d93a17f4a353b8c80e620cb1597.zip
gcc-e8d76a395e5f1d93a17f4a353b8c80e620cb1597.tar.gz
gcc-e8d76a395e5f1d93a17f4a353b8c80e620cb1597.tar.bz2
(fold_rtx): For SUBREG, actually test subreg_lowpart_p in the code to handle narrowing subregs.
(fold_rtx): For SUBREG, actually test subreg_lowpart_p in the code to handle narrowing subregs. And exclude binary ops like DIV where truncating the args is not valid. From-SVN: r2160
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cse.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index e76a130..85ecc77 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4457,7 +4457,8 @@ fold_rtx (x, insn)
can use the inner value. */
if (GET_CODE (folded_arg0) == REG
- && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (folded_arg0)))
+ && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (folded_arg0))
+ && subreg_lowpart_p (x))
{
struct table_elt *elt;
@@ -4472,6 +4473,8 @@ fold_rtx (x, insn)
for (; elt; elt = elt->next_same_value)
{
+ enum rtx_code eltcode = GET_CODE (elt->exp);
+
/* Just check for unary and binary operations. */
if (GET_RTX_CLASS (GET_CODE (elt->exp)) == '1'
&& GET_CODE (elt->exp) != SIGN_EXTEND
@@ -4491,6 +4494,10 @@ fold_rtx (x, insn)
}
else if ((GET_RTX_CLASS (GET_CODE (elt->exp)) == '2'
|| GET_RTX_CLASS (GET_CODE (elt->exp)) == 'c')
+ && eltcode != DIV && eltcode != MOD
+ && eltcode != UDIV && eltcode != UMOD
+ && eltcode != ASHIFTRT && eltcode != LSHIFTRT
+ && eltcode != ROTATE && eltcode != ROTATERT
&& ((GET_CODE (XEXP (elt->exp, 0)) == SUBREG
&& (GET_MODE (SUBREG_REG (XEXP (elt->exp, 0)))
== mode))