aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-02-27 19:04:24 +0000
committerRichard Stallman <rms@gnu.org>1993-02-27 19:04:24 +0000
commitd3c64ee3f322bedd7e692b6a767be7ef424f337c (patch)
tree31946851dffac03661828384928f66c757e5f1f8 /gcc
parent0df69870f149a0576e6d2b9699583d22fb2583fe (diff)
downloadgcc-d3c64ee3f322bedd7e692b6a767be7ef424f337c.zip
gcc-d3c64ee3f322bedd7e692b6a767be7ef424f337c.tar.gz
gcc-d3c64ee3f322bedd7e692b6a767be7ef424f337c.tar.bz2
(convert_move): Truncate via word_mode only if to_mode fits in one word.
Truncate by referring in TO_MODE for any FROM, but force_reg if nec. From-SVN: r3553
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index c2abbcb..0f63276 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -833,7 +833,9 @@ convert_move (to, from, unsignedp)
return;
}
- if (GET_MODE_BITSIZE (from_mode) > BITS_PER_WORD)
+ /* Truncating multi-word to a word or less. */
+ if (GET_MODE_BITSIZE (from_mode) > BITS_PER_WORD
+ && GET_MODE_BITSIZE (to_mode) <= BITS_PER_WORD)
{
convert_move (to, gen_lowpart (word_mode, from), 0);
return;
@@ -881,19 +883,20 @@ convert_move (to, from, unsignedp)
/* For truncation, usually we can just refer to FROM in a narrower mode. */
if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
- GET_MODE_BITSIZE (from_mode))
- && ((GET_CODE (from) == MEM
- && ! MEM_VOLATILE_P (from)
- && direct_load[(int) to_mode]
- && ! mode_dependent_address_p (XEXP (from, 0)))
- || GET_CODE (from) == REG
- || GET_CODE (from) == SUBREG))
+ GET_MODE_BITSIZE (from_mode)))
{
+ if (!((GET_CODE (from) == MEM
+ && ! MEM_VOLATILE_P (from)
+ && direct_load[(int) to_mode]
+ && ! mode_dependent_address_p (XEXP (from, 0)))
+ || GET_CODE (from) == REG
+ || GET_CODE (from) == SUBREG))
+ from = force_reg (from_mode, from);
emit_move_insn (to, gen_lowpart (to_mode, from));
return;
}
- /* For truncation, usually we can just refer to FROM in a narrower mode. */
+ /* Handle extension. */
if (GET_MODE_BITSIZE (to_mode) > GET_MODE_BITSIZE (from_mode))
{
/* Convert directly if that works. */