From e99efbad0ff6615399e49dc9a5a810cb7c712145 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 13 Apr 1997 22:45:30 +0000 Subject: [PATCH] Get the modes right when setting reg_values for a reg to reg copy git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13896 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/reload1.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gcc/reload1.c b/gcc/reload1.c index 119e51a4578..702ebd812a1 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); -- 2.11.4.GIT