aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-03-10 16:10:20 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1997-03-10 16:10:20 -0500
commit3c99d5ffb6ce983cd9df0b570d08b77eb7b9ddd2 (patch)
tree282e942f870d17f29772bf53ba0fa2bf993cff0a /gcc
parenta3a03040fb9ec55225cdb4e3a5cfbb2c5b5dda94 (diff)
downloadgcc-3c99d5ffb6ce983cd9df0b570d08b77eb7b9ddd2.zip
gcc-3c99d5ffb6ce983cd9df0b570d08b77eb7b9ddd2.tar.gz
gcc-3c99d5ffb6ce983cd9df0b570d08b77eb7b9ddd2.tar.bz2
(simplify_rtx, case SUBREG): Fix direction of test when calling operand_subword...
(simplify_rtx, case SUBREG): Fix direction of test when calling operand_subword; use inline code intead of subreg_lowpart_p. From-SVN: r13698
Diffstat (limited to 'gcc')
-rw-r--r--gcc/combine.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 2300ce9..89f6525 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3383,7 +3383,7 @@ simplify_rtx (x, op0_mode, last, in_dest)
if (CONSTANT_P (SUBREG_REG (x)) && op0_mode != VOIDmode
&& GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_MODE_SIZE (op0_mode) < UNITS_PER_WORD
+ && GET_MODE_SIZE (op0_mode) > UNITS_PER_WORD
&& GET_MODE_CLASS (mode) == MODE_INT)
{
temp = operand_subword (SUBREG_REG (x), SUBREG_WORD (x),
@@ -3395,8 +3395,16 @@ simplify_rtx (x, op0_mode, last, in_dest)
/* If we want a subreg of a constant, at offset 0,
take the low bits. On a little-endian machine, that's
always valid. On a big-endian machine, it's valid
- only if the constant's mode fits in one word. */
- if (CONSTANT_P (SUBREG_REG (x)) && subreg_lowpart_p (x)
+ only if the constant's mode fits in one word. Note that we
+ cannot use subreg_lowpart_p since we SUBREG_REG may be VOIDmode. */
+ if (CONSTANT_P (SUBREG_REG (x))
+ && ((GET_MODE_SIZE (op0_mode) <= UNITS_PER_WORD
+ || ! WORDS_BIG_ENDIAN)
+ ? SUBREG_WORD (x) == 0
+ : (SUBREG_WORD (x)
+ == ((GET_MODE_SIZE (op0_mode)
+ - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
+ / UNITS_PER_WORD)))
&& GET_MODE_SIZE (mode) <= GET_MODE_SIZE (op0_mode)
&& (! WORDS_BIG_ENDIAN
|| GET_MODE_BITSIZE (op0_mode) <= BITS_PER_WORD))