* configure.ac (HAVE_LD_LARGE_TOC): Add AIX test.
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Nov 2012 16:41:21 +0000 (16:41 +0000)
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Nov 2012 16:41:21 +0000 (16:41 +0000)
        * configure: Regenerated.
        * config/rs6000/aix61.h (SUBTARGET_OVERRIDE_OPTIONS): Warn if
        other toc options used with cmodel. Disable TARGET_NO_FP_IN_TOC
        and TARGET_NO_SUM_IN_TOC if not CMODEL_SMALL. CMODEL_MEDIUM means
        CMODEL_LARGE on AIX.
        (ASM_SPEC): -mvsx implies -mpwr6. Add -many.
        (ASM_DEFAULT_SPEC): Use -mpwr4.
        (TARGET_CMODEL): Define.
        (SET_CMODEL): Define.
        * config/rs6000/rs6000.md (largetoc_high_aix<mode>): New.
        (largetoc_high_plus_aix<mode>): New.
        (largetoc_low<mode>): Change to mode iterator. Test TARGET_TOC
        instead of TARGET_ELF.
        (tocref): Remove TARGET_ELF test.
        * config/rs6000/rs6000.c (output_toc): Use [TE] for large TOC
        symbols on AIX.
        * config/rs6000/aix64.opt (mcmodel): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193502 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/aix61.h
gcc/config/rs6000/aix64.opt
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md
gcc/configure
gcc/configure.ac

index 94b1200..ebebb1d 100644 (file)
@@ -1,3 +1,24 @@
+2012-11-14  David Edelsohn  <dje.gcc@gmail.com>
+
+       * configure.ac (HAVE_LD_LARGE_TOC): Add AIX test.
+       * configure: Regenerated.
+       * config/rs6000/aix61.h (SUBTARGET_OVERRIDE_OPTIONS): Warn if
+       other toc options used with cmodel. Disable TARGET_NO_FP_IN_TOC
+       and TARGET_NO_SUM_IN_TOC if not CMODEL_SMALL. CMODEL_MEDIUM means
+       CMODEL_LARGE on AIX.
+       (ASM_SPEC): -mvsx implies -mpwr6. Add -many.
+       (ASM_DEFAULT_SPEC): Use -mpwr4.
+       (TARGET_CMODEL): Define.
+       (SET_CMODEL): Define.
+       * config/rs6000/rs6000.md (largetoc_high_aix<mode>): New.
+       (largetoc_high_plus_aix<mode>): New.
+       (largetoc_low<mode>): Change to mode iterator. Test TARGET_TOC
+       instead of TARGET_ELF.
+       (tocref): Remove TARGET_ELF test.
+       * config/rs6000/rs6000.c (output_toc): Use [TE] for large TOC
+       symbols on AIX.
+       * config/rs6000/aix64.opt (mcmodel): New.
+
 2012-11-14  Andreas Tobler  <andreast@fgznet.ch>
 
        * config/i386/i386.c (ix86_get_function_versions_dispatcher): Guard
        * config/i386/i386.c (ix86_function_ok_for_sibcall): Put back exception
        to make a sibcall if one of the functions has void return type.
 
-2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-11-07  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53063
        * doc/invoke.texi (Wformat): Update.
 
-2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-11-07  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * optc-gen.awk: Factor code out to...
        * opt-functions.awk (lang_enabled_by): ... this new function.
 
-2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-11-07  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53063
        * common.opt (Wswitch,Wswitch-default,Wswitch-enum): Move to c.opt.
 
        * expmed.c (store_bit_field_1): Remove test for BLKmode values.
 
-2012-10-31  Ralf Corsépius  <ralf.corsepius@rtems.org>,
+2012-10-31  Ralf CorsÃ\83©pius  <ralf.corsepius@rtems.org>,
            Joel Sherrill  <joel.sherrill@oarcorp.com>
 
        * config/sparc/t-rtems: New (Custom multilibs).
        * lra-spills.c: Likewise.
        * lra.c: Likewise.
 
-2012-10-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-10-29  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53066
        * tree.h (FUNCTION_POINTER_TYPE_P): New.
        * config/i386/x86intrin.h: Include
        xsaveintrin.h, fxsrintrin.h, xsaveoptintrin.h.
 
