mips.c (mips_add_offset): Use gen_int_mode for CONST_HIGH_PART result.
authorJames E. Wilson <wilson@codesourcery.com>
Thu, 30 Apr 2009 00:58:10 +0000 (00:58 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Thu, 30 Apr 2009 00:58:10 +0000 (17:58 -0700)
* config/mips/mips.c (mips_add_offset): Use gen_int_mode for
CONST_HIGH_PART result.

From-SVN: r146995

gcc/ChangeLog
gcc/config/mips/mips.c

index 51d9ec989c4e8ae7a179cc0fdea409954aa0f202..c2943a6c3a0f437c5f4482aea35dcb9a350d9a9b 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-29  James E. Wilson  <wilson@codesourcery.com>
+
+       * config/mips/mips.c (mips_add_offset): Use gen_int_mode for
+       CONST_HIGH_PART result.
+
 2009-04-29  Anatoly Sokolov  <aesok@post.ru>
 
        * config/avr/avr.c (initial_elimination_offset): Rename to
index 29ae1795a5e4689de381d6105b3a69f6a44d81ab..8dfd3c2e9fa2f8cdd891871a2b1ac2a350a921ba 100644 (file)
@@ -2703,8 +2703,10 @@ mips_add_offset (rtx temp, rtx reg, HOST_WIDE_INT offset)
        }
       else
        {
-         /* Leave OFFSET as a 16-bit offset and put the excess in HIGH.  */
-         high = GEN_INT (CONST_HIGH_PART (offset));
+         /* Leave OFFSET as a 16-bit offset and put the excess in HIGH.
+            The addition inside the macro CONST_HIGH_PART may cause an
+            overflow, so we need to force a sign-extension check.  */
+         high = gen_int_mode (CONST_HIGH_PART (offset), Pmode);
          offset = CONST_LOW_PART (offset);
        }
       high = mips_force_temporary (temp, high);