re PR target/53961 (internal compiler error: in memory_address_length, at config...
authorUros Bizjak <uros@gcc.gnu.org>
Tue, 24 Jul 2012 11:37:20 +0000 (13:37 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 24 Jul 2012 11:37:20 +0000 (13:37 +0200)
PR target/53961
* config/i386/i386.c (ix86_legitimate_address_p): Move check for
negative constant address for TARET_X32 ...
(ix86_decompose_address): ... here.  Reject constant addresses
that don't satisfy x86_64_immediate_operand predicate.

From-SVN: r189806

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index af268f4..08722af 100644 (file)
@@ -1,7 +1,14 @@
+2012-07-24  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/53961
+       * config/i386/i386.c (ix86_legitimate_address_p): Move check for
+       negative constant address for TARET_X32 ...
+       (ix86_decompose_address): ... here.  Reject constant addresses
+       that don't satisfy x86_64_immediate_operand predicate.
+
 2012-07-24  Julian Brown  <julian@codesourcery.com>
 
-       * doc/sourcebuild.texi (arm_hf_eabi): Document effective-target
-       check.
+       * doc/sourcebuild.texi (arm_hf_eabi): Document effective-target check.
 
 2012-07-24  Steven Bosscher  <steven@gcc.gnu.org>
 
@@ -17,7 +24,8 @@
        (GCC_MEM_STAT_ARGUMENTS): New define.
        (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS.
        (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines.
-       (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT,
+       (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT,
+       FINAL_PASS_MEM_STAT): Define.
        * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL.
        * ggc.h (ggc_record_overhead, ggc_free_overhead,
        ggc_prune_overhead_list): Remove internal prototypes, they are defined
@@ -25,7 +33,7 @@
        * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS
        wrappers.
        (add_statistics): Likewise.
-       (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. 
+       (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0.
        * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS
        wrappers around "survived" and "stats" members.
        (alloc_large_page): Always initialize survived.
index eeb8c82..efad32c 100644 (file)
@@ -11733,6 +11733,19 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
       scale = 1 << scale;
       retval = -1;
     }
+  else if (CONST_INT_P (addr))
+    {
+      if (!x86_64_immediate_operand (addr, VOIDmode))
+       return 0;
+
+      /* Constant addresses are sign extended to 64bit, we have to
+        prevent addresses from 0x80000000 to 0xffffffff in x32 mode.  */
+      if (TARGET_X32
+         && val_signbit_known_set_p (SImode, INTVAL (addr)))
+       return 0;
+
+      disp = addr;
+    }
   else
     disp = addr;                       /* displacement */
 
@@ -12242,13 +12255,6 @@ ix86_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
   rtx base, index, disp;
   HOST_WIDE_INT scale;
 
-  /* Since constant address in x32 is signed extended to 64bit,
-     we have to prevent addresses from 0x80000000 to 0xffffffff.  */
-  if (TARGET_X32
-      && CONST_INT_P (addr)
-      && INTVAL (addr) < 0)
-    return false;
-
   if (ix86_decompose_address (addr, &parts) <= 0)
     /* Decomposition failed.  */
     return false;
index 114ad13..0048934 100644 (file)
   DONE;
 })
 \f
+;; Load effective address instructions
+
 (define_insn_and_split "*lea<mode>"
   [(set (match_operand:SWI48 0 "register_operand" "=r")
        (match_operand:SWI48 1 "lea_address_operand" "p"))]