diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-02-26 13:09:58 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-02-26 13:09:58 +0000 |
commit | b8053af55de78a3f080783e5113fd6452e5a43c5 (patch) | |
tree | a5906142e844e296abb7382e34657faf4e58f74f /gcc/config/rs6000 | |
parent | 4896274c9597b09d4c61bdd2efb3201a72634b3c (diff) | |
download | gcc-b8053af55de78a3f080783e5113fd6452e5a43c5.tar.gz |
2008-02-26 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r132671
Merged revisions 132452-132671 via svnmerge from
svn+ssh://bstarynk@gcc.gnu.org/svn/gcc/trunk
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@132672 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/darwin.h | 3 | ||||
-rw-r--r-- | gcc/config/rs6000/eabispe.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/linuxspe.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 105 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.h | 27 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 3 |
6 files changed, 113 insertions, 29 deletions
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 6c88757d24e..f6c9ee3c2e2 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -432,3 +432,6 @@ /* When generating kernel code or kexts, we don't use Altivec by default, as kernel code doesn't save/restore those registers. */ #define OS_MISSING_ALTIVEC (flag_mkernel || flag_apple_kext) + +/* Darwin has to rename some of the long double builtins. */ +#define SUBTARGET_INIT_BUILTINS darwin_patch_builtins () diff --git a/gcc/config/rs6000/eabispe.h b/gcc/config/rs6000/eabispe.h index 0acc17c7022..c3a3f2b4e53 100644 --- a/gcc/config/rs6000/eabispe.h +++ b/gcc/config/rs6000/eabispe.h @@ -31,7 +31,7 @@ #define SUBSUBTARGET_OVERRIDE_OPTIONS \ if (rs6000_select[1].string == NULL) \ rs6000_cpu = PROCESSOR_PPC8540; \ - if (!rs6000_explicit_options.abi) \ + if (!rs6000_explicit_options.spe_abi) \ rs6000_spe_abi = 1; \ if (!rs6000_explicit_options.float_gprs) \ rs6000_float_gprs = 1; \ diff --git a/gcc/config/rs6000/linuxspe.h b/gcc/config/rs6000/linuxspe.h index 1aea7442c54..c526cf8dce4 100644 --- a/gcc/config/rs6000/linuxspe.h +++ b/gcc/config/rs6000/linuxspe.h @@ -30,7 +30,7 @@ #define SUBSUBTARGET_OVERRIDE_OPTIONS \ if (rs6000_select[1].string == NULL) \ rs6000_cpu = PROCESSOR_PPC8540; \ - if (!rs6000_explicit_options.abi) \ + if (!rs6000_explicit_options.spe_abi) \ rs6000_spe_abi = 1; \ if (!rs6000_explicit_options.float_gprs) \ rs6000_float_gprs = 1; \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 4ebea38388b..9b9fefda2af 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -171,7 +171,7 @@ int rs6000_long_double_type_size; /* IEEE quad extended precision long double. */ int rs6000_ieeequad; -/* Whether -mabi=altivec has appeared. */ +/* Nonzero to use AltiVec ABI. */ int rs6000_altivec_abi; /* Nonzero if we want SPE ABI extensions. */ @@ -262,12 +262,14 @@ int rs6000_alignment_flags; struct { bool aix_struct_ret; /* True if -maix-struct-ret was used. */ bool alignment; /* True if -malign- was used. */ - bool abi; /* True if -mabi=spe/nospe was used. */ + bool spe_abi; /* True if -mabi=spe/no-spe was used. */ + bool altivec_abi; /* True if -mabi=altivec/no-altivec used. */ bool spe; /* True if -mspe= was used. */ bool float_gprs; /* True if -mfloat-gprs= was used. */ bool isel; /* True if -misel was used. */ bool long_double; /* True if -mlong-double- was used. */ bool ieee; /* True if -mabi=ieee/ibmlongdouble used. */ + bool vrsave; /* True if -mvrsave was used. */ } rs6000_explicit_options; struct builtin_description @@ -667,6 +669,25 @@ struct processor_costs ppc8540_cost = { 1, /* prefetch streams /*/ }; +/* Instruction costs on E300C2 and E300C3 cores. */ +static const +struct processor_costs ppce300c2c3_cost = { + COSTS_N_INSNS (4), /* mulsi */ + COSTS_N_INSNS (4), /* mulsi_const */ + COSTS_N_INSNS (4), /* mulsi_const9 */ + COSTS_N_INSNS (4), /* muldi */ + COSTS_N_INSNS (19), /* divsi */ + COSTS_N_INSNS (19), /* divdi */ + COSTS_N_INSNS (3), /* fp */ + COSTS_N_INSNS (4), /* dmul */ + COSTS_N_INSNS (18), /* sdiv */ + COSTS_N_INSNS (33), /* ddiv */ + 32, + 32, /* l1 cache */ + 256, /* l2 cache */ + 1, /* prefetch streams /*/ +}; + /* Instruction costs on POWER4 and POWER5 processors. */ static const struct processor_costs power4_cost = { @@ -1418,6 +1439,8 @@ rs6000_override_options (const char *default_cpu) {"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, /* 8548 has a dummy entry for now. */ {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, + {"e300c2", PROCESSOR_PPCE300C2, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, + {"e300c3", PROCESSOR_PPCE300C3, POWERPC_BASE_MASK}, {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"970", PROCESSOR_POWER4, POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64}, @@ -1524,6 +1547,14 @@ rs6000_override_options (const char *default_cpu) if (TARGET_E500) rs6000_isel = 1; + if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3) + { + if (TARGET_ALTIVEC) + error ("AltiVec not supported in this target"); + if (TARGET_SPE) + error ("Spe not supported in this target"); + } + /* If we are optimizing big endian systems for space, use the load/store multiple and string instructions. */ if (BYTES_BIG_ENDIAN && optimize_size) @@ -1590,11 +1621,18 @@ rs6000_override_options (const char *default_cpu) if (TARGET_XCOFF && TARGET_ALTIVEC) rs6000_altivec_abi = 1; - /* Set Altivec ABI as default for PowerPC64 Linux. */ - if (TARGET_ELF && TARGET_64BIT) + /* The AltiVec ABI is the default for PowerPC-64 GNU/Linux. For + PowerPC-32 GNU/Linux, -maltivec implies the AltiVec ABI. It can + be explicitly overridden in either case. */ + if (TARGET_ELF) { - rs6000_altivec_abi = 1; - TARGET_ALTIVEC_VRSAVE = 1; + if (!rs6000_explicit_options.altivec_abi + && (TARGET_64BIT || TARGET_ALTIVEC)) + rs6000_altivec_abi = 1; + + /* Enable VRSAVE for AltiVec ABI, unless explicitly overridden. */ + if (!rs6000_explicit_options.vrsave) + TARGET_ALTIVEC_VRSAVE = rs6000_altivec_abi; } /* Set the Darwin64 ABI as default for 64-bit Darwin. */ @@ -1638,7 +1676,7 @@ rs6000_override_options (const char *default_cpu) /* For the powerpc-eabispe configuration, we set all these by default, so let's unset them if we manually set another CPU that is not the E500. */ - if (!rs6000_explicit_options.abi) + if (!rs6000_explicit_options.spe_abi) rs6000_spe_abi = 0; if (!rs6000_explicit_options.spe) rs6000_spe = 0; @@ -1836,6 +1874,11 @@ rs6000_override_options (const char *default_cpu) rs6000_cost = &ppc8540_cost; break; + case PROCESSOR_PPCE300C2: + case PROCESSOR_PPCE300C3: + rs6000_cost = &ppce300c2c3_cost; + break; + case PROCESSOR_POWER4: case PROCESSOR_POWER5: rs6000_cost = &power4_cost; @@ -2131,6 +2174,7 @@ rs6000_handle_option (size_t code, const char *arg, int value) break; case OPT_mvrsave_: + rs6000_explicit_options.vrsave = true; rs6000_parse_yes_no_option ("vrsave", arg, &(TARGET_ALTIVEC_VRSAVE)); break; @@ -2188,19 +2232,20 @@ rs6000_handle_option (size_t code, const char *arg, int value) case OPT_mabi_: if (!strcmp (arg, "altivec")) { - rs6000_explicit_options.abi = true; + rs6000_explicit_options.altivec_abi = true; rs6000_altivec_abi = 1; + + /* Enabling the AltiVec ABI turns off the SPE ABI. */ rs6000_spe_abi = 0; } else if (! strcmp (arg, "no-altivec")) { - /* ??? Don't set rs6000_explicit_options.abi here, to allow - the default for rs6000_spe_abi to be chosen later. */ + rs6000_explicit_options.altivec_abi = true; rs6000_altivec_abi = 0; } else if (! strcmp (arg, "spe")) { - rs6000_explicit_options.abi = true; + rs6000_explicit_options.spe_abi = true; rs6000_spe_abi = 1; rs6000_altivec_abi = 0; if (!TARGET_SPE_ABI) @@ -2208,7 +2253,7 @@ rs6000_handle_option (size_t code, const char *arg, int value) } else if (! strcmp (arg, "no-spe")) { - rs6000_explicit_options.abi = true; + rs6000_explicit_options.spe_abi = true; rs6000_spe_abi = 0; } @@ -3619,19 +3664,29 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, /* We accept [reg + reg] and [reg + OFFSET]. */ if (GET_CODE (x) == PLUS) - { - rtx op1 = XEXP (x, 0); - rtx op2 = XEXP (x, 1); + { + rtx op1 = XEXP (x, 0); + rtx op2 = XEXP (x, 1); + rtx y; - op1 = force_reg (Pmode, op1); + op1 = force_reg (Pmode, op1); - if (GET_CODE (op2) != REG - && (GET_CODE (op2) != CONST_INT - || !SPE_CONST_OFFSET_OK (INTVAL (op2)))) - op2 = force_reg (Pmode, op2); + if (GET_CODE (op2) != REG + && (GET_CODE (op2) != CONST_INT + || !SPE_CONST_OFFSET_OK (INTVAL (op2)) + || (GET_MODE_SIZE (mode) > 8 + && !SPE_CONST_OFFSET_OK (INTVAL (op2) + 8)))) + op2 = force_reg (Pmode, op2); - return gen_rtx_PLUS (Pmode, op1, op2); - } + /* We can't always do [reg + reg] for these, because [reg + + reg + offset] is not a legitimate addressing mode. */ + y = gen_rtx_PLUS (Pmode, op1, op2); + + if (GET_MODE_SIZE (mode) > 8 && REG_P (op2)) + return force_reg (Pmode, y); + else + return y; + } return force_reg (Pmode, x); } @@ -9166,6 +9221,10 @@ rs6000_init_builtins (void) if (built_in_decls [BUILT_IN_CLOG]) set_user_assembler_name (built_in_decls [BUILT_IN_CLOG], "__clog"); #endif + +#ifdef SUBTARGET_INIT_BUILTINS + SUBTARGET_INIT_BUILTINS; +#endif } /* Search through a set of builtins and enable the mask bits. @@ -18502,6 +18561,8 @@ rs6000_issue_rate (void) case CPU_PPC7400: case CPU_PPC8540: case CPU_CELL: + case CPU_PPCE300C2: + case CPU_PPCE300C3: return 2; case CPU_RIOS2: case CPU_PPC604: diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 6a64eae3dd9..7f7dd57e1e1 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -60,6 +60,18 @@ #define TARGET_PAIRED_FLOAT 0 #endif +#ifdef HAVE_AS_POPCNTB +#define ASM_CPU_POWER5_SPEC "-mpower5" +#else +#define ASM_CPU_POWER5_SPEC "-mpower4" +#endif + +#ifdef HAVE_AS_DFP +#define ASM_CPU_POWER6_SPEC "-mpower6 -maltivec" +#else +#define ASM_CPU_POWER6_SPEC "-mpower4 -maltivec" +#endif + /* Common ASM definitions used by ASM_SPEC among the various targets for handling -mcpu=xxx switches. */ #define ASM_CPU_SPEC \ @@ -76,10 +88,10 @@ %{mcpu=power2: -mpwrx} \ %{mcpu=power3: -mppc64} \ %{mcpu=power4: -mpower4} \ -%{mcpu=power5: -mpower4} \ -%{mcpu=power5+: -mpower4} \ -%{mcpu=power6: -mpower4 -maltivec} \ -%{mcpu=power6x: -mpower4 -maltivec} \ +%{mcpu=power5: %(asm_cpu_power5)} \ +%{mcpu=power5+: %(asm_cpu_power5)} \ +%{mcpu=power6: %(asm_cpu_power6) -maltivec} \ +%{mcpu=power6x: %(asm_cpu_power6) -maltivec} \ %{mcpu=powerpc: -mppc} \ %{mcpu=rios: -mpwr} \ %{mcpu=rios1: -mpwr} \ @@ -117,6 +129,8 @@ %{mcpu=G5: -mpower4 -maltivec} \ %{mcpu=8540: -me500} \ %{mcpu=8548: -me500} \ +%{mcpu=e300c2: -me300} \ +%{mcpu=e300c3: -me300} \ %{maltivec: -maltivec} \ -many" @@ -141,6 +155,8 @@ { "asm_cpu", ASM_CPU_SPEC }, \ { "asm_default", ASM_DEFAULT_SPEC }, \ { "cc1_cpu", CC1_CPU_SPEC }, \ + { "asm_cpu_power5", ASM_CPU_POWER5_SPEC }, \ + { "asm_cpu_power6", ASM_CPU_POWER6_SPEC }, \ SUBTARGET_EXTRA_SPECS /* -mcpu=native handling only makes sense with compiler running on @@ -262,6 +278,8 @@ enum processor_type PROCESSOR_PPC7400, PROCESSOR_PPC7450, PROCESSOR_PPC8540, + PROCESSOR_PPCE300C2, + PROCESSOR_PPCE300C3, PROCESSOR_POWER4, PROCESSOR_POWER5, PROCESSOR_POWER6, @@ -596,6 +614,7 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; Make vector constants quadword aligned. */ #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ (TREE_CODE (EXP) == STRING_CST \ + && (STRICT_ALIGNMENT || !optimize_size) \ && (ALIGN) < BITS_PER_WORD \ ? BITS_PER_WORD \ : (ALIGN)) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index d1b43dc78af..777a1ecf46d 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -133,7 +133,7 @@ ;; Processor type -- this attribute must exactly match the processor_type ;; enumeration in rs6000.h. -(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell" +(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,power4,power5,power6,cell" (const (symbol_ref "rs6000_cpu_attr"))) @@ -166,6 +166,7 @@ (include "7xx.md") (include "7450.md") (include "8540.md") +(include "e300c2c3.md") (include "power4.md") (include "power5.md") (include "power6.md") |