emit-rtl.c (operand_subword): Correctly handle extracting a word from a CONST_DOUBLE...
authorJeffrey A Law <law@cygnus.com>
Thu, 1 Jan 1998 12:55:19 +0000 (12:55 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 1 Jan 1998 12:55:19 +0000 (05:55 -0700)
* emit-rtl.c (operand_subword): Correctly handle extracting a word
from a CONST_DOUBLE for 16bit targets with !WORDS_BIG_ENDIAN.

From-SVN: r17276

gcc/ChangeLog
gcc/emit-rtl.c

index c6a453b591b9cb3d0d4be3b0392ea0f615a067a5..4f0f0e8cdd8cad1890bc22d662b3a926f6981bc4 100644 (file)
@@ -1,5 +1,8 @@
 Thu Jan  1 10:49:12 1998  Jeffrey A Law  (law@cygnus.com)
 
+       * emit-rtl.c (operand_subword): Correctly handle extracting a word
+       from a CONST_DOUBLE for 16bit targets with !WORDS_BIG_ENDIAN.
+
        * mn10200.md (tstxx, cmpxx): Use "nonimmediate_operand" as predicate
        for first argument.
 
index c93c3eadf18201cbea0a31dac443d584c89c5b64..7b114d6910456ccd1608d452dc4c0560f3044420 100644 (file)
@@ -1208,7 +1208,7 @@ operand_subword (op, i, validate_address, mode)
        {
          long value;
          value = k[i >> 1];
-         if ((i & 0x1) == 0)
+         if ((i & 0x1) == !WORDS_BIG_ENDIAN)
            value >>= 16;
          value &= 0xffff;
          return GEN_INT ((HOST_WIDE_INT) value);
@@ -1265,6 +1265,13 @@ operand_subword (op, i, validate_address, mode)
 
       REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
       REAL_VALUE_TO_TARGET_SINGLE (rv, l);
+
+      if (BITS_PER_WORD == 16)
+       {
+         if ((i & 0x1) == !WORDS_BIG_ENDIAN)
+           l >>= 16;
+         l &= 0xffff;
+       }
       return GEN_INT ((HOST_WIDE_INT) l);
     }
 #else