(subst): For subreg-of-constant, don't gen_lowpart
authorRichard Stallman <rms@gnu.org>
Mon, 24 May 1993 07:45:54 +0000 (07:45 +0000)
committerRichard Stallman <rms@gnu.org>
Mon, 24 May 1993 07:45:54 +0000 (07:45 +0000)
if it's a big-endian machine and constant is multi-word.

From-SVN: r4554

gcc/combine.c

index ca1567c6f0e3e1cb49aaeaf80a86497a02b7a4ad..49e214eecbf70ec41bde93fd635b062eab3c15bc 100644 (file)
@@ -3085,8 +3085,16 @@ subst (x, from, to, in_dest, unique_copy)
            return temp;
        }
        
+      /* 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)
-         && GET_MODE_SIZE (mode) < GET_MODE_SIZE (op0_mode))
+         && GET_MODE_SIZE (mode) < GET_MODE_SIZE (op0_mode)
+#if WORDS_BIG_ENDIAN
+         && GET_MODE_BITSIZE (op0_mode) < BITS_PER_WORD
+#endif
+         )
        return gen_lowpart_for_combine (mode, SUBREG_REG (x));
 
       /* If we are narrowing the object, we need to see if we can simplify