-2012-10-26  Ralf Corsépius  <ralf.corsepius@rtems.org>
+2012-10-26  Ralf CorsÃ\83©pius  <ralf.corsepius@rtems.org>
 
        * config/avr/t-rtems: Revert previous commit.
 
        * lra-constraints.c (check_and_process_move): Remove #if
        ENABLE_ASSERT_CHECKING.
 
-2012-10-26  Ralf Corsépius  <ralf.corsepius@rtems.org>
+2012-10-26  Ralf CorsÃ\83©pius  <ralf.corsepius@rtems.org>
 
        * config/avr/rtems.h (TARGET_OS_CPP_BUILTINS): Remove
        __USE_INIT_FINI__.
        * lra-assigns.c (assign_by_spills): Add non-reload pseudos
        assigned to hard register to changed_pseudo_bitmap.
 
-2012-10-25  Ralf Corsépius  <ralf.corsepius@rtems.org>
+2012-10-25  Ralf CorsÃ\83©pius  <ralf.corsepius@rtems.org>
 
        * config.gcc (microblaze*-*-rtems*): New target.
        * config/microblaze/rtems.h: New.
        * config/rs6000/rs6000.c (rs6000_density_test): Use dump_enabled_p
        instead of dump_kind_p.
 
-2012-10-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-10-24  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c++/54928
        * tree-diagnostic.c (maybe_unwind_expanded_macro_loc):
        * loop-iv.c (iv_number_of_iterations): Record the upper bound
        only if there are no further conditions on it.
 
-2012-10-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-10-20  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53063
        PR c/40989
        out of ...
        (forwarder_block_p): ... here.
 
-2012-10-16  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-10-16  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53063
        PR c/40989
        * opts.c (finish_options): Do not handle them explicitly.
        * opt-functions.awk (search_var_name): New.
 
-2012-10-16  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-10-16  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53063
        PR c/40989
        and -meb.
 
 2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
-           Manuel López-Ibáñez  <manu@gcc.gnu.org>
+           Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c++/53210
        * doc/invoke.texi ([Winit-self]): Document as enabled by -Wall in C++.
        PR rtl-optimization/54088
        * jump.c (delete_related_insns): Robustify latest change.
 
-2012-08-25  Ricardo Catalinas Jiménez  <jimenezrick@gmail.com>
+2012-08-25  Ricardo Catalinas JimÃ\83©nez  <jimenezrick@gmail.com>
 
        * doc/extend.texi (__atomic Builtins): Remove space before comma.
 
        (ASM_SPEC): Pass mcu options to the assembler.
        * doc/invoke.texi (MIPS Options): Document -mmcu and -mno-mcu.
 
-2012-07-18  Ralf Corsépius  <ralf.corsepius@rtems.org>
+2012-07-18  Ralf CorsÃ\83©pius  <ralf.corsepius@rtems.org>
 
        * config.gcc (v850-*-rtems*): New target.
        * config/v850/rtems.h: New.
        * tree-inline.c (estimate_num_insns): Estimate call cost for
        tailcalls properly.
 
-2012-06-20  Rüdiger Sonderfeld  <ruediger@c-plusplus.de>
+2012-06-20  RÃ\83¼diger Sonderfeld  <ruediger@c-plusplus.de>
 
        * tree.h (DECL_SOURCE_COLUMN): New accessor.
 
        (generate_code_for_partition): Generate code according
        to partition classification.
 
-2012-06-01  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-06-01  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
            Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        PR c++/50134
        (decide_is_variable_needed): Handle externals.
        (varpool_remove_unreferenced_decls): Likewise.
 
-2012-05-17  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-17  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * opts.c (common_handle_option): -pedantic-errors enables -Wpedantic.
        (enable_warning_as_error): Do not special case Wuninitialized.
        strided loads.
        * tree-vect-stmts.c (vect_model_load_cost): Handle strided loads.
 
-2012-05-14  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-14  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR 53063
        * doc/options.texi: (LangEnabledBy): Document it.
 
        * config/pa/pa.md: Use define_c_enum for "unspec" and "unspecv".
 
-2012-05-13  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-13  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * common.opt (Wtype-limits): Use EnabledBy.
 
        (*<code><mode>3): Ditto.
        (<code>tf3): Ditto.
 
-2012-05-13  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-13  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * optc-gen.awk: Error instead of warning for conflicting help.
 
        (delete_tree_ssa): Do not call fini_phinodes.
        * tree-flow.h (init_phinodes, fini_phinodes): Remove.
 
