ia64.md (*ptr_extend_plus_1): Rename to ...
authorMark Mitchell <mark@codesourcery.com>
Fri, 22 Aug 2003 17:58:05 +0000 (17:58 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 22 Aug 2003 17:58:05 +0000 (17:58 +0000)
* config/ia64/ia64.md (*ptr_extend_plus_1): Rename to ...
(ptr_extend_plus_imm): ... this.
* config/ia64/ia64.c (addp4_optimize_ok): Do not disable addp4
optimization in C++.
(ia64_output_mi_thunk): Support ILP32 mode.

From-SVN: r70692

gcc/ChangeLog
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.md

index 113b98b55a786640c2c39890f5b80250e46de49a..8b238d097702c1cf8e0da64a08d2236c1bddfae9 100644 (file)
@@ -1,3 +1,11 @@
+2003-08-22  Mark Mitchell  <mark@codesourcery.com>
+
+       * config/ia64/ia64.md (*ptr_extend_plus_1): Rename to ...
+       (ptr_extend_plus_imm): ... this.
+       * config/ia64/ia64.c (addp4_optimize_ok): Do not disable addp4
+       optimization in C++.
+       (ia64_output_mi_thunk): Support ILP32 mode.
+
 2003-08-22  bernardo innocenti  <bernie@develer.com>
 
        * gcc/config/m68k/m68k.c (m68k_coff_asm_named_section): remove unused
index efed0b11deb84b0dfbe27da03d9fbdcce2fa7880..816f089dad8db450f21547faf5f59a746967ec7f 100644 (file)
@@ -1106,16 +1106,9 @@ ia64_move_ok (rtx dst, rtx src)
     return GET_CODE (src) == CONST_DOUBLE && CONST_DOUBLE_OK_FOR_G (src);
 }
 
-/* Return 0 if we are doing C++ code.  This optimization fails with
-   C++ because of GNAT c++/6685.  */
-
 int
 addp4_optimize_ok (rtx op1, rtx op2)
 {
-
-  if (!strcmp (lang_hooks.name, "GNU C++"))
-    return 0;
-
   return (basereg_operand (op1, GET_MODE(op1)) !=
          basereg_operand (op2, GET_MODE(op2)));
 }
@@ -8360,6 +8353,18 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
   emit_note (NOTE_INSN_PROLOGUE_END);
 
   this = gen_rtx_REG (Pmode, IN_REG (0));
+  if (TARGET_ILP32)
+    {
+      rtx tmp = gen_rtx_REG (ptr_mode, IN_REG (0));
+      REG_POINTER (tmp) = 1;
+      if (delta && CONST_OK_FOR_I (delta))
+       {
+         emit_insn (gen_ptr_extend_plus_imm (this, tmp, GEN_INT (delta)));
+         delta = 0;
+       }
+      else
+       emit_insn (gen_ptr_extend (this, tmp));
+    }
 
   /* Apply the constant offset, if required.  */
   if (delta)
@@ -8381,17 +8386,39 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
       rtx vcall_offset_rtx = GEN_INT (vcall_offset);
       rtx tmp = gen_rtx_REG (Pmode, 2);
 
-      emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
+      if (TARGET_ILP32)
+       {
+         rtx t = gen_rtx_REG (ptr_mode, 2);
+         REG_POINTER (t) = 1;
+         emit_move_insn (t, gen_rtx_MEM (ptr_mode, this));
+         if (CONST_OK_FOR_I (vcall_offset))
+           {
+             emit_insn (gen_ptr_extend_plus_imm (tmp, t, 
+                                                 vcall_offset_rtx));
+             vcall_offset = 0;
+           }
+         else
+           emit_insn (gen_ptr_extend (tmp, t));
+       }
+      else
+       emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
 
-      if (!CONST_OK_FOR_J (vcall_offset))
+      if (vcall_offset)
        {
-         rtx tmp2 = gen_rtx_REG (Pmode, next_scratch_gr_reg ());
-         emit_move_insn (tmp2, vcall_offset_rtx);
-         vcall_offset_rtx = tmp2;
+         if (!CONST_OK_FOR_J (vcall_offset))
+           {
+             rtx tmp2 = gen_rtx_REG (Pmode, next_scratch_gr_reg ());
+             emit_move_insn (tmp2, vcall_offset_rtx);
+             vcall_offset_rtx = tmp2;
+           }
+         emit_insn (gen_adddi3 (tmp, tmp, vcall_offset_rtx));
        }
-      emit_insn (gen_adddi3 (tmp, tmp, vcall_offset_rtx));
 
-      emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp));
+      if (TARGET_ILP32)
+       emit_move_insn (gen_rtx_REG (ptr_mode, 2), 
+                       gen_rtx_MEM (ptr_mode, tmp));
+      else
+       emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp));
 
       emit_insn (gen_adddi3 (this, this, tmp));
     }
index 0d0999fa6dbd9b00f6719cc2feeced0229c4a01e..9ead0866798475cda87157ffec39cf8b29c93ede 100644 (file)
 ;;
 ;; Optimizations for ptr_extend
 
-(define_insn "*ptr_extend_plus_1"
+(define_insn "ptr_extend_plus_imm"
   [(set (match_operand:DI 0 "gr_register_operand" "=r")
         (unspec:DI
          [(plus:SI (match_operand:SI 1 "basereg_operand" "r")