aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>1997-04-13 22:45:30 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>1997-04-13 22:45:30 +0000
commitad5780142a62bf2937d21341b3c488c9d143449f (patch)
tree7e3c13a6a971905e2f3f5b4656d042335e7e8a24 /gcc
parent3e42d56b4b6fa2d03a6bd52e7135df62e12a3385 (diff)
downloadgcc-ad5780142a62bf2937d21341b3c488c9d143449f.zip
gcc-ad5780142a62bf2937d21341b3c488c9d143449f.tar.gz
gcc-ad5780142a62bf2937d21341b3c488c9d143449f.tar.bz2
Get the modes right when setting reg_values for a reg to reg copy
From-SVN: r13896
Diffstat (limited to 'gcc')
-rw-r--r--gcc/reload1.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 119e51a..702ebd8 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8215,7 +8215,29 @@ reload_cse_record_set (set, body)
/* This is an assignment to a register. Update the value we
have stored for the register. */
if (sreg >= 0)
- reg_values[dreg] = reg_values[sreg];
+ {
+ rtx x;
+
+ /* This is a copy from one register to another. Any values
+ which were valid for SREG are now valid for DREG. If the
+ mode changes, we use gen_lowpart_common to extract only
+ the part of the value that is copied. */
+ reg_values[dreg] = 0;
+ for (x = reg_values[sreg]; x; x = XEXP (x, 1))
+ {
+ rtx tmp;
+
+ if (XEXP (x, 0) == 0)
+ continue;
+ if (dest_mode == GET_MODE (XEXP (x, 0)))
+ tmp = XEXP (x, 0);
+ else
+ tmp = gen_lowpart_common (dest_mode, XEXP (x, 0));
+ if (tmp)
+ reg_values[dreg] = gen_rtx (EXPR_LIST, dest_mode, tmp,
+ reg_values[dreg]);
+ }
+ }
else
reg_values[dreg] = gen_rtx (EXPR_LIST, dest_mode, src, NULL_RTX);