-2012-05-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-11  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR 53063
        * doc/options.texi (EnabledBy): Document
        (xop_mulv2div2di3_low): Remove insn_and_split pattern.
        (xop_mulv2div2di3_high): Ditto.
 
-2012-05-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-09  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c++/53289
        * diagnostic.h (diagnostic_context): Add last_location.
        * diagnostic.c (diagnostic_initialize): Initialize it.
        (diagnostic_show_locus): Use it.
 
-2012-05-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-09  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * doc/extend.texi (Function Attributes): Point xref to section
        about Pragmas.
        Same stands for reloads with type RELOAD_FOR_OUTPUT_ADDRESS and
        RELOAD_FOR_OUTADDR_ADDRESS.
 
-2012-05-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-04  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c++/24985
        * tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Show caret
        for macro expansion.
 
-2012-05-03  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-05-03  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * flags.h (flag_permissive): Do not declare.
        * diagnostic.c (diagnostic_report_diagnostic): Handle fpermissive
        * config/i386/i386.c (ix86_handle_struct_attribute): Use the proper
        predicate to discriminate types.
 
-2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-30  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * doc/invoke.texi (Wmissing-format-attribute): Document as an
        alias of Wsuggest-attribute=format.
        Wmissing-format-attribute with Wsuggest-attribute=format.
        (digest_init): Likewise.
 
-2012-04-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-29  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * opts.c (finish_options): Do not handle -Wmissing-noreturn here.
        * common.opt (Wmissing-noreturn): Alias of
        PR middle-end/27139
        * tree-ssa-forwprop.c (combine_conversions): Handle INT->FP->INT.
 
-2012-04-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-25  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/53130
        * c-typeck.c (pop_init_level): Use %qD instead of %qT.
        * reload.c (find_reloads): Change the loop nesting when trying an
        alternative with swapped operands.
 
-2012-04-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-26  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Fix
        comment. Delete unused parameter first_exp_point_map.
        set_nonincremental_init_from_string): Pass true instead of false
        as IMPLICIT to add_pending_init.
 
-2012-04-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-25  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * c-typeck.c (pop_init_level): Improve diagnostics.
 
        * config/vxworks.c (vxworks_override_options): Default to strict-dwarf
        and dwarf_version 2.
 
-2012-04-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-24  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * tree-pretty-print.h (default_tree_printer): Do not declare.
        * tree-diagnostic.c: Include tree-pretty-print.h, tree-pass.h and
        Likewise.
        * tree-switch-conversion.c (build_one_array): Likewise.
 
-2012-04-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-22  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/44774
        * doc/invoke.texi (pedantic): Rename to Wpedantic.
 
        * fold-const.c (fold_checksum_tree): Fix VECTOR_CST case.
 
-2012-04-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-21  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR 35441
        * c-typeck.c (inform_declaration): New.
 
        * config/arm/sync.md (sync_optab): Change ior attribute to "or".
 
-2012-04-19  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-19  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c/52283/37985
        * stmt.c (warn_if_unused_value): Skip NOP_EXPR.
        * varpoo.c (varpool_node_name): Remove.
        (dump_varpool_node): Use dump_symtab_base; reformat.
 
-2012-04-18  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-18  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * doc/invoke.texi (Language Independent Options): @item should be
        before @opindex.
 
        * doc/extend.texi (Type Attributes): Move paragraph.
 
-2012-04-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-11  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR 24985
        * diagnostic.h (show_caret): Declare.
        manipulation code we are threading through a loop header
        to an exit destination.
 
-2012-04-10  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-10  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * tree.h (warn_if_unused_value): Move declaration from here.
        * stmt.c (warn_if_unused_value): Move definition from here.
        comment block.
        (Sr0): Remove unused memory constraint.
 
-2012-04-08  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-04-08  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        * tree-pretty-print.h: Update comment.
 
        * tree-data-ref.c (subscript_dependence_tester_1): Check
        all dimensions for non-conflicting access functions.
 
-2012-03-15  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+2012-03-15  Manuel LÃ\83³pez-IbÃ\83¡Ã\83±ez  <manu@gcc.gnu.org>
 
        PR c++/44783
        * doc/invoke.texi [C++ Language Options]: Document
        in new variable 'empty'.  Increase issue_rate only for
        non-empty insns.
 
