summaryrefslogtreecommitdiff
path: root/gcc/config/rs6000
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-14 16:41:21 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-14 16:41:21 +0000
commit0a2ab8ccc199cfa92d31bb84e15e9887141d58cc (patch)
treec71692baa6ca664efa39787ea6398cc4fcbb3ed8 /gcc/config/rs6000
parentdcdb0f810c793a2a186451f00030e67a8e2a0e42 (diff)
downloadgcc-0a2ab8ccc199cfa92d31bb84e15e9887141d58cc.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193502 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r--gcc/config/rs6000/aix61.h32
-rw-r--r--gcc/config/rs6000/aix64.opt17
-rw-r--r--gcc/config/rs6000/rs6000.c6
-rw-r--r--gcc/config/rs6000/rs6000.md32
4 files changed, 78 insertions, 9 deletions
diff --git a/gcc/config/rs6000/aix61.h b/gcc/config/rs6000/aix61.h
index 3fa48a8b9f6..063cb26e86d 100644
--- a/gcc/config/rs6000/aix61.h
+++ b/gcc/config/rs6000/aix61.h
@@ -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. */
diff --git a/gcc/config/rs6000/aix64.opt b/gcc/config/rs6000/aix64.opt
index 2dabd809806..8acc05beaa5 100644
--- a/gcc/config/rs6000/aix64.opt
+++ b/gcc/config/rs6000/aix64.opt
@@ -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
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d907461814e..b37bca935a8 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -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
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 25fed1ffa8f..daa16a4fbad 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10339,6 +10339,15 @@
"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
@@ -10350,11 +10359,22 @@
"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")
@@ -10364,7 +10384,7 @@
(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)))])