From d1f0d3769edfb2217f19f0937f30423e6298f744 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Mon, 9 Nov 2015 16:56:22 +0000 Subject: [PATCH] rs6000.opt (-mpower9-fusion): Add new switches for ISA 3.0 (power9). 2015-11-09 Michael Meissner * config/rs6000/rs6000.opt (-mpower9-fusion): Add new switches for ISA 3.0 (power9). (-mpower9-vector): Likewise. (-mpower9-dform): Likewise. (-mpower9-minmax): Likewise. (-mtoc-fusion): Likewise. (-mmodulo): Likewise. (-mfloat128-hardware): Likewise. * config/rs6000/rs6000-cpus.def (ISA_3_0_MASKS_SERVER): Add option mask for ISA 3.0 (power9). (POWERPC_MASKS): Add new ISA 3.0 switches. (power9 cpu): Add power9 cpu. * config/rs6000/rs6000.h (ASM_CPU_POWER9_SPEC): Add support for power9. (ASM_CPU_SPEC): Likewise. (EXTRA_SPECS): Likewise. * config/rs6000/rs6000-opts.h (enum processor_type): Add PROCESSOR_POWER9. * config/rs6000/rs6000.c (power9_cost): Initial cost setup for power9. (rs6000_debug_reg_global): Add support for power9 fusion. (rs6000_setup_reg_addr_masks): Cache mode size. (rs6000_option_override_internal): Until real power9 tuning is added, use -mtune=power8 for -mcpu=power9. (rs6000_setup_reg_addr_masks): Do not allow pre-increment, pre-decrement, or pre-modify on SFmode/DFmode if we allow the use of Altivec registers. (rs6000_option_override_internal): Add support for ISA 3.0 switches. (rs6000_loop_align): Add support for power9 cpu. (rs6000_file_start): Likewise. (rs6000_adjust_cost): Likewise. (rs6000_issue_rate): Likewise. (insn_must_be_first_in_group): Likewise. (insn_must_be_last_in_group): Likewise. (force_new_group): Likewise. (rs6000_register_move_cost): Likewise. (rs6000_opt_masks): Likewise. * config/rs6000/rs6000.md (cpu attribute): Add power9. * config/rs6000/rs6000-tables.opt: Regenerate. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define _ARCH_PWR9 if power9 support is available. * config/rs6000/aix61.h (ASM_CPU_SPEC): Add power9. * config/rs6000/aix53.h (ASM_CPU_SPEC): Likewise. * configure.ac: Determine if the assembler supports the ISA 3.0 instructions. * config.in (HAVE_AS_POWER9): Likewise. * configure: Regenerate. * doc/invoke.texi (RS/6000 and PowerPC Options): Document ISA 3.0 switches. From-SVN: r230031 --- gcc/ChangeLog | 62 ++++++++ gcc/config.in | 6 + gcc/config/rs6000/aix53.h | 1 + gcc/config/rs6000/aix61.h | 1 + gcc/config/rs6000/rs6000-c.c | 2 + gcc/config/rs6000/rs6000-cpus.def | 16 +++ gcc/config/rs6000/rs6000-opts.h | 1 + gcc/config/rs6000/rs6000-tables.opt | 11 +- gcc/config/rs6000/rs6000.c | 212 ++++++++++++++++++++++++++-- gcc/config/rs6000/rs6000.h | 8 ++ gcc/config/rs6000/rs6000.md | 2 +- gcc/config/rs6000/rs6000.opt | 28 ++++ gcc/configure | 42 ++++++ gcc/configure.ac | 13 ++ gcc/doc/invoke.texi | 48 ++++++- 15 files changed, 427 insertions(+), 26 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ebd537cbcae..791180455b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,65 @@ +2015-11-09 Michael Meissner + + * config/rs6000/rs6000.opt (-mpower9-fusion): Add new switches for + ISA 3.0 (power9). + (-mpower9-vector): Likewise. + (-mpower9-dform): Likewise. + (-mpower9-minmax): Likewise. + (-mtoc-fusion): Likewise. + (-mmodulo): Likewise. + (-mfloat128-hardware): Likewise. + + * config/rs6000/rs6000-cpus.def (ISA_3_0_MASKS_SERVER): Add option + mask for ISA 3.0 (power9). + (POWERPC_MASKS): Add new ISA 3.0 switches. + (power9 cpu): Add power9 cpu. + + * config/rs6000/rs6000.h (ASM_CPU_POWER9_SPEC): Add support for + power9. + (ASM_CPU_SPEC): Likewise. + (EXTRA_SPECS): Likewise. + + * config/rs6000/rs6000-opts.h (enum processor_type): Add + PROCESSOR_POWER9. + + * config/rs6000/rs6000.c (power9_cost): Initial cost setup for + power9. + (rs6000_debug_reg_global): Add support for power9 fusion. + (rs6000_setup_reg_addr_masks): Cache mode size. + (rs6000_option_override_internal): Until real power9 tuning is + added, use -mtune=power8 for -mcpu=power9. + (rs6000_setup_reg_addr_masks): Do not allow pre-increment, + pre-decrement, or pre-modify on SFmode/DFmode if we allow the use + of Altivec registers. + (rs6000_option_override_internal): Add support for ISA 3.0 + switches. + (rs6000_loop_align): Add support for power9 cpu. + (rs6000_file_start): Likewise. + (rs6000_adjust_cost): Likewise. + (rs6000_issue_rate): Likewise. + (insn_must_be_first_in_group): Likewise. + (insn_must_be_last_in_group): Likewise. + (force_new_group): Likewise. + (rs6000_register_move_cost): Likewise. + (rs6000_opt_masks): Likewise. + + * config/rs6000/rs6000.md (cpu attribute): Add power9. + * config/rs6000/rs6000-tables.opt: Regenerate. + + * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define + _ARCH_PWR9 if power9 support is available. + + * config/rs6000/aix61.h (ASM_CPU_SPEC): Add power9. + * config/rs6000/aix53.h (ASM_CPU_SPEC): Likewise. + + * configure.ac: Determine if the assembler supports the ISA 3.0 + instructions. + * config.in (HAVE_AS_POWER9): Likewise. + * configure: Regenerate. + + * doc/invoke.texi (RS/6000 and PowerPC Options): Document ISA 3.0 + switches. + 2015-11-09 Kyrylo Tkachov * config/aarch64/aarch64.c (aarch64_simd_valid_immediate): diff --git a/gcc/config.in b/gcc/config.in index eb1ea106031..bb0d22053e9 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -556,6 +556,12 @@ #endif +/* Define if your assembler supports POWER9 instructions. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_POWER9 +#endif + + /* Define if your assembler supports .ref */ #ifndef USED_FOR_TARGET #undef HAVE_AS_REF diff --git a/gcc/config/rs6000/aix53.h b/gcc/config/rs6000/aix53.h index b912e7b8589..d9aa3c20f75 100644 --- a/gcc/config/rs6000/aix53.h +++ b/gcc/config/rs6000/aix53.h @@ -63,6 +63,7 @@ do { \ %{mcpu=power6x: -mpwr6} \ %{mcpu=power7: -mpwr7} \ %{mcpu=power8: -mpwr8} \ +%{mcpu=power9: -mpwr9} \ %{mcpu=powerpc: -mppc} \ %{mcpu=rs64a: -mppc} \ %{mcpu=603: -m603} \ diff --git a/gcc/config/rs6000/aix61.h b/gcc/config/rs6000/aix61.h index 0e27057027f..46bdcf50035 100644 --- a/gcc/config/rs6000/aix61.h +++ b/gcc/config/rs6000/aix61.h @@ -80,6 +80,7 @@ do { \ %{mcpu=power6x: -mpwr6} \ %{mcpu=power7: -mpwr7} \ %{mcpu=power8: -mpwr8} \ +%{mcpu=power9: -mpwr9} \ %{mcpu=powerpc: -mppc} \ %{mcpu=rs64a: -mppc} \ %{mcpu=603: -m603} \ diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 8f02edd1a63..a1b4fd4d17e 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -349,6 +349,8 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7"); if ((flags & OPTION_MASK_DIRECT_MOVE) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR8"); + if ((flags & OPTION_MASK_MODULO) != 0) + rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR9"); if ((flags & OPTION_MASK_SOFT_FLOAT) != 0) rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT"); if ((flags & OPTION_MASK_RECIP_PRECISION) != 0) diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index c63506bdf82..fc2b0f11353 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -60,6 +60,15 @@ | OPTION_MASK_QUAD_MEMORY_ATOMIC \ | OPTION_MASK_UPPER_REGS_SF) +/* Add ISEL back into ISA 3.0, since it is supposed to be a win. Do not add + P9_DFORM or P9_MINMAX until they are fully debugged. */ +#define ISA_3_0_MASKS_SERVER (ISA_2_7_MASKS_SERVER \ + | OPTION_MASK_FLOAT128_HW \ + | OPTION_MASK_ISEL \ + | OPTION_MASK_MODULO \ + | OPTION_MASK_P9_FUSION \ + | OPTION_MASK_P9_VECTOR) + #define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC) /* Deal with ports that do not have -mstrict-align. */ @@ -87,10 +96,15 @@ | OPTION_MASK_ISEL \ | OPTION_MASK_MFCRF \ | OPTION_MASK_MFPGPR \ + | OPTION_MASK_MODULO \ | OPTION_MASK_MULHW \ | OPTION_MASK_NO_UPDATE \ | OPTION_MASK_P8_FUSION \ | OPTION_MASK_P8_VECTOR \ + | OPTION_MASK_P9_DFORM \ + | OPTION_MASK_P9_FUSION \ + | OPTION_MASK_P9_MINMAX \ + | OPTION_MASK_P9_VECTOR \ | OPTION_MASK_POPCNTB \ | OPTION_MASK_POPCNTD \ | OPTION_MASK_POWERPC64 \ @@ -101,6 +115,7 @@ | OPTION_MASK_RECIP_PRECISION \ | OPTION_MASK_SOFT_FLOAT \ | OPTION_MASK_STRICT_ALIGN_OPTIONAL \ + | OPTION_MASK_TOC_FUSION \ | OPTION_MASK_UPPER_REGS_DF \ | OPTION_MASK_UPPER_REGS_SF \ | OPTION_MASK_VSX \ @@ -195,6 +210,7 @@ RS6000_CPU ("power7", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */ | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD | MASK_VSX | MASK_RECIP_PRECISION | OPTION_MASK_UPPER_REGS_DF) RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) +RS6000_CPU ("power9", PROCESSOR_POWER9, MASK_POWERPC64 | ISA_3_0_MASKS_SERVER) RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0) RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64) RS6000_CPU ("powerpc64le", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) diff --git a/gcc/config/rs6000/rs6000-opts.h b/gcc/config/rs6000/rs6000-opts.h index 2a028eaae8f..012c0db42fc 100644 --- a/gcc/config/rs6000/rs6000-opts.h +++ b/gcc/config/rs6000/rs6000-opts.h @@ -60,6 +60,7 @@ enum processor_type PROCESSOR_POWER6, PROCESSOR_POWER7, PROCESSOR_POWER8, + PROCESSOR_POWER9, PROCESSOR_RS64A, PROCESSOR_MPCCORE, diff --git a/gcc/config/rs6000/rs6000-tables.opt b/gcc/config/rs6000/rs6000-tables.opt index e4b41e148bc..2529ff1ca91 100644 --- a/gcc/config/rs6000/rs6000-tables.opt +++ b/gcc/config/rs6000/rs6000-tables.opt @@ -180,14 +180,17 @@ EnumValue Enum(rs6000_cpu_opt_value) String(power8) Value(50) EnumValue -Enum(rs6000_cpu_opt_value) String(powerpc) Value(51) +Enum(rs6000_cpu_opt_value) String(power9) Value(51) EnumValue -Enum(rs6000_cpu_opt_value) String(powerpc64) Value(52) +Enum(rs6000_cpu_opt_value) String(powerpc) Value(52) EnumValue -Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(53) +Enum(rs6000_cpu_opt_value) String(powerpc64) Value(53) EnumValue -Enum(rs6000_cpu_opt_value) String(rs64) Value(54) +Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(54) + +EnumValue +Enum(rs6000_cpu_opt_value) String(rs64) Value(55) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 13d0193ea55..2adf79b1315 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -985,6 +985,26 @@ struct processor_costs power8_cost = { COSTS_N_INSNS (3), /* SF->DF convert */ }; +/* Instruction costs on POWER9 processors. */ +static const +struct processor_costs power9_cost = { + COSTS_N_INSNS (3), /* mulsi */ + COSTS_N_INSNS (3), /* mulsi_const */ + COSTS_N_INSNS (3), /* mulsi_const9 */ + COSTS_N_INSNS (3), /* muldi */ + COSTS_N_INSNS (19), /* divsi */ + COSTS_N_INSNS (35), /* divdi */ + COSTS_N_INSNS (3), /* fp */ + COSTS_N_INSNS (3), /* dmul */ + COSTS_N_INSNS (14), /* sdiv */ + COSTS_N_INSNS (17), /* ddiv */ + 128, /* cache line size */ + 32, /* l1 cache */ + 256, /* l2 cache */ + 12, /* prefetch streams */ + COSTS_N_INSNS (3), /* SF->DF convert */ +}; + /* Instruction costs on POWER A2 processors. */ static const struct processor_costs ppca2_cost = { @@ -2423,8 +2443,18 @@ rs6000_debug_reg_global (void) fprintf (stderr, DEBUG_FMT_S, "lra", "true"); if (TARGET_P8_FUSION) - fprintf (stderr, DEBUG_FMT_S, "p8 fusion", - (TARGET_P8_FUSION_SIGN) ? "zero+sign" : "zero"); + { + char options[80]; + + strcpy (options, (TARGET_P9_FUSION) ? "power9" : "power8"); + if (TARGET_TOC_FUSION) + strcat (options, ", toc"); + + if (TARGET_P8_FUSION_SIGN) + strcat (options, ", sign"); + + fprintf (stderr, DEBUG_FMT_S, "fusion", options); + } fprintf (stderr, DEBUG_FMT_S, "plt-format", TARGET_SECURE_PLT ? "secure" : "bss"); @@ -2463,6 +2493,7 @@ rs6000_setup_reg_addr_masks (void) for (m = 0; m < NUM_MACHINE_MODES; ++m) { machine_mode m2 = (machine_mode)m; + unsigned short msize = GET_MODE_SIZE (m2); /* SDmode is special in that we want to access it only via REG+REG addressing on power7 and above, since we want to use the LFIWZX and @@ -2492,16 +2523,18 @@ rs6000_setup_reg_addr_masks (void) /* Figure out if we can do PRE_INC, PRE_DEC, or PRE_MODIFY addressing. Restrict addressing on SPE for 64-bit types because of the SUBREG hackery used to address 64-bit floats in - '32-bit' GPRs. */ + '32-bit' GPRs. If we allow scalars into Altivec registers, + don't allow PRE_INC, PRE_DEC, or PRE_MODIFY. */ if (TARGET_UPDATE && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR) - && GET_MODE_SIZE (m2) <= 8 + && msize <= 8 && !VECTOR_MODE_P (m2) && !FLOAT128_VECTOR_P (m2) && !COMPLEX_MODE_P (m2) - && !indexed_only_p - && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m2) == 8)) + && (m2 != DFmode || !TARGET_UPPER_REGS_DF) + && (m2 != SFmode || !TARGET_UPPER_REGS_SF) + && !(TARGET_E500_DOUBLE && msize == 8)) { addr_mask |= RELOAD_REG_PRE_INCDEC; @@ -2536,7 +2569,7 @@ rs6000_setup_reg_addr_masks (void) /* VMX registers can do (REG & -16) and ((REG+REG) & -16) addressing on 128-bit types. */ - if (rc == RELOAD_REG_VMX && GET_MODE_SIZE (m2) == 16 + if (rc == RELOAD_REG_VMX && msize == 16 && (addr_mask & RELOAD_REG_VALID) != 0) addr_mask |= RELOAD_REG_AND_M16; @@ -3382,7 +3415,22 @@ rs6000_option_override_internal (bool global_init_p) if (rs6000_tune_index >= 0) tune_index = rs6000_tune_index; else if (have_cpu) - rs6000_tune_index = tune_index = cpu_index; + { + /* Until power9 tuning is available, use power8 tuning if -mcpu=power9. */ + if (processor_target_table[cpu_index].processor != PROCESSOR_POWER9) + rs6000_tune_index = tune_index = cpu_index; + else + { + size_t i; + tune_index = -1; + for (i = 0; i < ARRAY_SIZE (processor_target_table); i++) + if (processor_target_table[i].processor == PROCESSOR_POWER8) + { + rs6000_tune_index = tune_index = i; + break; + } + } + } else { size_t i; @@ -3557,7 +3605,9 @@ rs6000_option_override_internal (bool global_init_p) /* For the newer switches (vsx, dfp, etc.) set some of the older options, unless the user explicitly used the -mno-