-2012-03-07  Ralf Corsépius  <ralf.corsepius@rtems.org>
+2012-03-07  Ralf CorsÃ\83©pius  <ralf.corsepius@rtems.org>
 
        PR target/51417
        * Makefile.in: Let install-gcc-ar depend on installdirs,
index 3fa48a8..063cb26 100644 (file)
@@ -39,6 +39,23 @@ do {                                                                 \
     {                                                                  \
       error ("-maix64 required: 64-bit computation with 32-bit addressing not yet supported"); \
     }                                                                  \
+  if ((rs6000_isa_flags_explicit                                       \
+       & OPTION_MASK_MINIMAL_TOC) != 0)                                        \
+    {                                                                  \
+      if (global_options_set.x_rs6000_current_cmodel                   \
+         && rs6000_current_cmodel != CMODEL_SMALL)                     \
+       error ("-mcmodel incompatible with other toc options");         \
+      SET_CMODEL (CMODEL_SMALL);                                       \
+    }                                                                  \
+  if (rs6000_current_cmodel != CMODEL_SMALL)                           \
+    {                                                                  \
+      TARGET_NO_FP_IN_TOC = 0;                                         \
+      TARGET_NO_SUM_IN_TOC = 0;                                                \
+    }                                                                  \
+  if (rs6000_current_cmodel == CMODEL_MEDIUM)                          \
+    {                                                                  \
+      rs6000_current_cmodel = CMODEL_LARGE;                            \
+    }                                                                  \
 } while (0);
 
 #undef ASM_SPEC
