From 36c216e5d0fc6780aa2a5390d252ffade976d21a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 22 Aug 2003 17:58:05 +0000 Subject: [PATCH] ia64.md (*ptr_extend_plus_1): Rename to ... * 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 | 8 ++++++ gcc/config/ia64/ia64.c | 55 ++++++++++++++++++++++++++++++----------- gcc/config/ia64/ia64.md | 2 +- 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 113b98b55a7..8b238d09770 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2003-08-22 Mark Mitchell + + * 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 * gcc/config/m68k/m68k.c (m68k_coff_asm_named_section): remove unused diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index efed0b11deb..816f089dad8 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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)); } diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md index 0d0999fa6db..9ead0866798 100644 --- a/gcc/config/ia64/ia64.md +++ b/gcc/config/ia64/ia64.md @@ -5472,7 +5472,7 @@ ;; ;; 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") -- 2.30.2