diff options
author | Michael Meissner <meissner@linux.vnet.ibm.com> | 2014-11-14 20:56:41 +0000 |
---|---|---|
committer | Michael Meissner <meissner@linux.vnet.ibm.com> | 2014-11-14 20:56:41 +0000 |
commit | 9dd6f12405975ac30dc5094262219439c4deaaa5 (patch) | |
tree | 4af4d2bd5fade0b2adec1e38046fecea5fb7cd40 | |
parent | 2b116a764007f88f5dd387cbdd510e61a581163d (diff) |
Apply patch #8
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/addr-patch@217592 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/config/rs6000/predicates.md | 21 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-cpus.def | 10 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 41 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 15 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.opt | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 28 |
6 files changed, 102 insertions, 17 deletions
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 8abac7ee128..de7fa4ebc76 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -521,6 +521,27 @@ } }) +;; Return 1 if the operand must be loaded from memory. This is used by a +;; define_split to insure constants get pushed to the constant pool before +;; reload. If -ffast-math is used, easy_fp_constant will allow move insns to +;; have constants in order not interfere with reciprocal estimation. However, +;; with -mupper-regs support, these constants must be moved to the constant +;; pool before register allocation. + +(define_predicate "memory_fp_constant" + (match_code "const_double") +{ + if (TARGET_VSX && op == CONST0_RTX (mode)) + return 0; + + if (!TARGET_HARD_FLOAT || !TARGET_FPRS + || (mode == SFmode && !TARGET_SINGLE_FLOAT) + || (mode == DFmode && !TARGET_DOUBLE_FLOAT)) + return 0; + + return 1; +}) + ;; Return 1 if the operand is a CONST_VECTOR and can be loaded into a ;; vector register without using memory. (define_predicate "easy_vector_constant" diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index b17fd0d7207..c1a7649c3fb 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -44,7 +44,8 @@ #define ISA_2_6_MASKS_SERVER (ISA_2_5_MASKS_SERVER \ | OPTION_MASK_POPCNTD \ | OPTION_MASK_ALTIVEC \ - | OPTION_MASK_VSX) + | OPTION_MASK_VSX \ + | OPTION_MASK_UPPER_REGS_DF) /* For now, don't provide an embedded version of ISA 2.07. */ #define ISA_2_7_MASKS_SERVER (ISA_2_6_MASKS_SERVER \ @@ -54,7 +55,8 @@ | OPTION_MASK_DIRECT_MOVE \ | OPTION_MASK_HTM \ | OPTION_MASK_QUAD_MEMORY \ - | OPTION_MASK_QUAD_MEMORY_ATOMIC) + | OPTION_MASK_QUAD_MEMORY_ATOMIC \ + | OPTION_MASK_UPPER_REGS_SF) #define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC) @@ -94,6 +96,8 @@ | OPTION_MASK_RECIP_PRECISION \ | OPTION_MASK_SOFT_FLOAT \ | OPTION_MASK_STRICT_ALIGN_OPTIONAL \ + | OPTION_MASK_UPPER_REGS_DF \ + | OPTION_MASK_UPPER_REGS_SF \ | OPTION_MASK_VSX \ | OPTION_MASK_VSX_TIMODE) @@ -184,7 +188,7 @@ RS6000_CPU ("power6x", PROCESSOR_POWER6, MASK_POWERPC64 | MASK_PPC_GPOPT RS6000_CPU ("power7", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */ POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD - | MASK_VSX | MASK_RECIP_PRECISION) + | MASK_VSX | MASK_RECIP_PRECISION | OPTION_MASK_UPPER_REGS_DF) RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0) RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 52adf762e6b..4f66840fd4a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2462,9 +2462,7 @@ 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. To simplify secondary reload, don't allow - update forms on scalar floating point types that can go in the - upper registers. */ + '32-bit' GPRs. */ if (TARGET_UPDATE && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR) @@ -2472,8 +2470,7 @@ rs6000_setup_reg_addr_masks (void) && !VECTOR_MODE_P (m2) && !COMPLEX_MODE_P (m2) && !indexed_only_p - && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m2) == 8) - && !reg_addr[m2].scalar_in_vmx_p) + && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m2) == 8)) { addr_mask |= RELOAD_REG_PRE_INCDEC; @@ -3509,6 +3506,40 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags &= ~OPTION_MASK_DFP; } + /* Allow an explicit -mupper-regs to set both -mupper-regs-df and + -mupper-regs-sf, depending on the cpu, unless the user explicitly also set + the individual option. */ + if (TARGET_UPPER_REGS > 0) + { + if (TARGET_VSX + && !(rs6000_isa_flags_explicit & OPTION_MASK_UPPER_REGS_DF)) + { + rs6000_isa_flags |= OPTION_MASK_UPPER_REGS_DF; + rs6000_isa_flags_explicit |= OPTION_MASK_UPPER_REGS_DF; + } + if (TARGET_P8_VECTOR + && !(rs6000_isa_flags_explicit & OPTION_MASK_UPPER_REGS_SF)) + { + rs6000_isa_flags |= OPTION_MASK_UPPER_REGS_SF; + rs6000_isa_flags_explicit |= OPTION_MASK_UPPER_REGS_SF; + } + } + else if (TARGET_UPPER_REGS == 0) + { + if (TARGET_VSX + && !(rs6000_isa_flags_explicit & OPTION_MASK_UPPER_REGS_DF)) + { + rs6000_isa_flags &= ~OPTION_MASK_UPPER_REGS_DF; + rs6000_isa_flags_explicit |= OPTION_MASK_UPPER_REGS_DF; + } + if (TARGET_P8_VECTOR + && !(rs6000_isa_flags_explicit & OPTION_MASK_UPPER_REGS_SF)) + { + rs6000_isa_flags &= ~OPTION_MASK_UPPER_REGS_SF; + rs6000_isa_flags_explicit |= OPTION_MASK_UPPER_REGS_SF; + } + } + if (TARGET_UPPER_REGS_DF && !TARGET_VSX) { if (rs6000_isa_flags_explicit & OPTION_MASK_UPPER_REGS_DF) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index d69236a3469..fe73acff2d4 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -8137,6 +8137,21 @@ { rs6000_split_multireg_move (operands[0], operands[1]); DONE; } [(set_attr "length" "20,20,16")]) +;; If we are using -ffast-math, easy_fp_constant assumes all constants are +;; 'easy' in order to allow for reciprocal estimation. Make sure the constant +;; is in the constant pool before reload occurs. This simplifies accessing +;; scalars in the traditional Altivec registers. + +(define_split + [(set (match_operand:SFDF 0 "register_operand" "") + (match_operand:SFDF 1 "memory_fp_constant" ""))] + "TARGET_<MODE>_FPR && flag_unsafe_math_optimizations + && !reload_in_progress && !reload_completed && !lra_in_progress" + [(set (match_dup 0) (match_dup 2))] +{ + operands[2] = validize_mem (force_const_mem (<MODE>mode, operands[1])); +}) + (define_expand "extenddftf2" [(set (match_operand:TF 0 "nonimmediate_operand" "") (float_extend:TF (match_operand:DF 1 "input_operand" "")))] diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 7abd647dafe..eb3e3237935 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -589,6 +589,10 @@ mupper-regs-sf Target Report Mask(UPPER_REGS_SF) Var(rs6000_isa_flags) Allow float variables in upper registers with -mcpu=power8 or -mpower8-vector +mupper-regs +Target Report Var(TARGET_UPPER_REGS) Init(-1) Save +Allow float/double variables in upper registers if cpu allows it + moptimize-swaps Target Undocumented Var(rs6000_optimize_swaps) Init(1) Save Analyze and remove doubleword swaps from VSX computations. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2779580daf9..b70ecf00bd6 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -941,7 +941,8 @@ See RS/6000 and PowerPC Options. -mquad-memory -mno-quad-memory @gol -mquad-memory-atomic -mno-quad-memory-atomic @gol -mcompat-align-parm -mno-compat-align-parm @gol --mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf} +-mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol +-mupper-regs -mno-upper-regs} @emph{RX Options} @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol @@ -19718,10 +19719,9 @@ instructions. The @option{-mquad-memory-atomic} option requires use of Generate code that uses (does not use) the scalar double precision instructions that target all 64 registers in the vector/scalar floating point register set that were added in version 2.06 of the -PowerPC ISA. If @option{-mupper-regs-df} is not set, the traditional -floating instructions will be generated that target the first 32 -registers. This option requires the @option{-mvsx}, -@option{-mcpu=power7}, or @option{-mcpu=power8} options to be set. +PowerPC ISA. The @option{-mupper-regs-df} turned on by default if you +use either of the @option{-mcpu=power7}, @option{-mcpu=power8}, or +@option{-mvsx} options. @item -mupper-regs-sf @itemx -mno-upper-regs-sf @@ -19730,10 +19730,20 @@ registers. This option requires the @option{-mvsx}, Generate code that uses (does not use) the scalar single precision instructions that target all 64 registers in the vector/scalar floating point register set that were added in version 2.07 of the -PowerPC ISA. If @option{-mupper-regs-sf} is not set, the traditional -floating instructions will be generated that target the first 32 -registers. This option requires the @option{-mpower8-vector}, -@option{-mcpu=power7}, or @option{-mcpu=power8} options to be set. +PowerPC ISA. The @option{-mupper-regs-sf} turned on by default if you +use either of the @option{-mcpu=power8}, or @option{-mpower8-vector} +options. + +@item -mupper-regs +@itemx -mno-upper-regs +@opindex mupper-regs +@opindex mno-upper-regs +Generate code that uses (does not use) the scalar +instructions that target all 64 registers in the vector/scalar +floating point register set, depending on the model of the machine. + +If the @option{-mno-upper-regs} option was used, it will turn off both +@option{-mupper-regs-sf} and @option{-mupper-regs-df} options. @item -mfloat-gprs=@var{yes/single/double/no} @itemx -mfloat-gprs |