@@ -72,10 +89,12 @@ do {                                                                        \
 %{mcpu=620: -m620} \
 %{mcpu=630: -m620} \
 %{mcpu=970: -m970} \
-%{mcpu=G5: -m970}"
+%{mcpu=G5: -m970} \
+%{mvsx: %{!mcpu*: -mpwr6}} \
+-many"
 
 #undef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC "-mppc"
+#define ASM_DEFAULT_SPEC "-mpwr4"
 
 #undef TARGET_OS_CPP_BUILTINS
 #define TARGET_OS_CPP_BUILTINS()     \
@@ -177,6 +196,15 @@ extern long long int    atoll(const char *);
 /* This target uses the aix64.opt file.  */
 #define TARGET_USES_AIX64_OPT 1
 
+/* Large TOC Support */
+#ifdef HAVE_LD_LARGE_TOC
+#undef TARGET_CMODEL
+#define TARGET_CMODEL rs6000_current_cmodel
+#define SET_CMODEL(opt) rs6000_current_cmodel = opt
+#else
+#define SET_CMODEL(opt) do {} while (0)
+#endif
+
 /* This target defines SUPPORTS_WEAK and TARGET_ASM_NAMED_SECTION,
    but does not have crtbegin/end.  */
 
index 2dabd80..8acc05b 100644 (file)
@@ -27,6 +27,23 @@ maix32
 Target Report RejectNegative Negative(maix64) InverseMask(64BIT) Var(rs6000_isa_flags)
 Compile for 32-bit pointers
 
+mcmodel=
+Target RejectNegative Joined Enum(rs6000_cmodel) Var(rs6000_current_cmodel)
+Select code model
+
+Enum
+Name(rs6000_cmodel) Type(enum rs6000_cmodel)
+Known code models (for use with the -mcmodel= option):
+
+EnumValue
+Enum(rs6000_cmodel) String(small) Value(CMODEL_SMALL)
+
+EnumValue
+Enum(rs6000_cmodel) String(medium) Value(CMODEL_MEDIUM)
+
+EnumValue
+Enum(rs6000_cmodel) String(large) Value(CMODEL_LARGE)
+
 mpe
 Target Report RejectNegative Var(internal_nothing_1) Save
 Support message passing with the Parallel Environment
index d907461..b37bca9 100644 (file)
@@ -22183,7 +22183,11 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
       else if (offset)
        fprintf (file, ".P" HOST_WIDE_INT_PRINT_UNSIGNED, offset);
 
-      fputs ("[TC],", file);
+      /* Mark large TOC symbols on AIX with [TE] so they are mapped
+        after other TOC symbols, reducing overflow of small TOC access
+        to [TC] symbols.  */
+      fputs (TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL
+            ? "[TE]," : "[TC],", file);
     }
 
   /* Currently C++ toc references to vtables can be emitted before it
index 25fed1f..daa16a4 100644 (file)
    "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
    "addis %0,%2,%1@toc@ha")
 
+(define_insn "*largetoc_high_aix<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
+        (high:P
+         (unspec [(match_operand:P 1 "" "")
+                  (match_operand:P 2 "gpc_reg_operand" "b")]
+                 UNSPEC_TOCREL)))]
+   "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
+   "addis %0,%1@u(%2)")
+
 (define_insn "*largetoc_high_plus"
   [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
         (high:DI
    "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
    "addis %0,%2,%1+%3@toc@ha")
 
-(define_insn "*largetoc_low"
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
-        (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
-                  (match_operand:DI 2 "" "")))]
-   "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
+(define_insn "*largetoc_high_plus_aix<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
+        (high:P
+         (plus:P
+           (unspec [(match_operand:P 1 "" "")
+                    (match_operand:P 2 "gpc_reg_operand" "b")]
+                   UNSPEC_TOCREL)
+           (match_operand 3 "const_int_operand" "n"))))]
+   "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
+   "addis %0,%1+%3@u(%2)")
+
+(define_insn "*largetoc_low<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
+        (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b,!*r")
+                  (match_operand:P 2 "" "")))]
+   "TARGET_TOC && TARGET_CMODEL != CMODEL_SMALL"
    "@
     addi %0,%1,%2@l
     addic %0,%1,%2@l")
        (match_operand:P 1 "small_toc_ref" "R"))]
    "TARGET_TOC"
    "la %0,%a1"
-   "&& TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL && reload_completed"
+   "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
   [(set (match_dup 0) (high:P (match_dup 1)))
    (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
 
index 673b908..3f1ca74 100755 (executable)
@@ -26413,6 +26413,42 @@ $as_echo "#define HAVE_LD_LARGE_TOC 1" >>confdefs.h
     ;;
 esac
 
+case "$target" in
+  *-*-aix*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker large toc support" >&5
+$as_echo_n "checking linker large toc support... " >&6; }
+if test "${gcc_cv_ld_large_toc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_ld_large_toc=no
+    if test x$gcc_cv_as != x ; then
+      cat > conftest.s <<EOF
+       .toc
+LC..1:
+       .tc a[TC],a[RW]
+       .extern a[RW]
+       .csect .text[PR]
+.largetoctest:
+       addis 9,LC..1@u(2)
+       ld 3,LC..1@l(9)
+EOF
+      if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then
+        gcc_cv_ld_large_toc=yes
+      fi
+      rm -f conftest conftest.o conftest.s
+    fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_large_toc" >&5
+$as_echo "$gcc_cv_ld_large_toc" >&6; }
+    if test x"$gcc_cv_ld_large_toc" = xyes; then
+
+$as_echo "#define HAVE_LD_LARGE_TOC 1" >>confdefs.h
+
+    fi
+    ;;
+esac
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --build-id support" >&5
 $as_echo_n "checking linker --build-id support... " >&6; }
 if test "${gcc_cv_ld_buildid+set}" = set; then :
index e0e12c0..efddb7a 100644 (file)
@@ -4496,6 +4496,35 @@ EOF
     ;;
 esac
 
+case "$target" in
+  *-*-aix*)
+    AC_CACHE_CHECK(linker large toc support,
+    gcc_cv_ld_large_toc,
+    [gcc_cv_ld_large_toc=no
+    if test x$gcc_cv_as != x ; then
+      cat > conftest.s <<EOF
+       .toc
+LC..1:
+       .tc a[[TC]],a[[RW]]
+       .extern a[[RW]]
+       .csect .text[[PR]]
+.largetoctest:
+       addis 9,LC..1@u(2)
+       ld 3,LC..1@l(9)
+EOF
+      if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then
+        gcc_cv_ld_large_toc=yes
+      fi
+      rm -f conftest conftest.o conftest.s
+    fi
+    ])
+    if test x"$gcc_cv_ld_large_toc" = xyes; then
+      AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
+    [Define if your AIX linker supports a large TOC.])
+    fi
+    ;;
+esac
+
 AC_CACHE_CHECK(linker --build-id support,
   gcc_cv_ld_buildid,
   [gcc_cv_ld_buildid=no