summaryrefslogtreecommitdiff
path: root/gcc/regrename.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-16 20:13:35 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-16 20:13:35 +0000
commit14a4ccb4c3fdb0ae4a7126ca818d2aee00cd3b8e (patch)
tree0654a0eaf2c78a4f25b1a9a8b0ae119b3f56c05f /gcc/regrename.c
parent1c4417b568d45d63789611aa7013788f1bf41582 (diff)
downloadgcc-14a4ccb4c3fdb0ae4a7126ca818d2aee00cd3b8e.tar.gz
* regrename.c (copy_value): Don't record high part copies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55493 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/regrename.c')
-rw-r--r--gcc/regrename.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 532d5753df3..0ceab76c6e2 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1268,6 +1268,26 @@ copy_value (dest, src, vd)
if (vd->e[sr].mode == VOIDmode)
set_value_regno (sr, vd->e[dr].mode, vd);
+ /* If we are narrowing the the input to a smaller number of hard regs,
+ and it is in big endian, we are really extracting a high part.
+ Since we generally associate a low part of a value with the value itself,
+ we must not do the same for the high part.
+ Note we can still get low parts for the same mode combination through
+ a two-step copy involving differently sized hard regs.
+ Assume hard regs fr* are 32 bits bits each, while r* are 64 bits each:
+ (set (reg:DI r0) (reg:DI fr0))
+ (set (reg:SI fr2) (reg:SI r0))
+ loads the low part of (reg:DI fr0) - i.e. fr1 - into fr2, while:
+ (set (reg:SI fr2) (reg:SI fr0))
+ loads the high part of (reg:DI fr0) into fr2.
+
+ We can't properly represent the latter case in our tables, so don't
+ record anything then. */
+ else if (sn < (unsigned int) HARD_REGNO_NREGS (sr, vd->e[sr].mode)
+ && (GET_MODE_SIZE (vd->e[sr].mode) > UNITS_PER_WORD
+ ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN))
+ return;
+
/* If SRC had been assigned a mode narrower than the copy, we can't
link DEST into the chain, because not all of the pieces of the
copy came from oldest_regno. */