diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-14 18:55:01 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-14 18:55:01 +0000 |
commit | bde1393a7b0583bc123ac962ed2f729b80cd7498 (patch) | |
tree | d9e8972ddece739bbdc248c5e33919ded2862cf7 /gcc/config/rs6000/rs6000.c | |
parent | 8f8a206e72c6183084a6792ae98593944dd06fbd (diff) | |
download | gcc-bde1393a7b0583bc123ac962ed2f729b80cd7498.tar.gz |
2016-04-14 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9
svn merge -r228401:229500 ^/trunk
}}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@234985 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rs6000/rs6000.c')
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 135 |
1 files changed, 56 insertions, 79 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e4082959992..6ee8d5c4130 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -22,63 +22,44 @@ #include "system.h" #include "coretypes.h" #include "backend.h" -#include "cfghooks.h" +#include "rtl.h" #include "tree.h" #include "gimple.h" -#include "rtl.h" +#include "cfghooks.h" +#include "cfgloop.h" #include "df.h" +#include "tm_p.h" +#include "stringpool.h" +#include "expmed.h" +#include "optabs.h" #include "regs.h" -#include "insn-config.h" -#include "conditions.h" +#include "ira.h" +#include "recog.h" +#include "cgraph.h" +#include "diagnostic-core.h" #include "insn-attr.h" #include "flags.h" -#include "recog.h" #include "alias.h" #include "fold-const.h" -#include "stringpool.h" #include "stor-layout.h" #include "calls.h" #include "print-tree.h" #include "varasm.h" -#include "expmed.h" -#include "dojump.h" #include "explow.h" -#include "emit-rtl.h" -#include "stmt.h" #include "expr.h" -#include "insn-codes.h" -#include "optabs.h" -#include "except.h" #include "output.h" #include "dbxout.h" -#include "cfgrtl.h" -#include "cfganal.h" -#include "lcm.h" -#include "cfgbuild.h" -#include "cfgcleanup.h" -#include "diagnostic-core.h" -#include "toplev.h" -#include "tm_p.h" -#include "target.h" #include "common/common-target.h" #include "langhooks.h" #include "reload.h" -#include "cfgloop.h" #include "sched-int.h" -#include "internal-fn.h" -#include "gimple-fold.h" -#include "tree-eh.h" #include "gimplify.h" #include "gimple-iterator.h" #include "gimple-walk.h" #include "intl.h" #include "params.h" #include "tm-constrs.h" -#include "ira.h" -#include "opts.h" #include "tree-vectorizer.h" -#include "dumpfile.h" -#include "cgraph.h" #include "target-globals.h" #include "builtins.h" #include "context.h" @@ -1690,6 +1671,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode #undef TARGET_UNWIND_WORD_MODE #define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode + +#undef TARGET_OFFLOAD_OPTIONS +#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options /* Processor table. */ @@ -5325,24 +5309,20 @@ num_insns_constant (rtx op, machine_mode mode) if (mode == SFmode || mode == SDmode) { long l; - REAL_VALUE_TYPE rv; - REAL_VALUE_FROM_CONST_DOUBLE (rv, op); if (DECIMAL_FLOAT_MODE_P (mode)) - REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l); + REAL_VALUE_TO_TARGET_DECIMAL32 + (*CONST_DOUBLE_REAL_VALUE (op), l); else - REAL_VALUE_TO_TARGET_SINGLE (rv, l); + REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op), l); return num_insns_constant_wide ((HOST_WIDE_INT) l); } long l[2]; - REAL_VALUE_TYPE rv; - - REAL_VALUE_FROM_CONST_DOUBLE (rv, op); if (DECIMAL_FLOAT_MODE_P (mode)) - REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l); + REAL_VALUE_TO_TARGET_DECIMAL64 (*CONST_DOUBLE_REAL_VALUE (op), l); else - REAL_VALUE_TO_TARGET_DOUBLE (rv, l); + REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), l); high = l[WORDS_BIG_ENDIAN == 0]; low = l[WORDS_BIG_ENDIAN != 0]; @@ -9534,6 +9514,16 @@ rs6000_abi_word_mode (void) return TARGET_32BIT ? SImode : DImode; } +/* Implement the TARGET_OFFLOAD_OPTIONS hook. */ +static char * +rs6000_offload_options (void) +{ + if (TARGET_64BIT) + return xstrdup ("-foffload-abi=lp64"); + else + return xstrdup ("-foffload-abi=ilp32"); +} + /* On rs6000, function arguments are promoted, as are function return values. */ @@ -9781,12 +9771,12 @@ rs6000_darwin64_record_arg_advance_flush (CUMULATIVE_ARGS *cum, e.g., in packed structs when there are 3 bytes to load. Back intoffset back to the beginning of the word in this case. */ - intoffset = intoffset & -BITS_PER_WORD; + intoffset = ROUND_DOWN (intoffset, BITS_PER_WORD); } } - startbit = intoffset & -BITS_PER_WORD; - endbit = (bitpos + BITS_PER_WORD - 1) & -BITS_PER_WORD; + startbit = ROUND_DOWN (intoffset, BITS_PER_WORD); + endbit = ROUND_UP (bitpos, BITS_PER_WORD); intregs = (endbit - startbit) / BITS_PER_WORD; cum->words += intregs; /* words should be unsigned. */ @@ -10246,15 +10236,15 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum, e.g., in packed structs when there are 3 bytes to load. Back intoffset back to the beginning of the word in this case. */ - intoffset = intoffset & -BITS_PER_WORD; - mode = word_mode; + intoffset = ROUND_DOWN (intoffset, BITS_PER_WORD); + mode = word_mode; } } else mode = word_mode; - startbit = intoffset & -BITS_PER_WORD; - endbit = (bitpos + BITS_PER_WORD - 1) & -BITS_PER_WORD; + startbit = ROUND_DOWN (intoffset, BITS_PER_WORD); + endbit = ROUND_UP (bitpos, BITS_PER_WORD); intregs = (endbit - startbit) / BITS_PER_WORD; this_regno = cum->words + intoffset / BITS_PER_WORD; @@ -10613,7 +10603,7 @@ rs6000_function_arg (cumulative_args_t cum_v, machine_mode mode, save area? */ if (TARGET_64BIT && ! cum->prototype) { - int align_words = (cum->words + 1) & ~1; + int align_words = ROUND_UP (cum->words, 2); k = rs6000_psave_function_arg (mode, type, align_words, rvec); } @@ -20731,7 +20721,6 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) enum rtx_code code = GET_CODE (op); rtx op0 = XEXP (op, 0); rtx op1 = XEXP (op, 1); - REAL_VALUE_TYPE c1; machine_mode compare_mode = GET_MODE (op0); machine_mode result_mode = GET_MODE (dest); rtx temp; @@ -20792,9 +20781,6 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) if (code == UNEQ && HONOR_NANS (compare_mode)) return 0; - if (GET_CODE (op1) == CONST_DOUBLE) - REAL_VALUE_FROM_CONST_DOUBLE (c1, op1); - /* We're going to try to implement comparisons by performing a subtract, then comparing against zero. Unfortunately, Inf - Inf is NaN which is not zero, and so if we don't @@ -20802,7 +20788,8 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) would treat EQ different to UNORDERED, we can't do it. */ if (HONOR_INFINITIES (compare_mode) && code != GT && code != UNGE - && (GET_CODE (op1) != CONST_DOUBLE || real_isinf (&c1)) + && (GET_CODE (op1) != CONST_DOUBLE + || real_isinf (CONST_DOUBLE_REAL_VALUE (op1))) /* Constructs of the form (a OP b ? a : b) are safe. */ && ((! rtx_equal_p (op0, false_cond) && ! rtx_equal_p (op1, false_cond)) || (! rtx_equal_p (op0, true_cond) @@ -23330,7 +23317,7 @@ rs6000_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) /* Step 1: round SIZE to the previous multiple of the interval. */ - rounded_size = size & -PROBE_INTERVAL; + rounded_size = ROUND_DOWN (size, PROBE_INTERVAL); /* Step 2: compute initial and final value of the loop counter. */ @@ -27103,14 +27090,12 @@ output_toc (FILE *file, rtx x, int labelno, machine_mode mode) (GET_MODE (x) == TFmode || GET_MODE (x) == TDmode || GET_MODE (x) == IFmode || GET_MODE (x) == KFmode)) { - REAL_VALUE_TYPE rv; long k[4]; - REAL_VALUE_FROM_CONST_DOUBLE (rv, x); if (DECIMAL_FLOAT_MODE_P (GET_MODE (x))) - REAL_VALUE_TO_TARGET_DECIMAL128 (rv, k); + REAL_VALUE_TO_TARGET_DECIMAL128 (*CONST_DOUBLE_REAL_VALUE (x), k); else - REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k); + REAL_VALUE_TO_TARGET_LONG_DOUBLE (*CONST_DOUBLE_REAL_VALUE (x), k); if (TARGET_64BIT) { @@ -27144,15 +27129,12 @@ output_toc (FILE *file, rtx x, int labelno, machine_mode mode) else if (GET_CODE (x) == CONST_DOUBLE && (GET_MODE (x) == DFmode || GET_MODE (x) == DDmode)) { - REAL_VALUE_TYPE rv; long k[2]; - REAL_VALUE_FROM_CONST_DOUBLE (rv, x); - if (DECIMAL_FLOAT_MODE_P (GET_MODE (x))) - REAL_VALUE_TO_TARGET_DECIMAL64 (rv, k); + REAL_VALUE_TO_TARGET_DECIMAL64 (*CONST_DOUBLE_REAL_VALUE (x), k); else - REAL_VALUE_TO_TARGET_DOUBLE (rv, k); + REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (x), k); if (TARGET_64BIT) { @@ -27181,14 +27163,12 @@ output_toc (FILE *file, rtx x, int labelno, machine_mode mode) else if (GET_CODE (x) == CONST_DOUBLE && (GET_MODE (x) == SFmode || GET_MODE (x) == SDmode)) { - REAL_VALUE_TYPE rv; long l; - REAL_VALUE_FROM_CONST_DOUBLE (rv, x); if (DECIMAL_FLOAT_MODE_P (GET_MODE (x))) - REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l); + REAL_VALUE_TO_TARGET_DECIMAL32 (*CONST_DOUBLE_REAL_VALUE (x), l); else - REAL_VALUE_TO_TARGET_SINGLE (rv, l); + REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (x), l); if (TARGET_64BIT) { @@ -30723,10 +30703,7 @@ rs6000_elf_file_end (void) static enum unwind_info_type rs6000_xcoff_debug_unwind_info (void) { - if (HAVE_XCOFF_DWARF_EXTRAS) - return UI_DWARF2; - else - return UI_NONE; + return UI_NONE; } static void @@ -31849,19 +31826,19 @@ rs6000_load_constant_and_splat (machine_mode mode, REAL_VALUE_TYPE dconst) if (mode == SFmode || mode == DFmode) { - rtx d = CONST_DOUBLE_FROM_REAL_VALUE (dconst, mode); + rtx d = const_double_from_real_value (dconst, mode); reg = force_reg (mode, d); } else if (mode == V4SFmode) { - rtx d = CONST_DOUBLE_FROM_REAL_VALUE (dconst, SFmode); + rtx d = const_double_from_real_value (dconst, SFmode); rtvec v = gen_rtvec (4, d, d, d, d); reg = gen_reg_rtx (mode); rs6000_expand_vector_init (reg, gen_rtx_PARALLEL (mode, v)); } else if (mode == V2DFmode) { - rtx d = CONST_DOUBLE_FROM_REAL_VALUE (dconst, DFmode); + rtx d = const_double_from_real_value (dconst, DFmode); rtvec v = gen_rtvec (2, d, d); reg = gen_reg_rtx (mode); rs6000_expand_vector_init (reg, gen_rtx_PARALLEL (mode, v)); @@ -32699,7 +32676,7 @@ rs6000_scale_v2df (rtx tgt, rtx src, int scale) rtx elt; rtx scale_vec = gen_reg_rtx (V2DFmode); (void)real_powi (&r_pow, DFmode, &dconst2, hwi_scale); - elt = CONST_DOUBLE_FROM_REAL_VALUE (r_pow, DFmode); + elt = const_double_from_real_value (r_pow, DFmode); RTVEC_ELT (v, 0) = elt; RTVEC_ELT (v, 1) = elt; rs6000_expand_vector_init (scale_vec, gen_rtx_PARALLEL (V2DFmode, v)); @@ -36489,8 +36466,8 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) DECL_EXTERNAL (atomic_update_decl) = 1; } - tree fenv_var = create_tmp_var (double_type_node); - mark_addressable (fenv_var); + tree fenv_var = create_tmp_var_raw (double_type_node); + TREE_ADDRESSABLE (fenv_var) = 1; tree fenv_addr = build1 (ADDR_EXPR, double_ptr_type_node, fenv_var); *hold = build_call_expr (atomic_hold_decl, 1, fenv_addr); @@ -36517,7 +36494,7 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) const unsigned HOST_WIDE_INT hold_exception_mask = HOST_WIDE_INT_C (0xffffffff00000007); - tree fenv_var = create_tmp_var (double_type_node); + tree fenv_var = create_tmp_var_raw (double_type_node); tree hold_mffs = build2 (MODIFY_EXPR, void_type_node, fenv_var, call_mffs); @@ -36546,7 +36523,7 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) const unsigned HOST_WIDE_INT clear_exception_mask = HOST_WIDE_INT_C (0xffffffff00000000); - tree fenv_clear = create_tmp_var (double_type_node); + tree fenv_clear = create_tmp_var_raw (double_type_node); tree clear_mffs = build2 (MODIFY_EXPR, void_type_node, fenv_clear, call_mffs); @@ -36578,7 +36555,7 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) const unsigned HOST_WIDE_INT new_exception_mask = HOST_WIDE_INT_C (0x1ff80fff); - tree old_fenv = create_tmp_var (double_type_node); + tree old_fenv = create_tmp_var_raw (double_type_node); tree update_mffs = build2 (MODIFY_EXPR, void_type_node, old_fenv, call_mffs); tree old_llu = build1 (VIEW_CONVERT_EXPR, uint64_type_node, old_fenv); |