summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog239
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/c/Make-lang.in1
-rw-r--r--gcc/cfg.c2
-rw-r--r--gcc/cfgcleanup.c4
-rw-r--r--gcc/cfgrtl.c2
-rw-r--r--gcc/cgraph.c2
-rw-r--r--gcc/cgraph.h4
-rw-r--r--gcc/cgraphunit.c2
-rw-r--r--gcc/common.opt2
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/aarch64/aarch64.md593
-rw-r--r--gcc/config/arm/arm.c33
-rw-r--r--gcc/config/i386/i386.c2
-rw-r--r--gcc/config/i386/ssemath.h4
-rw-r--r--gcc/config/mips/mips.c2
-rw-r--r--gcc/config/mips/mips.h36
-rw-r--r--gcc/config/mips/mips.md22
-rw-r--r--gcc/config/rs6000/rs6000.c40
-rw-r--r--gcc/config/rs6000/vsx.md28
-rw-r--r--gcc/config/sh/sh.c11
-rw-r--r--gcc/config/sh/sh_optimize_sett_clrt.cc453
-rw-r--r--gcc/config/sh/t-sh4
-rw-r--r--gcc/config/sparc/sparc.c24
-rw-r--r--gcc/cse.c4
-rw-r--r--gcc/dbxout.c4
-rw-r--r--gcc/dominance.c2
-rw-r--r--gcc/dwarf2out.c8
-rw-r--r--gcc/function.c2
-rw-r--r--gcc/gdbhooks.py2
-rw-r--r--gcc/gimple-fold.c4
-rw-r--r--gcc/gimplify-me.c12
-rw-r--r--gcc/gimplify.c110
-rw-r--r--gcc/gimplify.h35
-rw-r--r--gcc/graphite-scop-detection.c2
-rw-r--r--gcc/ipa-split.c2
-rw-r--r--gcc/lra-constraints.c34
-rw-r--r--gcc/lra-int.h35
-rw-r--r--gcc/lra.c18
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/omp-low.c36
-rw-r--r--gcc/opts.c7
-rw-r--r--gcc/plugin.c2
-rw-r--r--gcc/plugin.def3
-rw-r--r--gcc/profile.c2
-rw-r--r--gcc/real.c104
-rw-r--r--gcc/recog.c4
-rw-r--r--gcc/regcprop.c18
-rw-r--r--gcc/sched-int.h2
-rw-r--r--gcc/targhooks.c2
-rw-r--r--gcc/testsuite/ChangeLog44
-rw-r--r--gcc/testsuite/g++.dg/plugin/selfassign.c1
-rw-r--r--gcc/testsuite/gcc.dg/float-exact-1.c3177
-rw-r--r--gcc/testsuite/gcc.target/arm/pr54300.C61
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59133.c42
-rw-r--r--gcc/testsuite/gcc.target/powerpc/darwin-longlong.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr48258-1.c1
-rw-r--r--gcc/testsuite/gcc.target/sh/pr53976-1.c41
-rw-r--r--gcc/testsuite/gfortran.dg/erf_3.F9053
-rw-r--r--gcc/tree-cfgcleanup.c4
-rw-r--r--gcc/tree-inline.c10
-rw-r--r--gcc/tree-loop-distribution.c33
-rw-r--r--gcc/tree-scalar-evolution.h4
-rw-r--r--gcc/tree-ssa-forwprop.c65
-rw-r--r--gcc/tree-ssa-loop-ch.c10
-rw-r--r--gcc/tree-ssa-propagate.c2
-rw-r--r--gcc/tree-ssa-tail-merge.c1
-rw-r--r--gcc/tree-vect-loop-manip.c165
-rw-r--r--gcc/tree-vect-loop.c136
-rw-r--r--gcc/tree-vectorizer.h7
-rw-r--r--gcc/varpool.c2
-rw-r--r--libgfortran/ChangeLog12
-rw-r--r--libgfortran/intrinsics/erfc_scaled.c55
-rw-r--r--libgfortran/intrinsics/erfc_scaled_inc.c5
-rw-r--r--libstdc++-v3/ChangeLog66
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxx2011.xml10
-rw-r--r--libstdc++-v3/include/experimental/string_view24
-rw-r--r--libstdc++-v3/include/experimental/string_view.tcc6
-rw-r--r--libstdc++-v3/include/ext/pointer.h2
-rw-r--r--libstdc++-v3/include/ext/random261
-rw-r--r--libstdc++-v3/include/ext/random.tcc108
-rw-r--r--libstdc++-v3/include/std/future84
-rw-r--r--libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc37
-rw-r--r--libstdc++-v3/src/c++11/future.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/async/async.cc21
-rw-r--r--libstdc++-v3/testsuite/30_threads/async/sync.cc24
-rw-r--r--libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc11
-rw-r--r--libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc11
-rw-r--r--libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc4
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc47
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/parms.cc47
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/equal.cc44
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/inequal.cc44
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc50
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/values.cc57
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/explicit_instantiation/1.cc27
-rw-r--r--libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_random.h19
99 files changed, 6022 insertions, 929 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d962593581c..f9c4cc564fe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,237 @@
+2013-11-21 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-forwprop.c (simplify_vce): New function.
+ (ssa_forward_propagate_and_combine): Call it.
+
+2013-11-21 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-loop-manip.c (vect_build_loop_niters,
+ vect_generate_tmps_on_preheader): Move ...
+ * tree-vect-loop.c (vect_build_loop_niters,
+ vect_generate_tmps_on_preheader): ... here and simplify.
+ (vect_transform_loop): Call them here and pass down results
+ to consumers.
+ * tree-vect-loop-manip.c (vect_do_peeling_for_loop_bound):
+ Get niter variables from caller.
+ (vect_do_peeling_for_alignment): Likewise.
+ * tree-vectorizer.h (vect_generate_tmps_on_preheader): Remove.
+ (vect_do_peeling_for_loop_bound, vect_do_peeling_for_alignment):
+ Adjust prototypes.
+
+2013-11-21 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-loop-ch.c (copy_loop_headers): Decrement
+ nb_iterations_upper_bound by one.
+
+2013-11-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/59058
+ * tree-loop-distribution.c (struct partition_s): Add plus_one
+ member.
+ (build_size_arg_loc): Apply niter adjustment here.
+ (generate_memset_builtin): Adjust.
+ (generate_memcpy_builtin): Likewise.
+ (classify_partition): Do not use number_of_exit_cond_executions
+ but record whether niter needs to be adjusted.
+
+2013-11-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-tail-merge.c (stmt_local_def): Return false if the statement
+ could throw.
+
+2013-11-21 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/53976
+ * config/sh/sh_optimize_sett_clrt.cc: New SH specific RTL pass.
+ * config/sh/sh.c (register_sh_passes): Add sh_optimize_sett_clrt pass.
+ * config/sh/sh/t-sh (sh_optimize_sett_clrt pass.o): New entry.
+ * config.gcc (sh[123456789lbe]*-*-* | sh-*-*): Add
+ sh_optimize_sett_clrt pass.o to extra_objs.
+
+2013-11-20 David Malcolm <dmalcolm@redhat.com>
+
+ * cfg.c (dump_edge_info): Remove redundant comment.
+ * cfgcleanup.c (outgoing_edges_match): Reword reference to
+ EXIT_BLOCK_PTR in comment.
+ (try_optimize_cfg): Likewise.
+ * cfgrtl.c (last_bb_in_partition): Likewise.
+ * cgraph.c (cgraph_node_cannot_return): Likewise.
+ * function.c (thread_prologue_and_epilogue_insns): Likewise.
+ * graphite-scop-detection.c (scopdet_basic_block_info): Likewise.
+ * ipa-split.c (consider_split): Likewise.
+ * profile.c (find_spanning_tree): Likewise.
+ * sched-int.h (common_sched_info_def.add_block): Likewise.
+ * dominance.c (calc_dfs_tree_nonrec): Reword references in
+ comments to now removed ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR macros.
+ * tree-cfgcleanup.c (cleanup_control_flow_bb): Reword references
+ in comments to now removed ENTRY_BLOCK_PTR macro.
+ (tree_forwarder_block_p): Reword reference in comment to
+ EXIT_BLOCK_PTR.
+ * tree-inline.c (copy_cfg_body): Reword references in comments to
+ now removed ENTRY_BLOCK_PTR macro.
+ * tree-ssa-propagate.c (ssa_prop_init): Likewise.
+ * tree-scalar-evolution.h ( block_before_loop): Likewise. Add
+ a comma to the comment to clarify the meaning.
+
+2013-11-20 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimplify.h (gimplify_hasher : typed_free_remove, struct gimplify_ctx):
+ Move to gimplify.c.
+ (free_gimplify_stack): Add prototype.
+ * gimplify.c (gimplify_hasher:typed_free_remove): Relocate here.
+ (struct gimplify_ctx): Relocate here.
+ (gimplify_ctxp): Make static.
+ (ctx_pool, ctx_alloc, ctx_free, free_gimplify_stack): New. Manage a
+ list of struct gimplify_ctx.
+ (push_gimplify_context): Add default parameters and allocate a struct
+ from the pool.
+ (pop_gimplify_context): Free a struct back to the pool.
+ (gimplify_scan_omp_clauses, gimplify_omp_parallel, gimplify_omp_task,
+ gimplify_omp_workshare, gimplify_transaction, gimplify_body): Don't
+ use a local 'struct gimplify_ctx'.
+ * cgraphunit.c (expand_all_functions): call free_gimplify_stack.
+ * gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
+ Likewise.
+ * omp-low.c (lower_omp_sections, lower_omp_single, lower_omp_master,
+ lower_omp_ordered, lower_omp_critical, lower_omp_for,
+ create_task_copyfn, lower_omp_taskreg, lower_omp_target,
+ lower_omp_teams, execute_lower_omp): Likewise.
+ * gimple-fold.c (gimplify_and_update_call_from_tree): Likewise.
+ * tree-inline.c (optimize_inline_calls): Likewise.
+
+2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/vsx.md (vsx_set_<mode>): Adjust for little endian.
+ (vsx_extract_<mode>): Likewise.
+ (*vsx_extract_<mode>_one_le): New LE variant on
+ *vsx_extract_<mode>_zero.
+ (vsx_extract_v4sf): Adjust for little endian.
+
+2013-11-20 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/59133
+ * lra.c (expand_reg_data): Add new argument. Set up ALL_REGS for
+ new pseudos.
+ (lra_create_new_reg_with_unique_value): Pass new argument value.
+ (lra_emit_add, lra_emit_move): Ditto.
+ * lra-constraints.c (in_class_p): Add check for move for a new
+ insn.
+ (change_class): Rename to lra_change_class. Move to lra-int.h.
+ (get_reload_reg, narrow_reload_pseudo_class): Adjust calls of
+ change_class.
+ (process_addr_reg, process_addr): Ditto.
+ (curr_insn_transform): Ditto. Add check on old pseudo for
+ optional reload.
+ * lra-int.h (lra_get_regno_hard_regno): Move below.
+ (lra_change_class): Renamed change_class from lra.c.
+
+2013-11-20 David Malcolm <dmalcolm@redhat.com>
+
+ * gdbhooks.py (VecPrinter.children): Don't attempt to iterate
+ the children of a NULL pointer.
+
+2013-11-20 Robert Suchanek <Robert.Suchanek@imgtec.com>
+
+ * lra.c (lra): Set lra_in_progress before check_rtl call.
+ * recog.c (insn_invalid_p): Add !lra_in_progress to prevent
+ adding clobber regs when LRA is running.
+
+2013-11-20 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * config/mips/mips.h (ISA_HAS_FP4): Remove TARGET_FLOAT64
+ restriction for ISA_MIPS32R2.
+ (ISA_HAS_LXC1_SXC1): New macro.
+ (ISA_HAS_FP_MADD4_MSUB4): Remove ISA_MIPS32R2 special-casing.
+ (ISA_HAS_NMADD4_NMSUB4): Likewise.
+ (ISA_HAS_FP_RECIP_RSQRT): Likewise.
+ (ISA_HAS_PREFETCHX): Redefine in terms of ISA_HAS_FP4.
+ * config/mips/mips.md (*<ANYF:loadx>_<P:mode>): Use
+ ISA_HAS_LXC1_SXC1 rather than ISA_HAS_FP4.
+ (*<ANYF:storex>_<P:mode>): Likewise.
+
+2013-11-20 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * config/mips/mips.h (ISA_HAS_FP_RECIP_RSQRT): New macro.
+ * config/mips/mips.c (mips_rtx_costs) <DIV>: Check for
+ ISA_HAS_FP_RECIP_RSQRT rather than ISA_HAS_FP4.
+ * config/mips/mips.md (recip_condition): Remove mode attribute.
+ (div<mode>3): Use ISA_HAS_FP_RECIP_RSQRT rather than
+ <recip_condition>.
+ (*recip<mode>3, *rsqrt<mode>a, *rsqrt<mode>b): Likewise.
+
+2013-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/59207
+ * config/sparc/sparc.c (sparc_fold_builtin) <case CODE_FOR_pdist_vis>:
+ Make sure neg2_ovf is set before being used.
+
+2013-11-20 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * plugin.def: Add comment about register_callback and
+ invoke_plugin_callbacks_full.
+
+ * plugin.c (register_callback, invoke_plugin_callbacks_full):
+ Handle PLUGIN_INCLUDE_FILE event.
+
+2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_cannot_change_mode_class): Do not
+ allow subregs of TDmode in FPRs of smaller size in little-endian.
+ (rs6000_split_multireg_move): When splitting an access to TDmode
+ in FPRs, do not use simplify_gen_subreg.
+
+2013-11-20 Joseph Myers <joseph@codesourcery.com>
+
+ PR middle-end/21718
+ * real.c: Remove comment about decimal string conversion and
+ rounding errors.
+ (real_from_string): Use MPFR to convert nonzero decimal constant
+ to REAL_VALUE_TYPE.
+
+2013-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/arm/arm.c (arm_dwarf_register_span): Take into account the
+ endianness of the D registers for the legacy encodings.
+
+2013-11-20 Richard Earnshaw <rearnsha@arm.com>
+
+ PR rtl-optimization/54300
+ * regcprop.c (copyprop_hardreg_forward_1): Ensure any unused
+ outputs in a single-set are killed from the value chains.
+
+2013-11-20 Ilya Enkovich <ilya.enkovich@intel.com>
+
+ * cgraph.h (varpool_node): Add need_bounds_init field.
+ * lto-cgraph.c (lto_output_varpool_node): Output
+ need_bounds_init value.
+ (input_varpool_node): Read need_bounds_init value.
+ * varpool.c (dump_varpool_node): Dump need_bounds_init field.
+
+2013-11-20 Jan Hubicka <jh@suse.cz>
+
+ * opts.c (finish_options): Imply -ffat-lto-objects with -fno-use-linker-plugin.
+ * common.opt (fuse-linker-plugin): Add var.
+
+2013-11-20 Ilya Enkovich <ilya.enkovich@intel.com>
+
+ * dbxout.c (dbxout_type): Ignore POINTER_BOUNDS_TYPE.
+ * dwarf2out.c (gen_subprogram_die): Ignore bound args.
+ (gen_type_die_with_usage): Skip pointer bounds.
+ (dwarf2out_global_decl): Likewise.
+
+2013-11-20 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/aarch64/aarch64.md: Remove "mode" and "mode2" attributes
+ from all insns.
+
+2013-11-20 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ PR target/57756
+ * config/i386/i386.c (ix86_option_override_internal): Add missed
+ argument prefix for 'ix86_fpmath'.
+ * config/i386/ssemath.h: Add missed definition of
+ TARGET_FPMATH_DEFAULT_P macros.
+
2013-11-20 Kenneth Zadeck <zadeck@naturalbridge.com>
Mike Stump <mikestump@comcast.net>
Richard Sandiford <rdsandiford@googlemail.com>
@@ -1572,7 +1806,7 @@
* tree.c (int_fits_type_p): Change GET_MODE_BITSIZE to
GET_MODE_PRECISION.
* fold-const.c (fold_single_bit_test_into_sign_test)
- (fold_binary_loc): Change GET_MODE_BITSIZE to GET_MODE_PRECISION.
+ (fold_binary_loc): Change GET_MODE_BITSIZE to GET_MODE_PRECISION.
2013-11-18 Teresa Johnson <tejohnson@google.com>
@@ -9117,7 +9351,8 @@
PR target/51244
* config/sh/sh_treg_combine.cc: New SH specific RTL pass.
- * config.gcc (SH extra_objs): Add sh_ifcvt.o.
+ * config.gcc (sh[123456789lbe]*-*-* | sh-*-*): Add sh_treg_combine.o to
+ extra_objs.
* config/sh/t-sh (sh_treg_combine.o): New entry.
* config/sh/sh.c (sh_fixed_condition_code_regs): New function that
implements the target hook TARGET_FIXED_CONDITION_CODE_REGS.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 91b73955538..dbbbc09457b 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20131120
+20131121
diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in
index d79fc4f410c..e68000a8246 100644
--- a/gcc/c/Make-lang.in
+++ b/gcc/c/Make-lang.in
@@ -137,4 +137,3 @@ c.stageprofile: stageprofile-start
-mv c/*$(objext) stageprofile/c
c.stagefeedback: stagefeedback-start
-mv c/*$(objext) stagefeedback/c
-
diff --git a/gcc/cfg.c b/gcc/cfg.c
index e35eee9a9bc..6bceca5ed26 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -473,8 +473,6 @@ dump_edge_info (FILE *file, edge e, int flags, int do_succ)
&& (flags & TDF_SLIM) == 0)
do_details = true;
- /* ENTRY_BLOCK_PTR/EXIT_BLOCK_PTR depend on cfun.
- Compare against ENTRY_BLOCK/EXIT_BLOCK to avoid that dependency. */
if (side->index == ENTRY_BLOCK)
fputs (" ENTRY", file);
else if (side->index == EXIT_BLOCK)
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 9c126102a54..dbaee9667ab 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1535,7 +1535,7 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
edge e1, e2;
edge_iterator ei;
- /* If we performed shrink-wrapping, edges to the EXIT_BLOCK_PTR can
+ /* If we performed shrink-wrapping, edges to the exit block can
only be distinguished for JUMP_INSNs. The two paths may differ in
whether they went through the prologue. Sibcalls are fine, we know
that we either didn't need or inserted an epilogue before them. */
@@ -2684,7 +2684,7 @@ try_optimize_cfg (int mode)
}
delete_basic_block (b);
changed = true;
- /* Avoid trying to remove ENTRY_BLOCK_PTR. */
+ /* Avoid trying to remove the exit block. */
b = (c == ENTRY_BLOCK_PTR_FOR_FN (cfun) ? c->next_bb : c);
continue;
}
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 7ad38721606..63f44afbbae 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1795,7 +1795,7 @@ last_bb_in_partition (basic_block start_bb)
if (BB_PARTITION (start_bb) != BB_PARTITION (bb->next_bb))
return bb;
}
- /* Return bb before EXIT_BLOCK_PTR. */
+ /* Return bb before the exit block. */
return bb->prev_bb;
}
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 936b405294c..cfbd79edc76 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2333,7 +2333,7 @@ cgraph_node_cannot_return (struct cgraph_node *node)
and thus it is safe to ignore its side effects for IPA analysis
when computing side effects of the caller.
FIXME: We could actually mark all edges that have no reaching
- patch to EXIT_BLOCK_PTR or throw to get better results. */
+ patch to the exit block or throw to get better results. */
bool
cgraph_edge_cannot_lead_to_return (struct cgraph_edge *e)
{
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 4acf2d0c286..15719fb6872 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -528,6 +528,10 @@ class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node {
public:
/* Set when variable is scheduled to be assembled. */
unsigned output : 1;
+
+ /* Set when variable has statically initialized pointer
+ or is a static bounds variable and needs initalization. */
+ unsigned need_bounds_init : 1;
};
/* Every top level asm statement is put into a asm_node. */
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index fb23abed8da..f56f7c7abbb 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -205,6 +205,7 @@ along with GCC; see the file COPYING3. If not see
#include "context.h"
#include "pass_manager.h"
#include "tree-nested.h"
+#include "gimplify.h"
/* Queue of cgraph nodes scheduled to be added into cgraph. This is a
secondary queue used during optimization to accommodate passes that
@@ -1866,6 +1867,7 @@ expand_all_functions (void)
}
}
cgraph_process_new_functions ();
+ free_gimplify_stack ();
free (order);
diff --git a/gcc/common.opt b/gcc/common.opt
index 43d49ace352..2216d6e0392 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2247,7 +2247,7 @@ Common Negative(fuse-ld=bfd)
Use the gold linker instead of the default linker
fuse-linker-plugin
-Common Undocumented
+Common Undocumented Var(flag_use_linker_plugin)
; Positive if we should track variables, negative if we should run
; the var-tracking pass only to discard debug annotations, zero if
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 2907018987d..1f20f18aa2c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -469,7 +469,7 @@ sh[123456789lbe]*-*-* | sh-*-*)
cpu_type=sh
need_64bit_hwint=yes
extra_options="${extra_options} fused-madd.opt"
- extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o"
+ extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
;;
v850*-*-*)
cpu_type=v850
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 22051ec27e6..8b3dbd7550e 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -117,14 +117,6 @@
;; Instruction types and attributes
;; -------------------------------------------------------------------
-;; Main data types used by the insntructions
-
-(define_attr "mode" "unknown,none,QI,HI,SI,DI,TI,SF,DF,TF"
- (const_string "unknown"))
-
-(define_attr "mode2" "unknown,none,QI,HI,SI,DI,TI,SF,DF,TF"
- (const_string "unknown"))
-
; The "type" attribute is is included here from AArch32 backend to be able
; to share pipeline descriptions.
(include "../arm/types.md")
@@ -378,7 +370,6 @@
return \"<tbz>\\t%<w>0, %1, %l2\";
"
[(set_attr "type" "branch")
- (set_attr "mode" "<MODE>")
(set (attr "length")
(if_then_else (and (ge (minus (match_dup 2) (pc)) (const_int -32768))
(lt (minus (match_dup 2) (pc)) (const_int 32764)))
@@ -399,7 +390,6 @@
return \"<tbz>\\t%<w>0, <sizem1>, %l1\";
"
[(set_attr "type" "branch")
- (set_attr "mode" "<MODE>")
(set (attr "length")
(if_then_else (and (ge (minus (match_dup 1) (pc)) (const_int -32768))
(lt (minus (match_dup 1) (pc)) (const_int 32764)))
@@ -630,8 +620,7 @@
}
[(set_attr "type" "mov_reg,mov_imm,mov_imm,load1,load1,store1,store1,\
neon_from_gp<q>,neon_from_gp<q>, neon_dup")
- (set_attr "simd" "*,*,yes,*,*,*,*,yes,yes,yes")
- (set_attr "mode" "<MODE>")]
+ (set_attr "simd" "*,*,yes,*,*,*,*,yes,yes,yes")]
)
(define_expand "mov<mode>"
@@ -671,7 +660,6 @@
fmov\\t%s0, %s1"
[(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,load1,load1,store1,store1,\
adr,adr,fmov,fmov,fmov")
- (set_attr "mode" "SI")
(set_attr "fp" "*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes")]
)
@@ -697,7 +685,6 @@
movi\\t%d0, %1"
[(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,load1,load1,store1,store1,\
adr,adr,fmov,fmov,fmov,fmov")
- (set_attr "mode" "DI")
(set_attr "fp" "*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes,*")
(set_attr "simd" "*,*,*,*,*,*,*,*,*,*,*,*,*,yes")]
)
@@ -710,8 +697,7 @@
"UINTVAL (operands[1]) < GET_MODE_BITSIZE (<MODE>mode)
&& UINTVAL (operands[1]) % 16 == 0"
"movk\\t%<w>0, %X2, lsl %1"
- [(set_attr "type" "mov_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "mov_imm")]
)
(define_expand "movti"
@@ -743,7 +729,6 @@
str\\t%q1, %0"
[(set_attr "type" "multiple,f_mcr,f_mrc,neon_logic_q, \
load2,store2,store2,f_loadd,f_stored")
- (set_attr "mode" "DI,DI,DI,TI,DI,DI,DI,TI,TI")
(set_attr "length" "8,8,8,4,4,4,4,4,4")
(set_attr "simd" "*,*,*,yes,*,*,*,*,*")
(set_attr "fp" "*,*,*,*,*,*,*,yes,yes")]
@@ -794,8 +779,7 @@
str\\t%w1, %0
mov\\t%w0, %w1"
[(set_attr "type" "f_mcr,f_mrc,fmov,fconsts,\
- f_loads,f_stores,f_loads,f_stores,fmov")
- (set_attr "mode" "SF")]
+ f_loads,f_stores,f_loads,f_stores,fmov")]
)
(define_insn "*movdf_aarch64"
@@ -814,8 +798,7 @@
str\\t%x1, %0
mov\\t%x0, %x1"
[(set_attr "type" "f_mcr,f_mrc,fmov,fconstd,\
- f_loadd,f_stored,f_loadd,f_stored,mov_reg")
- (set_attr "mode" "DF")]
+ f_loadd,f_stored,f_loadd,f_stored,mov_reg")]
)
(define_expand "movtf"
@@ -854,7 +837,6 @@
stp\\t%1, %H1, %0"
[(set_attr "type" "logic_reg,multiple,f_mcr,f_mrc,fconstd,fconstd,\
f_loadd,f_stored,neon_load1_2reg,neon_store1_2reg")
- (set_attr "mode" "DF,DF,DF,DF,DF,DF,TF,TF,DF,DF")
(set_attr "length" "4,8,8,8,4,4,4,4,4,4")
(set_attr "fp" "*,*,yes,yes,*,yes,yes,yes,*,*")
(set_attr "simd" "yes,*,*,*,yes,*,*,*,*,*")]
@@ -883,8 +865,7 @@
XEXP (operands[1], 0),
GET_MODE_SIZE (<MODE>mode)))"
"ldp\\t%<w>0, %<w>2, %1"
- [(set_attr "type" "load2")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "load2")]
)
;; Operands 0 and 2 are tied together by the final condition; so we allow
@@ -899,8 +880,7 @@
XEXP (operands[0], 0),
GET_MODE_SIZE (<MODE>mode)))"
"stp\\t%<w>1, %<w>3, %0"
- [(set_attr "type" "store2")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "store2")]
)
;; Operands 1 and 3 are tied together by the final condition; so we allow
@@ -915,8 +895,7 @@
XEXP (operands[1], 0),
GET_MODE_SIZE (<MODE>mode)))"
"ldp\\t%<w>0, %<w>2, %1"
- [(set_attr "type" "neon_load1_2reg<q>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "neon_load1_2reg<q>")]
)
;; Operands 0 and 2 are tied together by the final condition; so we allow
@@ -931,8 +910,7 @@
XEXP (operands[0], 0),
GET_MODE_SIZE (<MODE>mode)))"
"stp\\t%<w>1, %<w>3, %0"
- [(set_attr "type" "neon_store1_2reg<q>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "neon_store1_2reg<q>")]
)
;; Load pair with writeback. This is primarily used in function epilogues
@@ -950,8 +928,7 @@
(match_operand:P 5 "const_int_operand" "n"))))])]
"INTVAL (operands[5]) == INTVAL (operands[4]) + GET_MODE_SIZE (<GPI:MODE>mode)"
"ldp\\t%<w>2, %<w>3, [%1], %4"
- [(set_attr "type" "load2")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "load2")]
)
;; Store pair with writeback. This is primarily used in function prologues
@@ -969,8 +946,7 @@
(match_operand:GPI 3 "register_operand" "r"))])]
"INTVAL (operands[5]) == INTVAL (operands[4]) + GET_MODE_SIZE (<GPI:MODE>mode)"
"stp\\t%<w>2, %<w>3, [%0, %4]!"
- [(set_attr "type" "store2")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "store2")]
)
;; -------------------------------------------------------------------
@@ -990,8 +966,7 @@
"@
sxtw\t%0, %w1
ldrsw\t%0, %1"
- [(set_attr "type" "extend,load1")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "extend,load1")]
)
(define_insn "*zero_extendsidi2_aarch64"
@@ -1001,8 +976,7 @@
"@
uxtw\t%0, %w1
ldr\t%w0, %1"
- [(set_attr "type" "extend,load1")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "extend,load1")]
)
(define_expand "<ANY_EXTEND:optab><SHORT:mode><GPI:mode>2"
@@ -1018,8 +992,7 @@
"@
sxt<SHORT:size>\t%<GPI:w>0, %w1
ldrs<SHORT:size>\t%<GPI:w>0, %1"
- [(set_attr "type" "extend,load1")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "extend,load1")]
)
(define_insn "*zero_extend<SHORT:mode><GPI:mode>2_aarch64"
@@ -1030,8 +1003,7 @@
uxt<SHORT:size>\t%<GPI:w>0, %w1
ldr<SHORT:size>\t%w0, %1
ldr\t%<SHORT:size>0, %1"
- [(set_attr "type" "extend,load1,load1")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "extend,load1,load1")]
)
(define_expand "<optab>qihi2"
@@ -1047,8 +1019,7 @@
"@
<su>xtb\t%w0, %w1
<ldrxt>b\t%w0, %1"
- [(set_attr "type" "extend,load1")
- (set_attr "mode" "HI")]
+ [(set_attr "type" "extend,load1")]
)
;; -------------------------------------------------------------------
@@ -1091,8 +1062,7 @@
add\\t%w0, %w1, %2
add\\t%w0, %w1, %w2
sub\\t%w0, %w1, #%n2"
- [(set_attr "type" "alu_imm,alu_reg,alu_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_imm,alu_reg,alu_imm")]
)
;; zero_extend version of above
@@ -1107,8 +1077,7 @@
add\\t%w0, %w1, %2
add\\t%w0, %w1, %w2
sub\\t%w0, %w1, #%n2"
- [(set_attr "type" "alu_imm,alu_reg,alu_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_imm,alu_reg,alu_imm")]
)
(define_insn "*adddi3_aarch64"
@@ -1124,7 +1093,6 @@
sub\\t%x0, %x1, #%n2
add\\t%d0, %d1, %d2"
[(set_attr "type" "alu_imm,alu_reg,alu_imm,alu_reg")
- (set_attr "mode" "DI")
(set_attr "simd" "*,*,*,yes")]
)
@@ -1141,8 +1109,7 @@
adds\\t%<w>0, %<w>1, %<w>2
adds\\t%<w>0, %<w>1, %<w>2
subs\\t%<w>0, %<w>1, #%n2"
- [(set_attr "type" "alus_reg,alus_imm,alus_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_reg,alus_imm,alus_imm")]
)
;; zero_extend version of above
@@ -1159,8 +1126,7 @@
adds\\t%w0, %w1, %w2
adds\\t%w0, %w1, %w2
subs\\t%w0, %w1, #%n2"
- [(set_attr "type" "alus_reg,alus_imm,alus_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alus_reg,alus_imm,alus_imm")]
)
(define_insn "*adds_mul_imm_<mode>"
@@ -1176,8 +1142,7 @@
(match_dup 3)))]
""
"adds\\t%<w>0, %<w>3, %<w>1, lsl %p2"
- [(set_attr "type" "alus_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_shift_imm")]
)
(define_insn "*subs_mul_imm_<mode>"
@@ -1193,8 +1158,7 @@
(mult:GPI (match_dup 2) (match_dup 3))))]
""
"subs\\t%<w>0, %<w>1, %<w>2, lsl %p3"
- [(set_attr "type" "alus_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_shift_imm")]
)
(define_insn "*adds_<optab><ALLX:mode>_<GPI:mode>"
@@ -1208,8 +1172,7 @@
(plus:GPI (ANY_EXTEND:GPI (match_dup 1)) (match_dup 2)))]
""
"adds\\t%<GPI:w>0, %<GPI:w>2, %<GPI:w>1, <su>xt<ALLX:size>"
- [(set_attr "type" "alus_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alus_ext")]
)
(define_insn "*subs_<optab><ALLX:mode>_<GPI:mode>"
@@ -1223,8 +1186,7 @@
(minus:GPI (match_dup 1) (ANY_EXTEND:GPI (match_dup 2))))]
""
"subs\\t%<GPI:w>0, %<GPI:w>1, %<GPI:w>2, <su>xt<ALLX:size>"
- [(set_attr "type" "alus_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alus_ext")]
)
(define_insn "*adds_<optab><mode>_multp2"
@@ -1244,8 +1206,7 @@
(match_dup 4)))]
"aarch64_is_extend_from_extract (<MODE>mode, operands[2], operands[3])"
"adds\\t%<w>0, %<w>4, %<w>1, <su>xt%e3 %p2"
- [(set_attr "type" "alus_ext")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_ext")]
)
(define_insn "*subs_<optab><mode>_multp2"
@@ -1265,8 +1226,7 @@
(const_int 0))))]
"aarch64_is_extend_from_extract (<MODE>mode, operands[2], operands[3])"
"subs\\t%<w>0, %<w>4, %<w>1, <su>xt%e3 %p2"
- [(set_attr "type" "alus_ext")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_ext")]
)
(define_insn "*add<mode>3nr_compare0"
@@ -1280,8 +1240,7 @@
cmn\\t%<w>0, %<w>1
cmn\\t%<w>0, %<w>1
cmp\\t%<w>0, #%n1"
- [(set_attr "type" "alus_reg,alus_imm,alus_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_reg,alus_imm,alus_imm")]
)
(define_insn "*compare_neg<mode>"
@@ -1291,8 +1250,7 @@
(match_operand:GPI 1 "register_operand" "r")))]
""
"cmn\\t%<w>1, %<w>0"
- [(set_attr "type" "alus_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_reg")]
)
(define_insn "*add_<shift>_<mode>"
@@ -1302,8 +1260,7 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"add\\t%<w>0, %<w>3, %<w>1, <shift> %2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_shift_imm")]
)
;; zero_extend version of above
@@ -1315,8 +1272,7 @@
(match_operand:SI 3 "register_operand" "r"))))]
""
"add\\t%w0, %w3, %w1, <shift> %2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_shift_imm")]
)
(define_insn "*add_mul_imm_<mode>"
@@ -1326,8 +1282,7 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"add\\t%<w>0, %<w>3, %<w>1, lsl %p2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_shift_imm")]
)
(define_insn "*add_<optab><ALLX:mode>_<GPI:mode>"
@@ -1336,8 +1291,7 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"add\\t%<GPI:w>0, %<GPI:w>2, %<GPI:w>1, <su>xt<ALLX:size>"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1348,8 +1302,7 @@
(match_operand:GPI 2 "register_operand" "r"))))]
""
"add\\t%w0, %w2, %w1, <su>xt<SHORT:size>"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*add_<optab><ALLX:mode>_shft_<GPI:mode>"
@@ -1360,8 +1313,7 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"add\\t%<GPI:w>0, %<GPI:w>3, %<GPI:w>1, <su>xt<ALLX:size> %2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1374,8 +1326,7 @@
(match_operand:SI 3 "register_operand" "r"))))]
""
"add\\t%w0, %w3, %w1, <su>xt<SHORT:size> %2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*add_<optab><ALLX:mode>_mult_<GPI:mode>"
@@ -1386,8 +1337,7 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"add\\t%<GPI:w>0, %<GPI:w>3, %<GPI:w>1, <su>xt<ALLX:size> %p2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1399,8 +1349,7 @@
(match_operand:SI 3 "register_operand" "r"))))]
""
"add\\t%w0, %w3, %w1, <su>xt<SHORT:size> %p2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*add_<optab><mode>_multp2"
@@ -1413,8 +1362,7 @@
(match_operand:GPI 4 "register_operand" "r")))]
"aarch64_is_extend_from_extract (<MODE>mode, operands[2], operands[3])"
"add\\t%<w>0, %<w>4, %<w>1, <su>xt%e3 %p2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1429,8 +1377,7 @@
(match_operand:SI 4 "register_operand" "r"))))]
"aarch64_is_extend_from_extract (SImode, operands[2], operands[3])"
"add\\t%w0, %w4, %w1, <su>xt%e3 %p2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*add<mode>3_carryin"
@@ -1442,8 +1389,7 @@
(match_operand:GPI 2 "register_operand" "r"))))]
""
"adc\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "adc_reg")]
)
;; zero_extend version of above
@@ -1457,8 +1403,7 @@
(match_operand:SI 2 "register_operand" "r")))))]
""
"adc\\t%w0, %w1, %w2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*add<mode>3_carryin_alt1"
@@ -1470,8 +1415,7 @@
(geu:GPI (reg:CC CC_REGNUM) (const_int 0))))]
""
"adc\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "adc_reg")]
)
;; zero_extend version of above
@@ -1485,8 +1429,7 @@
(geu:SI (reg:CC CC_REGNUM) (const_int 0)))))]
""
"adc\\t%w0, %w1, %w2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*add<mode>3_carryin_alt2"
@@ -1498,8 +1441,7 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"adc\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "adc_reg")]
)
;; zero_extend version of above
@@ -1513,8 +1455,7 @@
(match_operand:SI 2 "register_operand" "r"))))]
""
"adc\\t%w0, %w1, %w2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*add<mode>3_carryin_alt3"
@@ -1526,8 +1467,7 @@
(match_operand:GPI 1 "register_operand" "r")))]
""
"adc\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "adc_reg")]
)
;; zero_extend version of above
@@ -1541,8 +1481,7 @@
(match_operand:SI 1 "register_operand" "r"))))]
""
"adc\\t%w0, %w1, %w2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*add_uxt<mode>_multp2"
@@ -1557,8 +1496,7 @@
operands[3] = GEN_INT (aarch64_uxt_size (exact_log2 (INTVAL (operands[2])),
INTVAL (operands[3])));
return \"add\t%<w>0, %<w>4, %<w>1, uxt%e3 %p2\";"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1575,8 +1513,7 @@
operands[3] = GEN_INT (aarch64_uxt_size (exact_log2 (INTVAL (operands[2])),
INTVAL (operands[3])));
return \"add\t%w0, %w4, %w1, uxt%e3 %p2\";"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "subsi3"
@@ -1585,8 +1522,7 @@
(match_operand:SI 2 "register_operand" "r")))]
""
"sub\\t%w0, %w1, %w2"
- [(set_attr "type" "alu_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_reg")]
)
;; zero_extend version of above
@@ -1597,8 +1533,7 @@
(match_operand:SI 2 "register_operand" "r"))))]
""
"sub\\t%w0, %w1, %w2"
- [(set_attr "type" "alu_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_reg")]
)
(define_insn "subdi3"
@@ -1610,7 +1545,6 @@
sub\\t%x0, %x1, %x2
sub\\t%d0, %d1, %d2"
[(set_attr "type" "alu_reg, neon_sub")
- (set_attr "mode" "DI")
(set_attr "simd" "*,yes")]
)
@@ -1624,8 +1558,7 @@
(minus:GPI (match_dup 1) (match_dup 2)))]
""
"subs\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "alus_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_reg")]
)
;; zero_extend version of above
@@ -1638,8 +1571,7 @@
(zero_extend:DI (minus:SI (match_dup 1) (match_dup 2))))]
""
"subs\\t%w0, %w1, %w2"
- [(set_attr "type" "alus_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alus_reg")]
)
(define_insn "*sub_<shift>_<mode>"
@@ -1650,8 +1582,7 @@
(match_operand:QI 2 "aarch64_shift_imm_<mode>" "n"))))]
""
"sub\\t%<w>0, %<w>3, %<w>1, <shift> %2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_shift_imm")]
)
;; zero_extend version of above
@@ -1664,8 +1595,7 @@
(match_operand:QI 2 "aarch64_shift_imm_si" "n")))))]
""
"sub\\t%w0, %w3, %w1, <shift> %2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_shift_imm")]
)
(define_insn "*sub_mul_imm_<mode>"
@@ -1676,8 +1606,7 @@
(match_operand:QI 2 "aarch64_pwr_2_<mode>" "n"))))]
""
"sub\\t%<w>0, %<w>3, %<w>1, lsl %p2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_shift_imm")]
)
;; zero_extend version of above
@@ -1690,8 +1619,7 @@
(match_operand:QI 2 "aarch64_pwr_2_si" "n")))))]
""
"sub\\t%w0, %w3, %w1, lsl %p2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_shift_imm")]
)
(define_insn "*sub_<optab><ALLX:mode>_<GPI:mode>"
@@ -1701,8 +1629,7 @@
(match_operand:ALLX 2 "register_operand" "r"))))]
""
"sub\\t%<GPI:w>0, %<GPI:w>1, %<GPI:w>2, <su>xt<ALLX:size>"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1714,8 +1641,7 @@
(match_operand:SHORT 2 "register_operand" "r")))))]
""
"sub\\t%w0, %w1, %w2, <su>xt<SHORT:size>"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*sub_<optab><ALLX:mode>_shft_<GPI:mode>"
@@ -1726,8 +1652,7 @@
(match_operand 3 "aarch64_imm3" "Ui3"))))]
""
"sub\\t%<GPI:w>0, %<GPI:w>1, %<GPI:w>2, <su>xt<ALLX:size> %3"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1740,8 +1665,7 @@
(match_operand 3 "aarch64_imm3" "Ui3")))))]
""
"sub\\t%w0, %w1, %w2, <su>xt<SHORT:size> %3"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*sub_<optab><mode>_multp2"
@@ -1754,8 +1678,7 @@
(const_int 0))))]
"aarch64_is_extend_from_extract (<MODE>mode, operands[2], operands[3])"
"sub\\t%<w>0, %<w>4, %<w>1, <su>xt%e3 %p2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1770,8 +1693,7 @@
(const_int 0)))))]
"aarch64_is_extend_from_extract (SImode, operands[2], operands[3])"
"sub\\t%w0, %w4, %w1, <su>xt%e3 %p2"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn "*sub<mode>3_carryin"
@@ -1783,8 +1705,7 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"sbc\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "adc_reg")]
)
;; zero_extend version of the above
@@ -1798,8 +1719,7 @@
(match_operand:SI 2 "register_operand" "r"))))]
""
"sbc\\t%w0, %w1, %w2"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*sub_uxt<mode>_multp2"
@@ -1814,8 +1734,7 @@
operands[3] = GEN_INT (aarch64_uxt_size (exact_log2 (INTVAL (operands[2])),
INTVAL (operands[3])));
return \"sub\t%<w>0, %<w>4, %<w>1, uxt%e3 %p2\";"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_ext")]
)
;; zero_extend version of above
@@ -1832,8 +1751,7 @@
operands[3] = GEN_INT (aarch64_uxt_size (exact_log2 (INTVAL (operands[2])),
INTVAL (operands[3])));
return \"sub\t%w0, %w4, %w1, uxt%e3 %p2\";"
- [(set_attr "type" "alu_ext")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_ext")]
)
(define_insn_and_split "absdi2"
@@ -1864,8 +1782,7 @@
GEN_INT (63)))));
DONE;
}
- [(set_attr "type" "alu_reg")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "alu_reg")]
)
(define_insn "neg<mode>2"
@@ -1876,8 +1793,7 @@
neg\\t%<w>0, %<w>1
neg\\t%<rtn>0<vas>, %<rtn>1<vas>"
[(set_attr "type" "alu_reg, neon_neg<q>")
- (set_attr "simd" "*,yes")
- (set_attr "mode" "<MODE>")]
+ (set_attr "simd" "*,yes")]
)
;; zero_extend version of above
@@ -1886,8 +1802,7 @@
(zero_extend:DI (neg:SI (match_operand:SI 1 "register_operand" "r"))))]
""
"neg\\t%w0, %w1"
- [(set_attr "type" "alu_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_reg")]
)
(define_insn "*ngc<mode>"
@@ -1896,8 +1811,7 @@
(match_operand:GPI 1 "register_operand" "r")))]
""
"ngc\\t%<w>0, %<w>1"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*ngcsi_uxtw"
@@ -1907,8 +1821,7 @@
(match_operand:SI 1 "register_operand" "r"))))]
""
"ngc\\t%w0, %w1"
- [(set_attr "type" "adc_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "adc_reg")]
)
(define_insn "*neg<mode>2_compare0"
@@ -1919,8 +1832,7 @@
(neg:GPI (match_dup 1)))]
""
"negs\\t%<w>0, %<w>1"
- [(set_attr "type" "alus_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_reg")]
)
;; zero_extend version of above
@@ -1932,8 +1844,7 @@
(zero_extend:DI (neg:SI (match_dup 1))))]
""
"negs\\t%w0, %w1"
- [(set_attr "type" "alus_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alus_reg")]
)
(define_insn "*neg_<shift><mode>3_compare0"
@@ -1947,8 +1858,7 @@
(neg:GPI (ASHIFT:GPI (match_dup 1) (match_dup 2))))]
""
"negs\\t%<w>0, %<w>1, <shift> %2"
- [(set_attr "type" "alus_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_shift_imm")]
)
(define_insn "*neg_<shift>_<mode>2"
@@ -1958,8 +1868,7 @@
(match_operand:QI 2 "aarch64_shift_imm_<mode>" "n"))))]
""
"neg\\t%<w>0, %<w>1, <shift> %2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_shift_imm")]
)
;; zero_extend version of above
@@ -1971,8 +1880,7 @@
(match_operand:QI 2 "aarch64_shift_imm_si" "n")))))]
""
"neg\\t%w0, %w1, <shift> %2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_shift_imm")]
)
(define_insn "*neg_mul_imm_<mode>2"
@@ -1982,8 +1890,7 @@
(match_operand:QI 2 "aarch64_pwr_2_<mode>" "n"))))]
""
"neg\\t%<w>0, %<w>1, lsl %p2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_shift_imm")]
)
;; zero_extend version of above
@@ -1995,8 +1902,7 @@
(match_operand:QI 2 "aarch64_pwr_2_si" "n")))))]
""
"neg\\t%w0, %w1, lsl %p2"
- [(set_attr "type" "alu_shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "alu_shift_imm")]
)
(define_insn "mul<mode>3"
@@ -2005,8 +1911,7 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"mul\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "mul")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "mul")]
)
;; zero_extend version of above
@@ -2017,8 +1922,7 @@
(match_operand:SI 2 "register_operand" "r"))))]
""
"mul\\t%w0, %w1, %w2"
- [(set_attr "type" "mul")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "mul")]
)
(define_insn "*madd<mode>"
@@ -2028,8 +1932,7 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"madd\\t%<w>0, %<w>1, %<w>2, %<w>3"
- [(set_attr "type" "mla")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "mla")]
)
;; zero_extend version of above
@@ -2041,8 +1944,7 @@
(match_operand:SI 3 "register_operand" "r"))))]
""
"madd\\t%w0, %w1, %w2, %w3"
- [(set_attr "type" "mla")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "mla")]
)
(define_insn "*msub<mode>"
@@ -2053,8 +1955,7 @@
""
"msub\\t%<w>0, %<w>1, %<w>2, %<w>3"
- [(set_attr "type" "mla")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "mla")]
)
;; zero_extend version of above
@@ -2067,8 +1968,7 @@
""
"msub\\t%w0, %w1, %w2, %w3"
- [(set_attr "type" "mla")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "mla")]
)
(define_insn "*mul<mode>_neg"
@@ -2078,8 +1978,7 @@
""
"mneg\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "mul")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "mul")]
)
;; zero_extend version of above
@@ -2091,8 +1990,7 @@
""
"mneg\\t%w0, %w1, %w2"
- [(set_attr "type" "mul")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "mul")]
)
(define_insn "<su_optab>mulsidi3"
@@ -2101,8 +1999,7 @@
(ANY_EXTEND:DI (match_operand:SI 2 "register_operand" "r"))))]
""
"<su>mull\\t%0, %w1, %w2"
- [(set_attr "type" "<su>mull")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "<su>mull")]
)
(define_insn "<su_optab>maddsidi4"
@@ -2113,8 +2010,7 @@
(match_operand:DI 3 "register_operand" "r")))]
""
"<su>maddl\\t%0, %w1, %w2, %3"
- [(set_attr "type" "<su>mlal")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "<su>mlal")]
)
(define_insn "<su_optab>msubsidi4"
@@ -2126,8 +2022,7 @@
(match_operand:SI 2 "register_operand" "r")))))]
""
"<su>msubl\\t%0, %w1, %w2, %3"
- [(set_attr "type" "<su>mlal")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "<su>mlal")]
)
(define_insn "*<su_optab>mulsidi_neg"
@@ -2137,8 +2032,7 @@
(ANY_EXTEND:DI (match_operand:SI 2 "register_operand" "r"))))]
""
"<su>mnegl\\t%0, %w1, %w2"
- [(set_attr "type" "<su>mull")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "<su>mull")]
)
(define_insn "<su>muldi3_highpart"
@@ -2151,8 +2045,7 @@
(const_int 64))))]
""
"<su>mulh\\t%0, %1, %2"
- [(set_attr "type" "<su>mull")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "<su>mull")]
)
(define_insn "<su_optab>div<mode>3"
@@ -2161,8 +2054,7 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"<su>div\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "<su>div")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "<su>div")]
)
;; zero_extend version of above
@@ -2173,8 +2065,7 @@
(match_operand:SI 2 "register_operand" "r"))))]
""
"<su>div\\t%w0, %w1, %w2"
- [(set_attr "type" "<su>div")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "<su>div")]
)
;; -------------------------------------------------------------------
@@ -2190,8 +2081,7 @@
cmp\\t%<w>0, %<w>1
cmp\\t%<w>0, %<w>1
cmn\\t%<w>0, #%n1"
- [(set_attr "type" "alus_reg,alus_imm,alus_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_reg,alus_imm,alus_imm")]
)
(define_insn "*cmp<mode>"
@@ -2202,8 +2092,7 @@
"@
fcmp\\t%<s>0, #0.0
fcmp\\t%<s>0, %<s>1"
- [(set_attr "type" "fcmp<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fcmp<s>")]
)
(define_insn "*cmpe<mode>"
@@ -2214,8 +2103,7 @@
"@
fcmpe\\t%<s>0, #0.0
fcmpe\\t%<s>0, %<s>1"
- [(set_attr "type" "fcmp<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fcmp<s>")]
)
(define_insn "*cmp_swp_<shift>_reg<mode>"
@@ -2226,8 +2114,7 @@
(match_operand:GPI 2 "aarch64_reg_or_zero" "rZ")))]
""
"cmp\\t%<w>2, %<w>0, <shift> %1"
- [(set_attr "type" "alus_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alus_shift_imm")]
)
(define_insn "*cmp_swp_<optab><ALLX:mode>_reg<GPI:mode>"
@@ -2237,8 +2124,7 @@
(match_operand:GPI 1 "register_operand" "r")))]
""
"cmp\\t%<GPI:w>1, %<GPI:w>0, <su>xt<ALLX:size>"
- [(set_attr "type" "alus_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alus_ext")]
)
(define_insn "*cmp_swp_<optab><ALLX:mode>_shft_<GPI:mode>"
@@ -2250,8 +2136,7 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"cmp\\t%<GPI:w>2, %<GPI:w>0, <su>xt<ALLX:size> %1"
- [(set_attr "type" "alus_ext")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "alus_ext")]
)
;; -------------------------------------------------------------------
@@ -2290,8 +2175,7 @@
[(match_operand 2 "cc_register" "") (const_int 0)]))]
""
"cset\\t%<w>0, %m1"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "csel")]
)
;; zero_extend version of the above
@@ -2302,8 +2186,7 @@
[(match_operand 2 "cc_register" "") (const_int 0)])))]
""
"cset\\t%w0, %m1"
- [(set_attr "type" "csel")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "csel")]
)
(define_insn "cstore<mode>_neg"
@@ -2312,8 +2195,7 @@
[(match_operand 2 "cc_register" "") (const_int 0)])))]
""
"csetm\\t%<w>0, %m1"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "csel")]
)
;; zero_extend version of the above
@@ -2324,8 +2206,7 @@
[(match_operand 2 "cc_register" "") (const_int 0)]))))]
""
"csetm\\t%w0, %m1"
- [(set_attr "type" "csel")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "csel")]
)
(define_expand "cmov<mode>6"
@@ -2378,8 +2259,7 @@
csinc\\t%<w>0, %<w>4, <w>zr, %M1
mov\\t%<w>0, -1
mov\\t%<w>0, 1"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "csel")]
)
;; zero_extend version of above
@@ -2402,8 +2282,7 @@
csinc\\t%w0, %w4, wzr, %M1
mov\\t%w0, -1
mov\\t%w0, 1"
- [(set_attr "type" "csel")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "csel")]
)
(define_insn "*cmov<mode>_insn"
@@ -2415,8 +2294,7 @@
(match_operand:GPF 4 "register_operand" "w")))]
"TARGET_FLOAT"
"fcsel\\t%<s>0, %<s>3, %<s>4, %m1"
- [(set_attr "type" "fcsel")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fcsel")]
)
(define_expand "mov<mode>cc"
@@ -2464,8 +2342,8 @@
(match_operand:GPI 1 "register_operand" "r")))]
""
"csinc\\t%<w>0, %<w>1, %<w>1, %M2"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "csel")]
+)
(define_insn "csinc3<mode>_insn"
[(set (match_operand:GPI 0 "register_operand" "=r")
@@ -2477,8 +2355,7 @@
(match_operand:GPI 4 "aarch64_reg_or_zero" "rZ")))]
""
"csinc\\t%<w>0, %<w>4, %<w>3, %M1"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "csel")]
)
(define_insn "*csinv3<mode>_insn"
@@ -2490,8 +2367,8 @@
(match_operand:GPI 4 "aarch64_reg_or_zero" "rZ")))]
""
"csinv\\t%<w>0, %<w>4, %<w>3, %M1"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "csel")]
+)
(define_insn "*csneg3<mode>_insn"
[(set (match_operand:GPI 0 "register_operand" "=r")
@@ -2502,8 +2379,8 @@
(match_operand:GPI 4 "aarch64_reg_or_zero" "rZ")))]
""
"csneg\\t%<w>0, %<w>4, %<w>3, %M1"
- [(set_attr "type" "csel")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "csel")]
+)
;; -------------------------------------------------------------------
;; Logical operations
@@ -2515,8 +2392,8 @@
(match_operand:GPI 2 "aarch64_logical_operand" "r,<lconst>")))]
""
"<logical>\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "logic_reg,logic_imm")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logic_reg,logic_imm")]
+)
;; zero_extend version of above
(define_insn "*<optab>si3_uxtw"
@@ -2526,8 +2403,8 @@
(match_operand:SI 2 "aarch64_logical_operand" "r,K"))))]
""
"<logical>\\t%w0, %w1, %w2"
- [(set_attr "type" "logic_reg,logic_imm")
- (set_attr "mode" "SI")])
+ [(set_attr "type" "logic_reg,logic_imm")]
+)
(define_insn "*and<mode>3_compare0"
[(set (reg:CC_NZ CC_REGNUM)
@@ -2539,8 +2416,7 @@
(and:GPI (match_dup 1) (match_dup 2)))]
""
"ands\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "logics_reg,logics_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "logics_reg,logics_imm")]
)
;; zero_extend version of above
@@ -2554,8 +2430,7 @@
(zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))]
""
"ands\\t%w0, %w1, %w2"
- [(set_attr "type" "logics_reg,logics_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "logics_reg,logics_imm")]
)
(define_insn "*and_<SHIFT:optab><mode>3_compare0"
@@ -2570,8 +2445,7 @@
(and:GPI (SHIFT:GPI (match_dup 1) (match_dup 2)) (match_dup 3)))]
""
"ands\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2"
- [(set_attr "type" "logics_shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "logics_shift_imm")]
)
;; zero_extend version of above
@@ -2588,8 +2462,7 @@
(match_dup 3))))]
""
"ands\\t%w0, %w3, %w1, <SHIFT:shift> %2"
- [(set_attr "type" "logics_shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "logics_shift_imm")]
)
(define_insn "*<LOGICAL:optab>_<SHIFT:optab><mode>3"
@@ -2600,8 +2473,8 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"<LOGICAL:logical>\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2"
- [(set_attr "type" "logic_shift_imm")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logic_shift_imm")]
+)
;; zero_extend version of above
(define_insn "*<LOGICAL:optab>_<SHIFT:optab>si3_uxtw"
@@ -2613,16 +2486,16 @@
(match_operand:SI 3 "register_operand" "r"))))]
""
"<LOGICAL:logical>\\t%w0, %w3, %w1, <SHIFT:shift> %2"
- [(set_attr "type" "logic_shift_imm")
- (set_attr "mode" "SI")])
+ [(set_attr "type" "logic_shift_imm")]
+)
(define_insn "one_cmpl<mode>2"
[(set (match_operand:GPI 0 "register_operand" "=r")
(not:GPI (match_operand:GPI 1 "register_operand" "r")))]
""
"mvn\\t%<w>0, %<w>1"
- [(set_attr "type" "logic_reg")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logic_reg")]
+)
(define_insn "*one_cmpl_<optab><mode>2"
[(set (match_operand:GPI 0 "register_operand" "=r")
@@ -2630,8 +2503,8 @@
(match_operand:QI 2 "aarch64_shift_imm_<mode>" "n"))))]
""
"mvn\\t%<w>0, %<w>1, <shift> %2"
- [(set_attr "type" "logic_shift_imm")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logic_shift_imm")]
+)
(define_insn "*<LOGICAL:optab>_one_cmpl<mode>3"
[(set (match_operand:GPI 0 "register_operand" "=r")
@@ -2640,8 +2513,8 @@
(match_operand:GPI 2 "register_operand" "r")))]
""
"<LOGICAL:nlogical>\\t%<w>0, %<w>2, %<w>1"
- [(set_attr "type" "logic_reg")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logic_reg")]
+)
(define_insn "*and_one_cmpl<mode>3_compare0"
[(set (reg:CC_NZ CC_REGNUM)
@@ -2654,8 +2527,8 @@
(and:GPI (not:GPI (match_dup 1)) (match_dup 2)))]
""
"bics\\t%<w>0, %<w>2, %<w>1"
- [(set_attr "type" "logics_reg")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logics_reg")]
+)
;; zero_extend version of above
(define_insn "*and_one_cmplsi3_compare0_uxtw"
@@ -2669,8 +2542,8 @@
(zero_extend:DI (and:SI (not:SI (match_dup 1)) (match_dup 2))))]
""
"bics\\t%w0, %w2, %w1"
- [(set_attr "type" "logics_reg")
- (set_attr "mode" "SI")])
+ [(set_attr "type" "logics_reg")]
+)
(define_insn "*<LOGICAL:optab>_one_cmpl_<SHIFT:optab><mode>3"
[(set (match_operand:GPI 0 "register_operand" "=r")
@@ -2681,8 +2554,8 @@
(match_operand:GPI 3 "register_operand" "r")))]
""
"<LOGICAL:nlogical>\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2"
- [(set_attr "type" "logics_shift_imm")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logics_shift_imm")]
+)
(define_insn "*and_one_cmpl_<SHIFT:optab><mode>3_compare0"
[(set (reg:CC_NZ CC_REGNUM)
@@ -2699,8 +2572,8 @@
(match_dup 1) (match_dup 2))) (match_dup 3)))]
""
"bics\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2"
- [(set_attr "type" "logics_shift_imm")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logics_shift_imm")]
+)
;; zero_extend version of above
(define_insn "*and_one_cmpl_<SHIFT:optab>si3_compare0_uxtw"
@@ -2718,16 +2591,16 @@
(SHIFT:SI (match_dup 1) (match_dup 2))) (match_dup 3))))]
""
"bics\\t%w0, %w3, %w1, <SHIFT:shift> %2"
- [(set_attr "type" "logics_shift_imm")
- (set_attr "mode" "SI")])
+ [(set_attr "type" "logics_shift_imm")]
+)
(define_insn "clz<mode>2"
[(set (match_operand:GPI 0 "register_operand" "=r")
(clz:GPI (match_operand:GPI 1 "register_operand" "r")))]
""
"clz\\t%<w>0, %<w>1"
- [(set_attr "type" "clz")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "clz")]
+)
(define_expand "ffs<mode>2"
[(match_operand:GPI 0 "register_operand")
@@ -2749,16 +2622,16 @@
(unspec:GPI [(match_operand:GPI 1 "register_operand" "r")] UNSPEC_CLS))]
""
"cls\\t%<w>0, %<w>1"
- [(set_attr "type" "clz")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "clz")]
+)
(define_insn "rbit<mode>2"
[(set (match_operand:GPI 0 "register_operand" "=r")
(unspec:GPI [(match_operand:GPI 1 "register_operand" "r")] UNSPEC_RBIT))]
""
"rbit\\t%<w>0, %<w>1"
- [(set_attr "type" "rbit")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "rbit")]
+)
(define_expand "ctz<mode>2"
[(match_operand:GPI 0 "register_operand")
@@ -2779,8 +2652,8 @@
(const_int 0)))]
""
"tst\\t%<w>0, %<w>1"
- [(set_attr "type" "logics_reg")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logics_reg")]
+)
(define_insn "*and_<SHIFT:optab><mode>3nr_compare0"
[(set (reg:CC_NZ CC_REGNUM)
@@ -2792,8 +2665,8 @@
(const_int 0)))]
""
"tst\\t%<w>2, %<w>0, <SHIFT:shift> %1"
- [(set_attr "type" "logics_shift_imm")
- (set_attr "mode" "<MODE>")])
+ [(set_attr "type" "logics_shift_imm")]
+)
;; -------------------------------------------------------------------
;; Shifts
@@ -2894,8 +2767,7 @@
ushl\t%<rtn>0<vas>, %<rtn>1<vas>, %<rtn>2<vas>
lsl\t%<w>0, %<w>1, %<w>2"
[(set_attr "simd" "yes,yes,no")
- (set_attr "type" "neon_shift_imm<q>, neon_shift_reg<q>,shift_reg")
- (set_attr "mode" "*,*,<MODE>")]
+ (set_attr "type" "neon_shift_imm<q>, neon_shift_reg<q>,shift_reg")]
)
;; Logical right shift using SISD or Integer instruction
@@ -2910,8 +2782,7 @@
#
lsr\t%<w>0, %<w>1, %<w>2"
[(set_attr "simd" "yes,yes,no")
- (set_attr "type" "neon_shift_imm<q>,neon_shift_reg<q>,shift_reg")
- (set_attr "mode" "*,*,<MODE>")]
+ (set_attr "type" "neon_shift_imm<q>,neon_shift_reg<q>,shift_reg")]
)
(define_split
@@ -2952,8 +2823,7 @@
#
asr\t%<w>0, %<w>1, %<w>2"
[(set_attr "simd" "yes,yes,no")
- (set_attr "type" "neon_shift_imm<q>,neon_shift_reg<q>,shift_reg")
- (set_attr "mode" "*,*,<MODE>")]
+ (set_attr "type" "neon_shift_imm<q>,neon_shift_reg<q>,shift_reg")]
)
(define_split
@@ -3044,8 +2914,7 @@
(match_operand:QI 2 "aarch64_reg_or_shift_imm_<mode>" "rUs<cmode>")))]
""
"ror\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "shift_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "shift_reg")]
)
;; zero_extend version of above
@@ -3056,8 +2925,7 @@
(match_operand:QI 2 "aarch64_reg_or_shift_imm_si" "rUss"))))]
""
"<shift>\\t%w0, %w1, %w2"
- [(set_attr "type" "shift_reg")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "shift_reg")]
)
(define_insn "*ashl<mode>3_insn"
@@ -3066,8 +2934,7 @@
(match_operand:QI 2 "aarch64_reg_or_shift_imm_si" "rUss")))]
""
"lsl\\t%<w>0, %<w>1, %<w>2"
- [(set_attr "type" "shift_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "shift_reg")]
)
(define_insn "*<optab><mode>3_insn"
@@ -3079,8 +2946,7 @@
operands[3] = GEN_INT (<sizen> - UINTVAL (operands[2]));
return "<bfshift>\t%w0, %w1, %2, %3";
}
- [(set_attr "type" "bfm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "bfm")]
)
(define_insn "*extr<mode>5_insn"
@@ -3092,8 +2958,7 @@
"UINTVAL (operands[3]) < GET_MODE_BITSIZE (<MODE>mode) &&
(UINTVAL (operands[3]) + UINTVAL (operands[4]) == GET_MODE_BITSIZE (<MODE>mode))"
"extr\\t%<w>0, %<w>1, %<w>2, %4"
- [(set_attr "type" "shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "shift_imm")]
)
;; zero_extend version of the above
@@ -3107,8 +2972,7 @@
"UINTVAL (operands[3]) < 32 &&
(UINTVAL (operands[3]) + UINTVAL (operands[4]) == 32)"
"extr\\t%w0, %w1, %w2, %4"
- [(set_attr "type" "shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "shift_imm")]
)
(define_insn "*ror<mode>3_insn"
@@ -3120,8 +2984,7 @@
operands[3] = GEN_INT (<sizen> - UINTVAL (operands[2]));
return "ror\\t%<w>0, %<w>1, %3";
}
- [(set_attr "type" "shift_imm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "shift_imm")]
)
;; zero_extend version of the above
@@ -3135,8 +2998,7 @@
operands[3] = GEN_INT (32 - UINTVAL (operands[2]));
return "ror\\t%w0, %w1, %3";
}
- [(set_attr "type" "shift_imm")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "shift_imm")]
)
(define_insn "*<ANY_EXTEND:optab><GPI:mode>_ashl<SHORT:mode>"
@@ -3149,8 +3011,7 @@
operands[3] = GEN_INT (<SHORT:sizen> - UINTVAL (operands[2]));
return "<su>bfiz\t%<GPI:w>0, %<GPI:w>1, %2, %3";
}
- [(set_attr "type" "bfm")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "bfm")]
)
(define_insn "*zero_extend<GPI:mode>_lshr<SHORT:mode>"
@@ -3163,8 +3024,7 @@
operands[3] = GEN_INT (<SHORT:sizen> - UINTVAL (operands[2]));
return "ubfx\t%<GPI:w>0, %<GPI:w>1, %2, %3";
}
- [(set_attr "type" "bfm")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "bfm")]
)
(define_insn "*extend<GPI:mode>_ashr<SHORT:mode>"
@@ -3177,8 +3037,7 @@
operands[3] = GEN_INT (<SHORT:sizen> - UINTVAL (operands[2]));
return "sbfx\\t%<GPI:w>0, %<GPI:w>1, %2, %3";
}
- [(set_attr "type" "bfm")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "bfm")]
)
;; -------------------------------------------------------------------
@@ -3201,8 +3060,7 @@
(match_operand 3 "const_int_operand" "n")))]
""
"<su>bfx\\t%<w>0, %<w>1, %3, %2"
- [(set_attr "type" "bfm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "bfm")]
)
;; Bitfield Insert (insv)
@@ -3245,8 +3103,7 @@
|| (UINTVAL (operands[2]) + UINTVAL (operands[1])
> GET_MODE_BITSIZE (<MODE>mode)))"
"bfi\\t%<w>0, %<w>3, %2, %1"
- [(set_attr "type" "bfm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "bfm")]
)
(define_insn "*extr_insv_lower_reg<mode>"
@@ -3260,8 +3117,7 @@
|| (UINTVAL (operands[3]) + UINTVAL (operands[1])
> GET_MODE_BITSIZE (<MODE>mode)))"
"bfxil\\t%<w>0, %<w>2, %3, %1"
- [(set_attr "type" "bfm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "bfm")]
)
(define_insn "*<optab><ALLX:mode>_shft_<GPI:mode>"
@@ -3276,8 +3132,7 @@
: GEN_INT (<GPI:sizen> - UINTVAL (operands[2]));
return "<su>bfiz\t%<GPI:w>0, %<GPI:w>1, %2, %3";
}
- [(set_attr "type" "bfm")
- (set_attr "mode" "<GPI:MODE>")]
+ [(set_attr "type" "bfm")]
)
;; XXX We should match (any_extend (ashift)) here, like (and (ashift)) below
@@ -3290,8 +3145,7 @@
"exact_log2 ((INTVAL (operands[3]) >> INTVAL (operands[2])) + 1) >= 0
&& (INTVAL (operands[3]) & ((1 << INTVAL (operands[2])) - 1)) == 0"
"ubfiz\\t%<w>0, %<w>1, %2, %P3"
- [(set_attr "type" "bfm")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "bfm")]
)
(define_insn "bswap<mode>2"
@@ -3299,8 +3153,7 @@
(bswap:GPI (match_operand:GPI 1 "register_operand" "r")))]
""
"rev\\t%<w>0, %<w>1"
- [(set_attr "type" "rev")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "rev")]
)
(define_insn "bswaphi2"
@@ -3308,8 +3161,7 @@
(bswap:HI (match_operand:HI 1 "register_operand" "r")))]
""
"rev16\\t%w0, %w1"
- [(set_attr "type" "rev")
- (set_attr "mode" "HI")]
+ [(set_attr "type" "rev")]
)
;; zero_extend version of above
@@ -3318,8 +3170,7 @@
(zero_extend:DI (bswap:SI (match_operand:SI 1 "register_operand" "r"))))]
""
"rev\\t%w0, %w1"
- [(set_attr "type" "rev")
- (set_attr "mode" "SI")]
+ [(set_attr "type" "rev")]
)
;; -------------------------------------------------------------------
@@ -3335,8 +3186,7 @@
FRINT))]
"TARGET_FLOAT"
"frint<frint_suffix>\\t%<s>0, %<s>1"
- [(set_attr "type" "f_rint<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "f_rint<s>")]
)
;; frcvt floating-point round to integer and convert standard patterns.
@@ -3347,9 +3197,7 @@
FCVT)))]
"TARGET_FLOAT"
"fcvt<frint_suffix><su>\\t%<GPI:w>0, %<GPF:s>1"
- [(set_attr "type" "f_cvtf2i")
- (set_attr "mode" "<GPF:MODE>")
- (set_attr "mode2" "<GPI:MODE>")]
+ [(set_attr "type" "f_cvtf2i")]
)
;; fma - no throw
@@ -3361,8 +3209,7 @@
(match_operand:GPF 3 "register_operand" "w")))]
"TARGET_FLOAT"
"fmadd\\t%<s>0, %<s>1, %<s>2, %<s>3"
- [(set_attr "type" "fmac<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmac<s>")]
)
(define_insn "fnma<mode>4"
@@ -3372,8 +3219,7 @@
(match_operand:GPF 3 "register_operand" "w")))]
"TARGET_FLOAT"
"fmsub\\t%<s>0, %<s>1, %<s>2, %<s>3"
- [(set_attr "type" "fmac<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmac<s>")]
)
(define_insn "fms<mode>4"
@@ -3383,8 +3229,7 @@
(neg:GPF (match_operand:GPF 3 "register_operand" "w"))))]
"TARGET_FLOAT"
"fnmsub\\t%<s>0, %<s>1, %<s>2, %<s>3"
- [(set_attr "type" "fmac<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmac<s>")]
)
(define_insn "fnms<mode>4"
@@ -3394,8 +3239,7 @@
(neg:GPF (match_operand:GPF 3 "register_operand" "w"))))]
"TARGET_FLOAT"
"fnmadd\\t%<s>0, %<s>1, %<s>2, %<s>3"
- [(set_attr "type" "fmac<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmac<s>")]
)
;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
@@ -3406,8 +3250,7 @@
(match_operand:GPF 3 "register_operand" "w"))))]
"!HONOR_SIGNED_ZEROS (<MODE>mode) && TARGET_FLOAT"
"fnmadd\\t%<s>0, %<s>1, %<s>2, %<s>3"
- [(set_attr "type" "fmac<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmac<s>")]
)
;; -------------------------------------------------------------------
@@ -3419,9 +3262,7 @@
(float_extend:DF (match_operand:SF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fcvt\\t%d0, %s1"
- [(set_attr "type" "f_cvt")
- (set_attr "mode" "DF")
- (set_attr "mode2" "SF")]
+ [(set_attr "type" "f_cvt")]
)
(define_insn "truncdfsf2"
@@ -3429,9 +3270,7 @@
(float_truncate:SF (match_operand:DF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fcvt\\t%s0, %d1"
- [(set_attr "type" "f_cvt")
- (set_attr "mode" "SF")
- (set_attr "mode2" "DF")]
+ [(set_attr "type" "f_cvt")]
)
(define_insn "fix_trunc<GPF:mode><GPI:mode>2"
@@ -3439,9 +3278,7 @@
(fix:GPI (match_operand:GPF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fcvtzs\\t%<GPI:w>0, %<GPF:s>1"
- [(set_attr "type" "f_cvtf2i")
- (set_attr "mode" "<GPF:MODE>")
- (set_attr "mode2" "<GPI:MODE>")]
+ [(set_attr "type" "f_cvtf2i")]
)
(define_insn "fixuns_trunc<GPF:mode><GPI:mode>2"
@@ -3449,9 +3286,7 @@
(unsigned_fix:GPI (match_operand:GPF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fcvtzu\\t%<GPI:w>0, %<GPF:s>1"
- [(set_attr "type" "f_cvtf2i")
- (set_attr "mode" "<GPF:MODE>")
- (set_attr "mode2" "<GPI:MODE>")]
+ [(set_attr "type" "f_cvtf2i")]
)
(define_insn "float<GPI:mode><GPF:mode>2"
@@ -3459,9 +3294,7 @@
(float:GPF (match_operand:GPI 1 "register_operand" "r")))]
"TARGET_FLOAT"
"scvtf\\t%<GPF:s>0, %<GPI:w>1"
- [(set_attr "type" "f_cvti2f")
- (set_attr "mode" "<GPF:MODE>")
- (set_attr "mode2" "<GPI:MODE>")]
+ [(set_attr "type" "f_cvti2f")]
)
(define_insn "floatuns<GPI:mode><GPF:mode>2"
@@ -3469,9 +3302,7 @@
(unsigned_float:GPF (match_operand:GPI 1 "register_operand" "r")))]
"TARGET_FLOAT"
"ucvtf\\t%<GPF:s>0, %<GPI:w>1"
- [(set_attr "type" "f_cvt")
- (set_attr "mode" "<GPF:MODE>")
- (set_attr "mode2" "<GPI:MODE>")]
+ [(set_attr "type" "f_cvt")]
)
;; -------------------------------------------------------------------
@@ -3485,8 +3316,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fadd\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "fadd<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fadd<s>")]
)
(define_insn "sub<mode>3"
@@ -3496,8 +3326,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fsub\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "fadd<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fadd<s>")]
)
(define_insn "mul<mode>3"
@@ -3507,8 +3336,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fmul\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "fmul<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmul<s>")]
)
(define_insn "*fnmul<mode>3"
@@ -3518,8 +3346,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fnmul\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "fmul<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fmul<s>")]
)
(define_insn "div<mode>3"
@@ -3529,8 +3356,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fdiv\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "fdiv<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fdiv<s>")]
)
(define_insn "neg<mode>2"
@@ -3538,8 +3364,7 @@
(neg:GPF (match_operand:GPF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fneg\\t%<s>0, %<s>1"
- [(set_attr "type" "ffarith<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "ffarith<s>")]
)
(define_insn "sqrt<mode>2"
@@ -3547,8 +3372,7 @@
(sqrt:GPF (match_operand:GPF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fsqrt\\t%<s>0, %<s>1"
- [(set_attr "type" "fsqrt<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "fsqrt<s>")]
)
(define_insn "abs<mode>2"
@@ -3556,8 +3380,7 @@
(abs:GPF (match_operand:GPF 1 "register_operand" "w")))]
"TARGET_FLOAT"
"fabs\\t%<s>0, %<s>1"
- [(set_attr "type" "ffarith<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "ffarith<s>")]
)
;; Given that smax/smin do not specify the result when either input is NaN,
@@ -3570,8 +3393,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fmaxnm\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "f_minmax<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "f_minmax<s>")]
)
(define_insn "smin<mode>3"
@@ -3580,8 +3402,7 @@
(match_operand:GPF 2 "register_operand" "w")))]
"TARGET_FLOAT"
"fminnm\\t%<s>0, %<s>1, %<s>2"
- [(set_attr "type" "f_minmax<s>")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "f_minmax<s>")]
)
;; -------------------------------------------------------------------
@@ -3614,7 +3435,6 @@
"reload_completed || reload_in_progress"
"fmov\\t%x0, %d1"
[(set_attr "type" "f_mrc")
- (set_attr "mode" "DI")
(set_attr "length" "4")
])
@@ -3626,7 +3446,6 @@
"reload_completed || reload_in_progress"
"fmov\\t%x0, %1.d[1]"
[(set_attr "type" "f_mrc")
- (set_attr "mode" "DI")
(set_attr "length" "4")
])
@@ -3637,7 +3456,6 @@
"reload_completed || reload_in_progress"
"fmov\\t%0.d[1], %x1"
[(set_attr "type" "f_mcr")
- (set_attr "mode" "DI")
(set_attr "length" "4")
])
@@ -3647,7 +3465,6 @@
"reload_completed || reload_in_progress"
"fmov\\t%d0, %x1"
[(set_attr "type" "f_mcr")
- (set_attr "mode" "DI")
(set_attr "length" "4")
])
@@ -3658,7 +3475,6 @@
"reload_completed || reload_in_progress"
"fmov\\t%d0, %d1"
[(set_attr "type" "f_mcr")
- (set_attr "mode" "DI")
(set_attr "length" "4")
])
@@ -3689,8 +3505,7 @@
(match_operand 2 "aarch64_valid_symref" "S")))]
""
"add\\t%<w>0, %<w>1, :lo12:%a2"
- [(set_attr "type" "alu_reg")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "alu_reg")]
)
(define_insn "ldr_got_small_<mode>"
@@ -3701,8 +3516,7 @@
UNSPEC_GOTSMALLPIC))]
""
"ldr\\t%<w>0, [%1, #:got_lo12:%a2]"
- [(set_attr "type" "load1")
- (set_attr "mode" "<MODE>")]
+ [(set_attr "type" "load1")]
)
(define_insn "ldr_got_small_sidi"
@@ -3714,8 +3528,7 @@
UNSPEC_GOTSMALLPIC)))]
"TARGET_ILP32"
"ldr\\t%w0, [%1, #:got_lo12:%a2]"
- [(set_attr "type" "load1")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "load1")]
)
(define_insn "ldr_got_tiny"
@@ -3724,8 +3537,7 @@
UNSPEC_GOTTINYPIC))]
""
"ldr\\t%0, %L1"
- [(set_attr "type" "load1")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "load1")]
)
(define_insn "aarch64_load_tp_hard"
@@ -3733,8 +3545,7 @@
(unspec:DI [(const_int 0)] UNSPEC_TLS))]
""
"mrs\\t%0, tpidr_el0"
- [(set_attr "type" "mrs")
- (set_attr "mode" "DI")]
+ [(set_attr "type" "mrs")]
)
;; The TLS ABI specifically requires that the compiler does not schedule
@@ -3768,7 +3579,6 @@
""
"adrp\\t%0, %A1\;ldr\\t%0, [%0, #%L1]"
[(set_attr "type" "load1")
- (set_attr "mode" "DI")
(set_attr "length" "8")]
)
@@ -3780,7 +3590,6 @@
""
"add\\t%0, %1, #%G2\;add\\t%0, %0, #%L2"
[(set_attr "type" "alu_reg")
- (set_attr "mode" "DI")
(set_attr "length" "8")]
)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 12934233a48..03bb13612eb 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -27986,10 +27986,11 @@ arm_dbx_register_number (unsigned int regno)
static rtx
arm_dwarf_register_span (rtx rtl)
{
+ enum machine_mode mode;
unsigned regno;
+ rtx parts[8];
int nregs;
int i;
- rtx p;
regno = REGNO (rtl);
if (!IS_VFP_REGNUM (regno))
@@ -28002,15 +28003,33 @@ arm_dwarf_register_span (rtx rtl)
corresponding D register. Until GDB supports this, we shall use the
legacy encodings. We also use these encodings for D0-D15 for
compatibility with older debuggers. */
- if (VFP_REGNO_OK_FOR_SINGLE (regno))
+ mode = GET_MODE (rtl);
+ if (GET_MODE_SIZE (mode) < 8)
return NULL_RTX;
- nregs = GET_MODE_SIZE (GET_MODE (rtl)) / 8;
- p = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs));
- for (i = 0; i < nregs; i++)
- XVECEXP (p, 0, i) = gen_rtx_REG (DImode, regno + i);
+ if (VFP_REGNO_OK_FOR_SINGLE (regno))
+ {
+ nregs = GET_MODE_SIZE (mode) / 4;
+ for (i = 0; i < nregs; i += 2)
+ if (TARGET_BIG_END)
+ {
+ parts[i] = gen_rtx_REG (SImode, regno + i + 1);
+ parts[i + 1] = gen_rtx_REG (SImode, regno + i);
+ }
+ else
+ {
+ parts[i] = gen_rtx_REG (SImode, regno + i);
+ parts[i + 1] = gen_rtx_REG (SImode, regno + i + 1);
+ }
+ }
+ else
+ {
+ nregs = GET_MODE_SIZE (mode) / 8;
+ for (i = 0; i < nregs; i++)
+ parts[i] = gen_rtx_REG (DImode, regno + i);
+ }
- return p;
+ return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nregs , parts));
}
#if ARM_UNWIND_INFO
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8e6bbd14dff..57bbc91ec26 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3913,7 +3913,7 @@ ix86_option_override_internal (bool main_args_p,
functions. */
else if (fast_math_flags_set_p (&global_options)
&& TARGET_SSE2_P (opts->x_ix86_isa_flags))
- ix86_fpmath = FPMATH_SSE;
+ opts->x_ix86_fpmath = FPMATH_SSE;
else
opts->x_ix86_fpmath = TARGET_FPMATH_DEFAULT_P (opts->x_ix86_isa_flags);
diff --git a/gcc/config/i386/ssemath.h b/gcc/config/i386/ssemath.h
index 4e4656fa0d1..83abfddfeb7 100644
--- a/gcc/config/i386/ssemath.h
+++ b/gcc/config/i386/ssemath.h
@@ -19,6 +19,10 @@ along with GCC; see the file COPYING3. If not see
#undef TARGET_FPMATH_DEFAULT
#define TARGET_FPMATH_DEFAULT (TARGET_SSE2 ? FPMATH_SSE : FPMATH_387)
+#undef TARGET_FPMATH_DEFAULT_P
+#define TARGET_FPMATH_DEFAULT_P(x) \
+ (TARGET_SSE2_P(x) ? FPMATH_SSE : FPMATH_387)
+
#undef TARGET_SUBTARGET32_ISA_DEFAULT
#define TARGET_SUBTARGET32_ISA_DEFAULT \
(OPTION_MASK_ISA_MMX | OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_SSE2)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index d06d5747081..0aeb35aa6d6 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3972,7 +3972,7 @@ mips_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
case DIV:
/* Check for a reciprocal. */
if (float_mode_p
- && ISA_HAS_FP4
+ && ISA_HAS_FP_RECIP_RSQRT (mode)
&& flag_unsafe_math_optimizations
&& XEXP (x, 0) == CONST1_RTX (mode))
{
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 11687b8a053..021419c0a6a 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -882,13 +882,18 @@ struct mips_cpu_info {
/* This is a catch all for other mips4 instructions: indexed load, the
FP madd and msub instructions, and the FP recip and recip sqrt
- instructions. */
+ instructions. Note that this macro should only be used by other
+ ISA_HAS_* macros. */
#define ISA_HAS_FP4 ((ISA_MIPS4 \
- || (ISA_MIPS32R2 && TARGET_FLOAT64) \
+ || ISA_MIPS32R2 \
|| ISA_MIPS64 \
|| ISA_MIPS64R2) \
&& !TARGET_MIPS16)
+/* ISA has floating-point indexed load and store instructions
+ (LWXC1, LDXC1, SWXC1 and SDXC1). */
+#define ISA_HAS_LXC1_SXC1 ISA_HAS_FP4
+
/* ISA has paired-single instructions. */
#define ISA_HAS_PAIRED_SINGLE (ISA_MIPS32R2 || ISA_MIPS64 || ISA_MIPS64R2)
@@ -906,21 +911,34 @@ struct mips_cpu_info {
#define GENERATE_MADD_MSUB (TARGET_IMADD && !TARGET_MIPS16)
/* ISA has floating-point madd and msub instructions 'd = a * b [+-] c'. */
-#define ISA_HAS_FP_MADD4_MSUB4 (ISA_HAS_FP4 \
- || (ISA_MIPS32R2 && !TARGET_MIPS16))
+#define ISA_HAS_FP_MADD4_MSUB4 ISA_HAS_FP4
/* ISA has floating-point madd and msub instructions 'c = a * b [+-] c'. */
#define ISA_HAS_FP_MADD3_MSUB3 TARGET_LOONGSON_2EF
/* ISA has floating-point nmadd and nmsub instructions
'd = -((a * b) [+-] c)'. */
-#define ISA_HAS_NMADD4_NMSUB4 (ISA_HAS_FP4 \
- || (ISA_MIPS32R2 && !TARGET_MIPS16))
+#define ISA_HAS_NMADD4_NMSUB4 ISA_HAS_FP4
/* ISA has floating-point nmadd and nmsub instructions
'c = -((a * b) [+-] c)'. */
#define ISA_HAS_NMADD3_NMSUB3 TARGET_LOONGSON_2EF
+/* ISA has floating-point RECIP.fmt and RSQRT.fmt instructions. The
+ MIPS64 rev. 1 ISA says that RECIP.D and RSQRT.D are unpredictable when
+ doubles are stored in pairs of FPRs, so for safety's sake, we apply
+ this restriction to the MIPS IV ISA too. */
+#define ISA_HAS_FP_RECIP_RSQRT(MODE) \
+ (((ISA_HAS_FP4 \
+ && ((MODE) == SFmode \
+ || ((TARGET_FLOAT64 \
+ || ISA_MIPS32R2 \
+ || ISA_MIPS64R2) \
+ && (MODE) == DFmode))) \
+ || (TARGET_SB1 \
+ && (MODE) == V2SFmode)) \
+ && !TARGET_MIPS16)
+
/* ISA has count leading zeroes/ones instruction (not implemented). */
#define ISA_HAS_CLZ_CLO ((ISA_MIPS32 \
|| ISA_MIPS32R2 \
@@ -991,11 +1009,7 @@ struct mips_cpu_info {
'prefx', along with TARGET_HARD_FLOAT and TARGET_DOUBLE_FLOAT.
(prefx is a cop1x instruction, so can only be used if FP is
enabled.) */
-#define ISA_HAS_PREFETCHX ((ISA_MIPS4 \
- || ISA_MIPS32R2 \
- || ISA_MIPS64 \
- || ISA_MIPS64R2) \
- && !TARGET_MIPS16)
+#define ISA_HAS_PREFETCHX ISA_HAS_FP4
/* True if trunc.w.s and trunc.w.d are real (not synthetic)
instructions. Both require TARGET_HARD_FLOAT, and trunc.w.d
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 6991f203df4..1bd1ec5e2cc 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -881,15 +881,6 @@
(define_mode_attr sqrt_condition
[(SF "!ISA_MIPS1") (DF "!ISA_MIPS1") (V2SF "TARGET_SB1")])
-;; This attribute gives the conditions under which RECIP.fmt and RSQRT.fmt
-;; instructions can be used. The MIPS32 and MIPS64 ISAs say that RECIP.D
-;; and RSQRT.D are unpredictable when doubles are stored in pairs of FPRs,
-;; so for safety's sake, we apply this restriction to all targets.
-(define_mode_attr recip_condition
- [(SF "ISA_HAS_FP4")
- (DF "ISA_HAS_FP4 && TARGET_FLOAT64")
- (V2SF "TARGET_SB1")])
-
;; This code iterator allows signed and unsigned widening multiplications
;; to use the same template.
(define_code_iterator any_extend [sign_extend zero_extend])
@@ -2501,7 +2492,8 @@
"<divide_condition>"
{
if (const_1_operand (operands[1], <MODE>mode))
- if (!(<recip_condition> && flag_unsafe_math_optimizations))
+ if (!(ISA_HAS_FP_RECIP_RSQRT (<MODE>mode)
+ && flag_unsafe_math_optimizations))
operands[1] = force_reg (<MODE>mode, operands[1]);
})
@@ -2539,7 +2531,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(div:ANYF (match_operand:ANYF 1 "const_1_operand" "")
(match_operand:ANYF 2 "register_operand" "f")))]
- "<recip_condition> && flag_unsafe_math_optimizations"
+ "ISA_HAS_FP_RECIP_RSQRT (<MODE>mode) && flag_unsafe_math_optimizations"
{
if (TARGET_FIX_SB1)
return "recip.<fmt>\t%0,%2\;mov.<fmt>\t%0,%0";
@@ -2674,7 +2666,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(div:ANYF (match_operand:ANYF 1 "const_1_operand" "")
(sqrt:ANYF (match_operand:ANYF 2 "register_operand" "f"))))]
- "<recip_condition> && flag_unsafe_math_optimizations"
+ "ISA_HAS_FP_RECIP_RSQRT (<MODE>mode) && flag_unsafe_math_optimizations"
{
if (TARGET_FIX_SB1)
return "rsqrt.<fmt>\t%0,%2\;mov.<fmt>\t%0,%0";
@@ -2692,7 +2684,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(sqrt:ANYF (div:ANYF (match_operand:ANYF 1 "const_1_operand" "")
(match_operand:ANYF 2 "register_operand" "f"))))]
- "<recip_condition> && flag_unsafe_math_optimizations"
+ "ISA_HAS_FP_RECIP_RSQRT (<MODE>mode) && flag_unsafe_math_optimizations"
{
if (TARGET_FIX_SB1)
return "rsqrt.<fmt>\t%0,%2\;mov.<fmt>\t%0,%0";
@@ -4448,7 +4440,7 @@
[(set (match_operand:ANYF 0 "register_operand" "=f")
(mem:ANYF (plus:P (match_operand:P 1 "register_operand" "d")
(match_operand:P 2 "register_operand" "d"))))]
- "ISA_HAS_FP4"
+ "ISA_HAS_LXC1_SXC1"
"<ANYF:loadx>\t%0,%1(%2)"
[(set_attr "type" "fpidxload")
(set_attr "mode" "<ANYF:UNITMODE>")])
@@ -4457,7 +4449,7 @@
[(set (mem:ANYF (plus:P (match_operand:P 1 "register_operand" "d")
(match_operand:P 2 "register_operand" "d")))
(match_operand:ANYF 0 "register_operand" "f"))]
- "ISA_HAS_FP4"
+ "ISA_HAS_LXC1_SXC1"
"<ANYF:storex>\t%0,%1(%2)"
[(set_attr "type" "fpidxstore")
(set_attr "mode" "<ANYF:UNITMODE>")])
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 52879c8bf23..76b4f02381e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16665,6 +16665,13 @@ rs6000_cannot_change_mode_class (enum machine_mode from,
if (TARGET_IEEEQUAD && (to == TFmode || from == TFmode))
return true;
+ /* TDmode in floating-mode registers must always go into a register
+ pair with the most significant word in the even-numbered register
+ to match ISA requirements. In little-endian mode, this does not
+ match subreg numbering, so we cannot allow subregs. */
+ if (!BYTES_BIG_ENDIAN && (to == TDmode || from == TDmode))
+ return true;
+
if (from_size < 8 || to_size < 8)
return true;
@@ -19607,6 +19614,39 @@ rs6000_split_multireg_move (rtx dst, rtx src)
gcc_assert (reg_mode_size * nregs == GET_MODE_SIZE (mode));
+ /* TDmode residing in FP registers is special, since the ISA requires that
+ the lower-numbered word of a register pair is always the most significant
+ word, even in little-endian mode. This does not match the usual subreg
+ semantics, so we cannnot use simplify_gen_subreg in those cases. Access
+ the appropriate constituent registers "by hand" in little-endian mode.
+
+ Note we do not need to check for destructive overlap here since TDmode
+ can only reside in even/odd register pairs. */
+ if (FP_REGNO_P (reg) && DECIMAL_FLOAT_MODE_P (mode) && !BYTES_BIG_ENDIAN)
+ {
+ rtx p_src, p_dst;
+ int i;
+
+ for (i = 0; i < nregs; i++)
+ {
+ if (REG_P (src) && FP_REGNO_P (REGNO (src)))
+ p_src = gen_rtx_REG (reg_mode, REGNO (src) + nregs - 1 - i);
+ else
+ p_src = simplify_gen_subreg (reg_mode, src, mode,
+ i * reg_mode_size);
+
+ if (REG_P (dst) && FP_REGNO_P (REGNO (dst)))
+ p_dst = gen_rtx_REG (reg_mode, REGNO (dst) + nregs - 1 - i);
+ else
+ p_dst = simplify_gen_subreg (reg_mode, dst, mode,
+ i * reg_mode_size);
+
+ emit_insn (gen_rtx_SET (VOIDmode, p_dst, p_src));
+ }
+
+ return;
+ }
+
if (REG_P (src) && REG_P (dst) && (REGNO (src) < REGNO (dst)))
{
/* Move register range backwards, if we might have destructive
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 8a51afb3c86..977ef963411 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -1497,9 +1497,10 @@
UNSPEC_VSX_SET))]
"VECTOR_MEM_VSX_P (<MODE>mode)"
{
- if (INTVAL (operands[3]) == 0)
+ int idx_first = BYTES_BIG_ENDIAN ? 0 : 1;
+ if (INTVAL (operands[3]) == idx_first)
return \"xxpermdi %x0,%x2,%x1,1\";
- else if (INTVAL (operands[3]) == 1)
+ else if (INTVAL (operands[3]) == 1 - idx_first)
return \"xxpermdi %x0,%x1,%x2,0\";
else
gcc_unreachable ();
@@ -1514,8 +1515,12 @@
[(match_operand:QI 2 "u5bit_cint_operand" "i,i,i")])))]
"VECTOR_MEM_VSX_P (<MODE>mode)"
{
+ int fldDM;
gcc_assert (UINTVAL (operands[2]) <= 1);
- operands[3] = GEN_INT (INTVAL (operands[2]) << 1);
+ fldDM = INTVAL (operands[2]) << 1;
+ if (!BYTES_BIG_ENDIAN)
+ fldDM = 3 - fldDM;
+ operands[3] = GEN_INT (fldDM);
return \"xxpermdi %x0,%x1,%x1,%3\";
}
[(set_attr "type" "vecperm")])
@@ -1535,6 +1540,21 @@
(const_string "fpload")))
(set_attr "length" "4")])
+;; Optimize extracting element 1 from memory for little endian
+(define_insn "*vsx_extract_<mode>_one_le"
+ [(set (match_operand:<VS_scalar> 0 "vsx_register_operand" "=ws,d,?wa")
+ (vec_select:<VS_scalar>
+ (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z")
+ (parallel [(const_int 1)])))]
+ "VECTOR_MEM_VSX_P (<MODE>mode) && !WORDS_BIG_ENDIAN"
+ "lxsd%U1x %x0,%y1"
+ [(set (attr "type")
+ (if_then_else
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
+ (const_string "fpload_ux")
+ (const_string "fpload")))
+ (set_attr "length" "4")])
+
;; Extract a SF element from V4SF
(define_insn_and_split "vsx_extract_v4sf"
[(set (match_operand:SF 0 "vsx_register_operand" "=f,f")
@@ -1555,7 +1575,7 @@
rtx op2 = operands[2];
rtx op3 = operands[3];
rtx tmp;
- HOST_WIDE_INT ele = INTVAL (op2);
+ HOST_WIDE_INT ele = BYTES_BIG_ENDIAN ? INTVAL (op2) : 3 - INTVAL (op2);
if (ele == 0)
tmp = op1;
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index d5f7f15c1cc..6981ab6229a 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -720,7 +720,9 @@ got_mode_name:;
/* Register SH specific RTL passes. */
extern opt_pass* make_pass_sh_treg_combine (gcc::context* ctx, bool split_insns,
- const char* name);
+ const char* name);
+extern opt_pass* make_pass_sh_optimize_sett_clrt (gcc::context* ctx,
+ const char* name);
static void
register_sh_passes (void)
{
@@ -744,6 +746,13 @@ register_sh_passes (void)
reordering as this sometimes creates new opportunities. */
register_pass (make_pass_sh_treg_combine (g, true, "sh_treg_combine3"),
PASS_POS_INSERT_AFTER, "split4", 1);
+
+ /* Optimize sett and clrt insns, by e.g. removing them if the T bit value
+ is known after a conditional branch.
+ This must be done after basic blocks and branch conditions have
+ stabilized and won't be changed by further passes. */
+ register_pass (make_pass_sh_optimize_sett_clrt (g, "sh_optimize_sett_clrt"),
+ PASS_POS_INSERT_BEFORE, "sched2", 1);
}
/* Implement TARGET_OPTION_OVERRIDE macro. Validate and override
diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
new file mode 100644
index 00000000000..abb75672e86
--- /dev/null
+++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
@@ -0,0 +1,453 @@
+/* An SH specific RTL pass that tries to optimize clrt and sett insns.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "machmode.h"
+#include "basic-block.h"
+#include "df.h"
+#include "rtl.h"
+#include "insn-config.h"
+#include "tree-pass.h"
+#include "target.h"
+
+#include <vector>
+
+/*
+This pass tries to eliminate unnecessary sett or clrt instructions in cases
+where the ccreg value is already known to be the same as the constant set
+would set it to. This is done as follows:
+
+Check every BB's insn and see if it's a sett or clrt.
+Once a sett or clrt insn is hit, walk insns and predecessor basic blocks
+backwards from that insn and determine all possible ccreg values from all
+basic block paths.
+Insns that set the ccreg value in some way (simple set, clobber etc) are
+recorded. Conditional branches where one edge leads to the sett / clrt insn
+are also recorded, since for each edge in the conditional branch the ccreg
+value is known constant.
+After collecting all possible ccreg values at the sett / clrt insn, check that
+all the values are the same. If that value is the same as the sett / clrt
+insn would set the ccreg to, the sett / clrt insn can be eliminated.
+*/
+
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// Helper functions
+
+#define log_msg(...)\
+ do { if (dump_file != NULL) fprintf (dump_file, __VA_ARGS__); } while (0)
+
+#define log_insn(i)\
+ do { if (dump_file != NULL) print_rtl_single (dump_file, \
+ (const_rtx)i); } while (0)
+
+#define log_rtx(r)\
+ do { if (dump_file != NULL) print_rtl (dump_file, (const_rtx)r); } while (0)
+
+#define log_return(retval, ...)\
+ do { if (dump_file != NULL) fprintf (dump_file, __VA_ARGS__); \
+ return retval; } while (0)
+
+#define log_return_void(...)\
+ do { if (dump_file != NULL) fprintf (dump_file, __VA_ARGS__); \
+ return; } while (0)
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// RTL pass class
+
+class sh_optimize_sett_clrt : public rtl_opt_pass
+{
+public:
+ sh_optimize_sett_clrt (gcc::context* ctx, const char* name);
+ virtual ~sh_optimize_sett_clrt (void);
+ virtual bool gate (void);
+ virtual unsigned int execute (void);
+
+private:
+ static const pass_data default_pass_data;
+
+ struct ccreg_value
+ {
+ // The insn at which the ccreg value was determined.
+ rtx insn;
+
+ // The basic block where the insn was discovered.
+ // Notice that the CFG might be invalid at late RTL stages and
+ // BLOCK_FOR_INSN might return null. Thus the basic block are recorded
+ // here while traversing them.
+ basic_block bb;
+
+ // The value of ccreg. If NULL_RTX, the value is not known, e.g. if the
+ // ccreg is clobbered.
+ rtx value;
+ };
+
+ // Update the mode of the captured m_ccreg with the specified mode.
+ void update_ccreg_mode (machine_mode m);
+
+ // Given an insn pattern, check if it sets the ccreg to a constant value
+ // of either zero or STORE_FLAG_VALUE. If so, return the value rtx,
+ // NULL_RTX otherwise.
+ rtx const_setcc_value (rtx pat) const;
+
+ // Given a start insn and its basic block, recursively determine all
+ // possible ccreg values in all basic block paths that can lead to the
+ // start insn.
+ void find_last_ccreg_values (rtx start_insn, basic_block bb,
+ std::vector<ccreg_value>& values_out,
+ basic_block prev_visited_bb = NULL) const;
+
+ // Given a cbranch insn, its basic block and another basic block, determine
+ // the value to which the ccreg will be set after jumping/falling through to
+ // the specified target basic block.
+ bool sh_cbranch_ccreg_value (rtx cbranch_insn,
+ basic_block cbranch_insn_bb,
+ basic_block branch_target_bb) const;
+
+ // Check whether all of the ccreg values are the same.
+ static bool all_ccreg_values_equal (const std::vector<ccreg_value>& values);
+
+ // Remove REG_DEAD and REG_UNUSED notes from insns of the specified
+ // ccreg_value entries.
+ void remove_ccreg_dead_unused_notes (std::vector<ccreg_value>& values) const;
+
+ // rtx of the ccreg that is obtained from the target.
+ rtx m_ccreg;
+};
+
+const pass_data sh_optimize_sett_clrt::default_pass_data =
+{
+ RTL_PASS, // type
+ "", // name (overwritten by the constructor)
+ OPTGROUP_NONE, // optinfo_flags
+ true, // has_gate
+ true, // has_execute
+ TV_OPTIMIZE, // tv_id
+ 0, // properties_required
+ 0, // properties_provided
+ 0, // properties_destroyed
+ 0, // todo_flags_start
+ 0 // todo_flags_finish
+};
+
+sh_optimize_sett_clrt::sh_optimize_sett_clrt (gcc::context* ctx,
+ const char* name)
+: rtl_opt_pass (default_pass_data, ctx),
+ m_ccreg (NULL_RTX)
+{
+ // Overwrite default name in pass_data base class.
+ this->name = name;
+}
+
+sh_optimize_sett_clrt::~sh_optimize_sett_clrt (void)
+{
+}
+
+bool
+sh_optimize_sett_clrt::gate (void)
+{
+ return optimize > 0;
+}
+
+unsigned int
+sh_optimize_sett_clrt::execute (void)
+{
+ unsigned int ccr0 = INVALID_REGNUM;
+ unsigned int ccr1 = INVALID_REGNUM;
+
+ if (targetm.fixed_condition_code_regs (&ccr0, &ccr1)
+ && ccr0 != INVALID_REGNUM)
+ {
+ // Initially create a reg rtx with VOIDmode.
+ // When the constant setcc is discovered, the mode is changed
+ // to the mode that is actually used by the target.
+ m_ccreg = gen_rtx_REG (VOIDmode, ccr0);
+ }
+
+ if (m_ccreg == NULL_RTX)
+ log_return (0, "no ccreg.\n\n");
+
+ if (STORE_FLAG_VALUE != 1)
+ log_return (0, "unsupported STORE_FLAG_VALUE %d", STORE_FLAG_VALUE);
+
+ log_msg ("ccreg: ");
+ log_rtx (m_ccreg);
+ log_msg (" STORE_FLAG_VALUE = %d\n", STORE_FLAG_VALUE);
+
+ if (!df_regs_ever_live_p (ccr0))
+ log_return (0, "ccreg never live\n\n");
+
+ // Output vector for find_known_ccreg_values.
+ std::vector<ccreg_value> ccreg_values;
+ ccreg_values.reserve (32);
+
+ // Look for insns that set the ccreg to a constant value and see if it can
+ // be optimized.
+ basic_block bb;
+ FOR_EACH_BB_REVERSE (bb)
+ for (rtx next_i, i = NEXT_INSN (BB_HEAD (bb));
+ i != NULL_RTX && i != BB_END (bb); i = next_i)
+ {
+ next_i = NEXT_INSN (i);
+
+ if (!INSN_P (i) || !NONDEBUG_INSN_P (i))
+ continue;
+
+ rtx setcc_val = const_setcc_value (PATTERN (i));
+ if (setcc_val != NULL_RTX)
+ {
+ update_ccreg_mode (GET_MODE (XEXP (PATTERN (i), 0)));
+
+ log_msg ("\n\nfound const setcc insn in [bb %d]: \n", bb->index);
+ log_insn (i);
+ log_msg ("\n");
+
+ ccreg_values.clear ();
+ find_last_ccreg_values (PREV_INSN (i), bb, ccreg_values);
+
+ log_msg ("number of ccreg values collected: %u\n",
+ (unsigned int)ccreg_values.size ());
+
+ // If all the collected values are equal and are equal to the
+ // constant value of the setcc insn, the setcc insn can be
+ // removed.
+ if (all_ccreg_values_equal (ccreg_values)
+ && rtx_equal_p (ccreg_values.front ().value, setcc_val))
+ {
+ log_msg ("all values are ");
+ log_rtx (setcc_val);
+ log_msg ("\n");
+
+ delete_insn (i);
+ remove_ccreg_dead_unused_notes (ccreg_values);
+ }
+ }
+ }
+
+ log_return (0, "\n\n");
+}
+
+void
+sh_optimize_sett_clrt::update_ccreg_mode (machine_mode m)
+{
+ if (GET_MODE (m_ccreg) == m)
+ return;
+
+ PUT_MODE (m_ccreg, m);
+ log_msg ("updated ccreg mode: ");
+ log_rtx (m_ccreg);
+ log_msg ("\n\n");
+}
+
+rtx
+sh_optimize_sett_clrt::const_setcc_value (rtx pat) const
+{
+ if (GET_CODE (pat) == SET
+ && REG_P (XEXP (pat, 0)) && REGNO (XEXP (pat, 0)) == REGNO (m_ccreg)
+ && CONST_INT_P (XEXP (pat, 1))
+ && (INTVAL (XEXP (pat, 1)) == 0
+ || INTVAL (XEXP (pat, 1)) == STORE_FLAG_VALUE))
+ return XEXP (pat, 1);
+ else
+ return NULL_RTX;
+}
+
+bool
+sh_optimize_sett_clrt
+::sh_cbranch_ccreg_value (rtx cbranch_insn, basic_block cbranch_insn_bb,
+ basic_block branch_target_bb) const
+{
+ rtx pc_set_rtx = pc_set (cbranch_insn);
+ gcc_assert (pc_set_rtx != NULL_RTX);
+ gcc_assert (branch_target_bb != NULL);
+
+ rtx cond = XEXP (XEXP (pc_set_rtx, 1), 0);
+ bool branch_if;
+
+ if (GET_CODE (cond) == NE
+ && REG_P (XEXP (cond, 0)) && REGNO (XEXP (cond, 0)) == REGNO (m_ccreg)
+ && XEXP (cond, 1) == const0_rtx)
+ branch_if = true;
+
+ else if (GET_CODE (cond) == EQ
+ && REG_P (XEXP (cond, 0)) && REGNO (XEXP (cond, 0)) == REGNO (m_ccreg)
+ && XEXP (cond, 1) == const0_rtx)
+ branch_if = false;
+
+ else
+ gcc_unreachable ();
+
+ if (branch_target_bb == BRANCH_EDGE (cbranch_insn_bb)->dest)
+ return branch_if;
+ else if (branch_target_bb == FALLTHRU_EDGE (cbranch_insn_bb)->dest)
+ return !branch_if;
+ else
+ gcc_unreachable ();
+}
+
+void
+sh_optimize_sett_clrt
+::find_last_ccreg_values (rtx start_insn, basic_block bb,
+ std::vector<ccreg_value>& values_out,
+ basic_block prev_visited_bb) const
+{
+ if (start_insn == NULL_RTX)
+ return;
+
+ log_msg ("looking for ccreg values in [bb %d]\n", bb->index);
+
+ for (rtx i = start_insn; i != NULL_RTX && i != PREV_INSN (BB_HEAD (bb));
+ i = PREV_INSN (i))
+ {
+ if (!INSN_P (i))
+ continue;
+
+ if (reg_set_p (m_ccreg, i))
+ {
+ const_rtx set_rtx = set_of (m_ccreg, i);
+
+ ccreg_value v;
+ v.insn = i;
+ v.bb = bb;
+ v.value = set_rtx != NULL_RTX && GET_CODE (set_rtx) == SET
+ ? XEXP (set_rtx, 1)
+ : NULL_RTX;
+
+ log_msg ("found setcc in [bb %d] in insn:\n", bb->index);
+ log_insn (i);
+ log_msg ("\nccreg value: ");
+ log_rtx (v.value);
+ log_msg ("\n");
+
+ values_out.push_back (v);
+ return;
+ }
+
+ if (any_condjump_p (i) && onlyjump_p (i) && prev_visited_bb != NULL)
+ {
+ // For a conditional branch the ccreg value will be a known constant
+ // of either 0 or STORE_FLAG_VALUE after branching/falling through
+ // to one of the two successor BBs. Record the value for the BB
+ // where we came from.
+ log_msg ("found cbranch in [bb %d]:\n", bb->index);
+ log_insn (i);
+
+ ccreg_value v;
+ v.insn = i;
+ v.bb = bb;
+ v.value = GEN_INT (sh_cbranch_ccreg_value (i, bb, prev_visited_bb));
+
+ log_msg (" branches to [bb %d] with ccreg value ",
+ prev_visited_bb->index);
+ log_rtx (v.value);
+ log_msg ("\n");
+
+ values_out.push_back (v);
+ return;
+ }
+ }
+
+ // If here, we've walked up all the insns of the current basic block
+ // and none of them seems to modify the ccreg.
+ // In this case, check the predecessor basic blocks.
+ unsigned int pred_bb_count = 0;
+
+ // If the current basic block is the same as the previous one, it's a loop.
+ // Don't try to recurse again, as this will result in an infinite loop.
+ if (bb != prev_visited_bb)
+ for (edge_iterator ei = ei_start (bb->preds); !ei_end_p (ei); ei_next (&ei))
+ {
+ basic_block pred_bb = ei_edge (ei)->src;
+ if (pred_bb->index == ENTRY_BLOCK)
+ continue;
+
+ pred_bb_count += 1;
+ find_last_ccreg_values (BB_END (pred_bb), pred_bb, values_out, bb);
+ }
+
+ log_msg ("[bb %d] pred_bb_count = %u\n", bb->index, pred_bb_count);
+
+ // If here, we've walked up all the predecessor basic blocks without finding
+ // anything setcc related. Add an entry for the last insn of the current
+ // basic block with the ccreg value being set to unknown (NULL_RTX).
+ if (pred_bb_count == 0)
+ {
+ log_msg ("unknown ccreg value for [bb %d]\n", bb->index);
+
+ ccreg_value v;
+ v.insn = BB_END (bb);
+ v.bb = bb;
+ v.value = NULL_RTX;
+
+ values_out.push_back (v);
+ }
+}
+
+bool
+sh_optimize_sett_clrt
+::all_ccreg_values_equal (const std::vector<ccreg_value>& values)
+{
+ if (values.empty ())
+ return false;
+
+ rtx last_value = values.front ().value;
+
+ // If the ccreg is modified in the insn but the exact value is not known
+ // the value rtx might be null.
+ if (last_value == NULL_RTX)
+ return false;
+
+ for (std::vector<ccreg_value>::const_iterator i = values.begin ();
+ i != values.end (); ++i)
+ if (i->value == NULL_RTX || !rtx_equal_p (last_value, i->value))
+ return false;
+
+ return true;
+}
+
+void
+sh_optimize_sett_clrt
+::remove_ccreg_dead_unused_notes (std::vector<ccreg_value>& values) const
+{
+ for (std::vector<ccreg_value>::iterator i = values.begin ();
+ i != values.end (); ++i)
+ {
+ if (i->insn == NULL_RTX)
+ continue;
+
+ rtx n = find_regno_note (i->insn, REG_DEAD, REGNO (m_ccreg));
+ if (n != NULL_RTX)
+ remove_note (i->insn, n);
+
+ n = find_regno_note (i->insn, REG_UNUSED, REGNO (m_ccreg));
+ if (n != NULL_RTX)
+ remove_note (i->insn, n);
+ }
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// This allows instantiating the pass somewhere else without having to pull
+// in a header file.
+opt_pass*
+make_pass_sh_optimize_sett_clrt (gcc::context* ctx, const char* name)
+{
+ return new sh_optimize_sett_clrt (ctx, name);
+}
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index 710bc873e75..405d3142253 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -29,6 +29,10 @@ sh_treg_combine.o: $(srcdir)/config/sh/sh_treg_combine.cc \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) $(TM_P_H) coretypes.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+sh_optimize_sett_clrt.o: $(srcdir)/config/sh/sh_optimize_sett_clrt.cc \
+ $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) $(TM_P_H) coretypes.h
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
DEFAULT_ENDIAN = $(word 1,$(TM_ENDIAN_CONFIG))
OTHER_ENDIAN = $(word 2,$(TM_ENDIAN_CONFIG))
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 13192c0aa21..410c8eeee03 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -10643,7 +10643,7 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
&& TREE_CODE (arg1) == VECTOR_CST
&& TREE_CODE (arg2) == INTEGER_CST)
{
- bool overflow, overall_overflow = false;
+ bool overflow = false;
wide_int result = arg2;
wide_int tmp;
unsigned i;
@@ -10653,21 +10653,19 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
tree e0 = VECTOR_CST_ELT (arg0, i);
tree e1 = VECTOR_CST_ELT (arg1, i);
- tmp = wi::neg (e1, &overflow);
- overall_overflow |= overall_overflow;
- tmp = wi::add (e0, tmp, SIGNED, &overflow);
- overall_overflow |= overall_overflow;
- if (wi::neg_p (tmp))
- {
- tmp = wi::neg (tmp, &overflow);
- overall_overflow |= overall_overflow;
- }
+ bool neg1_ovf, neg2_ovf, add1_ovf, add2_ovf;
- result = wi::add (result, tmp, SIGNED, &overflow);
- overall_overflow |= overall_overflow;
+ tmp = wi::neg (e1, &neg1_ovf);
+ tmp = wi::add (e0, tmp, SIGNED, &add1_ovf);
+ if (wi::neg_p (tmp))
+ tmp = wi::neg (tmp, &neg2_ovf);
+ else
+ neg2_ovf = false;
+ result = wi::add (result, tmp, SIGNED, &add2_ovf);
+ overflow |= neg1_ovf | neg2_ovf | add1_ovf | add2_ovf;
}
- gcc_assert (!overall_overflow);
+ gcc_assert (!overflow);
return wide_int_to_tree (rtype, result);
}
diff --git a/gcc/cse.c b/gcc/cse.c
index cebb7a10bb8..15e582cd223 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3296,8 +3296,8 @@ fold_rtx (rtx x, rtx insn)
break;
new_rtx = simplify_unary_operation (code, mode,
- const_arg0 ? const_arg0 : folded_arg0,
- mode_arg0);
+ const_arg0 ? const_arg0 : folded_arg0,
+ mode_arg0);
}
break;
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 5da1e0d0e8a..bbd8be07eac 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -2315,6 +2315,10 @@ dbxout_type (tree type, int full)
dbxout_type (TREE_TYPE (type), 0);
break;
+ case POINTER_BOUNDS_TYPE:
+ /* No debug info for pointer bounds type supported yet. */
+ break;
+
default:
gcc_unreachable ();
}
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 3d88c0d3ed1..5ece3f68b94 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -227,7 +227,7 @@ calc_dfs_tree_nonrec (struct dom_info *di, basic_block bb, bool reverse)
edge_iterator *stack;
edge_iterator ei, einext;
int sp;
- /* Start block (ENTRY_BLOCK_PTR for forward problem, EXIT_BLOCK for backward
+ /* Start block (the entry block for forward problem, exit block for backward
problem). */
basic_block en_block;
/* Ending block. */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d31cab99012..3c1e0023c3f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18457,7 +18457,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
gen_formal_parameter_pack_die (generic_decl_parm,
parm, subr_die,
&parm);
- else if (parm)
+ else if (parm && !POINTER_BOUNDS_P (parm))
{
dw_die_ref parm_die = gen_decl_die (parm, NULL, subr_die);
@@ -18469,6 +18469,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
parm = DECL_CHAIN (parm);
}
+ else if (parm)
+ parm = DECL_CHAIN (parm);
if (generic_decl_parm)
generic_decl_parm = DECL_CHAIN (generic_decl_parm);
@@ -19967,6 +19969,7 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
case FIXED_POINT_TYPE:
case COMPLEX_TYPE:
case BOOLEAN_TYPE:
+ case POINTER_BOUNDS_TYPE:
/* No DIEs needed for fundamental types. */
break;
@@ -20614,7 +20617,8 @@ dwarf2out_global_decl (tree decl)
declarations, file-scope (extern) function declarations (which
had no corresponding body) and file-scope tagged type declarations
and definitions which have not yet been forced out. */
- if (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl))
+ if ((TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl))
+ && !POINTER_BOUNDS_P (decl))
dwarf2out_decl (decl);
}
diff --git a/gcc/function.c b/gcc/function.c
index fde4a8e6d07..5b33c46559b 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6349,7 +6349,7 @@ thread_prologue_and_epilogue_insns (void)
{
unsigned i, last;
- /* convert_jumps_to_returns may add to EXIT_BLOCK_PTR->preds
+ /* convert_jumps_to_returns may add to preds of the exit block
(but won't remove). Stop at end of current preds. */
last = EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds);
for (i = 0; i < last; i++)
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index baccd6b783e..f0a925c2b9c 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -383,6 +383,8 @@ class VecPrinter:
return '0x%x' % long(self.gdbval)
def children (self):
+ if long(self.gdbval) == 0:
+ return
m_vecpfx = self.gdbval['m_vecpfx']
m_num = m_vecpfx['m_num']
m_vecdata = self.gdbval['m_vecdata']
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 18c0a5315ad..216318743ab 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -608,7 +608,6 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
gimple stmt, new_stmt;
gimple_stmt_iterator i;
gimple_seq stmts = NULL;
- struct gimplify_ctx gctx;
gimple laststore;
tree reaching_vuse;
@@ -616,8 +615,7 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
gcc_assert (is_gimple_call (stmt));
- push_gimplify_context (&gctx);
- gctx.into_ssa = gimple_in_ssa_p (cfun);
+ push_gimplify_context (gimple_in_ssa_p (cfun));
lhs = gimple_call_lhs (stmt);
if (lhs == NULL_TREE)
diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c
index a7e9387b648..92542a9a2e9 100644
--- a/gcc/gimplify-me.c
+++ b/gcc/gimplify-me.c
@@ -45,7 +45,6 @@ force_gimple_operand_1 (tree expr, gimple_seq *stmts,
gimple_predicate gimple_test_f, tree var)
{
enum gimplify_status ret;
- struct gimplify_ctx gctx;
location_t saved_location;
*stmts = NULL;
@@ -57,16 +56,13 @@ force_gimple_operand_1 (tree expr, gimple_seq *stmts,
&& (*gimple_test_f) (expr))
return expr;
- push_gimplify_context (&gctx);
- gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
- gimplify_ctxp->allow_rhs_cond_expr = true;
+ push_gimplify_context (gimple_in_ssa_p (cfun), true);
saved_location = input_location;
input_location = UNKNOWN_LOCATION;
if (var)
{
- if (gimplify_ctxp->into_ssa
- && is_gimple_reg (var))
+ if (gimple_in_ssa_p (cfun) && is_gimple_reg (var))
var = make_ssa_name (var, NULL);
expr = build2 (MODIFY_EXPR, TREE_TYPE (var), var, expr);
}
@@ -160,10 +156,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
tree lhs;
gimple_seq pre = NULL;
gimple post_stmt = NULL;
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
- gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
+ push_gimplify_context (gimple_in_ssa_p (cfun));
switch (gimple_code (stmt))
{
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 5c71d2c3605..2b6de3e1732 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -89,6 +89,37 @@ enum omp_region_type
ORT_TARGET = 32
};
+/* Gimplify hashtable helper. */
+
+struct gimplify_hasher : typed_free_remove <elt_t>
+{
+ typedef elt_t value_type;
+ typedef elt_t compare_type;
+ static inline hashval_t hash (const value_type *);
+ static inline bool equal (const value_type *, const compare_type *);
+};
+
+struct gimplify_ctx
+{
+ struct gimplify_ctx *prev_context;
+
+ vec<gimple> bind_expr_stack;
+ tree temps;
+ gimple_seq conditional_cleanups;
+ tree exit_label;
+ tree return_temp;
+
+ vec<tree> case_labels;
+ /* The formal temporary table. Should this be persistent? */
+ hash_table <gimplify_hasher> temp_htab;
+
+ int conditions;
+ bool save_stack;
+ bool into_ssa;
+ bool allow_rhs_cond_expr;
+ bool in_cleanup_point_expr;
+};
+
struct gimplify_omp_ctx
{
struct gimplify_omp_ctx *outer_context;
@@ -100,10 +131,9 @@ struct gimplify_omp_ctx
bool combined_loop;
};
-struct gimplify_ctx *gimplify_ctxp;
+static struct gimplify_ctx *gimplify_ctxp;
static struct gimplify_omp_ctx *gimplify_omp_ctxp;
-
/* Forward declaration. */
static enum gimplify_status gimplify_compound_expr (tree *, gimple_seq *, bool);
@@ -134,14 +164,63 @@ gimplify_seq_add_seq (gimple_seq *dst_p, gimple_seq src)
gsi_insert_seq_after_without_update (&si, src, GSI_NEW_STMT);
}
+
+/* Pointer to a list of allocated gimplify_ctx structs to be used for pushing
+ and popping gimplify contexts. */
+
+static struct gimplify_ctx *ctx_pool = NULL;
+
+/* Return a gimplify context struct from the pool. */
+
+static inline struct gimplify_ctx *
+ctx_alloc (void)
+{
+ struct gimplify_ctx * c = ctx_pool;
+
+ if (c)
+ ctx_pool = c->prev_context;
+ else
+ c = XNEW (struct gimplify_ctx);
+
+ memset (c, '\0', sizeof (*c));
+ return c;
+}
+
+/* Put gimplify context C back into the pool. */
+
+static inline void
+ctx_free (struct gimplify_ctx *c)
+{
+ c->prev_context = ctx_pool;
+ ctx_pool = c;
+}
+
+/* Free allocated ctx stack memory. */
+
+void
+free_gimplify_stack (void)
+{
+ struct gimplify_ctx *c;
+
+ while ((c = ctx_pool))
+ {
+ ctx_pool = c->prev_context;
+ free (c);
+ }
+}
+
+
/* Set up a context for the gimplifier. */
void
-push_gimplify_context (struct gimplify_ctx *c)
+push_gimplify_context (bool in_ssa, bool rhs_cond_ok)
{
- memset (c, '\0', sizeof (*c));
+ struct gimplify_ctx *c = ctx_alloc ();
+
c->prev_context = gimplify_ctxp;
gimplify_ctxp = c;
+ gimplify_ctxp->into_ssa = in_ssa;
+ gimplify_ctxp->allow_rhs_cond_expr = rhs_cond_ok;
}
/* Tear down a context for the gimplifier. If BODY is non-null, then
@@ -168,6 +247,7 @@ pop_gimplify_context (gimple body)
if (c->temp_htab.is_created ())
c->temp_htab.dispose ();
+ ctx_free (c);
}
/* Push a GIMPLE_BIND tuple onto the stack of bindings. */
@@ -5726,7 +5806,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
enum omp_region_type region_type)
{
struct gimplify_omp_ctx *ctx, *outer_ctx;
- struct gimplify_ctx gctx;
tree c;
ctx = new_omp_context (region_type);
@@ -5863,7 +5942,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c),
GOVD_LOCAL | GOVD_SEEN);
gimplify_omp_ctxp = ctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = NULL;
OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = NULL;
@@ -5872,7 +5951,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
&OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c));
pop_gimplify_context
(gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)));
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c),
&OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c));
pop_gimplify_context
@@ -5886,7 +5965,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
&& OMP_CLAUSE_LASTPRIVATE_STMT (c))
{
gimplify_omp_ctxp = ctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR)
{
tree bind = build3 (BIND_EXPR, void_type_node, NULL,
@@ -6309,14 +6388,13 @@ gimplify_omp_parallel (tree *expr_p, gimple_seq *pre_p)
tree expr = *expr_p;
gimple g;
gimple_seq body = NULL;
- struct gimplify_ctx gctx;
gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p,
OMP_PARALLEL_COMBINED (expr)
? ORT_COMBINED_PARALLEL
: ORT_PARALLEL);
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
g = gimplify_and_return_first (OMP_PARALLEL_BODY (expr), &body);
if (gimple_code (g) == GIMPLE_BIND)
@@ -6346,14 +6424,13 @@ gimplify_omp_task (tree *expr_p, gimple_seq *pre_p)
tree expr = *expr_p;
gimple g;
gimple_seq body = NULL;
- struct gimplify_ctx gctx;
gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p,
find_omp_clause (OMP_TASK_CLAUSES (expr),
OMP_CLAUSE_UNTIED)
? ORT_UNTIED_TASK : ORT_TASK);
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
g = gimplify_and_return_first (OMP_TASK_BODY (expr), &body);
if (gimple_code (g) == GIMPLE_BIND)
@@ -6751,8 +6828,7 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
gimplify_scan_omp_clauses (&OMP_CLAUSES (expr), pre_p, ort);
if (ort == ORT_TARGET || ort == ORT_TARGET_DATA)
{
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
gimple g = gimplify_and_return_first (OMP_BODY (expr), &body);
if (gimple_code (g) == GIMPLE_BIND)
pop_gimplify_context (g);
@@ -6987,7 +7063,6 @@ gimplify_transaction (tree *expr_p, gimple_seq *pre_p)
tree expr = *expr_p, temp, tbody = TRANSACTION_EXPR_BODY (expr);
gimple g;
gimple_seq body = NULL;
- struct gimplify_ctx gctx;
int subcode = 0;
/* Wrap the transaction body in a BIND_EXPR so we have a context
@@ -7000,7 +7075,7 @@ gimplify_transaction (tree *expr_p, gimple_seq *pre_p)
TRANSACTION_EXPR_BODY (expr) = bind;
}
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
temp = voidify_wrapper_expr (*expr_p, NULL);
g = gimplify_and_return_first (TRANSACTION_EXPR_BODY (expr), &body);
@@ -8358,7 +8433,6 @@ gimplify_body (tree fndecl, bool do_parms)
location_t saved_location = input_location;
gimple_seq parm_stmts, seq;
gimple outer_bind;
- struct gimplify_ctx gctx;
struct cgraph_node *cgn;
timevar_push (TV_TREE_GIMPLIFY);
@@ -8368,7 +8442,7 @@ gimplify_body (tree fndecl, bool do_parms)
default_rtl_profile ();
gcc_assert (gimplify_ctxp == NULL);
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
if (flag_openmp)
{
diff --git a/gcc/gimplify.h b/gcc/gimplify.h
index 3f7e1b327a9..91000d1e6b7 100644
--- a/gcc/gimplify.h
+++ b/gcc/gimplify.h
@@ -48,39 +48,10 @@ enum gimplify_status {
GS_OK = 0, /* We did something, maybe more to do. */
GS_ALL_DONE = 1 /* The expression is fully gimplified. */
};
-/* Gimplify hashtable helper. */
-struct gimplify_hasher : typed_free_remove <elt_t>
-{
- typedef elt_t value_type;
- typedef elt_t compare_type;
- static inline hashval_t hash (const value_type *);
- static inline bool equal (const value_type *, const compare_type *);
-};
-
-struct gimplify_ctx
-{
- struct gimplify_ctx *prev_context;
-
- vec<gimple> bind_expr_stack;
- tree temps;
- gimple_seq conditional_cleanups;
- tree exit_label;
- tree return_temp;
-
- vec<tree> case_labels;
- /* The formal temporary table. Should this be persistent? */
- hash_table <gimplify_hasher> temp_htab;
-
- int conditions;
- bool save_stack;
- bool into_ssa;
- bool allow_rhs_cond_expr;
- bool in_cleanup_point_expr;
-};
-
-extern struct gimplify_ctx *gimplify_ctxp;
-extern void push_gimplify_context (struct gimplify_ctx *);
+extern void free_gimplify_stack (void);
+extern void push_gimplify_context (bool in_ssa = false,
+ bool rhs_cond_ok = false);
extern void pop_gimplify_context (gimple);
extern gimple gimple_current_bind_expr (void);
extern vec<gimple> gimple_bind_expr_stack (void);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 0cfb5a59cc9..15c4c0f99ea 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -518,7 +518,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
result.next = exit_e->dest;
/* If we do not dominate result.next, remove it. It's either
- the EXIT_BLOCK_PTR, or another bb dominates it and will
+ the exit block, or another bb dominates it and will
call the scop detection for this bb. */
if (!dominated_by_p (CDI_DOMINATORS, result.next, bb))
result.next = NULL;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index d7d6b8fd70f..2e8a062da6b 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -635,7 +635,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
<retval> = tmp_var;
return <retval>
but return_bb can not be more complex than this.
- If nothing is found, return EXIT_BLOCK_PTR.
+ If nothing is found, return the exit block.
When there are multiple RETURN statement, chose one with return value,
since that one is more likely shared by multiple code paths.
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 94b6e2559ef..4c88cca669d 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -269,7 +269,11 @@ in_class_p (rtx reg, enum reg_class cl, enum reg_class *new_class)
typically moves that have many alternatives, and restricting
reload pseudos for one alternative may lead to situations
where other reload pseudos are no longer allocatable. */
- || INSN_UID (curr_insn) >= new_insn_uid_start)
+ || (INSN_UID (curr_insn) >= new_insn_uid_start
+ && curr_insn_set != NULL
+ && (OBJECT_P (SET_SRC (curr_insn_set))
+ || (GET_CODE (SET_SRC (curr_insn_set)) == SUBREG
+ && OBJECT_P (SUBREG_REG (SET_SRC (curr_insn_set)))))))
/* When we don't know what class will be used finally for reload
pseudos, we use ALL_REGS. */
return ((regno >= new_regno_start && rclass == ALL_REGS)
@@ -381,21 +385,6 @@ init_curr_insn_input_reloads (void)
curr_insn_input_reloads_num = 0;
}
-/* Change class of pseudo REGNO to NEW_CLASS. Print info about it
- using TITLE. Output a new line if NL_P. */
-static void
-change_class (int regno, enum reg_class new_class,
- const char *title, bool nl_p)
-{
- lra_assert (regno >= FIRST_PSEUDO_REGISTER);
- if (lra_dump_file != NULL)
- fprintf (lra_dump_file, "%s to class %s for r%d",
- title, reg_class_names[new_class], regno);
- setup_reg_classes (regno, new_class, NO_REGS, new_class);
- if (lra_dump_file != NULL && nl_p)
- fprintf (lra_dump_file, "\n");
-}
-
/* Create a new pseudo using MODE, RCLASS, ORIGINAL or reuse already
created input reload pseudo (only if TYPE is not OP_OUT). The
result pseudo is returned through RESULT_REG. Return TRUE if we
@@ -442,7 +431,7 @@ get_reload_reg (enum op_type type, enum machine_mode mode, rtx original,
dump_value_slim (lra_dump_file, original, 1);
}
if (new_class != lra_get_allocno_class (regno))
- change_class (regno, new_class, ", change", false);
+ lra_change_class (regno, new_class, ", change to", false);
if (lra_dump_file != NULL)
fprintf (lra_dump_file, "\n");
return false;
@@ -667,7 +656,7 @@ narrow_reload_pseudo_class (rtx reg, enum reg_class cl)
if (! REG_P (reg) || (int) REGNO (reg) < new_regno_start)
return;
if (in_class_p (reg, cl, &rclass) && rclass != cl)
- change_class (REGNO (reg), rclass, " Change", true);
+ lra_change_class (REGNO (reg), rclass, " Change to", true);
}
/* Generate reloads for matching OUT and INS (array of input operand
@@ -1133,7 +1122,7 @@ process_addr_reg (rtx *loc, rtx *before, rtx *after, enum reg_class cl)
}
else if (new_class != NO_REGS && rclass != new_class)
{
- change_class (regno, new_class, " Change", true);
+ lra_change_class (regno, new_class, " Change to", true);
return false;
}
else
@@ -2796,7 +2785,7 @@ process_address (int nop, rtx *before, rtx *after)
regno = REGNO (*ad.base_term);
if (regno >= FIRST_PSEUDO_REGISTER
&& cl != lra_get_allocno_class (regno))
- change_class (regno, cl, " Change", true);
+ lra_change_class (regno, cl, " Change to", true);
new_reg = SET_SRC (set);
delete_insns_since (PREV_INSN (last_insn));
}
@@ -3316,7 +3305,7 @@ curr_insn_transform (void)
if (new_class != NO_REGS && get_reg_class (regno) != new_class)
{
lra_assert (ok_p);
- change_class (regno, new_class, " Change", true);
+ lra_change_class (regno, new_class, " Change to", true);
}
}
}
@@ -3395,7 +3384,7 @@ curr_insn_transform (void)
&& lra_former_scratch_operand_p (curr_insn, i))
{
int regno = REGNO (op);
- change_class (regno, NO_REGS, " Change", true);
+ lra_change_class (regno, NO_REGS, " Change to", true);
if (lra_get_regno_hard_regno (regno) >= 0)
/* We don't have to mark all insn affected by the
spilled pseudo as there is only one such insn, the
@@ -3410,6 +3399,7 @@ curr_insn_transform (void)
&& lra_undo_inheritance_iter < LRA_MAX_INHERITANCE_PASSES
&& goal_alt[i] != NO_REGS && REG_P (op)
&& (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER
+ && regno < new_regno_start
&& ! lra_former_scratch_p (regno)
&& reg_renumber[regno] < 0
&& (curr_insn_set == NULL_RTX
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index cb45c65d13a..c545d9d354f 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -33,16 +33,6 @@ along with GCC; see the file COPYING3. If not see
base and index registers might require a reload too. */
#define LRA_MAX_INSN_RELOADS (MAX_RECOG_OPERANDS * 3)
-/* Return the hard register which given pseudo REGNO assigned to.
- Negative value means that the register got memory or we don't know
- allocation yet. */
-static inline int
-lra_get_regno_hard_regno (int regno)
-{
- resize_reg_info ();
- return reg_renumber[regno];
-}
-
typedef struct lra_live_range *lra_live_range_t;
/* The structure describes program points where a given pseudo lives.
@@ -394,6 +384,31 @@ extern void lra_eliminate_reg_if_possible (rtx *);
+/* Return the hard register which given pseudo REGNO assigned to.
+ Negative value means that the register got memory or we don't know
+ allocation yet. */
+static inline int
+lra_get_regno_hard_regno (int regno)
+{
+ resize_reg_info ();
+ return reg_renumber[regno];
+}
+
+/* Change class of pseudo REGNO to NEW_CLASS. Print info about it
+ using TITLE. Output a new line if NL_P. */
+static void inline
+lra_change_class (int regno, enum reg_class new_class,
+ const char *title, bool nl_p)
+{
+ lra_assert (regno >= FIRST_PSEUDO_REGISTER);
+ if (lra_dump_file != NULL)
+ fprintf (lra_dump_file, "%s class %s for r%d",
+ title, reg_class_names[new_class], regno);
+ setup_reg_classes (regno, new_class, NO_REGS, new_class);
+ if (lra_dump_file != NULL && nl_p)
+ fprintf (lra_dump_file, "\n");
+}
+
/* Update insn operands which are duplication of NOP operand. The
insn is represented by its LRA internal representation ID. */
static inline void
diff --git a/gcc/lra.c b/gcc/lra.c
index 0deae88e85a..f4791a2de8b 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -130,11 +130,13 @@ static void invalidate_insn_data_regno_info (lra_insn_recog_data_t, rtx, int);
/* Expand all regno related info needed for LRA. */
static void
-expand_reg_data (void)
+expand_reg_data (int old)
{
resize_reg_info ();
expand_reg_info ();
ira_expand_reg_equiv ();
+ for (int i = (int) max_reg_num () - 1; i >= old; i--)
+ lra_change_class (i, ALL_REGS, " Set", true);
}
/* Create and return a new reg of ORIGINAL mode. If ORIGINAL is NULL
@@ -178,7 +180,7 @@ lra_create_new_reg_with_unique_value (enum machine_mode md_mode, rtx original,
title, REGNO (new_reg));
fprintf (lra_dump_file, "\n");
}
- expand_reg_data ();
+ expand_reg_data (max_reg_num ());
setup_reg_classes (REGNO (new_reg), rclass, NO_REGS, rclass);
return new_reg;
}
@@ -417,7 +419,7 @@ lra_emit_add (rtx x, rtx y, rtx z)
/* Functions emit_... can create pseudos -- so expand the pseudo
data. */
if (old != max_reg_num ())
- expand_reg_data ();
+ expand_reg_data (old);
}
/* The number of emitted reload insns so far. */
@@ -443,7 +445,7 @@ lra_emit_move (rtx x, rtx y)
/* Function emit_move can create pseudos -- so expand the pseudo
data. */
if (old != max_reg_num ())
- expand_reg_data ();
+ expand_reg_data (old);
return;
}
lra_emit_add (x, XEXP (y, 0), XEXP (y, 1));
@@ -2238,6 +2240,10 @@ lra (FILE *f)
init_insn_recog_data ();
+ /* We can not set up reload_in_progress because it prevents new
+ pseudo creation. */
+ lra_in_progress = 1;
+
#ifdef ENABLE_CHECKING
check_rtl (false);
#endif
@@ -2248,10 +2254,6 @@ lra (FILE *f)
setup_reg_spill_flag ();
- /* We can not set up reload_in_progress because it prevents new
- pseudo creation. */
- lra_in_progress = 1;
-
/* Function remove_scratches can creates new pseudos for clobbers --
so set up lra_constraint_new_regno_start before its call to
permit changing reg classes for pseudos created by this
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index d82759955d8..0f1a1c5e9a0 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -580,6 +580,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
&& boundary_p && !DECL_EXTERNAL (node->decl), 1);
/* in_other_partition. */
}
+ bp_pack_value (&bp, node->need_bounds_init, 1);
streamer_write_bitpack (&bp);
if (node->same_comdat_group && !boundary_p)
{
@@ -1150,6 +1151,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
node->analyzed = bp_unpack_value (&bp, 1);
node->used_from_other_partition = bp_unpack_value (&bp, 1);
node->in_other_partition = bp_unpack_value (&bp, 1);
+ node->need_bounds_init = bp_unpack_value (&bp, 1);
if (node->in_other_partition)
{
DECL_EXTERNAL (node->decl) = 1;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 17bf1dad0b7..a3bf71b6552 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8349,11 +8349,10 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple_stmt_iterator tgsi;
gimple stmt, new_stmt, bind, t;
gimple_seq ilist, dlist, olist, new_body;
- struct gimplify_ctx gctx;
stmt = gsi_stmt (*gsi_p);
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
dlist = NULL;
ilist = NULL;
@@ -8559,9 +8558,8 @@ lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx)
tree block;
gimple t, bind, single_stmt = gsi_stmt (*gsi_p);
gimple_seq bind_body, bind_body_tail = NULL, dlist;
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
block = make_node (BLOCK);
bind = gimple_build_bind (NULL, NULL, block);
@@ -8619,9 +8617,8 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple stmt = gsi_stmt (*gsi_p), bind;
location_t loc = gimple_location (stmt);
gimple_seq tseq;
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
block = make_node (BLOCK);
bind = gimple_build_bind (NULL, NULL, block);
@@ -8686,9 +8683,8 @@ lower_omp_ordered (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
gimple stmt = gsi_stmt (*gsi_p), bind, x;
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
block = make_node (BLOCK);
bind = gimple_build_bind (NULL, NULL, block);
@@ -8732,7 +8728,6 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple stmt = gsi_stmt (*gsi_p), bind;
location_t loc = gimple_location (stmt);
gimple_seq tbody;
- struct gimplify_ctx gctx;
name = gimple_omp_critical_name (stmt);
if (name)
@@ -8785,7 +8780,7 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
unlock = build_call_expr_loc (loc, unlock, 0);
}
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
block = make_node (BLOCK);
bind = gimple_build_bind (NULL, NULL, block);
@@ -8875,9 +8870,8 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple stmt = gsi_stmt (*gsi_p), new_stmt;
gimple_seq omp_for_body, body, dlist;
size_t i;
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
lower_omp (gimple_omp_for_pre_body_ptr (stmt), ctx);
@@ -9092,7 +9086,6 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
bool record_needs_remap = false, srecord_needs_remap = false;
splay_tree_node n;
struct omp_taskcopy_context tcctx;
- struct gimplify_ctx gctx;
location_t loc = gimple_location (task_stmt);
child_fn = gimple_omp_task_copy_fn (task_stmt);
@@ -9105,7 +9098,7 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
DECL_CONTEXT (t) = child_fn;
/* Populate the function. */
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
push_cfun (child_cfun);
bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
@@ -9385,7 +9378,6 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple stmt = gsi_stmt (*gsi_p);
gimple par_bind, bind, dep_bind = NULL;
gimple_seq par_body, olist, ilist, par_olist, par_rlist, par_ilist, new_body;
- struct gimplify_ctx gctx, dep_gctx;
location_t loc = gimple_location (stmt);
clauses = gimple_omp_taskreg_clauses (stmt);
@@ -9410,7 +9402,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (gimple_code (stmt) == GIMPLE_OMP_TASK
&& find_omp_clause (clauses, OMP_CLAUSE_DEPEND))
{
- push_gimplify_context (&dep_gctx);
+ push_gimplify_context ();
dep_bind = gimple_build_bind (NULL, NULL, make_node (BLOCK));
lower_depend_clauses (stmt, &dep_ilist, &dep_olist);
}
@@ -9418,7 +9410,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (ctx->srecord_type)
create_task_copyfn (stmt, ctx);
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
par_olist = NULL;
par_ilist = NULL;
@@ -9508,7 +9500,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple stmt = gsi_stmt (*gsi_p);
gimple tgt_bind = NULL, bind;
gimple_seq tgt_body = NULL, olist, ilist, new_body;
- struct gimplify_ctx gctx;
location_t loc = gimple_location (stmt);
int kind = gimple_omp_target_kind (stmt);
unsigned int map_cnt = 0;
@@ -9523,7 +9514,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
tgt_body = gimple_omp_body (stmt);
child_fn = ctx->cb.dst_fn;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
switch (OMP_CLAUSE_CODE (c))
@@ -9809,8 +9800,7 @@ static void
lower_omp_teams (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
gimple teams_stmt = gsi_stmt (*gsi_p);
- struct gimplify_ctx gctx;
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
tree block = make_node (BLOCK);
gimple bind = gimple_build_bind (NULL, NULL, block);
@@ -10103,10 +10093,8 @@ execute_lower_omp (void)
if (all_contexts->root)
{
- struct gimplify_ctx gctx;
-
if (task_shared_vars)
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
lower_omp (&body, NULL);
if (task_shared_vars)
pop_gimplify_context (NULL);
diff --git a/gcc/opts.c b/gcc/opts.c
index cd48c73267b..d282d6df507 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -809,10 +809,13 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
#else
error_at (loc, "LTO support has not been enabled in this configuration");
#endif
- if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
+ if (!opts->x_flag_fat_lto_objects
+ && (!HAVE_LTO_PLUGIN
+ || (opts_set->x_flag_use_linker_plugin
+ && !opts->x_flag_use_linker_plugin)))
{
if (opts_set->x_flag_fat_lto_objects)
- error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
+ error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin");
opts->x_flag_fat_lto_objects = 1;
}
}
diff --git a/gcc/plugin.c b/gcc/plugin.c
index d7dcb5f4d36..61d7fde0175 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -452,6 +452,7 @@ register_callback (const char *plugin_name,
case PLUGIN_EARLY_GIMPLE_PASSES_START:
case PLUGIN_EARLY_GIMPLE_PASSES_END:
case PLUGIN_NEW_PASS:
+ case PLUGIN_INCLUDE_FILE:
{
struct callback_info *new_callback;
if (!callback)
@@ -529,6 +530,7 @@ invoke_plugin_callbacks_full (int event, void *gcc_data)
case PLUGIN_EARLY_GIMPLE_PASSES_START:
case PLUGIN_EARLY_GIMPLE_PASSES_END:
case PLUGIN_NEW_PASS:
+ case PLUGIN_INCLUDE_FILE:
{
/* Iterate over every callback registered with this event and
call it. */
diff --git a/gcc/plugin.def b/gcc/plugin.def
index 25a645854a7..154f01c0f80 100644
--- a/gcc/plugin.def
+++ b/gcc/plugin.def
@@ -97,6 +97,9 @@ DEFEVENT (PLUGIN_NEW_PASS)
as a const char* pointer. */
DEFEVENT (PLUGIN_INCLUDE_FILE)
+/* When adding a new hard-coded plugin event, don't forget to edit in
+ file plugin.c the functions register_callback and
+ invoke_plugin_callbacks_full accordingly! */
/* After the hard-coded events above, plugins can dynamically allocate events
at run time.
diff --git a/gcc/profile.c b/gcc/profile.c
index 85671b30bc4..1d0e78ab4dc 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1392,7 +1392,7 @@ find_spanning_tree (struct edge_list *el)
union_groups (EXIT_BLOCK_PTR_FOR_FN (cfun), ENTRY_BLOCK_PTR_FOR_FN (cfun));
/* First add all abnormal edges to the tree unless they form a cycle. Also
- add all edges to EXIT_BLOCK_PTR to avoid inserting profiling code behind
+ add all edges to the exit block to avoid inserting profiling code behind
setting return value from function. */
for (i = 0; i < num_edges; i++)
{
diff --git a/gcc/real.c b/gcc/real.c
index 536aa977eaf..93a956cbd17 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -58,14 +58,7 @@
Both of these requirements are easily satisfied. The largest target
significand is 113 bits; we store at least 160. The smallest
- denormal number fits in 17 exponent bits; we store 26.
-
- Note that the decimal string conversion routines are sensitive to
- rounding errors. Since the raw arithmetic routines do not themselves
- have guard digits or rounding, the computation of 10**exp can
- accumulate more than a few digits of error. The previous incarnation
- of real.c successfully used a 144-bit fraction; given the current
- layout of REAL_VALUE_TYPE we're forced to expand to at least 160 bits. */
+ denormal number fits in 17 exponent bits; we store 26. */
/* Used to classify two numbers simultaneously. */
@@ -2032,75 +2025,50 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str)
else
{
/* Decimal floating point. */
- const REAL_VALUE_TYPE *ten = ten_to_ptwo (0);
- int d;
+ const char *cstr = str;
+ mpfr_t m;
+ bool inexact;
- while (*str == '0')
- str++;
- while (ISDIGIT (*str))
+ while (*cstr == '0')
+ cstr++;
+ if (*cstr == '.')
{
- d = *str++ - '0';
- do_multiply (r, r, ten);
- if (d)
- do_add (r, r, real_digit (d), 0);
- }
- if (*str == '.')
- {
- str++;
- if (r->cl == rvc_zero)
- {
- while (*str == '0')
- str++, exp--;
- }
- while (ISDIGIT (*str))
- {
- d = *str++ - '0';
- do_multiply (r, r, ten);
- if (d)
- do_add (r, r, real_digit (d), 0);
- exp--;
- }
+ cstr++;
+ while (*cstr == '0')
+ cstr++;
}
/* If the mantissa is zero, ignore the exponent. */
- if (r->cl == rvc_zero)
+ if (!ISDIGIT (*cstr))
goto is_a_zero;
- if (*str == 'e' || *str == 'E')
+ /* Nonzero value, possibly overflowing or underflowing. */
+ mpfr_init2 (m, SIGNIFICAND_BITS);
+ inexact = mpfr_strtofr (m, str, NULL, 10, GMP_RNDZ);
+ /* The result should never be a NaN, and because the rounding is
+ toward zero should never be an infinity. */
+ gcc_assert (!mpfr_nan_p (m) && !mpfr_inf_p (m));
+ if (mpfr_zero_p (m) || mpfr_get_exp (m) < -MAX_EXP + 4)
{
- bool exp_neg = false;
-
- str++;
- if (*str == '-')
- {
- exp_neg = true;
- str++;
- }
- else if (*str == '+')
- str++;
-
- d = 0;
- while (ISDIGIT (*str))
- {
- d *= 10;
- d += *str - '0';
- if (d > MAX_EXP)
- {
- /* Overflowed the exponent. */
- if (exp_neg)
- goto underflow;
- else
- goto overflow;
- }
- str++;
- }
- if (exp_neg)
- d = -d;
- exp += d;
+ mpfr_clear (m);
+ goto underflow;
+ }
+ else if (mpfr_get_exp (m) > MAX_EXP - 4)
+ {
+ mpfr_clear (m);
+ goto overflow;
+ }
+ else
+ {
+ real_from_mpfr (r, m, NULL_TREE, GMP_RNDZ);
+ /* 1 to 3 bits may have been shifted off (with a sticky bit)
+ because the hex digits used in real_from_mpfr did not
+ start with a digit 8 to f, but the exponent bounds above
+ should have avoided underflow or overflow. */
+ gcc_assert (r->cl = rvc_normal);
+ /* Set a sticky bit if mpfr_strtofr was inexact. */
+ r->sig[0] |= inexact;
}
-
- if (exp)
- times_pten (r, exp);
}
r->sign = sign;
diff --git a/gcc/recog.c b/gcc/recog.c
index b8073afb3a6..404d7a7355b 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -314,7 +314,9 @@ insn_invalid_p (rtx insn, bool in_group)
clobbers. */
int icode = recog (pat, insn,
(GET_CODE (pat) == SET
- && ! reload_completed && ! reload_in_progress)
+ && ! reload_completed
+ && ! reload_in_progress
+ && ! lra_in_progress)
? &num_clobbers : 0);
int is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0;
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 0fa0afbc824..9b52a6301f7 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -747,6 +747,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
int n_ops, i, alt, predicated;
bool is_asm, any_replacements;
rtx set;
+ rtx link;
bool replaced[MAX_RECOG_OPERANDS];
bool changed = false;
struct kill_set_value_data ksvd;
@@ -815,6 +816,23 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
if (recog_op_alt[i][alt].earlyclobber)
kill_value (recog_data.operand[i], vd);
+ /* If we have dead sets in the insn, then we need to note these as we
+ would clobbers. */
+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ {
+ if (REG_NOTE_KIND (link) == REG_UNUSED)
+ {
+ kill_value (XEXP (link, 0), vd);
+ /* Furthermore, if the insn looked like a single-set,
+ but the dead store kills the source value of that
+ set, then we can no-longer use the plain move
+ special case below. */
+ if (set
+ && reg_overlap_mentioned_p (XEXP (link, 0), SET_SRC (set)))
+ set = NULL;
+ }
+ }
+
/* Special-case plain move instructions, since we may well
be able to do the move from a different register class. */
if (set && REG_P (SET_SRC (set)))
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 070404c4245..84b5cb58c96 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -70,7 +70,7 @@ struct common_sched_info_def
/* Called to notify frontend, that new basic block is being added.
The first parameter - new basic block.
The second parameter - block, after which new basic block is being added,
- or EXIT_BLOCK_PTR, if recovery block is being added,
+ or the exit block, if recovery block is being added,
or NULL, if standalone block is being added. */
void (*add_block) (basic_block, basic_block);
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 0a56eff68ef..c383520314f 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -142,7 +142,6 @@ default_promote_function_mode_always_promote (const_tree type,
return promote_mode (type, mode, punsignedp);
}
-
enum machine_mode
default_cc_modes_compatible (enum machine_mode m1, enum machine_mode m2)
{
@@ -276,7 +275,6 @@ default_cxx_guard_type (void)
return long_long_integer_type_node;
}
-
/* Returns the size of the cookie to use when allocating an array
whose elements have the indicated TYPE. Assumes that it is already
known that a cookie is needed. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 606e4de6979..b29070fb11f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,47 @@
+2013-11-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/59227
+ * gfortran.dg/erf_3.F90: XFAIL on spu-* and ia64-*-linux*.
+ Make more generic for other platforms.
+
+2013-11-21 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/53976
+ * gcc.target/sh/pr53976-1.c: New.
+
+2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/49024
+ * gfortran.dg/erf_3.F90: New file.
+
+2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/pr48258-1.c: Skip for little endian.
+
+2013-11-20 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/59133
+ * gcc.target/i386/pr59133.c: New.
+
+2013-11-20 Joseph Myers <joseph@codesourcery.com>
+
+ PR middle-end/21718
+ * gcc.dg/float-exact-1.c: New test.
+
+2013-11-20 Richard Earnshaw <rearnsha@arm.com>
+
+ PR rtl-optimization/54300
+ * gcc.target/arm/pr54300.C: New test.
+
+2013-11-20 Diego Novillo <dnovillo@google.com>
+
+ PR 59212
+ * g++.dg/plugin/selfassign.c: Include stringpool.h
+
+2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gcc.target/powerpc/darwin-longlong.c (msw): Make endian-safe.
+
2013-11-20 Dominik Vogt <vogt@linux.vnet.ibm.com>
* gcc.target/s390/htm-1.c: Rename to ...
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 2498153a273..cdab74a19ae 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -8,6 +8,7 @@
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
+#include "stringpool.h"
#include "toplev.h"
#include "basic-block.h"
#include "gimple.h"
diff --git a/gcc/testsuite/gcc.dg/float-exact-1.c b/gcc/testsuite/gcc.dg/float-exact-1.c
new file mode 100644
index 00000000000..7e8f3f153ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/float-exact-1.c
@@ -0,0 +1,3177 @@
+/* Test exact conversion to binary floating-point types of
+ floating-point contents expressed in decimal. PR 21718. */
+/* { dg-do run } */
+/* { dg-options "-w" } */
+
+/* For float (if IEEE binary32), double (if IEEE binary64) and long
+ double (if IEEE binary64, x86 extended or IEEE binary128) we test
+ half-way values and numbers close to those half-way values. */
+
+#include <float.h>
+
+#if FLT_EVAL_METHOD == 0 \
+ && FLT_MANT_DIG == 24 \
+ && FLT_MIN_EXP == -125 \
+ && FLT_MAX_EXP == 128
+# define FLT_OK
+/* 0x0.8p-149 */
+static const float f1ae = 0, f1be = 0, f1ce = 0x1p-149f;
+static const float f1a =
+7.0064923216240853546186479164495806564013097093825788587853\
+4141944895541342930300743319094181060791015624999e-46f;
+static const float f1b =
+7.0064923216240853546186479164495806564013097093825788587853\
+4141944895541342930300743319094181060791015625e-46f;
+static const float f1c =
+7.0064923216240853546186479164495806564013097093825788587853\
+4141944895541342930300743319094181060791015625001e-46f;
+/* 0x1.8p-149 */
+static const float f2ae = 0x1p-149f, f2be = 0x2p-149f, f2ce = 0x2p-149f;
+static const float f2a =
+2.1019476964872256063855943749348741969203929128147736576356\
+02425834686624028790902229957282543182373046874999e-45f;
+static const float f2b =
+2.1019476964872256063855943749348741969203929128147736576356\
+02425834686624028790902229957282543182373046875e-45f;
+static const float f2c =
+2.1019476964872256063855943749348741969203929128147736576356\
+02425834686624028790902229957282543182373046875001e-45f;
+/* 0x1.000001p127 */
+static const float f3ae = 0x1p127f, f3be = 0x1p127f, f3ce = 0x1.000002p127f;
+static const float f3a =
+1.70141193601674033557522515689509748735999e+38f;
+static const float f3b =
+1.70141193601674033557522515689509748736e+38f;
+static const float f3c =
+1.70141193601674033557522515689509748736001e+38f;
+#endif
+
+#if (FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1) \
+ && DBL_MANT_DIG == 53 \
+ && DBL_MIN_EXP == -1021 \
+ && DBL_MAX_EXP == 1024
+# define DBL_OK
+/* 0x0.8p-1074 */
+static const double d1ae = 0, d1be = 0, d1ce = 0x1p-1074;
+static const double d1a =
+2.4703282292062327208828439643411068618252990130716238221279\
+284125033775363510437593264991818081799618989828234772285886\
+546332835517796989819938739800539093906315035659515570226392\
+290858392449105184435931802849936536152500319370457678249219\
+365623669863658480757001585769269903706311928279558551332927\
+834338409351978015531246597263579574622766465272827220056374\
+006485499977096599470454020828166226237857393450736339007967\
+761930577506740176324673600968951340535537458516661134223766\
+678604162159680461914467291840300530057530849048765391711386\
+591646239524912623653881879636239373280423891018672348497668\
+235089863388587925628302755995657524455507255189313690836254\
+779186948667994968324049705821028513185451396213837722826145\
+437693412532098591327667236328124999e-324;
+static const double d1b =
+2.4703282292062327208828439643411068618252990130716238221279\
+284125033775363510437593264991818081799618989828234772285886\
+546332835517796989819938739800539093906315035659515570226392\
+290858392449105184435931802849936536152500319370457678249219\
+365623669863658480757001585769269903706311928279558551332927\
+834338409351978015531246597263579574622766465272827220056374\
+006485499977096599470454020828166226237857393450736339007967\
+761930577506740176324673600968951340535537458516661134223766\
+678604162159680461914467291840300530057530849048765391711386\
+591646239524912623653881879636239373280423891018672348497668\
+235089863388587925628302755995657524455507255189313690836254\
+779186948667994968324049705821028513185451396213837722826145\
+437693412532098591327667236328125e-324;
+static const double d1c =
+2.4703282292062327208828439643411068618252990130716238221279\
+284125033775363510437593264991818081799618989828234772285886\
+546332835517796989819938739800539093906315035659515570226392\
+290858392449105184435931802849936536152500319370457678249219\
+365623669863658480757001585769269903706311928279558551332927\
+834338409351978015531246597263579574622766465272827220056374\
+006485499977096599470454020828166226237857393450736339007967\
+761930577506740176324673600968951340535537458516661134223766\
+678604162159680461914467291840300530057530849048765391711386\
+591646239524912623653881879636239373280423891018672348497668\
+235089863388587925628302755995657524455507255189313690836254\
+779186948667994968324049705821028513185451396213837722826145\
+437693412532098591327667236328125001e-324;
+/* 0x1.8p-1074 */
+static const double d2ae = 0x1p-1074, d2be = 0x2p-1074, d2ce = 0x2p-1074;
+static const double d2a =
+7.4109846876186981626485318930233205854758970392148714663837\
+852375101326090531312779794975454245398856969484704316857659\
+638998506553390969459816219401617281718945106978546710679176\
+872575177347315553307795408549809608457500958111373034747658\
+096871009590975442271004757307809711118935784838675653998783\
+503015228055934046593739791790738723868299395818481660169122\
+019456499931289798411362062484498678713572180352209017023903\
+285791732520220528974020802906854021606612375549983402671300\
+035812486479041385743401875520901590172592547146296175134159\
+774938718574737870961645638908718119841271673056017045493004\
+705269590165763776884908267986972573366521765567941072508764\
+337560846003984904972149117463085539556354188641513168478436\
+313080237596295773983001708984374999e-324;
+static const double d2b =
+7.4109846876186981626485318930233205854758970392148714663837\
+852375101326090531312779794975454245398856969484704316857659\
+638998506553390969459816219401617281718945106978546710679176\
+872575177347315553307795408549809608457500958111373034747658\
+096871009590975442271004757307809711118935784838675653998783\
+503015228055934046593739791790738723868299395818481660169122\
+019456499931289798411362062484498678713572180352209017023903\
+285791732520220528974020802906854021606612375549983402671300\
+035812486479041385743401875520901590172592547146296175134159\
+774938718574737870961645638908718119841271673056017045493004\
+705269590165763776884908267986972573366521765567941072508764\
+337560846003984904972149117463085539556354188641513168478436\
+313080237596295773983001708984375e-324;
+static const double d2c =
+7.4109846876186981626485318930233205854758970392148714663837\
+852375101326090531312779794975454245398856969484704316857659\
+638998506553390969459816219401617281718945106978546710679176\
+872575177347315553307795408549809608457500958111373034747658\
+096871009590975442271004757307809711118935784838675653998783\
+503015228055934046593739791790738723868299395818481660169122\
+019456499931289798411362062484498678713572180352209017023903\
+285791732520220528974020802906854021606612375549983402671300\
+035812486479041385743401875520901590172592547146296175134159\
+774938718574737870961645638908718119841271673056017045493004\
+705269590165763776884908267986972573366521765567941072508764\
+337560846003984904972149117463085539556354188641513168478436\
+313080237596295773983001708984375001e-324;
+/* 0x1.00000000000008p1023 */
+static const double d3ae = 0x1p1023, d3be = 0x1p1023, d3ce = 0x1.0000000000001p1023;
+static const double d3a =
+8.9884656743115805365666807213050294962762414131308158973971\
+342756154045415486693752413698006024096935349884403114202125\
+541629105369684531108613657287705365884742938136589844238179\
+474556051429647415148697857438797685859063890851407391008830\
+874765563025951597582513936655578157348020066364210154316532\
+161708031999e+307;
+static const double d3b =
+8.9884656743115805365666807213050294962762414131308158973971\
+342756154045415486693752413698006024096935349884403114202125\
+541629105369684531108613657287705365884742938136589844238179\
+474556051429647415148697857438797685859063890851407391008830\
+874765563025951597582513936655578157348020066364210154316532\
+161708032e+307;
+static const double d3c =
+8.9884656743115805365666807213050294962762414131308158973971\
+342756154045415486693752413698006024096935349884403114202125\
+541629105369684531108613657287705365884742938136589844238179\
+474556051429647415148697857438797685859063890851407391008830\
+874765563025951597582513936655578157348020066364210154316532\
+161708032001e+307;
+#endif
+
+#if LDBL_MANT_DIG == 53 \
+ && LDBL_MIN_EXP == -1021 \
+ && LDBL_MAX_EXP == 1024
+# define LDBL_OK
+/* 0x0.8p-1074 */
+static const long double ld1ae = 0, ld1be = 0, ld1ce = 0x1p-1074L;
+static const long double ld1a =
+2.4703282292062327208828439643411068618252990130716238221279\
+284125033775363510437593264991818081799618989828234772285886\
+546332835517796989819938739800539093906315035659515570226392\
+290858392449105184435931802849936536152500319370457678249219\
+365623669863658480757001585769269903706311928279558551332927\
+834338409351978015531246597263579574622766465272827220056374\
+006485499977096599470454020828166226237857393450736339007967\
+761930577506740176324673600968951340535537458516661134223766\
+678604162159680461914467291840300530057530849048765391711386\
+591646239524912623653881879636239373280423891018672348497668\
+235089863388587925628302755995657524455507255189313690836254\
+779186948667994968324049705821028513185451396213837722826145\
+437693412532098591327667236328124999e-324L;
+static const long double ld1b =
+2.4703282292062327208828439643411068618252990130716238221279\
+284125033775363510437593264991818081799618989828234772285886\
+546332835517796989819938739800539093906315035659515570226392\
+290858392449105184435931802849936536152500319370457678249219\
+365623669863658480757001585769269903706311928279558551332927\
+834338409351978015531246597263579574622766465272827220056374\
+006485499977096599470454020828166226237857393450736339007967\
+761930577506740176324673600968951340535537458516661134223766\
+678604162159680461914467291840300530057530849048765391711386\
+591646239524912623653881879636239373280423891018672348497668\
+235089863388587925628302755995657524455507255189313690836254\
+779186948667994968324049705821028513185451396213837722826145\
+437693412532098591327667236328125e-324L;
+static const long double ld1c =
+2.4703282292062327208828439643411068618252990130716238221279\
+284125033775363510437593264991818081799618989828234772285886\
+546332835517796989819938739800539093906315035659515570226392\
+290858392449105184435931802849936536152500319370457678249219\
+365623669863658480757001585769269903706311928279558551332927\
+834338409351978015531246597263579574622766465272827220056374\
+006485499977096599470454020828166226237857393450736339007967\
+761930577506740176324673600968951340535537458516661134223766\
+678604162159680461914467291840300530057530849048765391711386\
+591646239524912623653881879636239373280423891018672348497668\
+235089863388587925628302755995657524455507255189313690836254\
+779186948667994968324049705821028513185451396213837722826145\
+437693412532098591327667236328125001e-324L;
+/* 0x1.8p-1074 */
+static const long double ld2ae = 0x1p-1074L, ld2be = 0x2p-1074L, ld2ce = 0x2p-1074L;
+static const long double ld2a =
+7.4109846876186981626485318930233205854758970392148714663837\
+852375101326090531312779794975454245398856969484704316857659\
+638998506553390969459816219401617281718945106978546710679176\
+872575177347315553307795408549809608457500958111373034747658\
+096871009590975442271004757307809711118935784838675653998783\
+503015228055934046593739791790738723868299395818481660169122\
+019456499931289798411362062484498678713572180352209017023903\
+285791732520220528974020802906854021606612375549983402671300\
+035812486479041385743401875520901590172592547146296175134159\
+774938718574737870961645638908718119841271673056017045493004\
+705269590165763776884908267986972573366521765567941072508764\
+337560846003984904972149117463085539556354188641513168478436\
+313080237596295773983001708984374999e-324L;
+static const long double ld2b =
+7.4109846876186981626485318930233205854758970392148714663837\
+852375101326090531312779794975454245398856969484704316857659\
+638998506553390969459816219401617281718945106978546710679176\
+872575177347315553307795408549809608457500958111373034747658\
+096871009590975442271004757307809711118935784838675653998783\
+503015228055934046593739791790738723868299395818481660169122\
+019456499931289798411362062484498678713572180352209017023903\
+285791732520220528974020802906854021606612375549983402671300\
+035812486479041385743401875520901590172592547146296175134159\
+774938718574737870961645638908718119841271673056017045493004\
+705269590165763776884908267986972573366521765567941072508764\
+337560846003984904972149117463085539556354188641513168478436\
+313080237596295773983001708984375e-324L;
+static const long double ld2c =
+7.4109846876186981626485318930233205854758970392148714663837\
+852375101326090531312779794975454245398856969484704316857659\
+638998506553390969459816219401617281718945106978546710679176\
+872575177347315553307795408549809608457500958111373034747658\
+096871009590975442271004757307809711118935784838675653998783\
+503015228055934046593739791790738723868299395818481660169122\
+019456499931289798411362062484498678713572180352209017023903\
+285791732520220528974020802906854021606612375549983402671300\
+035812486479041385743401875520901590172592547146296175134159\
+774938718574737870961645638908718119841271673056017045493004\
+705269590165763776884908267986972573366521765567941072508764\
+337560846003984904972149117463085539556354188641513168478436\
+313080237596295773983001708984375001e-324L;
+/* 0x1.00000000000008p1023 */
+static const long double ld3ae = 0x1p1023L, ld3be = 0x1p1023L, ld3ce = 0x1.0000000000001p1023L;
+static const long double ld3a =
+8.9884656743115805365666807213050294962762414131308158973971\
+342756154045415486693752413698006024096935349884403114202125\
+541629105369684531108613657287705365884742938136589844238179\
+474556051429647415148697857438797685859063890851407391008830\
+874765563025951597582513936655578157348020066364210154316532\
+161708031999e+307L;
+static const long double ld3b =
+8.9884656743115805365666807213050294962762414131308158973971\
+342756154045415486693752413698006024096935349884403114202125\
+541629105369684531108613657287705365884742938136589844238179\
+474556051429647415148697857438797685859063890851407391008830\
+874765563025951597582513936655578157348020066364210154316532\
+161708032e+307L;
+static const long double ld3c =
+8.9884656743115805365666807213050294962762414131308158973971\
+342756154045415486693752413698006024096935349884403114202125\
+541629105369684531108613657287705365884742938136589844238179\
+474556051429647415148697857438797685859063890851407391008830\
+874765563025951597582513936655578157348020066364210154316532\
+161708032001e+307L;
+#endif
+
+#if LDBL_MANT_DIG == 64 \
+ && LDBL_MIN_EXP == -16381 \
+ && LDBL_MAX_EXP == 16384
+# define LDBL_OK
+/* 0x0.8p-16445 */
+static const long double ld1ae = 0, ld1be = 0, ld1ce = 0x1p-16445L;
+static const long double ld1a =
+1.8225997659412373012642029668097099081995254078467816718604\
+902435141858443166988684047803543129136025986236736736017655\
+509834928163110160849867540377949045027419112905889658392846\
+126319028167798783107812829917053644701598967767636342956203\
+999770864055077592691915230273843577112246476529298591341071\
+313110337661777304220340396298768698441131694859514066773321\
+059786469060001083813361460161387168195154228027648977594276\
+496061276605855817438145692314650177569263750801566422892936\
+732834290416745265618525969943519916542939199731612507343012\
+297331882934352282118173551211985973294301787840335672389913\
+821098681464088756477802684228806339233239542587316254618680\
+197563613907079766830481997222017010585267442240109888818022\
+189543438116245170584546472752661417773021275082355242554950\
+776248474101880875363872607989624146320823364146896124171892\
+610744237622308266702265704492674694505399997330424978964704\
+335411125839490463131661420668167686151828553033363555080508\
+484934542727634080467233927879117726432283352324546435315312\
+937809651095964197873430398662003709663353962932921239516263\
+008572512558260093668527782388349282015308359304941505110445\
+043762021191469060607078792635897736408141163554429972292873\
+575169264387977130124003958599909776720759582995017519144111\
+001778329839793855454688442046155253818724410472281602421363\
+580613990749181808302947976045417884436271162664776148749463\
+202753814797191206392480969096910387729527305862739806702349\
+088455828380471306603628636563037414688265702108098430515297\
+645997107159687247830496686980315376091511219227376708389862\
+310190633134517040835432587726931910775044780329777051964574\
+763119639404235797665922677433332402402817037657141926646502\
+612388421085254756323737273178774331073924707711575555193153\
+421957126062196520952920611871114861423032687425262323243276\
+848595495133802591437804984986053892365334900647137137197585\
+161954823956838391108748154877098567190695813394392779995887\
+642254413740232692940887236351533691174492514884514265006822\
+752026136435469700291628942927286843274959781329315250417360\
+438115330104516894597449604875954147108010051910197388860417\
+003307595774863477182911525109554542883460240867674794470854\
+883815424039187014069246137704710366577005576311674384079810\
+437206511282792194562503036151028910065418370565117488062226\
+073975854919243439941741016447206284543777826080409075756028\
+194465562812076645422284670475730922346454505830553174377950\
+824178034708147037448871898963699023373821217419560423459358\
+846127232531421552826545954362386431279626917642725181802754\
+271134597856231805666129524101509582941585421888561296839474\
+232056474112935379177434928227554149402642893913492062781246\
+372611175305462271711931011635602039137701669573065960945871\
+579420683440097179831368317352157202215160682058878025153007\
+184185319863451652087375936651004559837502483808090613073982\
+264685620351993519454344577635257452328683726988824705474397\
+398247190812883071734743260426540123481791283782928972842466\
+595210269414219040901793935553872090377394005932597887081359\
+481915849178541128182923272843218513093012167744690818603663\
+862691727272565325057703378827553284852502067686026850339624\
+401046086817036618366842240024522042069888708534827471235203\
+998932259309110942367856287784097166420437430118381247339347\
+418156902369282431197735078016591613063918260343498992697002\
+033186558413655576703389208301203552157755701852051877927864\
+696515420369217703510602759815252574799728706795849558382877\
+392016396900560101736741462690753991602263974212137632508984\
+264559315540891383192361601189350414311358816980975697568561\
+515680971830107704152657284552920241862730125888825702301035\
+564615759615882010733764341109834449576907982406265803484111\
+303615971297609065271517286111839839646343815364461776394273\
+571391219315553915335300622295196577640884201524657614065743\
+729121754460652975075990012786021662416077757235487562550381\
+116824006014440438178253273174734436163638119532295383351135\
+543170811596051785036366846773285937845231974424475418970517\
+659179798069972876889488877627309887323737590814875050457317\
+809625163713227973229002908003491739085115971899606986738405\
+752463436186745107821032315480693516006251388789902053863235\
+071957895722121876262598833823352290042576488238120724072267\
+480348425637199003147760378463243043407534395221882144887315\
+875876025907739792297575795373506429192468470170038312050500\
+917665707583420927303790875332407805094505665159755210495266\
+485594187244922216154283213688032393939401426499517609275128\
+062067355172333120857796045387692492375534056470145301671359\
+016602832469675123108598588424022216759334733452626330303791\
+660952659036162827509451468771297954737165701921676834866994\
+084496268491510599580714458155026746676860790028899722645883\
+679435969902046442373108472951515492761911884847211825930115\
+654927539118088350255959445076757398298893380662248358210075\
+297702191186519614515280395341723177201383862827129721649638\
+274531314762377778754560119397123180107310216608157141828379\
+259328274508467371717057031104537750450228447941619684073375\
+630517322006118640290925241602376256334414376495602911265450\
+165889418372161719063670619610214632774542741157366426747861\
+054811449449004970132668146607323502760146957586465275981090\
+328336256381187450646030492071694516054712444513961269623339\
+705411366337817643269316717217432478812002049894979925260411\
+553651385384826214231392012841425936827944383266227115236029\
+717393064659821056467446870597828757433936024422511537561864\
+619865595955628070343780472634463916608440151554502790128417\
+277259492437005696576453717387309605129939526661181496994297\
+244693710437436581443653555343763817246961834486181294985455\
+884981266421533438177271809310897035958260776218253097858601\
+160643120653927024652834025146166356877731266566437231429061\
+099807825113272551869352908241073955695854354852545370793609\
+838167127357752579007490955536081388103461735071174567636929\
+060824172375010035497010614957197713919909924635906503348016\
+450952475530978921242656498701313530533991692867619886826204\
+706468476070943378163577235406861262755114909606255628375659\
+196050370661430148107216310635729360112021571291096278032076\
+401092225373270173950575377792566872113768085940991929655824\
+050914085013970861399015141010432835406337266746706727481946\
+196898882472095111505210339933002505227334750020285673634670\
+738458390159933494226851499935336922036551687169140582574153\
+726872453800858360764892975201757027862632615130256075468549\
+502839367841926212872731925042838691319757663382746471782087\
+828988857978192483595747889021081459460627705275735868618724\
+958783348362295106875556443770626864591972089881215465141073\
+516646930158996569747675806719463602045230325049794904894739\
+988312727573320971310488326486213061839843830003145873279435\
+454121817918269218294901387830156432148142381592864575229119\
+479029130050663564889172093067341444164942736885872753984012\
+865743421266470861425283889134636885790293235727017788606167\
+560012477186697069994213912998550931078617189790771376702549\
+055361745205232419031423044366971378594392952093464046441667\
+117613906203494872209149396518971207279263883566606774353236\
+255473603377861613942239543893894460581170658088042083661404\
+937465706659424639301296621963906278930754459296017486063079\
+582024995485338893699574289806529424673393810217577605952909\
+491283123179789154639057105774960699934999681018155749261864\
+012821574480758746632022143860041252142846691648490809250856\
+327057133540568617791625295314357533564192304930155735301757\
+457531580062662693966772497728335047637869054460240023262262\
+260698443946964564691259441706490611176164305693669515767804\
+836460521205954731752583848846525153811934541997962775215961\
+180346397456122329133421016560406277159258781706172834569862\
+946953007793254152187010227976038449980797987728559041018441\
+590564594738308310579014597893182017151615208050090318483536\
+106249131918576316944251537092347119867433735046169725181104\
+507590928834713669184230634083190791725243913641206256399101\
+550966117564795555149420011152858441084271411289366093158722\
+254752761637144762690747726313899449121995142565661043193165\
+353010677613760383307839362361625628371456344409245507081913\
+518237257141164239966660785903970075181826808229440731778746\
+830751045427285945936163931997929399708401851740705527023711\
+492262489476846435969872480702228386506357017948329114555484\
+164760105906717855684788039081591713778852802032849601308169\
+832017420608399347713424218434541771868442189843417628618330\
+607429739733739437863581804003482214082370567967330530446020\
+897773385726872912189813323094415093143437550397556262780011\
+208941731420098754319961419532567861629590267320403217607660\
+774125374101195389953895035347940170148097810952083736798564\
+420421622607993390894450932047257403433908665884124601384175\
+012387617430467934818665777122459487877479257747635172691688\
+471574765285820096075133353869554987216398800026453207557923\
+535966131756358352198875705382763163680830588056974671628368\
+719411827591592806044707764658145625683998557872894583705117\
+936257144994734815912058252772021032081682437093280526665192\
+728869800954748014250481042845426151143544474372887617562791\
+409866964806319608280819816846942058817381943129762034507591\
+367065185343216917751414811188645979508942996964383255432999\
+246119971295726296202396921903289017490293595312645036697141\
+581149988784499288560584613793415358537364677872496224892098\
+940856692342358755626519304557946447004033186014602147449599\
+351317079758304444877174136521487256811625263467410007624215\
+856145392339552689565690577293133060124853654497575571509576\
+408069646196646757505249296126372820539234090564691695806544\
+715766025588258581902342311480969412221466852421842650484494\
+063894865891424563992751226230317059592413191308470146226366\
+458233536657973376067140793776369412191789801225320255079444\
+592709005698858098716107025188986428347407279053266600044521\
+079987989879536957560131070100060050673537683871138182387904\
+590837539252425985326631955455857258818756188063697492342550\
+045277400125480079927908846850898283905756532829762950509886\
+991675925213188409911532242068610889478326451513981115020992\
+630395715520350039372702741107911736947893709538471200363740\
+669304116845653259038102180504837110789645359520309929381266\
+271463740502507456882882255788069710715770802338317704510793\
+279398576163709512326095306022330346997717688118726634628650\
+675984237916551201500684504118483305560295744746257951860545\
+390826531622290588364837980034428055971370065573420370270905\
+592141420051502465016793525150950140243606137664910359769114\
+512792293426708006440346732679574519594848136194781488696994\
+267355775509666977187349644291823026624985531726865131782364\
+428380093055155988532106121916567178604128111080322761213573\
+781334480667563871257352254033032675246444238637990062075058\
+819854494711379915549313390179300091783493496822950479766923\
+983305064901026858870340863556799948310622536592472509634484\
+910640735459644047154918467543140024764605449756679450446473\
+048922824617117723876384637412932380635306714345354710568410\
+140587435077620501285599837051978855056335305570615129711860\
+309387503970812843734718712815925040263182888714533431137355\
+255722368962836390856001176889513153529416105504464217522618\
+741534232432067776306691118141998014985541610448993152948945\
+865983354717289054861249734477980864059509622993770525110616\
+313865830823478927462500895844216364365499438449134659145333\
+799994034010282254566331595018205841080487728993632798168070\
+476921205941768965021887178681810499301253039335978279707627\
+295287697256489961179958946847840431902105306618594831078534\
+622089641993900896756734276531931450266972752637997248151974\
+2277811246822238899767398834228515624999e-4951L;
+static const long double ld1b =
+1.8225997659412373012642029668097099081995254078467816718604\
+902435141858443166988684047803543129136025986236736736017655\
+509834928163110160849867540377949045027419112905889658392846\
+126319028167798783107812829917053644701598967767636342956203\
+999770864055077592691915230273843577112246476529298591341071\
+313110337661777304220340396298768698441131694859514066773321\
+059786469060001083813361460161387168195154228027648977594276\
+496061276605855817438145692314650177569263750801566422892936\
+732834290416745265618525969943519916542939199731612507343012\
+297331882934352282118173551211985973294301787840335672389913\
+821098681464088756477802684228806339233239542587316254618680\
+197563613907079766830481997222017010585267442240109888818022\
+189543438116245170584546472752661417773021275082355242554950\
+776248474101880875363872607989624146320823364146896124171892\
+610744237622308266702265704492674694505399997330424978964704\
+335411125839490463131661420668167686151828553033363555080508\
+484934542727634080467233927879117726432283352324546435315312\
+937809651095964197873430398662003709663353962932921239516263\
+008572512558260093668527782388349282015308359304941505110445\
+043762021191469060607078792635897736408141163554429972292873\
+575169264387977130124003958599909776720759582995017519144111\
+001778329839793855454688442046155253818724410472281602421363\
+580613990749181808302947976045417884436271162664776148749463\
+202753814797191206392480969096910387729527305862739806702349\
+088455828380471306603628636563037414688265702108098430515297\
+645997107159687247830496686980315376091511219227376708389862\
+310190633134517040835432587726931910775044780329777051964574\
+763119639404235797665922677433332402402817037657141926646502\
+612388421085254756323737273178774331073924707711575555193153\
+421957126062196520952920611871114861423032687425262323243276\
+848595495133802591437804984986053892365334900647137137197585\
+161954823956838391108748154877098567190695813394392779995887\
+642254413740232692940887236351533691174492514884514265006822\
+752026136435469700291628942927286843274959781329315250417360\
+438115330104516894597449604875954147108010051910197388860417\
+003307595774863477182911525109554542883460240867674794470854\
+883815424039187014069246137704710366577005576311674384079810\
+437206511282792194562503036151028910065418370565117488062226\
+073975854919243439941741016447206284543777826080409075756028\
+194465562812076645422284670475730922346454505830553174377950\
+824178034708147037448871898963699023373821217419560423459358\
+846127232531421552826545954362386431279626917642725181802754\
+271134597856231805666129524101509582941585421888561296839474\
+232056474112935379177434928227554149402642893913492062781246\
+372611175305462271711931011635602039137701669573065960945871\
+579420683440097179831368317352157202215160682058878025153007\
+184185319863451652087375936651004559837502483808090613073982\
+264685620351993519454344577635257452328683726988824705474397\
+398247190812883071734743260426540123481791283782928972842466\
+595210269414219040901793935553872090377394005932597887081359\
+481915849178541128182923272843218513093012167744690818603663\
+862691727272565325057703378827553284852502067686026850339624\
+401046086817036618366842240024522042069888708534827471235203\
+998932259309110942367856287784097166420437430118381247339347\
+418156902369282431197735078016591613063918260343498992697002\
+033186558413655576703389208301203552157755701852051877927864\
+696515420369217703510602759815252574799728706795849558382877\
+392016396900560101736741462690753991602263974212137632508984\
+264559315540891383192361601189350414311358816980975697568561\
+515680971830107704152657284552920241862730125888825702301035\
+564615759615882010733764341109834449576907982406265803484111\
+303615971297609065271517286111839839646343815364461776394273\
+571391219315553915335300622295196577640884201524657614065743\
+729121754460652975075990012786021662416077757235487562550381\
+116824006014440438178253273174734436163638119532295383351135\
+543170811596051785036366846773285937845231974424475418970517\
+659179798069972876889488877627309887323737590814875050457317\
+809625163713227973229002908003491739085115971899606986738405\
+752463436186745107821032315480693516006251388789902053863235\
+071957895722121876262598833823352290042576488238120724072267\
+480348425637199003147760378463243043407534395221882144887315\
+875876025907739792297575795373506429192468470170038312050500\
+917665707583420927303790875332407805094505665159755210495266\
+485594187244922216154283213688032393939401426499517609275128\
+062067355172333120857796045387692492375534056470145301671359\
+016602832469675123108598588424022216759334733452626330303791\
+660952659036162827509451468771297954737165701921676834866994\
+084496268491510599580714458155026746676860790028899722645883\
+679435969902046442373108472951515492761911884847211825930115\
+654927539118088350255959445076757398298893380662248358210075\
+297702191186519614515280395341723177201383862827129721649638\
+274531314762377778754560119397123180107310216608157141828379\
+259328274508467371717057031104537750450228447941619684073375\
+630517322006118640290925241602376256334414376495602911265450\
+165889418372161719063670619610214632774542741157366426747861\
+054811449449004970132668146607323502760146957586465275981090\
+328336256381187450646030492071694516054712444513961269623339\
+705411366337817643269316717217432478812002049894979925260411\
+553651385384826214231392012841425936827944383266227115236029\
+717393064659821056467446870597828757433936024422511537561864\
+619865595955628070343780472634463916608440151554502790128417\
+277259492437005696576453717387309605129939526661181496994297\
+244693710437436581443653555343763817246961834486181294985455\
+884981266421533438177271809310897035958260776218253097858601\
+160643120653927024652834025146166356877731266566437231429061\
+099807825113272551869352908241073955695854354852545370793609\
+838167127357752579007490955536081388103461735071174567636929\
+060824172375010035497010614957197713919909924635906503348016\
+450952475530978921242656498701313530533991692867619886826204\
+706468476070943378163577235406861262755114909606255628375659\
+196050370661430148107216310635729360112021571291096278032076\
+401092225373270173950575377792566872113768085940991929655824\
+050914085013970861399015141010432835406337266746706727481946\
+196898882472095111505210339933002505227334750020285673634670\
+738458390159933494226851499935336922036551687169140582574153\
+726872453800858360764892975201757027862632615130256075468549\
+502839367841926212872731925042838691319757663382746471782087\
+828988857978192483595747889021081459460627705275735868618724\
+958783348362295106875556443770626864591972089881215465141073\
+516646930158996569747675806719463602045230325049794904894739\
+988312727573320971310488326486213061839843830003145873279435\
+454121817918269218294901387830156432148142381592864575229119\
+479029130050663564889172093067341444164942736885872753984012\
+865743421266470861425283889134636885790293235727017788606167\
+560012477186697069994213912998550931078617189790771376702549\
+055361745205232419031423044366971378594392952093464046441667\
+117613906203494872209149396518971207279263883566606774353236\
+255473603377861613942239543893894460581170658088042083661404\
+937465706659424639301296621963906278930754459296017486063079\
+582024995485338893699574289806529424673393810217577605952909\
+491283123179789154639057105774960699934999681018155749261864\
+012821574480758746632022143860041252142846691648490809250856\
+327057133540568617791625295314357533564192304930155735301757\
+457531580062662693966772497728335047637869054460240023262262\
+260698443946964564691259441706490611176164305693669515767804\
+836460521205954731752583848846525153811934541997962775215961\
+180346397456122329133421016560406277159258781706172834569862\
+946953007793254152187010227976038449980797987728559041018441\
+590564594738308310579014597893182017151615208050090318483536\
+106249131918576316944251537092347119867433735046169725181104\
+507590928834713669184230634083190791725243913641206256399101\
+550966117564795555149420011152858441084271411289366093158722\
+254752761637144762690747726313899449121995142565661043193165\
+353010677613760383307839362361625628371456344409245507081913\
+518237257141164239966660785903970075181826808229440731778746\
+830751045427285945936163931997929399708401851740705527023711\
+492262489476846435969872480702228386506357017948329114555484\
+164760105906717855684788039081591713778852802032849601308169\
+832017420608399347713424218434541771868442189843417628618330\
+607429739733739437863581804003482214082370567967330530446020\
+897773385726872912189813323094415093143437550397556262780011\
+208941731420098754319961419532567861629590267320403217607660\
+774125374101195389953895035347940170148097810952083736798564\
+420421622607993390894450932047257403433908665884124601384175\
+012387617430467934818665777122459487877479257747635172691688\
+471574765285820096075133353869554987216398800026453207557923\
+535966131756358352198875705382763163680830588056974671628368\
+719411827591592806044707764658145625683998557872894583705117\
+936257144994734815912058252772021032081682437093280526665192\
+728869800954748014250481042845426151143544474372887617562791\
+409866964806319608280819816846942058817381943129762034507591\
+367065185343216917751414811188645979508942996964383255432999\
+246119971295726296202396921903289017490293595312645036697141\
+581149988784499288560584613793415358537364677872496224892098\
+940856692342358755626519304557946447004033186014602147449599\
+351317079758304444877174136521487256811625263467410007624215\
+856145392339552689565690577293133060124853654497575571509576\
+408069646196646757505249296126372820539234090564691695806544\
+715766025588258581902342311480969412221466852421842650484494\
+063894865891424563992751226230317059592413191308470146226366\
+458233536657973376067140793776369412191789801225320255079444\
+592709005698858098716107025188986428347407279053266600044521\
+079987989879536957560131070100060050673537683871138182387904\
+590837539252425985326631955455857258818756188063697492342550\
+045277400125480079927908846850898283905756532829762950509886\
+991675925213188409911532242068610889478326451513981115020992\
+630395715520350039372702741107911736947893709538471200363740\
+669304116845653259038102180504837110789645359520309929381266\
+271463740502507456882882255788069710715770802338317704510793\
+279398576163709512326095306022330346997717688118726634628650\
+675984237916551201500684504118483305560295744746257951860545\
+390826531622290588364837980034428055971370065573420370270905\
+592141420051502465016793525150950140243606137664910359769114\
+512792293426708006440346732679574519594848136194781488696994\
+267355775509666977187349644291823026624985531726865131782364\
+428380093055155988532106121916567178604128111080322761213573\
+781334480667563871257352254033032675246444238637990062075058\
+819854494711379915549313390179300091783493496822950479766923\
+983305064901026858870340863556799948310622536592472509634484\
+910640735459644047154918467543140024764605449756679450446473\
+048922824617117723876384637412932380635306714345354710568410\
+140587435077620501285599837051978855056335305570615129711860\
+309387503970812843734718712815925040263182888714533431137355\
+255722368962836390856001176889513153529416105504464217522618\
+741534232432067776306691118141998014985541610448993152948945\
+865983354717289054861249734477980864059509622993770525110616\
+313865830823478927462500895844216364365499438449134659145333\
+799994034010282254566331595018205841080487728993632798168070\
+476921205941768965021887178681810499301253039335978279707627\
+295287697256489961179958946847840431902105306618594831078534\
+622089641993900896756734276531931450266972752637997248151974\
+2277811246822238899767398834228515625e-4951L;
+static const long double ld1c =
+1.8225997659412373012642029668097099081995254078467816718604\
+902435141858443166988684047803543129136025986236736736017655\
+509834928163110160849867540377949045027419112905889658392846\
+126319028167798783107812829917053644701598967767636342956203\
+999770864055077592691915230273843577112246476529298591341071\
+313110337661777304220340396298768698441131694859514066773321\
+059786469060001083813361460161387168195154228027648977594276\
+496061276605855817438145692314650177569263750801566422892936\
+732834290416745265618525969943519916542939199731612507343012\
+297331882934352282118173551211985973294301787840335672389913\
+821098681464088756477802684228806339233239542587316254618680\
+197563613907079766830481997222017010585267442240109888818022\
+189543438116245170584546472752661417773021275082355242554950\
+776248474101880875363872607989624146320823364146896124171892\
+610744237622308266702265704492674694505399997330424978964704\
+335411125839490463131661420668167686151828553033363555080508\
+484934542727634080467233927879117726432283352324546435315312\
+937809651095964197873430398662003709663353962932921239516263\
+008572512558260093668527782388349282015308359304941505110445\
+043762021191469060607078792635897736408141163554429972292873\
+575169264387977130124003958599909776720759582995017519144111\
+001778329839793855454688442046155253818724410472281602421363\
+580613990749181808302947976045417884436271162664776148749463\
+202753814797191206392480969096910387729527305862739806702349\
+088455828380471306603628636563037414688265702108098430515297\
+645997107159687247830496686980315376091511219227376708389862\
+310190633134517040835432587726931910775044780329777051964574\
+763119639404235797665922677433332402402817037657141926646502\
+612388421085254756323737273178774331073924707711575555193153\
+421957126062196520952920611871114861423032687425262323243276\
+848595495133802591437804984986053892365334900647137137197585\
+161954823956838391108748154877098567190695813394392779995887\
+642254413740232692940887236351533691174492514884514265006822\
+752026136435469700291628942927286843274959781329315250417360\
+438115330104516894597449604875954147108010051910197388860417\
+003307595774863477182911525109554542883460240867674794470854\
+883815424039187014069246137704710366577005576311674384079810\
+437206511282792194562503036151028910065418370565117488062226\
+073975854919243439941741016447206284543777826080409075756028\
+194465562812076645422284670475730922346454505830553174377950\
+824178034708147037448871898963699023373821217419560423459358\
+846127232531421552826545954362386431279626917642725181802754\
+271134597856231805666129524101509582941585421888561296839474\
+232056474112935379177434928227554149402642893913492062781246\
+372611175305462271711931011635602039137701669573065960945871\
+579420683440097179831368317352157202215160682058878025153007\
+184185319863451652087375936651004559837502483808090613073982\
+264685620351993519454344577635257452328683726988824705474397\
+398247190812883071734743260426540123481791283782928972842466\
+595210269414219040901793935553872090377394005932597887081359\
+481915849178541128182923272843218513093012167744690818603663\
+862691727272565325057703378827553284852502067686026850339624\
+401046086817036618366842240024522042069888708534827471235203\
+998932259309110942367856287784097166420437430118381247339347\
+418156902369282431197735078016591613063918260343498992697002\
+033186558413655576703389208301203552157755701852051877927864\
+696515420369217703510602759815252574799728706795849558382877\
+392016396900560101736741462690753991602263974212137632508984\
+264559315540891383192361601189350414311358816980975697568561\
+515680971830107704152657284552920241862730125888825702301035\
+564615759615882010733764341109834449576907982406265803484111\
+303615971297609065271517286111839839646343815364461776394273\
+571391219315553915335300622295196577640884201524657614065743\
+729121754460652975075990012786021662416077757235487562550381\
+116824006014440438178253273174734436163638119532295383351135\
+543170811596051785036366846773285937845231974424475418970517\
+659179798069972876889488877627309887323737590814875050457317\
+809625163713227973229002908003491739085115971899606986738405\
+752463436186745107821032315480693516006251388789902053863235\
+071957895722121876262598833823352290042576488238120724072267\
+480348425637199003147760378463243043407534395221882144887315\
+875876025907739792297575795373506429192468470170038312050500\
+917665707583420927303790875332407805094505665159755210495266\
+485594187244922216154283213688032393939401426499517609275128\
+062067355172333120857796045387692492375534056470145301671359\
+016602832469675123108598588424022216759334733452626330303791\
+660952659036162827509451468771297954737165701921676834866994\
+084496268491510599580714458155026746676860790028899722645883\
+679435969902046442373108472951515492761911884847211825930115\
+654927539118088350255959445076757398298893380662248358210075\
+297702191186519614515280395341723177201383862827129721649638\
+274531314762377778754560119397123180107310216608157141828379\
+259328274508467371717057031104537750450228447941619684073375\
+630517322006118640290925241602376256334414376495602911265450\
+165889418372161719063670619610214632774542741157366426747861\
+054811449449004970132668146607323502760146957586465275981090\
+328336256381187450646030492071694516054712444513961269623339\
+705411366337817643269316717217432478812002049894979925260411\
+553651385384826214231392012841425936827944383266227115236029\
+717393064659821056467446870597828757433936024422511537561864\
+619865595955628070343780472634463916608440151554502790128417\
+277259492437005696576453717387309605129939526661181496994297\
+244693710437436581443653555343763817246961834486181294985455\
+884981266421533438177271809310897035958260776218253097858601\
+160643120653927024652834025146166356877731266566437231429061\
+099807825113272551869352908241073955695854354852545370793609\
+838167127357752579007490955536081388103461735071174567636929\
+060824172375010035497010614957197713919909924635906503348016\
+450952475530978921242656498701313530533991692867619886826204\
+706468476070943378163577235406861262755114909606255628375659\
+196050370661430148107216310635729360112021571291096278032076\
+401092225373270173950575377792566872113768085940991929655824\
+050914085013970861399015141010432835406337266746706727481946\
+196898882472095111505210339933002505227334750020285673634670\
+738458390159933494226851499935336922036551687169140582574153\
+726872453800858360764892975201757027862632615130256075468549\
+502839367841926212872731925042838691319757663382746471782087\
+828988857978192483595747889021081459460627705275735868618724\
+958783348362295106875556443770626864591972089881215465141073\
+516646930158996569747675806719463602045230325049794904894739\
+988312727573320971310488326486213061839843830003145873279435\
+454121817918269218294901387830156432148142381592864575229119\
+479029130050663564889172093067341444164942736885872753984012\
+865743421266470861425283889134636885790293235727017788606167\
+560012477186697069994213912998550931078617189790771376702549\
+055361745205232419031423044366971378594392952093464046441667\
+117613906203494872209149396518971207279263883566606774353236\
+255473603377861613942239543893894460581170658088042083661404\
+937465706659424639301296621963906278930754459296017486063079\
+582024995485338893699574289806529424673393810217577605952909\
+491283123179789154639057105774960699934999681018155749261864\
+012821574480758746632022143860041252142846691648490809250856\
+327057133540568617791625295314357533564192304930155735301757\
+457531580062662693966772497728335047637869054460240023262262\
+260698443946964564691259441706490611176164305693669515767804\
+836460521205954731752583848846525153811934541997962775215961\
+180346397456122329133421016560406277159258781706172834569862\
+946953007793254152187010227976038449980797987728559041018441\
+590564594738308310579014597893182017151615208050090318483536\
+106249131918576316944251537092347119867433735046169725181104\
+507590928834713669184230634083190791725243913641206256399101\
+550966117564795555149420011152858441084271411289366093158722\
+254752761637144762690747726313899449121995142565661043193165\
+353010677613760383307839362361625628371456344409245507081913\
+518237257141164239966660785903970075181826808229440731778746\
+830751045427285945936163931997929399708401851740705527023711\
+492262489476846435969872480702228386506357017948329114555484\
+164760105906717855684788039081591713778852802032849601308169\
+832017420608399347713424218434541771868442189843417628618330\
+607429739733739437863581804003482214082370567967330530446020\
+897773385726872912189813323094415093143437550397556262780011\
+208941731420098754319961419532567861629590267320403217607660\
+774125374101195389953895035347940170148097810952083736798564\
+420421622607993390894450932047257403433908665884124601384175\
+012387617430467934818665777122459487877479257747635172691688\
+471574765285820096075133353869554987216398800026453207557923\
+535966131756358352198875705382763163680830588056974671628368\
+719411827591592806044707764658145625683998557872894583705117\
+936257144994734815912058252772021032081682437093280526665192\
+728869800954748014250481042845426151143544474372887617562791\
+409866964806319608280819816846942058817381943129762034507591\
+367065185343216917751414811188645979508942996964383255432999\
+246119971295726296202396921903289017490293595312645036697141\
+581149988784499288560584613793415358537364677872496224892098\
+940856692342358755626519304557946447004033186014602147449599\
+351317079758304444877174136521487256811625263467410007624215\
+856145392339552689565690577293133060124853654497575571509576\
+408069646196646757505249296126372820539234090564691695806544\
+715766025588258581902342311480969412221466852421842650484494\
+063894865891424563992751226230317059592413191308470146226366\
+458233536657973376067140793776369412191789801225320255079444\
+592709005698858098716107025188986428347407279053266600044521\
+079987989879536957560131070100060050673537683871138182387904\
+590837539252425985326631955455857258818756188063697492342550\
+045277400125480079927908846850898283905756532829762950509886\
+991675925213188409911532242068610889478326451513981115020992\
+630395715520350039372702741107911736947893709538471200363740\
+669304116845653259038102180504837110789645359520309929381266\
+271463740502507456882882255788069710715770802338317704510793\
+279398576163709512326095306022330346997717688118726634628650\
+675984237916551201500684504118483305560295744746257951860545\
+390826531622290588364837980034428055971370065573420370270905\
+592141420051502465016793525150950140243606137664910359769114\
+512792293426708006440346732679574519594848136194781488696994\
+267355775509666977187349644291823026624985531726865131782364\
+428380093055155988532106121916567178604128111080322761213573\
+781334480667563871257352254033032675246444238637990062075058\
+819854494711379915549313390179300091783493496822950479766923\
+983305064901026858870340863556799948310622536592472509634484\
+910640735459644047154918467543140024764605449756679450446473\
+048922824617117723876384637412932380635306714345354710568410\
+140587435077620501285599837051978855056335305570615129711860\
+309387503970812843734718712815925040263182888714533431137355\
+255722368962836390856001176889513153529416105504464217522618\
+741534232432067776306691118141998014985541610448993152948945\
+865983354717289054861249734477980864059509622993770525110616\
+313865830823478927462500895844216364365499438449134659145333\
+799994034010282254566331595018205841080487728993632798168070\
+476921205941768965021887178681810499301253039335978279707627\
+295287697256489961179958946847840431902105306618594831078534\
+622089641993900896756734276531931450266972752637997248151974\
+2277811246822238899767398834228515625001e-4951L;
+/* 0x1.8p-16445 */
+static const long double ld2ae = 0x1p-16445L, ld2be = 0x2p-16445L, ld2ce = 0x2p-16445L;
+static const long double ld2a =
+5.4677992978237119037926089004291297245985762235403450155814\
+707305425575329500966052143410629387408077958710210208052966\
+529504784489330482549602621133847135082257338717668975178538\
+378957084503396349323438489751160934104796903302909028868611\
+999312592165232778075745690821530731336739429587895774023213\
+939331012985331912661021188896306095323395084578542200319963\
+179359407180003251440084380484161504585462684082946932782829\
+488183829817567452314437076943950532707791252404699268678810\
+198502871250235796855577909830559749628817599194837522029036\
+891995648803056846354520653635957919882905363521007017169741\
+463296044392266269433408052686419017699718627761948763856040\
+592690841721239300491445991666051031755802326720329666454066\
+568630314348735511753639418257984253319063825247065727664852\
+328745422305642626091617823968872438962470092440688372515677\
+832232712866924800106797113478024083516199991991274936894113\
+006233377518471389394984262004503058455485659100090665241525\
+454803628182902241401701783637353179296850056973639305945938\
+813428953287892593620291195986011128990061888798763718548789\
+025717537674780281005583347165047846045925077914824515331335\
+131286063574407181821236377907693209224423490663289916878620\
+725507793163931390372011875799729330162278748985052557432333\
+005334989519381566364065326138465761456173231416844807264090\
+741841972247545424908843928136253653308813487994328446248389\
+608261444391573619177442907290731163188581917588219420107047\
+265367485141413919810885909689112244064797106324295291545892\
+937991321479061743491490060940946128274533657682130125169586\
+930571899403551122506297763180795732325134340989331155893724\
+289358918212707392997768032299997207208451112971425779939507\
+837165263255764268971211819536322993221774123134726665579460\
+265871378186589562858761835613344584269098062275786969729830\
+545786485401407774313414954958161677096004701941411411592755\
+485864471870515173326244464631295701572087440183178339987662\
+926763241220698078822661709054601073523477544653542795020468\
+256078409306409100874886828781860529824879343987945751252081\
+314345990313550683792348814627862441324030155730592166581251\
+009922787324590431548734575328663628650380722603024383412564\
+651446272117561042207738413114131099731016728935023152239431\
+311619533848376583687509108453086730196255111695352464186678\
+221927564757730319825223049341618853631333478241227227268084\
+583396688436229936266854011427192767039363517491659523133852\
+472534104124441112346615696891097070121463652258681270378076\
+538381697594264658479637863087159293838880752928175545408262\
+813403793568695416998388572304528748824756265665683890518422\
+696169422338806137532304784682662448207928681740476188343739\
+117833525916386815135793034906806117413105008719197882837614\
+738262050320291539494104952056471606645482046176634075459021\
+552555959590354956262127809953013679512507451424271839221946\
+794056861055980558363033732905772356986051180966474116423192\
+194741572438649215204229781279620370445373851348786918527399\
+785630808242657122705381806661616271132182017797793661244078\
+445747547535623384548769818529655539279036503234072455810991\
+588075181817695975173110136482659854557506203058080551018873\
+203138260451109855100526720073566126209666125604482413705611\
+996796777927332827103568863352291499261312290355143742018042\
+254470707107847293593205234049774839191754781030496978091006\
+099559675240966730110167624903610656473267105556155633783594\
+089546261107653110531808279445757724399186120387548675148632\
+176049190701680305210224388072261974806791922636412897526952\
+793677946622674149577084803568051242934076450942927092705684\
+547042915490323112457971853658760725588190377666477106903106\
+693847278847646032201293023329503348730723947218797410452333\
+910847913892827195814551858335519518939031446093385329182820\
+714173657946661746005901866885589732922652604573972842197231\
+187365263381958925227970038358064987248233271706462687651143\
+350472018043321314534759819524203308490914358596886150053406\
+629512434788155355109100540319857813535695923273426256911552\
+977539394209918630668466632881929661971212772444625151371953\
+428875491139683919687008724010475217255347915698820960215217\
+257390308560235323463096946442080548018754166369706161589705\
+215873687166365628787796501470056870127729464714362172216802\
+441045276911597009443281135389729130222603185665646434661947\
+627628077723219376892727386120519287577405410510114936151502\
+752997122750262781911372625997223415283516995479265631485799\
+456782561734766648462849641064097181818204279498552827825384\
+186202065516999362573388136163077477126602169410435905014077\
+049808497409025369325795765272066650278004200357878990911374\
+982857977108488482528354406313893864211497105765030504600982\
+253488805474531798742143374465080240030582370086699167937651\
+038307909706139327119325418854546478285735654541635477790346\
+964782617354265050767878335230272194896680141986745074630225\
+893106573559558843545841186025169531604151588481389164948914\
+823593944287133336263680358191369540321930649824471425485137\
+777984823525402115151171093313613251350685343824859052220126\
+891551966018355920872775724807128769003243129486808733796350\
+497668255116485157191011858830643898323628223472099280243583\
+164434348347014910398004439821970508280440872759395827943270\
+985008769143562351938091476215083548164137333541883808870019\
+116234099013452929807950151652297436436006149684939775781234\
+660954156154478642694176038524277810483833149798681345708089\
+152179193979463169402340611793486272301808073267534612685593\
+859596787866884211031341417903391749825320454663508370385251\
+831778477311017089729361152161928815389818579983544490982891\
+734081131312309744330960666031291451740885503458543884956367\
+654943799264600314531815427932691107874782328654759293575803\
+481929361961781073958502075438499070633193799699311694287183\
+299423475339817655608058724723221867087563064557636112380829\
+514501382073257737022472866608244164310385205213523702910787\
+182472517125030106491031844871593141759729773907719510044049\
+352857426592936763727969496103940591601975078602859660478614\
+119405428212830134490731706220583788265344728818766885126977\
+588151111984290444321648931907188080336064713873288834096229\
+203276676119810521851726133377700616341304257822975788967472\
+152742255041912584197045423031298506219011800240120182445838\
+590696647416285334515631019799007515682004250060857020904012\
+215375170479800482680554499806010766109655061507421747722461\
+180617361402575082294678925605271083587897845390768226405648\
+508518103525778638618195775128516073959272990148239415346263\
+486966573934577450787243667063244378381883115827207605856174\
+876350045086885320626669331311880593775916269643646395423220\
+549940790476989709243027420158390806135690975149384714684219\
+964938182719962913931464979458639185519531490009437619838306\
+362365453754807654884704163490469296444427144778593725687358\
+437087390151990694667516279202024332494828210657618261952038\
+597230263799412584275851667403910657370879707181053365818502\
+680037431560091209982641738995652793235851569372314130107647\
+166085235615697257094269133100914135783178856280392139325001\
+352841718610484616627448189556913621837791650699820323059708\
+766420810133584841826718631681683381743511974264126250984214\
+812397119978273917903889865891718836792263377888052458189238\
+746074986456016681098722869419588274020181430652732817858728\
+473849369539367463917171317324882099804999043054467247785592\
+038464723442276239896066431580123756428540074945472427752568\
+981171400621705853374875885943072600692576914790467205905272\
+372594740187988081900317493185005142913607163380720069786786\
+782095331840893694073778325119471833528492917081008547303414\
+509381563617864195257751546539575461435803625993888325647883\
+541039192368366987400263049681218831477776345118518503709588\
+840859023379762456561030683928115349942393963185677123055324\
+771693784214924931737043793679546051454845624150270955450608\
+318747395755728950832754611277041359602301205138509175543313\
+522772786504141007552691902249572375175731740923618769197304\
+652898352694386665448260033458575323252814233868098279476166\
+764258284911434288072243178941698347365985427696983129579496\
+059032032841281149923518087084876885114369033227736521245740\
+554711771423492719899982357711910225545480424688322195336240\
+492253136281857837808491795993788199125205555222116581071134\
+476787468430539307909617442106685159519071053844987343666452\
+494280317720153567054364117244775141336558406098548803924509\
+496052261825198043140272655303625315605326569530252885854991\
+822289219201218313590745412010446642247111703901991591338062\
+693320157180618736569439969283245279430312651192668788340033\
+626825194260296262959884258597703584888770801961209652822982\
+322376122303586169861685106043820510444293432856251210395693\
+261264867823980172683352796141772210301725997652373804152525\
+037162852291403804455997331367378463632437773242905518075065\
+414724295857460288225400061608664961649196400079359622673770\
+607898395269075056596627116148289491042491764170924014885106\
+158235482774778418134123293974436877051995673618683751115353\
+808771434984204447736174758316063096245047311279841579995578\
+186609402864244042751443128536278453430633423118662852688374\
+229600894418958824842459450540826176452145829389286103522774\
+101195556029650753254244433565937938526828990893149766298997\
+738359913887178888607190765709867052470880785937935110091424\
+743449966353497865681753841380246075612094033617488674676296\
+822570077027076266879557913673839341012099558043806442348798\
+053951239274913334631522409564461770434875790402230022872647\
+568436177018658068697071731879399180374560963492726714528729\
+224208938589940272515747888379118461617702271694075087419634\
+147298076764775745707026934442908236664400557265527951453482\
+191684597674273691978253678690951178777239573925410438679099\
+374700609973920128201422381329108236575369403675960765238333\
+778127017096574296148321075566959285042221837159799800133563\
+239963969638610872680393210300180152020613051613414547163713\
+772512617757277955979895866367571776456268564191092477027650\
+135832200376440239783726540552694851717269598489288851529660\
+975027775639565229734596726205832668434979354541943345062977\
+891187146561050118118108223323735210843681128615413601091222\
+007912350536959777114306541514511332368936078560929788143798\
+814391221507522370648646767364209132147312407014953113532379\
+838195728491128536978285918066991040993153064356179903885952\
+027952713749653604502053512355449916680887234238773855581636\
+172479594866871765094513940103284167914110196720261110812716\
+776424260154507395050380575452850420730818412994731079307343\
+538376880280124019321040198038723558784544408584344466090982\
+802067326529000931562048932875469079874956595180595395347093\
+285140279165467965596318365749701535812384333240968283640721\
+344003442002691613772056762099098025739332715913970186225176\
+459563484134139746647940170537900275350480490468851439300771\
+949915194703080576611022590670399844931867609777417528903454\
+731922206378932141464755402629420074293816349270038351339419\
+146768473851353171629153912238797141905920143036064131705230\
+421762305232861503856799511155936565169005916711845389135580\
+928162511912438531204156138447775120789548666143600293412065\
+767167106888509172568003530668539460588248316513392652567856\
+224602697296203328920073354425994044956624831346979458846837\
+597950064151867164583749203433942592178528868981311575331848\
+941597492470436782387502687532649093096498315347403977436001\
+399982102030846763698994785054617523241463186980898394504211\
+430763617825306895065661536045431497903759118007934839122881\
+885863091769469883539876840543521295706315919855784493235603\
+866268925981702690270202829595794350800918257913991744455922\
+6833433740466716699302196502685546874999e-4951L;
+static const long double ld2b =
+5.4677992978237119037926089004291297245985762235403450155814\
+707305425575329500966052143410629387408077958710210208052966\
+529504784489330482549602621133847135082257338717668975178538\
+378957084503396349323438489751160934104796903302909028868611\
+999312592165232778075745690821530731336739429587895774023213\
+939331012985331912661021188896306095323395084578542200319963\
+179359407180003251440084380484161504585462684082946932782829\
+488183829817567452314437076943950532707791252404699268678810\
+198502871250235796855577909830559749628817599194837522029036\
+891995648803056846354520653635957919882905363521007017169741\
+463296044392266269433408052686419017699718627761948763856040\
+592690841721239300491445991666051031755802326720329666454066\
+568630314348735511753639418257984253319063825247065727664852\
+328745422305642626091617823968872438962470092440688372515677\
+832232712866924800106797113478024083516199991991274936894113\
+006233377518471389394984262004503058455485659100090665241525\
+454803628182902241401701783637353179296850056973639305945938\
+813428953287892593620291195986011128990061888798763718548789\
+025717537674780281005583347165047846045925077914824515331335\
+131286063574407181821236377907693209224423490663289916878620\
+725507793163931390372011875799729330162278748985052557432333\
+005334989519381566364065326138465761456173231416844807264090\
+741841972247545424908843928136253653308813487994328446248389\
+608261444391573619177442907290731163188581917588219420107047\
+265367485141413919810885909689112244064797106324295291545892\
+937991321479061743491490060940946128274533657682130125169586\
+930571899403551122506297763180795732325134340989331155893724\
+289358918212707392997768032299997207208451112971425779939507\
+837165263255764268971211819536322993221774123134726665579460\
+265871378186589562858761835613344584269098062275786969729830\
+545786485401407774313414954958161677096004701941411411592755\
+485864471870515173326244464631295701572087440183178339987662\
+926763241220698078822661709054601073523477544653542795020468\
+256078409306409100874886828781860529824879343987945751252081\
+314345990313550683792348814627862441324030155730592166581251\
+009922787324590431548734575328663628650380722603024383412564\
+651446272117561042207738413114131099731016728935023152239431\
+311619533848376583687509108453086730196255111695352464186678\
+221927564757730319825223049341618853631333478241227227268084\
+583396688436229936266854011427192767039363517491659523133852\
+472534104124441112346615696891097070121463652258681270378076\
+538381697594264658479637863087159293838880752928175545408262\
+813403793568695416998388572304528748824756265665683890518422\
+696169422338806137532304784682662448207928681740476188343739\
+117833525916386815135793034906806117413105008719197882837614\
+738262050320291539494104952056471606645482046176634075459021\
+552555959590354956262127809953013679512507451424271839221946\
+794056861055980558363033732905772356986051180966474116423192\
+194741572438649215204229781279620370445373851348786918527399\
+785630808242657122705381806661616271132182017797793661244078\
+445747547535623384548769818529655539279036503234072455810991\
+588075181817695975173110136482659854557506203058080551018873\
+203138260451109855100526720073566126209666125604482413705611\
+996796777927332827103568863352291499261312290355143742018042\
+254470707107847293593205234049774839191754781030496978091006\
+099559675240966730110167624903610656473267105556155633783594\
+089546261107653110531808279445757724399186120387548675148632\
+176049190701680305210224388072261974806791922636412897526952\
+793677946622674149577084803568051242934076450942927092705684\
+547042915490323112457971853658760725588190377666477106903106\
+693847278847646032201293023329503348730723947218797410452333\
+910847913892827195814551858335519518939031446093385329182820\
+714173657946661746005901866885589732922652604573972842197231\
+187365263381958925227970038358064987248233271706462687651143\
+350472018043321314534759819524203308490914358596886150053406\
+629512434788155355109100540319857813535695923273426256911552\
+977539394209918630668466632881929661971212772444625151371953\
+428875491139683919687008724010475217255347915698820960215217\
+257390308560235323463096946442080548018754166369706161589705\
+215873687166365628787796501470056870127729464714362172216802\
+441045276911597009443281135389729130222603185665646434661947\
+627628077723219376892727386120519287577405410510114936151502\
+752997122750262781911372625997223415283516995479265631485799\
+456782561734766648462849641064097181818204279498552827825384\
+186202065516999362573388136163077477126602169410435905014077\
+049808497409025369325795765272066650278004200357878990911374\
+982857977108488482528354406313893864211497105765030504600982\
+253488805474531798742143374465080240030582370086699167937651\
+038307909706139327119325418854546478285735654541635477790346\
+964782617354265050767878335230272194896680141986745074630225\
+893106573559558843545841186025169531604151588481389164948914\
+823593944287133336263680358191369540321930649824471425485137\
+777984823525402115151171093313613251350685343824859052220126\
+891551966018355920872775724807128769003243129486808733796350\
+497668255116485157191011858830643898323628223472099280243583\
+164434348347014910398004439821970508280440872759395827943270\
+985008769143562351938091476215083548164137333541883808870019\
+116234099013452929807950151652297436436006149684939775781234\
+660954156154478642694176038524277810483833149798681345708089\
+152179193979463169402340611793486272301808073267534612685593\
+859596787866884211031341417903391749825320454663508370385251\
+831778477311017089729361152161928815389818579983544490982891\
+734081131312309744330960666031291451740885503458543884956367\
+654943799264600314531815427932691107874782328654759293575803\
+481929361961781073958502075438499070633193799699311694287183\
+299423475339817655608058724723221867087563064557636112380829\
+514501382073257737022472866608244164310385205213523702910787\
+182472517125030106491031844871593141759729773907719510044049\
+352857426592936763727969496103940591601975078602859660478614\
+119405428212830134490731706220583788265344728818766885126977\
+588151111984290444321648931907188080336064713873288834096229\
+203276676119810521851726133377700616341304257822975788967472\
+152742255041912584197045423031298506219011800240120182445838\
+590696647416285334515631019799007515682004250060857020904012\
+215375170479800482680554499806010766109655061507421747722461\
+180617361402575082294678925605271083587897845390768226405648\
+508518103525778638618195775128516073959272990148239415346263\
+486966573934577450787243667063244378381883115827207605856174\
+876350045086885320626669331311880593775916269643646395423220\
+549940790476989709243027420158390806135690975149384714684219\
+964938182719962913931464979458639185519531490009437619838306\
+362365453754807654884704163490469296444427144778593725687358\
+437087390151990694667516279202024332494828210657618261952038\
+597230263799412584275851667403910657370879707181053365818502\
+680037431560091209982641738995652793235851569372314130107647\
+166085235615697257094269133100914135783178856280392139325001\
+352841718610484616627448189556913621837791650699820323059708\
+766420810133584841826718631681683381743511974264126250984214\
+812397119978273917903889865891718836792263377888052458189238\
+746074986456016681098722869419588274020181430652732817858728\
+473849369539367463917171317324882099804999043054467247785592\
+038464723442276239896066431580123756428540074945472427752568\
+981171400621705853374875885943072600692576914790467205905272\
+372594740187988081900317493185005142913607163380720069786786\
+782095331840893694073778325119471833528492917081008547303414\
+509381563617864195257751546539575461435803625993888325647883\
+541039192368366987400263049681218831477776345118518503709588\
+840859023379762456561030683928115349942393963185677123055324\
+771693784214924931737043793679546051454845624150270955450608\
+318747395755728950832754611277041359602301205138509175543313\
+522772786504141007552691902249572375175731740923618769197304\
+652898352694386665448260033458575323252814233868098279476166\
+764258284911434288072243178941698347365985427696983129579496\
+059032032841281149923518087084876885114369033227736521245740\
+554711771423492719899982357711910225545480424688322195336240\
+492253136281857837808491795993788199125205555222116581071134\
+476787468430539307909617442106685159519071053844987343666452\
+494280317720153567054364117244775141336558406098548803924509\
+496052261825198043140272655303625315605326569530252885854991\
+822289219201218313590745412010446642247111703901991591338062\
+693320157180618736569439969283245279430312651192668788340033\
+626825194260296262959884258597703584888770801961209652822982\
+322376122303586169861685106043820510444293432856251210395693\
+261264867823980172683352796141772210301725997652373804152525\
+037162852291403804455997331367378463632437773242905518075065\
+414724295857460288225400061608664961649196400079359622673770\
+607898395269075056596627116148289491042491764170924014885106\
+158235482774778418134123293974436877051995673618683751115353\
+808771434984204447736174758316063096245047311279841579995578\
+186609402864244042751443128536278453430633423118662852688374\
+229600894418958824842459450540826176452145829389286103522774\
+101195556029650753254244433565937938526828990893149766298997\
+738359913887178888607190765709867052470880785937935110091424\
+743449966353497865681753841380246075612094033617488674676296\
+822570077027076266879557913673839341012099558043806442348798\
+053951239274913334631522409564461770434875790402230022872647\
+568436177018658068697071731879399180374560963492726714528729\
+224208938589940272515747888379118461617702271694075087419634\
+147298076764775745707026934442908236664400557265527951453482\
+191684597674273691978253678690951178777239573925410438679099\
+374700609973920128201422381329108236575369403675960765238333\
+778127017096574296148321075566959285042221837159799800133563\
+239963969638610872680393210300180152020613051613414547163713\
+772512617757277955979895866367571776456268564191092477027650\
+135832200376440239783726540552694851717269598489288851529660\
+975027775639565229734596726205832668434979354541943345062977\
+891187146561050118118108223323735210843681128615413601091222\
+007912350536959777114306541514511332368936078560929788143798\
+814391221507522370648646767364209132147312407014953113532379\
+838195728491128536978285918066991040993153064356179903885952\
+027952713749653604502053512355449916680887234238773855581636\
+172479594866871765094513940103284167914110196720261110812716\
+776424260154507395050380575452850420730818412994731079307343\
+538376880280124019321040198038723558784544408584344466090982\
+802067326529000931562048932875469079874956595180595395347093\
+285140279165467965596318365749701535812384333240968283640721\
+344003442002691613772056762099098025739332715913970186225176\
+459563484134139746647940170537900275350480490468851439300771\
+949915194703080576611022590670399844931867609777417528903454\
+731922206378932141464755402629420074293816349270038351339419\
+146768473851353171629153912238797141905920143036064131705230\
+421762305232861503856799511155936565169005916711845389135580\
+928162511912438531204156138447775120789548666143600293412065\
+767167106888509172568003530668539460588248316513392652567856\
+224602697296203328920073354425994044956624831346979458846837\
+597950064151867164583749203433942592178528868981311575331848\
+941597492470436782387502687532649093096498315347403977436001\
+399982102030846763698994785054617523241463186980898394504211\
+430763617825306895065661536045431497903759118007934839122881\
+885863091769469883539876840543521295706315919855784493235603\
+866268925981702690270202829595794350800918257913991744455922\
+6833433740466716699302196502685546875e-4951L;
+static const long double ld2c =
+5.4677992978237119037926089004291297245985762235403450155814\
+707305425575329500966052143410629387408077958710210208052966\
+529504784489330482549602621133847135082257338717668975178538\
+378957084503396349323438489751160934104796903302909028868611\
+999312592165232778075745690821530731336739429587895774023213\
+939331012985331912661021188896306095323395084578542200319963\
+179359407180003251440084380484161504585462684082946932782829\
+488183829817567452314437076943950532707791252404699268678810\
+198502871250235796855577909830559749628817599194837522029036\
+891995648803056846354520653635957919882905363521007017169741\
+463296044392266269433408052686419017699718627761948763856040\
+592690841721239300491445991666051031755802326720329666454066\
+568630314348735511753639418257984253319063825247065727664852\
+328745422305642626091617823968872438962470092440688372515677\
+832232712866924800106797113478024083516199991991274936894113\
+006233377518471389394984262004503058455485659100090665241525\
+454803628182902241401701783637353179296850056973639305945938\
+813428953287892593620291195986011128990061888798763718548789\
+025717537674780281005583347165047846045925077914824515331335\
+131286063574407181821236377907693209224423490663289916878620\
+725507793163931390372011875799729330162278748985052557432333\
+005334989519381566364065326138465761456173231416844807264090\
+741841972247545424908843928136253653308813487994328446248389\
+608261444391573619177442907290731163188581917588219420107047\
+265367485141413919810885909689112244064797106324295291545892\
+937991321479061743491490060940946128274533657682130125169586\
+930571899403551122506297763180795732325134340989331155893724\
+289358918212707392997768032299997207208451112971425779939507\
+837165263255764268971211819536322993221774123134726665579460\
+265871378186589562858761835613344584269098062275786969729830\
+545786485401407774313414954958161677096004701941411411592755\
+485864471870515173326244464631295701572087440183178339987662\
+926763241220698078822661709054601073523477544653542795020468\
+256078409306409100874886828781860529824879343987945751252081\
+314345990313550683792348814627862441324030155730592166581251\
+009922787324590431548734575328663628650380722603024383412564\
+651446272117561042207738413114131099731016728935023152239431\
+311619533848376583687509108453086730196255111695352464186678\
+221927564757730319825223049341618853631333478241227227268084\
+583396688436229936266854011427192767039363517491659523133852\
+472534104124441112346615696891097070121463652258681270378076\
+538381697594264658479637863087159293838880752928175545408262\
+813403793568695416998388572304528748824756265665683890518422\
+696169422338806137532304784682662448207928681740476188343739\
+117833525916386815135793034906806117413105008719197882837614\
+738262050320291539494104952056471606645482046176634075459021\
+552555959590354956262127809953013679512507451424271839221946\
+794056861055980558363033732905772356986051180966474116423192\
+194741572438649215204229781279620370445373851348786918527399\
+785630808242657122705381806661616271132182017797793661244078\
+445747547535623384548769818529655539279036503234072455810991\
+588075181817695975173110136482659854557506203058080551018873\
+203138260451109855100526720073566126209666125604482413705611\
+996796777927332827103568863352291499261312290355143742018042\
+254470707107847293593205234049774839191754781030496978091006\
+099559675240966730110167624903610656473267105556155633783594\
+089546261107653110531808279445757724399186120387548675148632\
+176049190701680305210224388072261974806791922636412897526952\
+793677946622674149577084803568051242934076450942927092705684\
+547042915490323112457971853658760725588190377666477106903106\
+693847278847646032201293023329503348730723947218797410452333\
+910847913892827195814551858335519518939031446093385329182820\
+714173657946661746005901866885589732922652604573972842197231\
+187365263381958925227970038358064987248233271706462687651143\
+350472018043321314534759819524203308490914358596886150053406\
+629512434788155355109100540319857813535695923273426256911552\
+977539394209918630668466632881929661971212772444625151371953\
+428875491139683919687008724010475217255347915698820960215217\
+257390308560235323463096946442080548018754166369706161589705\
+215873687166365628787796501470056870127729464714362172216802\
+441045276911597009443281135389729130222603185665646434661947\
+627628077723219376892727386120519287577405410510114936151502\
+752997122750262781911372625997223415283516995479265631485799\
+456782561734766648462849641064097181818204279498552827825384\
+186202065516999362573388136163077477126602169410435905014077\
+049808497409025369325795765272066650278004200357878990911374\
+982857977108488482528354406313893864211497105765030504600982\
+253488805474531798742143374465080240030582370086699167937651\
+038307909706139327119325418854546478285735654541635477790346\
+964782617354265050767878335230272194896680141986745074630225\
+893106573559558843545841186025169531604151588481389164948914\
+823593944287133336263680358191369540321930649824471425485137\
+777984823525402115151171093313613251350685343824859052220126\
+891551966018355920872775724807128769003243129486808733796350\
+497668255116485157191011858830643898323628223472099280243583\
+164434348347014910398004439821970508280440872759395827943270\
+985008769143562351938091476215083548164137333541883808870019\
+116234099013452929807950151652297436436006149684939775781234\
+660954156154478642694176038524277810483833149798681345708089\
+152179193979463169402340611793486272301808073267534612685593\
+859596787866884211031341417903391749825320454663508370385251\
+831778477311017089729361152161928815389818579983544490982891\
+734081131312309744330960666031291451740885503458543884956367\
+654943799264600314531815427932691107874782328654759293575803\
+481929361961781073958502075438499070633193799699311694287183\
+299423475339817655608058724723221867087563064557636112380829\
+514501382073257737022472866608244164310385205213523702910787\
+182472517125030106491031844871593141759729773907719510044049\
+352857426592936763727969496103940591601975078602859660478614\
+119405428212830134490731706220583788265344728818766885126977\
+588151111984290444321648931907188080336064713873288834096229\
+203276676119810521851726133377700616341304257822975788967472\
+152742255041912584197045423031298506219011800240120182445838\
+590696647416285334515631019799007515682004250060857020904012\
+215375170479800482680554499806010766109655061507421747722461\
+180617361402575082294678925605271083587897845390768226405648\
+508518103525778638618195775128516073959272990148239415346263\
+486966573934577450787243667063244378381883115827207605856174\
+876350045086885320626669331311880593775916269643646395423220\
+549940790476989709243027420158390806135690975149384714684219\
+964938182719962913931464979458639185519531490009437619838306\
+362365453754807654884704163490469296444427144778593725687358\
+437087390151990694667516279202024332494828210657618261952038\
+597230263799412584275851667403910657370879707181053365818502\
+680037431560091209982641738995652793235851569372314130107647\
+166085235615697257094269133100914135783178856280392139325001\
+352841718610484616627448189556913621837791650699820323059708\
+766420810133584841826718631681683381743511974264126250984214\
+812397119978273917903889865891718836792263377888052458189238\
+746074986456016681098722869419588274020181430652732817858728\
+473849369539367463917171317324882099804999043054467247785592\
+038464723442276239896066431580123756428540074945472427752568\
+981171400621705853374875885943072600692576914790467205905272\
+372594740187988081900317493185005142913607163380720069786786\
+782095331840893694073778325119471833528492917081008547303414\
+509381563617864195257751546539575461435803625993888325647883\
+541039192368366987400263049681218831477776345118518503709588\
+840859023379762456561030683928115349942393963185677123055324\
+771693784214924931737043793679546051454845624150270955450608\
+318747395755728950832754611277041359602301205138509175543313\
+522772786504141007552691902249572375175731740923618769197304\
+652898352694386665448260033458575323252814233868098279476166\
+764258284911434288072243178941698347365985427696983129579496\
+059032032841281149923518087084876885114369033227736521245740\
+554711771423492719899982357711910225545480424688322195336240\
+492253136281857837808491795993788199125205555222116581071134\
+476787468430539307909617442106685159519071053844987343666452\
+494280317720153567054364117244775141336558406098548803924509\
+496052261825198043140272655303625315605326569530252885854991\
+822289219201218313590745412010446642247111703901991591338062\
+693320157180618736569439969283245279430312651192668788340033\
+626825194260296262959884258597703584888770801961209652822982\
+322376122303586169861685106043820510444293432856251210395693\
+261264867823980172683352796141772210301725997652373804152525\
+037162852291403804455997331367378463632437773242905518075065\
+414724295857460288225400061608664961649196400079359622673770\
+607898395269075056596627116148289491042491764170924014885106\
+158235482774778418134123293974436877051995673618683751115353\
+808771434984204447736174758316063096245047311279841579995578\
+186609402864244042751443128536278453430633423118662852688374\
+229600894418958824842459450540826176452145829389286103522774\
+101195556029650753254244433565937938526828990893149766298997\
+738359913887178888607190765709867052470880785937935110091424\
+743449966353497865681753841380246075612094033617488674676296\
+822570077027076266879557913673839341012099558043806442348798\
+053951239274913334631522409564461770434875790402230022872647\
+568436177018658068697071731879399180374560963492726714528729\
+224208938589940272515747888379118461617702271694075087419634\
+147298076764775745707026934442908236664400557265527951453482\
+191684597674273691978253678690951178777239573925410438679099\
+374700609973920128201422381329108236575369403675960765238333\
+778127017096574296148321075566959285042221837159799800133563\
+239963969638610872680393210300180152020613051613414547163713\
+772512617757277955979895866367571776456268564191092477027650\
+135832200376440239783726540552694851717269598489288851529660\
+975027775639565229734596726205832668434979354541943345062977\
+891187146561050118118108223323735210843681128615413601091222\
+007912350536959777114306541514511332368936078560929788143798\
+814391221507522370648646767364209132147312407014953113532379\
+838195728491128536978285918066991040993153064356179903885952\
+027952713749653604502053512355449916680887234238773855581636\
+172479594866871765094513940103284167914110196720261110812716\
+776424260154507395050380575452850420730818412994731079307343\
+538376880280124019321040198038723558784544408584344466090982\
+802067326529000931562048932875469079874956595180595395347093\
+285140279165467965596318365749701535812384333240968283640721\
+344003442002691613772056762099098025739332715913970186225176\
+459563484134139746647940170537900275350480490468851439300771\
+949915194703080576611022590670399844931867609777417528903454\
+731922206378932141464755402629420074293816349270038351339419\
+146768473851353171629153912238797141905920143036064131705230\
+421762305232861503856799511155936565169005916711845389135580\
+928162511912438531204156138447775120789548666143600293412065\
+767167106888509172568003530668539460588248316513392652567856\
+224602697296203328920073354425994044956624831346979458846837\
+597950064151867164583749203433942592178528868981311575331848\
+941597492470436782387502687532649093096498315347403977436001\
+399982102030846763698994785054617523241463186980898394504211\
+430763617825306895065661536045431497903759118007934839122881\
+885863091769469883539876840543521295706315919855784493235603\
+866268925981702690270202829595794350800918257913991744455922\
+6833433740466716699302196502685546875001e-4951L;
+/* 0x1.0000000000000001p16383 */
+static const long double ld3ae = 0x1p16383L, ld3be = 0x1p16383L, ld3ce = 0x1.0000000000000002p16383L;
+static const long double ld3a =
+5.9486574767861588257512740011252202817891302594919813725251\
+295428739285541899832559628345030434759848834258858109152060\
+168394580447354320917546191141469316674407503401251826592118\
+529247805068466318759038608659253988075214874609536526621357\
+456531393890166762179915866732524251539065872543957371571521\
+983821811625262362379785274802094595537134203491628334800642\
+100552410980148340419844099304716014319891796892117978584065\
+642215994189779833796388294931075153217985342401232585488548\
+183499573356819649604353341808627018653300000165159821533158\
+398534762310007133107769480816106094590754928301890268526601\
+948012303315011492834812113743989351274355589970363438128551\
+573643438403526566620300559126131289478114044934210031633528\
+263569989916613277150372804081100885766846923338387335735275\
+815690693627425316500993091757924061275520326543377826484801\
+260850814410014200240706874882235908793464063722267631785502\
+588978890438298369667014685160756795261293064179236782450102\
+879817506411379585551974343148401888001113058696688771238532\
+123329163319380775763389985796856252232367435778523577763581\
+076318820356483011816956309162306010784749642144593052844981\
+144455778303480881727480293033710826466852650686573284449164\
+971550815761322623554550767170481569400661823142075309755585\
+825399262942161733431916879499819498306470556518202895225167\
+570891857833504708712937447726161123901897152190727519098753\
+173091256107155059564163182449945325514965354563242034921715\
+085079669416064946957897843700525314730377964740286745952320\
+848539618361767466769711132391357232984948881905511016501295\
+373458116601070538750219227472880922074079367616789330713051\
+392796054620611196686398104309732110578180612371988986941283\
+463409571752839755060102940634838880149410521082372514146698\
+949690555298417297141754693386954049385392552489950059242099\
+158790234260937921119976211248531759522503364724271154732450\
+580204158756703065275680503502538215181617861403909609765438\
+459404741896379126766756324776550060890489522385655907004761\
+103760380176704738464932582597767398552360992261748200224552\
+499221197984163362555822765637968034280918669504609870586242\
+062170049756721980421608552698712778507151233315121277695507\
+694932304894125095195395002291537339548463471343544834535084\
+385597125111888342671654244935921073610595930775193595237994\
+484405470453247603596164707279142831292696020597352513459682\
+982542490819269161229107183625537754125393689567083050306972\
+299472451409351528024124972676859164822379702549840869992122\
+109088558738008051503238314435613116752657081607929379237268\
+685258548361696557803717952234859306922044575896046034219495\
+078937310258307531674502149231702180717812559299741279722940\
+331553164095430990867607708187092707603492795672693661579813\
+722297206006600340954221573260854019342039503980256096723323\
+974619210941227998945120494044519820953637210732374225869479\
+681431453077746347270062554307578221973966755682727685671115\
+104598487346465589917255152859638133529840253249441154093766\
+468296435228729803156904942774237478111621919125582394448948\
+295406406844691902789160843785892192212760482854142616066966\
+061436483840059374641455624686877579416182709686546132337333\
+180030729666859995573465620394353524944034503194887839608451\
+069029644904642077575045157730600577875158390703330602738631\
+860629283284285902868412268522486164537842820453011183015531\
+669082023505889165928251243784395957824980999247118276540195\
+068956031183236585108415603897481193085040746824934727777986\
+761703484626902903260925660927239810711484175954901422619731\
+922057229492660554293614771979793133433085936212830723862399\
+334585740422370252249982159238980361966177481883090934546250\
+903836442278836769393445168381535656636696931116641217099763\
+249205106142470169654056239769609880390474141835446455366216\
+163044493526155530766380018725181852858797332884069215206429\
+253933800732703242020102754246055713369281324885855415528125\
+659581759080256206862639693790603663547070031814664699862085\
+124026740519096394950750536940374610036575208929959836461615\
+919280191863569472772191938255564055565023733812663112274784\
+824733213440763947293874467915896768018331324730250697015099\
+463062533087218087488410166157459583569488345783974179340987\
+151815108212218686575226398710276498737521494877861721916239\
+286780194943271811625644415312213945242110591353818534254974\
+082884162962499579444882831630967263044313008877192427542802\
+154833385005287431176015973444837288763406349559772586733139\
+508290944276618724455216038372331277739377332938820061159422\
+131545699737995079186343848189545551446309662717473667598998\
+332988069951307480469935653061211574846012803370905284012473\
+025318540210297839541696998136885534223864988557670674501375\
+244470147903967779423817060038384764935662497442963759653206\
+786432859777470896394181997456033131032688720696203667198626\
+404895099030068466008555612541561023366202324622483939422567\
+021914882845352467305687811236417567525816955182834161603932\
+993065869465459807593704095390354125514253872107415823725124\
+7263969181695999e+4931L;
+static const long double ld3b =
+5.9486574767861588257512740011252202817891302594919813725251\
+295428739285541899832559628345030434759848834258858109152060\
+168394580447354320917546191141469316674407503401251826592118\
+529247805068466318759038608659253988075214874609536526621357\
+456531393890166762179915866732524251539065872543957371571521\
+983821811625262362379785274802094595537134203491628334800642\
+100552410980148340419844099304716014319891796892117978584065\
+642215994189779833796388294931075153217985342401232585488548\
+183499573356819649604353341808627018653300000165159821533158\
+398534762310007133107769480816106094590754928301890268526601\
+948012303315011492834812113743989351274355589970363438128551\
+573643438403526566620300559126131289478114044934210031633528\
+263569989916613277150372804081100885766846923338387335735275\
+815690693627425316500993091757924061275520326543377826484801\
+260850814410014200240706874882235908793464063722267631785502\
+588978890438298369667014685160756795261293064179236782450102\
+879817506411379585551974343148401888001113058696688771238532\
+123329163319380775763389985796856252232367435778523577763581\
+076318820356483011816956309162306010784749642144593052844981\
+144455778303480881727480293033710826466852650686573284449164\
+971550815761322623554550767170481569400661823142075309755585\
+825399262942161733431916879499819498306470556518202895225167\
+570891857833504708712937447726161123901897152190727519098753\
+173091256107155059564163182449945325514965354563242034921715\
+085079669416064946957897843700525314730377964740286745952320\
+848539618361767466769711132391357232984948881905511016501295\
+373458116601070538750219227472880922074079367616789330713051\
+392796054620611196686398104309732110578180612371988986941283\
+463409571752839755060102940634838880149410521082372514146698\
+949690555298417297141754693386954049385392552489950059242099\
+158790234260937921119976211248531759522503364724271154732450\
+580204158756703065275680503502538215181617861403909609765438\
+459404741896379126766756324776550060890489522385655907004761\
+103760380176704738464932582597767398552360992261748200224552\
+499221197984163362555822765637968034280918669504609870586242\
+062170049756721980421608552698712778507151233315121277695507\
+694932304894125095195395002291537339548463471343544834535084\
+385597125111888342671654244935921073610595930775193595237994\
+484405470453247603596164707279142831292696020597352513459682\
+982542490819269161229107183625537754125393689567083050306972\
+299472451409351528024124972676859164822379702549840869992122\
+109088558738008051503238314435613116752657081607929379237268\
+685258548361696557803717952234859306922044575896046034219495\
+078937310258307531674502149231702180717812559299741279722940\
+331553164095430990867607708187092707603492795672693661579813\
+722297206006600340954221573260854019342039503980256096723323\
+974619210941227998945120494044519820953637210732374225869479\
+681431453077746347270062554307578221973966755682727685671115\
+104598487346465589917255152859638133529840253249441154093766\
+468296435228729803156904942774237478111621919125582394448948\
+295406406844691902789160843785892192212760482854142616066966\
+061436483840059374641455624686877579416182709686546132337333\
+180030729666859995573465620394353524944034503194887839608451\
+069029644904642077575045157730600577875158390703330602738631\
+860629283284285902868412268522486164537842820453011183015531\
+669082023505889165928251243784395957824980999247118276540195\
+068956031183236585108415603897481193085040746824934727777986\
+761703484626902903260925660927239810711484175954901422619731\
+922057229492660554293614771979793133433085936212830723862399\
+334585740422370252249982159238980361966177481883090934546250\
+903836442278836769393445168381535656636696931116641217099763\
+249205106142470169654056239769609880390474141835446455366216\
+163044493526155530766380018725181852858797332884069215206429\
+253933800732703242020102754246055713369281324885855415528125\
+659581759080256206862639693790603663547070031814664699862085\
+124026740519096394950750536940374610036575208929959836461615\
+919280191863569472772191938255564055565023733812663112274784\
+824733213440763947293874467915896768018331324730250697015099\
+463062533087218087488410166157459583569488345783974179340987\
+151815108212218686575226398710276498737521494877861721916239\
+286780194943271811625644415312213945242110591353818534254974\
+082884162962499579444882831630967263044313008877192427542802\
+154833385005287431176015973444837288763406349559772586733139\
+508290944276618724455216038372331277739377332938820061159422\
+131545699737995079186343848189545551446309662717473667598998\
+332988069951307480469935653061211574846012803370905284012473\
+025318540210297839541696998136885534223864988557670674501375\
+244470147903967779423817060038384764935662497442963759653206\
+786432859777470896394181997456033131032688720696203667198626\
+404895099030068466008555612541561023366202324622483939422567\
+021914882845352467305687811236417567525816955182834161603932\
+993065869465459807593704095390354125514253872107415823725124\
+7263969181696e+4931L;
+static const long double ld3c =
+5.9486574767861588257512740011252202817891302594919813725251\
+295428739285541899832559628345030434759848834258858109152060\
+168394580447354320917546191141469316674407503401251826592118\
+529247805068466318759038608659253988075214874609536526621357\
+456531393890166762179915866732524251539065872543957371571521\
+983821811625262362379785274802094595537134203491628334800642\
+100552410980148340419844099304716014319891796892117978584065\
+642215994189779833796388294931075153217985342401232585488548\
+183499573356819649604353341808627018653300000165159821533158\
+398534762310007133107769480816106094590754928301890268526601\
+948012303315011492834812113743989351274355589970363438128551\
+573643438403526566620300559126131289478114044934210031633528\
+263569989916613277150372804081100885766846923338387335735275\
+815690693627425316500993091757924061275520326543377826484801\
+260850814410014200240706874882235908793464063722267631785502\
+588978890438298369667014685160756795261293064179236782450102\
+879817506411379585551974343148401888001113058696688771238532\
+123329163319380775763389985796856252232367435778523577763581\
+076318820356483011816956309162306010784749642144593052844981\
+144455778303480881727480293033710826466852650686573284449164\
+971550815761322623554550767170481569400661823142075309755585\
+825399262942161733431916879499819498306470556518202895225167\
+570891857833504708712937447726161123901897152190727519098753\
+173091256107155059564163182449945325514965354563242034921715\
+085079669416064946957897843700525314730377964740286745952320\
+848539618361767466769711132391357232984948881905511016501295\
+373458116601070538750219227472880922074079367616789330713051\
+392796054620611196686398104309732110578180612371988986941283\
+463409571752839755060102940634838880149410521082372514146698\
+949690555298417297141754693386954049385392552489950059242099\
+158790234260937921119976211248531759522503364724271154732450\
+580204158756703065275680503502538215181617861403909609765438\
+459404741896379126766756324776550060890489522385655907004761\
+103760380176704738464932582597767398552360992261748200224552\
+499221197984163362555822765637968034280918669504609870586242\
+062170049756721980421608552698712778507151233315121277695507\
+694932304894125095195395002291537339548463471343544834535084\
+385597125111888342671654244935921073610595930775193595237994\
+484405470453247603596164707279142831292696020597352513459682\
+982542490819269161229107183625537754125393689567083050306972\
+299472451409351528024124972676859164822379702549840869992122\
+109088558738008051503238314435613116752657081607929379237268\
+685258548361696557803717952234859306922044575896046034219495\
+078937310258307531674502149231702180717812559299741279722940\
+331553164095430990867607708187092707603492795672693661579813\
+722297206006600340954221573260854019342039503980256096723323\
+974619210941227998945120494044519820953637210732374225869479\
+681431453077746347270062554307578221973966755682727685671115\
+104598487346465589917255152859638133529840253249441154093766\
+468296435228729803156904942774237478111621919125582394448948\
+295406406844691902789160843785892192212760482854142616066966\
+061436483840059374641455624686877579416182709686546132337333\
+180030729666859995573465620394353524944034503194887839608451\
+069029644904642077575045157730600577875158390703330602738631\
+860629283284285902868412268522486164537842820453011183015531\
+669082023505889165928251243784395957824980999247118276540195\
+068956031183236585108415603897481193085040746824934727777986\
+761703484626902903260925660927239810711484175954901422619731\
+922057229492660554293614771979793133433085936212830723862399\
+334585740422370252249982159238980361966177481883090934546250\
+903836442278836769393445168381535656636696931116641217099763\
+249205106142470169654056239769609880390474141835446455366216\
+163044493526155530766380018725181852858797332884069215206429\
+253933800732703242020102754246055713369281324885855415528125\
+659581759080256206862639693790603663547070031814664699862085\
+124026740519096394950750536940374610036575208929959836461615\
+919280191863569472772191938255564055565023733812663112274784\
+824733213440763947293874467915896768018331324730250697015099\
+463062533087218087488410166157459583569488345783974179340987\
+151815108212218686575226398710276498737521494877861721916239\
+286780194943271811625644415312213945242110591353818534254974\
+082884162962499579444882831630967263044313008877192427542802\
+154833385005287431176015973444837288763406349559772586733139\
+508290944276618724455216038372331277739377332938820061159422\
+131545699737995079186343848189545551446309662717473667598998\
+332988069951307480469935653061211574846012803370905284012473\
+025318540210297839541696998136885534223864988557670674501375\
+244470147903967779423817060038384764935662497442963759653206\
+786432859777470896394181997456033131032688720696203667198626\
+404895099030068466008555612541561023366202324622483939422567\
+021914882845352467305687811236417567525816955182834161603932\
+993065869465459807593704095390354125514253872107415823725124\
+7263969181696001e+4931L;
+#endif
+
+#if LDBL_MANT_DIG == 113 \
+ && LDBL_MIN_EXP == -16381 \
+ && LDBL_MAX_EXP == 16384
+# define LDBL_OK
+/* 0x0.8p-16494 */
+static const long double ld1ae = 0, ld1be = 0, ld1ce = 0x1p-16494L;
+static const long double ld1a =
+3.2375875597190125554622194791138232762497846690173405048449\
+421945985197700620596855088357456383249701279390707384240598\
+382936099431912710233425550359863089915213963553756674672083\
+673128192358701197242632527769951957277781260855740340354110\
+173441284912381364143945515141786687806740155311932822963199\
+131134959539539338316310328556057915323285980341541664226172\
+265348802632447238304822896568757017013159021750199744350376\
+278243566840330589397015778833566517337174685312047058426075\
+688036665697114219175258344917835835984013214761767520398571\
+735519302688914468501077605843338555214753050109407568139932\
+147308502166696009676987494125921676927574464221699654264839\
+192243410627511520570610765229732327315423820550872393685221\
+676561948307418196052769717057382723931306989375320957256133\
+838073129463951849807075348034900035402513943244599879584009\
+391110011261908615236154859382854977144106096407982738165117\
+693915685918231984764157652755343417097983676870433731452629\
+339981084526616826599425863049784138127555181662391766144738\
+159400253422795753041594932607700680306368857466952063923782\
+760519487592638820793893796669403574411398166619131986561877\
+034635197232626532239192571857518274939275861531537920777299\
+133535479548088762634002006634954143608168633852204577195463\
+389533233992867620995583241321034602255800668175356808869060\
+608582640890741203603916133682748118680676374951545690715916\
+241859799379894025137504643469040366684778763795442214328000\
+375999444991619403217748350277527106812175542863660436614910\
+135938862296156144947361864759321605496309393905421651264941\
+669606814994816518612155298709843817262034769175075602668866\
+926449523554218142013501373514352370369126244144449924971423\
+038024236058971106053649565799145071085840022305247663313482\
+714565918140785997808209749619683146844964283106915422726638\
+184861327711776708749278315100024436584176080783836115268999\
+055336294569042349971163039294272620322160728879610722678506\
+182344928526064885227397447578450046944618127903428943538029\
+386719288345854473283987116842451647036255801966780244103035\
+425445345127067921349083698736056197567752071915587544133815\
+717564310032485290205726480489464589999677885266171263493459\
+668963623768410922688414177814149693150024191921819721215688\
+114324591287371281400636455584825253000890602388603923710921\
+026880979879158388608823700222683123228822356907857261909150\
+626993825760416437415551396973489279578569909699853422995997\
+974315036153120383930698087773157253674975950409660938084071\
+173163693891122166282318691732176374528554627905530306369204\
+877964658806333996327938827344733821685425961846791581492287\
+250044047142934607523718654369478552373072400018635730811749\
+291666457582760812726851561001954207941547404866373158231367\
+986951247388733285659455982411993350593989550494594498447410\
+984783303191128659803467713819821511544998464785455306500918\
+241648925913966507036336000231915215026183799886938007038845\
+551916478649593272604688927931953165785101738164060543643192\
+949066412847647883846835866623820426428526541564774787007791\
+235843699657232847114093617412355486871810526396392792853731\
+390841657984518997639795008374280777823099107035223998600103\
+103211166230289241182380237703814248941627178152962100972452\
+217697144954497443279450919433943252592977710901289696002698\
+225209041938801190947812141758873162203113090284565687499100\
+109623665868340184032428667217835198069330185880779776269137\
+742366802202585247113480377505916462865316253065105837519292\
+805411191872195967066157363040364443666632564266439033866945\
+366496486863801221986778957510023272290593640187551645170603\
+215150911733580059874983597994671388176488814794186236946834\
+548816837468411497151813344980969677026131105901402313456769\
+561412278508799050185582199844418197980544632067644131002512\
+557755358307705356209461595354064971347590431926479961905129\
+785864961996560707071051177738535042777950247546470241655891\
+294428226271478689174637951663865529219133988782700199051475\
+108495188941141025360733690471601309904116260484264378352956\
+830972782977747351810451586166745640802378131466232692150196\
+132319386267589275314909450293562079332893638471814389025392\
+970579695249613486078445695214422379148991006996109216699215\
+721671648754881325271879493185438097033881789311707997697928\
+860866812849648616086569281093053695399558469641977866770538\
+476039621947215238679930485285585513808236992918733520331110\
+962448142457896209307561142289713638388281085340301520317159\
+297224995464365477734040179470355969363384621039467975256670\
+339354334892926205316491997244008324897517881293654265688813\
+283579663372924392043825371743576754041055802440187836850412\
+247984570221893156921757872572872036331343007592090605703195\
+088864753777199111760713027328198781654685927174063882187275\
+850263521274368447629947228263907797373221137688424821608129\
+731003236738630502344377228987961455961818623205503012858619\
+800521948637807438081069469400793496307826769301971342062597\
+391253779410607511754278887744936774785938056823221738917303\
+119592848951788560393540150358649310736020595310015728915288\
+289821678102453433273888879288862086153270028346900686360943\
+250522514297816412678213672667152836436597491522644579383191\
+851483036048273636234050603745735057899230038434384361744893\
+838050985090837220507663282503497932038372021626246900935334\
+781144388106031405650705176699646299475436084049881780196520\
+881623075256119318210664937469946410480660118598143375898298\
+965497205621170906772915413181530577151676241283182977713765\
+317889730886996471681592298058774155948285325398399674640645\
+566475947058303746531133735308766583802401453804232106737787\
+768035926272312574958173945816077962772826443125107145322971\
+087220172175473177449006473180221085709470643042801004189714\
+505520073568915195232936144169440163547568663500508335014169\
+425050712038101167190534305435310279534374364467455668392421\
+298604104431988622194699721632249712583483143417550152131186\
+288827131347662976240916448058011869761525369135147129192405\
+037216807405860168320999468074663117771890506566769628495813\
+837909047220874786467663205170561835819702362482274133227483\
+041342457179876653773960112367066273208176545656826800069574\
+547599816180234764485446735080683694920665668954370505715843\
+455110709594838989387382250502925336743830916124954071268053\
+817964873658921319164268375226716232666274830656557657055342\
+393552148933959057023293404027940528842591460490646295820755\
+765633076707491896621769767253619370462005760078938144396953\
+018925287611875441613896820035092167912718365454954166761481\
+511451950826683236776211829914518353242818636196417736206010\
+145109509967467266157037719712666871515644277723594273405669\
+093518586548079997818085130346801040781966074621669280188633\
+856299289656492439545033914935979634179552686396067914528336\
+924678729357419403624798426886422277256625046946795576781709\
+298737741510378578072199383561520569978396254537274419476511\
+983161908266152660163477408756159700314280122283281906103567\
+067156627222418787671312246698375736071215395722993294041012\
+744631560602983489316782773611740570974847045870362276861106\
+774130949410119612624380274679529647271294627526939490197641\
+645383447755544661714281218489998189691140343327976729279891\
+077101372792811842951182338559423852563331641533781432796742\
+873181364582071661749961126386895359760476172215209100274274\
+851619657020388051618654944574445941780637669570374280535432\
+399157923698778110534174856844986671232161320063786308144771\
+068130888985636449091787794632959555876880672773686838364706\
+122084832995722603440165161942472322987408003421165899848443\
+566885769845535074102932500939450142098799833145629484519298\
+622410092757836842296697186410137365818568152771850732591405\
+340248509247875448717161746544246407280913725135059228268131\
+453903691495906528862410006254958805237716723952273129715780\
+425223305517882562616830806755498203755676925741529569939445\
+043490046171854709456730491532189688306135861932534903184518\
+717706426178028900836080044604143054210332610482947502104703\
+032028463320549525316174330585387581543470878545616097381416\
+151451037487775797335749896735101048367502483255117772375025\
+269956476872153642623856062175536913321594213515989059505375\
+135183515207096576145781316398544325320022366962008554087665\
+201050763789833457082359181807492731245904330245198691471329\
+319324627030678762142685799400660305214140453863665517807185\
+105354694177602424937823924511789133225030926924236498557565\
+212794565582753399214908928688568628950225640472058381324292\
+866007645368390366981937596341868992912741319342960598330486\
+905946276235953206760977215407164729909506118583728562718724\
+235732515062300426080741679038098122641980345051854359908213\
+563779664847422505775922437272989231878912994048540484468227\
+199282393172540734295329890896755037903724644870572648941076\
+132423009124870700536763793881894969000042397318202298868940\
+530196108237639578098191879486398269734335286831689173606327\
+500405178476864790935386838169242131756729797688220656276969\
+434749140204830563840068728357383111109865861495106613619153\
+421725274090787422508800568671498311491210197298472420373359\
+044400631309819996507004167876832936101195902219429743174557\
+163362274547892397934880322990633165889175059124060202200452\
+648684577182821651588921716304707095995039972827781680978274\
+973838841958209215836456212939412000456040621743349981715350\
+305133662772937143899882197561295808685181679238411733642697\
+748892466944352640514849114619882270112386610376024527101889\
+119004382703622803911212700216792471528793241950356942780714\
+774957204475130171711488773121937363663487116301055073658645\
+980695862570269762957141239436916216723776945522480189876803\
+386123827956059851911061129713987960026363403936931196519733\
+447116468545744829997003979525368783485129837821983305137448\
+031689360764270759437872004895754351479890333865299565515706\
+690471030702230767978923298480584997256328135245813726407464\
+159230169328539541524724878662873185450510653764301207480799\
+488602832618557388369552461881286225098286358672257087829660\
+174231705350465091313887538950130611513878400895128618426154\
+417299623157313010877679890009181366178705821415173309356192\
+686429159835537275875876767919535369607142366878476025895389\
+279625854409611312402187942369446302119309705461187450803468\
+606366203101933821675974655441744883993796837164178911391575\
+751463591650231265941242686108002052587760190005508737394014\
+453031299745602214380618917954427803281262300931789525045703\
+809571995929933387196864877982754748535701000330924817431298\
+365273697561943437891318220691072831562717726798635382168915\
+187137325209768346284183473712613689334546294053718697897526\
+843398053681374508250012035211936425982389543291022583173280\
+985811169783438836113209408147936547458073361625570571955232\
+746103236016857123149307991441916732438322836596693687161268\
+151183603534413030099360835441935243365729307681545065674775\
+655582111435085683962037818795920337874290127531069511296530\
+746308404963763022896682861683252995925040540038039172626001\
+958340013361801588367655990575379797454237110701588716509764\
+759243657077584013289594787913434812509790293636440469725564\
+222946985585616708175959944099853232059130350099233608207347\
+955460820122006976717445739825352919058005528371183277021250\
+186916447745609162301667393077050176560656798672598371789181\
+232542195795945358691713761483976100058707499929103557275695\
+937295677892604799308353051124627278706035295473126217205599\
+530746756205492173148619619059839609108464715691924592576481\
+382126740168148453274964955074129767533813576349605298268179\
+068244338581354855186516322703199278802275718580352103754433\
+240982354636196477238624205575823556321375833700666021556412\
+182358152808745703724362178773168996492870519432472065091133\
+11767578124999e-4966L;
+static const long double ld1b =
+3.2375875597190125554622194791138232762497846690173405048449\
+421945985197700620596855088357456383249701279390707384240598\
+382936099431912710233425550359863089915213963553756674672083\
+673128192358701197242632527769951957277781260855740340354110\
+173441284912381364143945515141786687806740155311932822963199\
+131134959539539338316310328556057915323285980341541664226172\
+265348802632447238304822896568757017013159021750199744350376\
+278243566840330589397015778833566517337174685312047058426075\
+688036665697114219175258344917835835984013214761767520398571\
+735519302688914468501077605843338555214753050109407568139932\
+147308502166696009676987494125921676927574464221699654264839\
+192243410627511520570610765229732327315423820550872393685221\
+676561948307418196052769717057382723931306989375320957256133\
+838073129463951849807075348034900035402513943244599879584009\
+391110011261908615236154859382854977144106096407982738165117\
+693915685918231984764157652755343417097983676870433731452629\
+339981084526616826599425863049784138127555181662391766144738\
+159400253422795753041594932607700680306368857466952063923782\
+760519487592638820793893796669403574411398166619131986561877\
+034635197232626532239192571857518274939275861531537920777299\
+133535479548088762634002006634954143608168633852204577195463\
+389533233992867620995583241321034602255800668175356808869060\
+608582640890741203603916133682748118680676374951545690715916\
+241859799379894025137504643469040366684778763795442214328000\
+375999444991619403217748350277527106812175542863660436614910\
+135938862296156144947361864759321605496309393905421651264941\
+669606814994816518612155298709843817262034769175075602668866\
+926449523554218142013501373514352370369126244144449924971423\
+038024236058971106053649565799145071085840022305247663313482\
+714565918140785997808209749619683146844964283106915422726638\
+184861327711776708749278315100024436584176080783836115268999\
+055336294569042349971163039294272620322160728879610722678506\
+182344928526064885227397447578450046944618127903428943538029\
+386719288345854473283987116842451647036255801966780244103035\
+425445345127067921349083698736056197567752071915587544133815\
+717564310032485290205726480489464589999677885266171263493459\
+668963623768410922688414177814149693150024191921819721215688\
+114324591287371281400636455584825253000890602388603923710921\
+026880979879158388608823700222683123228822356907857261909150\
+626993825760416437415551396973489279578569909699853422995997\
+974315036153120383930698087773157253674975950409660938084071\
+173163693891122166282318691732176374528554627905530306369204\
+877964658806333996327938827344733821685425961846791581492287\
+250044047142934607523718654369478552373072400018635730811749\
+291666457582760812726851561001954207941547404866373158231367\
+986951247388733285659455982411993350593989550494594498447410\
+984783303191128659803467713819821511544998464785455306500918\
+241648925913966507036336000231915215026183799886938007038845\
+551916478649593272604688927931953165785101738164060543643192\
+949066412847647883846835866623820426428526541564774787007791\
+235843699657232847114093617412355486871810526396392792853731\
+390841657984518997639795008374280777823099107035223998600103\
+103211166230289241182380237703814248941627178152962100972452\
+217697144954497443279450919433943252592977710901289696002698\
+225209041938801190947812141758873162203113090284565687499100\
+109623665868340184032428667217835198069330185880779776269137\
+742366802202585247113480377505916462865316253065105837519292\
+805411191872195967066157363040364443666632564266439033866945\
+366496486863801221986778957510023272290593640187551645170603\
+215150911733580059874983597994671388176488814794186236946834\
+548816837468411497151813344980969677026131105901402313456769\
+561412278508799050185582199844418197980544632067644131002512\
+557755358307705356209461595354064971347590431926479961905129\
+785864961996560707071051177738535042777950247546470241655891\
+294428226271478689174637951663865529219133988782700199051475\
+108495188941141025360733690471601309904116260484264378352956\
+830972782977747351810451586166745640802378131466232692150196\
+132319386267589275314909450293562079332893638471814389025392\
+970579695249613486078445695214422379148991006996109216699215\
+721671648754881325271879493185438097033881789311707997697928\
+860866812849648616086569281093053695399558469641977866770538\
+476039621947215238679930485285585513808236992918733520331110\
+962448142457896209307561142289713638388281085340301520317159\
+297224995464365477734040179470355969363384621039467975256670\
+339354334892926205316491997244008324897517881293654265688813\
+283579663372924392043825371743576754041055802440187836850412\
+247984570221893156921757872572872036331343007592090605703195\
+088864753777199111760713027328198781654685927174063882187275\
+850263521274368447629947228263907797373221137688424821608129\
+731003236738630502344377228987961455961818623205503012858619\
+800521948637807438081069469400793496307826769301971342062597\
+391253779410607511754278887744936774785938056823221738917303\
+119592848951788560393540150358649310736020595310015728915288\
+289821678102453433273888879288862086153270028346900686360943\
+250522514297816412678213672667152836436597491522644579383191\
+851483036048273636234050603745735057899230038434384361744893\
+838050985090837220507663282503497932038372021626246900935334\
+781144388106031405650705176699646299475436084049881780196520\
+881623075256119318210664937469946410480660118598143375898298\
+965497205621170906772915413181530577151676241283182977713765\
+317889730886996471681592298058774155948285325398399674640645\
+566475947058303746531133735308766583802401453804232106737787\
+768035926272312574958173945816077962772826443125107145322971\
+087220172175473177449006473180221085709470643042801004189714\
+505520073568915195232936144169440163547568663500508335014169\
+425050712038101167190534305435310279534374364467455668392421\
+298604104431988622194699721632249712583483143417550152131186\
+288827131347662976240916448058011869761525369135147129192405\
+037216807405860168320999468074663117771890506566769628495813\
+837909047220874786467663205170561835819702362482274133227483\
+041342457179876653773960112367066273208176545656826800069574\
+547599816180234764485446735080683694920665668954370505715843\
+455110709594838989387382250502925336743830916124954071268053\
+817964873658921319164268375226716232666274830656557657055342\
+393552148933959057023293404027940528842591460490646295820755\
+765633076707491896621769767253619370462005760078938144396953\
+018925287611875441613896820035092167912718365454954166761481\
+511451950826683236776211829914518353242818636196417736206010\
+145109509967467266157037719712666871515644277723594273405669\
+093518586548079997818085130346801040781966074621669280188633\
+856299289656492439545033914935979634179552686396067914528336\
+924678729357419403624798426886422277256625046946795576781709\
+298737741510378578072199383561520569978396254537274419476511\
+983161908266152660163477408756159700314280122283281906103567\
+067156627222418787671312246698375736071215395722993294041012\
+744631560602983489316782773611740570974847045870362276861106\
+774130949410119612624380274679529647271294627526939490197641\
+645383447755544661714281218489998189691140343327976729279891\
+077101372792811842951182338559423852563331641533781432796742\
+873181364582071661749961126386895359760476172215209100274274\
+851619657020388051618654944574445941780637669570374280535432\
+399157923698778110534174856844986671232161320063786308144771\
+068130888985636449091787794632959555876880672773686838364706\
+122084832995722603440165161942472322987408003421165899848443\
+566885769845535074102932500939450142098799833145629484519298\
+622410092757836842296697186410137365818568152771850732591405\
+340248509247875448717161746544246407280913725135059228268131\
+453903691495906528862410006254958805237716723952273129715780\
+425223305517882562616830806755498203755676925741529569939445\
+043490046171854709456730491532189688306135861932534903184518\
+717706426178028900836080044604143054210332610482947502104703\
+032028463320549525316174330585387581543470878545616097381416\
+151451037487775797335749896735101048367502483255117772375025\
+269956476872153642623856062175536913321594213515989059505375\
+135183515207096576145781316398544325320022366962008554087665\
+201050763789833457082359181807492731245904330245198691471329\
+319324627030678762142685799400660305214140453863665517807185\
+105354694177602424937823924511789133225030926924236498557565\
+212794565582753399214908928688568628950225640472058381324292\
+866007645368390366981937596341868992912741319342960598330486\
+905946276235953206760977215407164729909506118583728562718724\
+235732515062300426080741679038098122641980345051854359908213\
+563779664847422505775922437272989231878912994048540484468227\
+199282393172540734295329890896755037903724644870572648941076\
+132423009124870700536763793881894969000042397318202298868940\
+530196108237639578098191879486398269734335286831689173606327\
+500405178476864790935386838169242131756729797688220656276969\
+434749140204830563840068728357383111109865861495106613619153\
+421725274090787422508800568671498311491210197298472420373359\
+044400631309819996507004167876832936101195902219429743174557\
+163362274547892397934880322990633165889175059124060202200452\
+648684577182821651588921716304707095995039972827781680978274\
+973838841958209215836456212939412000456040621743349981715350\
+305133662772937143899882197561295808685181679238411733642697\
+748892466944352640514849114619882270112386610376024527101889\
+119004382703622803911212700216792471528793241950356942780714\
+774957204475130171711488773121937363663487116301055073658645\
+980695862570269762957141239436916216723776945522480189876803\
+386123827956059851911061129713987960026363403936931196519733\
+447116468545744829997003979525368783485129837821983305137448\
+031689360764270759437872004895754351479890333865299565515706\
+690471030702230767978923298480584997256328135245813726407464\
+159230169328539541524724878662873185450510653764301207480799\
+488602832618557388369552461881286225098286358672257087829660\
+174231705350465091313887538950130611513878400895128618426154\
+417299623157313010877679890009181366178705821415173309356192\
+686429159835537275875876767919535369607142366878476025895389\
+279625854409611312402187942369446302119309705461187450803468\
+606366203101933821675974655441744883993796837164178911391575\
+751463591650231265941242686108002052587760190005508737394014\
+453031299745602214380618917954427803281262300931789525045703\
+809571995929933387196864877982754748535701000330924817431298\
+365273697561943437891318220691072831562717726798635382168915\
+187137325209768346284183473712613689334546294053718697897526\
+843398053681374508250012035211936425982389543291022583173280\
+985811169783438836113209408147936547458073361625570571955232\
+746103236016857123149307991441916732438322836596693687161268\
+151183603534413030099360835441935243365729307681545065674775\
+655582111435085683962037818795920337874290127531069511296530\
+746308404963763022896682861683252995925040540038039172626001\
+958340013361801588367655990575379797454237110701588716509764\
+759243657077584013289594787913434812509790293636440469725564\
+222946985585616708175959944099853232059130350099233608207347\
+955460820122006976717445739825352919058005528371183277021250\
+186916447745609162301667393077050176560656798672598371789181\
+232542195795945358691713761483976100058707499929103557275695\
+937295677892604799308353051124627278706035295473126217205599\
+530746756205492173148619619059839609108464715691924592576481\
+382126740168148453274964955074129767533813576349605298268179\
+068244338581354855186516322703199278802275718580352103754433\
+240982354636196477238624205575823556321375833700666021556412\
+182358152808745703724362178773168996492870519432472065091133\
+11767578125e-4966L;
+static const long double ld1c =
+3.2375875597190125554622194791138232762497846690173405048449\
+421945985197700620596855088357456383249701279390707384240598\
+382936099431912710233425550359863089915213963553756674672083\
+673128192358701197242632527769951957277781260855740340354110\
+173441284912381364143945515141786687806740155311932822963199\
+131134959539539338316310328556057915323285980341541664226172\
+265348802632447238304822896568757017013159021750199744350376\
+278243566840330589397015778833566517337174685312047058426075\
+688036665697114219175258344917835835984013214761767520398571\
+735519302688914468501077605843338555214753050109407568139932\
+147308502166696009676987494125921676927574464221699654264839\
+192243410627511520570610765229732327315423820550872393685221\
+676561948307418196052769717057382723931306989375320957256133\
+838073129463951849807075348034900035402513943244599879584009\
+391110011261908615236154859382854977144106096407982738165117\
+693915685918231984764157652755343417097983676870433731452629\
+339981084526616826599425863049784138127555181662391766144738\
+159400253422795753041594932607700680306368857466952063923782\
+760519487592638820793893796669403574411398166619131986561877\
+034635197232626532239192571857518274939275861531537920777299\
+133535479548088762634002006634954143608168633852204577195463\
+389533233992867620995583241321034602255800668175356808869060\
+608582640890741203603916133682748118680676374951545690715916\
+241859799379894025137504643469040366684778763795442214328000\
+375999444991619403217748350277527106812175542863660436614910\
+135938862296156144947361864759321605496309393905421651264941\
+669606814994816518612155298709843817262034769175075602668866\
+926449523554218142013501373514352370369126244144449924971423\
+038024236058971106053649565799145071085840022305247663313482\
+714565918140785997808209749619683146844964283106915422726638\
+184861327711776708749278315100024436584176080783836115268999\
+055336294569042349971163039294272620322160728879610722678506\
+182344928526064885227397447578450046944618127903428943538029\
+386719288345854473283987116842451647036255801966780244103035\
+425445345127067921349083698736056197567752071915587544133815\
+717564310032485290205726480489464589999677885266171263493459\
+668963623768410922688414177814149693150024191921819721215688\
+114324591287371281400636455584825253000890602388603923710921\
+026880979879158388608823700222683123228822356907857261909150\
+626993825760416437415551396973489279578569909699853422995997\
+974315036153120383930698087773157253674975950409660938084071\
+173163693891122166282318691732176374528554627905530306369204\
+877964658806333996327938827344733821685425961846791581492287\
+250044047142934607523718654369478552373072400018635730811749\
+291666457582760812726851561001954207941547404866373158231367\
+986951247388733285659455982411993350593989550494594498447410\
+984783303191128659803467713819821511544998464785455306500918\
+241648925913966507036336000231915215026183799886938007038845\
+551916478649593272604688927931953165785101738164060543643192\
+949066412847647883846835866623820426428526541564774787007791\
+235843699657232847114093617412355486871810526396392792853731\
+390841657984518997639795008374280777823099107035223998600103\
+103211166230289241182380237703814248941627178152962100972452\
+217697144954497443279450919433943252592977710901289696002698\
+225209041938801190947812141758873162203113090284565687499100\
+109623665868340184032428667217835198069330185880779776269137\
+742366802202585247113480377505916462865316253065105837519292\
+805411191872195967066157363040364443666632564266439033866945\
+366496486863801221986778957510023272290593640187551645170603\
+215150911733580059874983597994671388176488814794186236946834\
+548816837468411497151813344980969677026131105901402313456769\
+561412278508799050185582199844418197980544632067644131002512\
+557755358307705356209461595354064971347590431926479961905129\
+785864961996560707071051177738535042777950247546470241655891\
+294428226271478689174637951663865529219133988782700199051475\
+108495188941141025360733690471601309904116260484264378352956\
+830972782977747351810451586166745640802378131466232692150196\
+132319386267589275314909450293562079332893638471814389025392\
+970579695249613486078445695214422379148991006996109216699215\
+721671648754881325271879493185438097033881789311707997697928\
+860866812849648616086569281093053695399558469641977866770538\
+476039621947215238679930485285585513808236992918733520331110\
+962448142457896209307561142289713638388281085340301520317159\
+297224995464365477734040179470355969363384621039467975256670\
+339354334892926205316491997244008324897517881293654265688813\
+283579663372924392043825371743576754041055802440187836850412\
+247984570221893156921757872572872036331343007592090605703195\
+088864753777199111760713027328198781654685927174063882187275\
+850263521274368447629947228263907797373221137688424821608129\
+731003236738630502344377228987961455961818623205503012858619\
+800521948637807438081069469400793496307826769301971342062597\
+391253779410607511754278887744936774785938056823221738917303\
+119592848951788560393540150358649310736020595310015728915288\
+289821678102453433273888879288862086153270028346900686360943\
+250522514297816412678213672667152836436597491522644579383191\
+851483036048273636234050603745735057899230038434384361744893\
+838050985090837220507663282503497932038372021626246900935334\
+781144388106031405650705176699646299475436084049881780196520\
+881623075256119318210664937469946410480660118598143375898298\
+965497205621170906772915413181530577151676241283182977713765\
+317889730886996471681592298058774155948285325398399674640645\
+566475947058303746531133735308766583802401453804232106737787\
+768035926272312574958173945816077962772826443125107145322971\
+087220172175473177449006473180221085709470643042801004189714\
+505520073568915195232936144169440163547568663500508335014169\
+425050712038101167190534305435310279534374364467455668392421\
+298604104431988622194699721632249712583483143417550152131186\
+288827131347662976240916448058011869761525369135147129192405\
+037216807405860168320999468074663117771890506566769628495813\
+837909047220874786467663205170561835819702362482274133227483\
+041342457179876653773960112367066273208176545656826800069574\
+547599816180234764485446735080683694920665668954370505715843\
+455110709594838989387382250502925336743830916124954071268053\
+817964873658921319164268375226716232666274830656557657055342\
+393552148933959057023293404027940528842591460490646295820755\
+765633076707491896621769767253619370462005760078938144396953\
+018925287611875441613896820035092167912718365454954166761481\
+511451950826683236776211829914518353242818636196417736206010\
+145109509967467266157037719712666871515644277723594273405669\
+093518586548079997818085130346801040781966074621669280188633\
+856299289656492439545033914935979634179552686396067914528336\
+924678729357419403624798426886422277256625046946795576781709\
+298737741510378578072199383561520569978396254537274419476511\
+983161908266152660163477408756159700314280122283281906103567\
+067156627222418787671312246698375736071215395722993294041012\
+744631560602983489316782773611740570974847045870362276861106\
+774130949410119612624380274679529647271294627526939490197641\
+645383447755544661714281218489998189691140343327976729279891\
+077101372792811842951182338559423852563331641533781432796742\
+873181364582071661749961126386895359760476172215209100274274\
+851619657020388051618654944574445941780637669570374280535432\
+399157923698778110534174856844986671232161320063786308144771\
+068130888985636449091787794632959555876880672773686838364706\
+122084832995722603440165161942472322987408003421165899848443\
+566885769845535074102932500939450142098799833145629484519298\
+622410092757836842296697186410137365818568152771850732591405\
+340248509247875448717161746544246407280913725135059228268131\
+453903691495906528862410006254958805237716723952273129715780\
+425223305517882562616830806755498203755676925741529569939445\
+043490046171854709456730491532189688306135861932534903184518\
+717706426178028900836080044604143054210332610482947502104703\
+032028463320549525316174330585387581543470878545616097381416\
+151451037487775797335749896735101048367502483255117772375025\
+269956476872153642623856062175536913321594213515989059505375\
+135183515207096576145781316398544325320022366962008554087665\
+201050763789833457082359181807492731245904330245198691471329\
+319324627030678762142685799400660305214140453863665517807185\
+105354694177602424937823924511789133225030926924236498557565\
+212794565582753399214908928688568628950225640472058381324292\
+866007645368390366981937596341868992912741319342960598330486\
+905946276235953206760977215407164729909506118583728562718724\
+235732515062300426080741679038098122641980345051854359908213\
+563779664847422505775922437272989231878912994048540484468227\
+199282393172540734295329890896755037903724644870572648941076\
+132423009124870700536763793881894969000042397318202298868940\
+530196108237639578098191879486398269734335286831689173606327\
+500405178476864790935386838169242131756729797688220656276969\
+434749140204830563840068728357383111109865861495106613619153\
+421725274090787422508800568671498311491210197298472420373359\
+044400631309819996507004167876832936101195902219429743174557\
+163362274547892397934880322990633165889175059124060202200452\
+648684577182821651588921716304707095995039972827781680978274\
+973838841958209215836456212939412000456040621743349981715350\
+305133662772937143899882197561295808685181679238411733642697\
+748892466944352640514849114619882270112386610376024527101889\
+119004382703622803911212700216792471528793241950356942780714\
+774957204475130171711488773121937363663487116301055073658645\
+980695862570269762957141239436916216723776945522480189876803\
+386123827956059851911061129713987960026363403936931196519733\
+447116468545744829997003979525368783485129837821983305137448\
+031689360764270759437872004895754351479890333865299565515706\
+690471030702230767978923298480584997256328135245813726407464\
+159230169328539541524724878662873185450510653764301207480799\
+488602832618557388369552461881286225098286358672257087829660\
+174231705350465091313887538950130611513878400895128618426154\
+417299623157313010877679890009181366178705821415173309356192\
+686429159835537275875876767919535369607142366878476025895389\
+279625854409611312402187942369446302119309705461187450803468\
+606366203101933821675974655441744883993796837164178911391575\
+751463591650231265941242686108002052587760190005508737394014\
+453031299745602214380618917954427803281262300931789525045703\
+809571995929933387196864877982754748535701000330924817431298\
+365273697561943437891318220691072831562717726798635382168915\
+187137325209768346284183473712613689334546294053718697897526\
+843398053681374508250012035211936425982389543291022583173280\
+985811169783438836113209408147936547458073361625570571955232\
+746103236016857123149307991441916732438322836596693687161268\
+151183603534413030099360835441935243365729307681545065674775\
+655582111435085683962037818795920337874290127531069511296530\
+746308404963763022896682861683252995925040540038039172626001\
+958340013361801588367655990575379797454237110701588716509764\
+759243657077584013289594787913434812509790293636440469725564\
+222946985585616708175959944099853232059130350099233608207347\
+955460820122006976717445739825352919058005528371183277021250\
+186916447745609162301667393077050176560656798672598371789181\
+232542195795945358691713761483976100058707499929103557275695\
+937295677892604799308353051124627278706035295473126217205599\
+530746756205492173148619619059839609108464715691924592576481\
+382126740168148453274964955074129767533813576349605298268179\
+068244338581354855186516322703199278802275718580352103754433\
+240982354636196477238624205575823556321375833700666021556412\
+182358152808745703724362178773168996492870519432472065091133\
+11767578125001e-4966L;
+/* 0x1.8p-16494 */
+static const long double ld2ae = 0x1p-16494L, ld2be = 0x2p-16494L, ld1ce = 0x2p-16494L;
+static const long double ld2a =
+9.7127626791570376663866584373414698287493540070520215145348\
+265837955593101861790565265072369149749103838172122152721795\
+148808298295738130700276651079589269745641890661270024016251\
+019384577076103591727897583309855871833343782567221021062330\
+520323854737144092431836545425360063420220465935798468889597\
+393404878618618014948930985668173745969857941024624992678516\
+796046407897341714914468689706271051039477065250599233051128\
+834730700520991768191047336500699552011524055936141175278227\
+064109997091342657525775034753507507952039644285302561195715\
+206557908066743405503232817530015665644259150328222704419796\
+441925506500088029030962482377765030782723392665098962794517\
+576730231882534561711832295689196981946271461652617181055665\
+029685844922254588158309151172148171793920968125962871768401\
+514219388391855549421226044104700106207541829733799638752028\
+173330033785725845708464578148564931432318289223948214495353\
+081747057754695954292472958266030251293951030611301194357888\
+019943253579850479798277589149352414382665544987175298434214\
+478200760268387259124784797823102040919106572400856191771348\
+281558462777916462381681390008210723234194499857395959685631\
+103905591697879596717577715572554824817827584594613762331897\
+400606438644266287902006019904862430824505901556613731586390\
+168599701978602862986749723963103806767402004526070426607181\
+825747922672223610811748401048244356042029124854637072147748\
+725579398139682075412513930407121100054336291386326642984001\
+127998334974858209653245050832581320436526628590981309844730\
+407816586888468434842085594277964816488928181716264953794825\
+008820444984449555836465896129531451786104307525226808006600\
+779348570662654426040504120543057111107378732433349774914269\
+114072708176913318160948697397435213257520066915742989940448\
+143697754422357993424629248859049440534892849320746268179914\
+554583983135330126247834945300073309752528242351508345806997\
+166008883707127049913489117882817860966482186638832168035518\
+547034785578194655682192342735350140833854383710286830614088\
+160157865037563419851961350527354941108767405900340732309106\
+276336035381203764047251096208168592703256215746762632401447\
+152692930097455870617179441468393769999033655798513790480379\
+006890871305232768065242533442449079450072575765459163647064\
+342973773862113844201909366754475759002671807165811771132763\
+080642939637475165826471100668049369686467070723571785727451\
+880981477281249312246654190920467838735709729099560268987993\
+922945108459361151792094263319471761024927851228982814252213\
+519491081673366498846956075196529123585663883716590919107614\
+633893976419001988983816482034201465056277885540374744476861\
+750132141428803822571155963108435657119217200055907192435247\
+874999372748282438180554683005862623824642214599119474694103\
+960853742166199856978367947235980051781968651483783495342232\
+954349909573385979410403141459464534634995394356365919502754\
+724946777741899521109008000695745645078551399660814021116536\
+655749435948779817814066783795859497355305214492181630929578\
+847199238542943651540507599871461279285579624694324361023373\
+707531098971698541342280852237066460615431579189178378561194\
+172524973953556992919385025122842333469297321105671995800309\
+309633498690867723547140713111442746824881534458886302917356\
+653091434863492329838352758301829757778933132703869088008094\
+675627125816403572843436425276619486609339270853697062497300\
+328870997605020552097286001653505594207990557642339328807413\
+227100406607755741340441132517749388595948759195317512557878\
+416233575616587901198472089121093330999897692799317101600836\
+099489460591403665960336872530069816871780920562654935511809\
+645452735200740179624950793984014164529466444382558710840503\
+646450512405234491455440034942909031078393317704206940370308\
+684236835526397150556746599533254593941633896202932393007537\
+673266074923116068628384786062194914042771295779439885715389\
+357594885989682121213153533215605128333850742639410724967673\
+883284678814436067523913854991596587657401966348100597154425\
+325485566823423076082201071414803929712348781452793135058870\
+492918348933242055431354758500236922407134394398698076450588\
+396958158802767825944728350880686237998680915415443167076178\
+911739085748840458235337085643267137446973020988327650097647\
+165014946264643975815638479556314291101645367935123993093786\
+582600438548945848259707843279161086198675408925933600311615\
+428118865841645716039791455856756541424710978756200560993332\
+887344427373688627922683426869140915164843256020904560951477\
+891674986393096433202120538411067908090153863118403925770011\
+018063004678778615949475991732024974692553643880962797066439\
+850738990118773176131476115230730262123167407320563510551236\
+743953710665679470765273617718616108994029022776271817109585\
+266594261331597335282139081984596344964057781522191646561827\
+550790563823105342889841684791723392119663413065274464824389\
+193009710215891507033131686963884367885455869616509038575859\
+401565845913422314243208408202380488923480307905914026187792\
+173761338231822535262836663234810324357814170469665216751909\
+358778546855365681180620451075947932208061785930047186745864\
+869465034307360299821666637866586258459810085040702059082829\
+751567542893449238034641018001458509309792474567933738149575\
+554449108144820908702151811237205173697690115303153085234681\
+514152955272511661522989847510493796115116064878740702806004\
+343433164318094216952115530098938898426308252149645340589562\
+644869225768357954631994812409839231441980355794430127694896\
+896491616863512720318746239544591731455028723849548933141295\
+953669192660989415044776894176322467844855976195199023921936\
+699427841174911239593401205926299751407204361412696320213363\
+304107778816937724874521837448233888318479329375321435968913\
+261660516526419532347019419540663257128411929128403012569143\
+516560220706745585698808432508320490642705990501525005042508\
+275152136114303501571602916305930838603123093402367005177263\
+895812313295965866584099164896749137750449430252650456393558\
+866481394042988928722749344174035609284576107405441387577215\
+111650422217580504962998404223989353315671519700308885487441\
+513727141662624359402989615511685507459107087446822399682449\
+124027371539629961321880337101198819624529636970480400208723\
+642799448540704293456340205242051084761997006863111517147530\
+365332128784516968162146751508776010231492748374862213804161\
+453894620976763957492805125680148697998824491969672971166027\
+180656446801877171069880212083821586527774381471938887462267\
+296899230122475689865309301760858111386017280236814433190859\
+056775862835626324841690460105276503738155096364862500284444\
+534355852480049710328635489743555059728455908589253208618030\
+435328529902401798471113159138000614546932833170782820217007\
+280555759644239993454255391040403122345898223865007840565901\
+568897868969477318635101744807938902538658059188203743585010\
+774036188072258210874395280659266831769875140840386730345127\
+896213224531135734216598150684561709935188763611823258429535\
+949485724798457980490432226268479100942840366849845718310701\
+201469881667256363013936740095127208213646187168979882123038\
+233894681808950467950348320835221712924541137611086830583320\
+322392848230358837873140824038588941813883882580818470592924\
+936150343266633985142843655469994569073421029983930187839673\
+231304118378435528853547015678271557689994924601344298390228\
+619544093746214985249883379160686079281428516645627300822824\
+554858971061164154855964833723337825341913008711122841606297\
+197473771096334331602524570534960013696483960191358924434313\
+204392666956909347275363383898878667630642018321060515094118\
+366254498987167810320495485827416968962224010263497699545330\
+700657309536605222308797502818350426296399499436888453557895\
+867230278273510526890091559230412097455704458315552197774216\
+020745527743626346151485239632739221842741175405177684804394\
+361711074487719586587230018764876415713150171856819389147341\
+275669916553647687850492420266494611267030777224588709818335\
+130470138515564128370191474596569064918407585797604709553556\
+153119278534086702508240133812429162630997831448842506314109\
+096085389961648575948522991756162744630412635636848292144248\
+454353112463327392007249690205303145102507449765353317125075\
+809869430616460927871568186526610739964782640547967178516125\
+405550545621289728437343949195632975960067100886025662262995\
+603152291369500371247077545422478193737712990735596074413987\
+957973881092036286428057398201980915642421361590996553421555\
+316064082532807274813471773535367399675092780772709495672695\
+638383696748260197644726786065705886850676921416175143972878\
+598022936105171100945812789025606978738223958028881794991460\
+717838828707859620282931646221494189728518355751185688156172\
+707197545186901278242225037114294367925941035155563079724640\
+691338994542267517327767311818967695636738982145621453404681\
+597847179517622202885989672690265113711173934611717946823228\
+397269027374612101610291381645684907000127191954606896606821\
+590588324712918734294575638459194809203005860495067520818982\
+501215535430594372806160514507726395270189393064661968830908\
+304247420614491691520206185072149333329597584485319840857460\
+265175822272362267526401706014494934473630591895417261120077\
+133201893929459989521012503630498808303587706658289229523671\
+490086823643677193804640968971899497667525177372180606601357\
+946053731548464954766765148914121287985119918483345042934824\
+921516525874627647509368638818236001368121865230049945146050\
+915400988318811431699646592683887426055545037715235200928093\
+246677400833057921544547343859646810337159831128073581305667\
+357013148110868411733638100650377414586379725851070828342144\
+324871613425390515134466319365812090990461348903165220975937\
+942087587710809288871423718310748650171330836567440569630410\
+158371483868179555733183389141963880079090211810793589559200\
+341349405637234489991011938576106350455389513465949915412344\
+095068082292812278313616014687263054439671001595898696547120\
+071413092106692303936769895441754991768984405737441179222392\
+477690507985618624574174635988619556351531961292903622442398\
+465808497855672165108657385643858675294859076016771263488980\
+522695116051395273941662616850391834541635202685385855278463\
+251898869471939032633039670027544098536117464245519928068578\
+059287479506611827627630303758606108821427100635428077686167\
+838877563228833937206563827108338906357929116383562352410405\
+819098609305801465027923966325234651981390511492536734174727\
+254390774950693797823728058324006157763280570016526212182043\
+359093899236806643141856753863283409843786902795368575137111\
+428715987789800161590594633948264245607103000992774452293895\
+095821092685830313673954662073218494688153180395906146506745\
+561411975629305038852550421137841068003638882161156093692580\
+530194161044123524750036105635809277947168629873067749519842\
+957433509350316508339628224443809642374220084876711715865698\
+238309708050571369447923974325750197314968509790081061483804\
+453550810603239090298082506325805730097187923044635197024326\
+966746334305257051886113456387761013622870382593208533889592\
+238925214891289068690048585049758987775121620114117517878005\
+875020040085404765102967971726139392362711332104766149529294\
+277730971232752039868784363740304437529370880909321409176692\
+668840956756850124527879832299559696177391050297700824622043\
+866382460366020930152337219476058757174016585113549831063750\
+560749343236827486905002179231150529681970396017795115367543\
+697626587387836076075141284451928300176122499787310671827087\
+811887033677814397925059153373881836118105886419378651616798\
+592240268616476519445858857179518827325394147075773777729444\
+146380220504445359824894865222389302601440729048815894804537\
+204733015744064565559548968109597836406827155741056311263299\
+722947063908589431715872616727470668964127501101998064669236\
+547074458426237111173086536319506989478611558297416195273399\
+35302734374999e-4966L;
+static const long double ld2b =
+9.7127626791570376663866584373414698287493540070520215145348\
+265837955593101861790565265072369149749103838172122152721795\
+148808298295738130700276651079589269745641890661270024016251\
+019384577076103591727897583309855871833343782567221021062330\
+520323854737144092431836545425360063420220465935798468889597\
+393404878618618014948930985668173745969857941024624992678516\
+796046407897341714914468689706271051039477065250599233051128\
+834730700520991768191047336500699552011524055936141175278227\
+064109997091342657525775034753507507952039644285302561195715\
+206557908066743405503232817530015665644259150328222704419796\
+441925506500088029030962482377765030782723392665098962794517\
+576730231882534561711832295689196981946271461652617181055665\
+029685844922254588158309151172148171793920968125962871768401\
+514219388391855549421226044104700106207541829733799638752028\
+173330033785725845708464578148564931432318289223948214495353\
+081747057754695954292472958266030251293951030611301194357888\
+019943253579850479798277589149352414382665544987175298434214\
+478200760268387259124784797823102040919106572400856191771348\
+281558462777916462381681390008210723234194499857395959685631\
+103905591697879596717577715572554824817827584594613762331897\
+400606438644266287902006019904862430824505901556613731586390\
+168599701978602862986749723963103806767402004526070426607181\
+825747922672223610811748401048244356042029124854637072147748\
+725579398139682075412513930407121100054336291386326642984001\
+127998334974858209653245050832581320436526628590981309844730\
+407816586888468434842085594277964816488928181716264953794825\
+008820444984449555836465896129531451786104307525226808006600\
+779348570662654426040504120543057111107378732433349774914269\
+114072708176913318160948697397435213257520066915742989940448\
+143697754422357993424629248859049440534892849320746268179914\
+554583983135330126247834945300073309752528242351508345806997\
+166008883707127049913489117882817860966482186638832168035518\
+547034785578194655682192342735350140833854383710286830614088\
+160157865037563419851961350527354941108767405900340732309106\
+276336035381203764047251096208168592703256215746762632401447\
+152692930097455870617179441468393769999033655798513790480379\
+006890871305232768065242533442449079450072575765459163647064\
+342973773862113844201909366754475759002671807165811771132763\
+080642939637475165826471100668049369686467070723571785727451\
+880981477281249312246654190920467838735709729099560268987993\
+922945108459361151792094263319471761024927851228982814252213\
+519491081673366498846956075196529123585663883716590919107614\
+633893976419001988983816482034201465056277885540374744476861\
+750132141428803822571155963108435657119217200055907192435247\
+874999372748282438180554683005862623824642214599119474694103\
+960853742166199856978367947235980051781968651483783495342232\
+954349909573385979410403141459464534634995394356365919502754\
+724946777741899521109008000695745645078551399660814021116536\
+655749435948779817814066783795859497355305214492181630929578\
+847199238542943651540507599871461279285579624694324361023373\
+707531098971698541342280852237066460615431579189178378561194\
+172524973953556992919385025122842333469297321105671995800309\
+309633498690867723547140713111442746824881534458886302917356\
+653091434863492329838352758301829757778933132703869088008094\
+675627125816403572843436425276619486609339270853697062497300\
+328870997605020552097286001653505594207990557642339328807413\
+227100406607755741340441132517749388595948759195317512557878\
+416233575616587901198472089121093330999897692799317101600836\
+099489460591403665960336872530069816871780920562654935511809\
+645452735200740179624950793984014164529466444382558710840503\
+646450512405234491455440034942909031078393317704206940370308\
+684236835526397150556746599533254593941633896202932393007537\
+673266074923116068628384786062194914042771295779439885715389\
+357594885989682121213153533215605128333850742639410724967673\
+883284678814436067523913854991596587657401966348100597154425\
+325485566823423076082201071414803929712348781452793135058870\
+492918348933242055431354758500236922407134394398698076450588\
+396958158802767825944728350880686237998680915415443167076178\
+911739085748840458235337085643267137446973020988327650097647\
+165014946264643975815638479556314291101645367935123993093786\
+582600438548945848259707843279161086198675408925933600311615\
+428118865841645716039791455856756541424710978756200560993332\
+887344427373688627922683426869140915164843256020904560951477\
+891674986393096433202120538411067908090153863118403925770011\
+018063004678778615949475991732024974692553643880962797066439\
+850738990118773176131476115230730262123167407320563510551236\
+743953710665679470765273617718616108994029022776271817109585\
+266594261331597335282139081984596344964057781522191646561827\
+550790563823105342889841684791723392119663413065274464824389\
+193009710215891507033131686963884367885455869616509038575859\
+401565845913422314243208408202380488923480307905914026187792\
+173761338231822535262836663234810324357814170469665216751909\
+358778546855365681180620451075947932208061785930047186745864\
+869465034307360299821666637866586258459810085040702059082829\
+751567542893449238034641018001458509309792474567933738149575\
+554449108144820908702151811237205173697690115303153085234681\
+514152955272511661522989847510493796115116064878740702806004\
+343433164318094216952115530098938898426308252149645340589562\
+644869225768357954631994812409839231441980355794430127694896\
+896491616863512720318746239544591731455028723849548933141295\
+953669192660989415044776894176322467844855976195199023921936\
+699427841174911239593401205926299751407204361412696320213363\
+304107778816937724874521837448233888318479329375321435968913\
+261660516526419532347019419540663257128411929128403012569143\
+516560220706745585698808432508320490642705990501525005042508\
+275152136114303501571602916305930838603123093402367005177263\
+895812313295965866584099164896749137750449430252650456393558\
+866481394042988928722749344174035609284576107405441387577215\
+111650422217580504962998404223989353315671519700308885487441\
+513727141662624359402989615511685507459107087446822399682449\
+124027371539629961321880337101198819624529636970480400208723\
+642799448540704293456340205242051084761997006863111517147530\
+365332128784516968162146751508776010231492748374862213804161\
+453894620976763957492805125680148697998824491969672971166027\
+180656446801877171069880212083821586527774381471938887462267\
+296899230122475689865309301760858111386017280236814433190859\
+056775862835626324841690460105276503738155096364862500284444\
+534355852480049710328635489743555059728455908589253208618030\
+435328529902401798471113159138000614546932833170782820217007\
+280555759644239993454255391040403122345898223865007840565901\
+568897868969477318635101744807938902538658059188203743585010\
+774036188072258210874395280659266831769875140840386730345127\
+896213224531135734216598150684561709935188763611823258429535\
+949485724798457980490432226268479100942840366849845718310701\
+201469881667256363013936740095127208213646187168979882123038\
+233894681808950467950348320835221712924541137611086830583320\
+322392848230358837873140824038588941813883882580818470592924\
+936150343266633985142843655469994569073421029983930187839673\
+231304118378435528853547015678271557689994924601344298390228\
+619544093746214985249883379160686079281428516645627300822824\
+554858971061164154855964833723337825341913008711122841606297\
+197473771096334331602524570534960013696483960191358924434313\
+204392666956909347275363383898878667630642018321060515094118\
+366254498987167810320495485827416968962224010263497699545330\
+700657309536605222308797502818350426296399499436888453557895\
+867230278273510526890091559230412097455704458315552197774216\
+020745527743626346151485239632739221842741175405177684804394\
+361711074487719586587230018764876415713150171856819389147341\
+275669916553647687850492420266494611267030777224588709818335\
+130470138515564128370191474596569064918407585797604709553556\
+153119278534086702508240133812429162630997831448842506314109\
+096085389961648575948522991756162744630412635636848292144248\
+454353112463327392007249690205303145102507449765353317125075\
+809869430616460927871568186526610739964782640547967178516125\
+405550545621289728437343949195632975960067100886025662262995\
+603152291369500371247077545422478193737712990735596074413987\
+957973881092036286428057398201980915642421361590996553421555\
+316064082532807274813471773535367399675092780772709495672695\
+638383696748260197644726786065705886850676921416175143972878\
+598022936105171100945812789025606978738223958028881794991460\
+717838828707859620282931646221494189728518355751185688156172\
+707197545186901278242225037114294367925941035155563079724640\
+691338994542267517327767311818967695636738982145621453404681\
+597847179517622202885989672690265113711173934611717946823228\
+397269027374612101610291381645684907000127191954606896606821\
+590588324712918734294575638459194809203005860495067520818982\
+501215535430594372806160514507726395270189393064661968830908\
+304247420614491691520206185072149333329597584485319840857460\
+265175822272362267526401706014494934473630591895417261120077\
+133201893929459989521012503630498808303587706658289229523671\
+490086823643677193804640968971899497667525177372180606601357\
+946053731548464954766765148914121287985119918483345042934824\
+921516525874627647509368638818236001368121865230049945146050\
+915400988318811431699646592683887426055545037715235200928093\
+246677400833057921544547343859646810337159831128073581305667\
+357013148110868411733638100650377414586379725851070828342144\
+324871613425390515134466319365812090990461348903165220975937\
+942087587710809288871423718310748650171330836567440569630410\
+158371483868179555733183389141963880079090211810793589559200\
+341349405637234489991011938576106350455389513465949915412344\
+095068082292812278313616014687263054439671001595898696547120\
+071413092106692303936769895441754991768984405737441179222392\
+477690507985618624574174635988619556351531961292903622442398\
+465808497855672165108657385643858675294859076016771263488980\
+522695116051395273941662616850391834541635202685385855278463\
+251898869471939032633039670027544098536117464245519928068578\
+059287479506611827627630303758606108821427100635428077686167\
+838877563228833937206563827108338906357929116383562352410405\
+819098609305801465027923966325234651981390511492536734174727\
+254390774950693797823728058324006157763280570016526212182043\
+359093899236806643141856753863283409843786902795368575137111\
+428715987789800161590594633948264245607103000992774452293895\
+095821092685830313673954662073218494688153180395906146506745\
+561411975629305038852550421137841068003638882161156093692580\
+530194161044123524750036105635809277947168629873067749519842\
+957433509350316508339628224443809642374220084876711715865698\
+238309708050571369447923974325750197314968509790081061483804\
+453550810603239090298082506325805730097187923044635197024326\
+966746334305257051886113456387761013622870382593208533889592\
+238925214891289068690048585049758987775121620114117517878005\
+875020040085404765102967971726139392362711332104766149529294\
+277730971232752039868784363740304437529370880909321409176692\
+668840956756850124527879832299559696177391050297700824622043\
+866382460366020930152337219476058757174016585113549831063750\
+560749343236827486905002179231150529681970396017795115367543\
+697626587387836076075141284451928300176122499787310671827087\
+811887033677814397925059153373881836118105886419378651616798\
+592240268616476519445858857179518827325394147075773777729444\
+146380220504445359824894865222389302601440729048815894804537\
+204733015744064565559548968109597836406827155741056311263299\
+722947063908589431715872616727470668964127501101998064669236\
+547074458426237111173086536319506989478611558297416195273399\
+35302734375e-4966L;
+static const long double ld2c =
+9.7127626791570376663866584373414698287493540070520215145348\
+265837955593101861790565265072369149749103838172122152721795\
+148808298295738130700276651079589269745641890661270024016251\
+019384577076103591727897583309855871833343782567221021062330\
+520323854737144092431836545425360063420220465935798468889597\
+393404878618618014948930985668173745969857941024624992678516\
+796046407897341714914468689706271051039477065250599233051128\
+834730700520991768191047336500699552011524055936141175278227\
+064109997091342657525775034753507507952039644285302561195715\
+206557908066743405503232817530015665644259150328222704419796\
+441925506500088029030962482377765030782723392665098962794517\
+576730231882534561711832295689196981946271461652617181055665\
+029685844922254588158309151172148171793920968125962871768401\
+514219388391855549421226044104700106207541829733799638752028\
+173330033785725845708464578148564931432318289223948214495353\
+081747057754695954292472958266030251293951030611301194357888\
+019943253579850479798277589149352414382665544987175298434214\
+478200760268387259124784797823102040919106572400856191771348\
+281558462777916462381681390008210723234194499857395959685631\
+103905591697879596717577715572554824817827584594613762331897\
+400606438644266287902006019904862430824505901556613731586390\
+168599701978602862986749723963103806767402004526070426607181\
+825747922672223610811748401048244356042029124854637072147748\
+725579398139682075412513930407121100054336291386326642984001\
+127998334974858209653245050832581320436526628590981309844730\
+407816586888468434842085594277964816488928181716264953794825\
+008820444984449555836465896129531451786104307525226808006600\
+779348570662654426040504120543057111107378732433349774914269\
+114072708176913318160948697397435213257520066915742989940448\
+143697754422357993424629248859049440534892849320746268179914\
+554583983135330126247834945300073309752528242351508345806997\
+166008883707127049913489117882817860966482186638832168035518\
+547034785578194655682192342735350140833854383710286830614088\
+160157865037563419851961350527354941108767405900340732309106\
+276336035381203764047251096208168592703256215746762632401447\
+152692930097455870617179441468393769999033655798513790480379\
+006890871305232768065242533442449079450072575765459163647064\
+342973773862113844201909366754475759002671807165811771132763\
+080642939637475165826471100668049369686467070723571785727451\
+880981477281249312246654190920467838735709729099560268987993\
+922945108459361151792094263319471761024927851228982814252213\
+519491081673366498846956075196529123585663883716590919107614\
+633893976419001988983816482034201465056277885540374744476861\
+750132141428803822571155963108435657119217200055907192435247\
+874999372748282438180554683005862623824642214599119474694103\
+960853742166199856978367947235980051781968651483783495342232\
+954349909573385979410403141459464534634995394356365919502754\
+724946777741899521109008000695745645078551399660814021116536\
+655749435948779817814066783795859497355305214492181630929578\
+847199238542943651540507599871461279285579624694324361023373\
+707531098971698541342280852237066460615431579189178378561194\
+172524973953556992919385025122842333469297321105671995800309\
+309633498690867723547140713111442746824881534458886302917356\
+653091434863492329838352758301829757778933132703869088008094\
+675627125816403572843436425276619486609339270853697062497300\
+328870997605020552097286001653505594207990557642339328807413\
+227100406607755741340441132517749388595948759195317512557878\
+416233575616587901198472089121093330999897692799317101600836\
+099489460591403665960336872530069816871780920562654935511809\
+645452735200740179624950793984014164529466444382558710840503\
+646450512405234491455440034942909031078393317704206940370308\
+684236835526397150556746599533254593941633896202932393007537\
+673266074923116068628384786062194914042771295779439885715389\
+357594885989682121213153533215605128333850742639410724967673\
+883284678814436067523913854991596587657401966348100597154425\
+325485566823423076082201071414803929712348781452793135058870\
+492918348933242055431354758500236922407134394398698076450588\
+396958158802767825944728350880686237998680915415443167076178\
+911739085748840458235337085643267137446973020988327650097647\
+165014946264643975815638479556314291101645367935123993093786\
+582600438548945848259707843279161086198675408925933600311615\
+428118865841645716039791455856756541424710978756200560993332\
+887344427373688627922683426869140915164843256020904560951477\
+891674986393096433202120538411067908090153863118403925770011\
+018063004678778615949475991732024974692553643880962797066439\
+850738990118773176131476115230730262123167407320563510551236\
+743953710665679470765273617718616108994029022776271817109585\
+266594261331597335282139081984596344964057781522191646561827\
+550790563823105342889841684791723392119663413065274464824389\
+193009710215891507033131686963884367885455869616509038575859\
+401565845913422314243208408202380488923480307905914026187792\
+173761338231822535262836663234810324357814170469665216751909\
+358778546855365681180620451075947932208061785930047186745864\
+869465034307360299821666637866586258459810085040702059082829\
+751567542893449238034641018001458509309792474567933738149575\
+554449108144820908702151811237205173697690115303153085234681\
+514152955272511661522989847510493796115116064878740702806004\
+343433164318094216952115530098938898426308252149645340589562\
+644869225768357954631994812409839231441980355794430127694896\
+896491616863512720318746239544591731455028723849548933141295\
+953669192660989415044776894176322467844855976195199023921936\
+699427841174911239593401205926299751407204361412696320213363\
+304107778816937724874521837448233888318479329375321435968913\
+261660516526419532347019419540663257128411929128403012569143\
+516560220706745585698808432508320490642705990501525005042508\
+275152136114303501571602916305930838603123093402367005177263\
+895812313295965866584099164896749137750449430252650456393558\
+866481394042988928722749344174035609284576107405441387577215\
+111650422217580504962998404223989353315671519700308885487441\
+513727141662624359402989615511685507459107087446822399682449\
+124027371539629961321880337101198819624529636970480400208723\
+642799448540704293456340205242051084761997006863111517147530\
+365332128784516968162146751508776010231492748374862213804161\
+453894620976763957492805125680148697998824491969672971166027\
+180656446801877171069880212083821586527774381471938887462267\
+296899230122475689865309301760858111386017280236814433190859\
+056775862835626324841690460105276503738155096364862500284444\
+534355852480049710328635489743555059728455908589253208618030\
+435328529902401798471113159138000614546932833170782820217007\
+280555759644239993454255391040403122345898223865007840565901\
+568897868969477318635101744807938902538658059188203743585010\
+774036188072258210874395280659266831769875140840386730345127\
+896213224531135734216598150684561709935188763611823258429535\
+949485724798457980490432226268479100942840366849845718310701\
+201469881667256363013936740095127208213646187168979882123038\
+233894681808950467950348320835221712924541137611086830583320\
+322392848230358837873140824038588941813883882580818470592924\
+936150343266633985142843655469994569073421029983930187839673\
+231304118378435528853547015678271557689994924601344298390228\
+619544093746214985249883379160686079281428516645627300822824\
+554858971061164154855964833723337825341913008711122841606297\
+197473771096334331602524570534960013696483960191358924434313\
+204392666956909347275363383898878667630642018321060515094118\
+366254498987167810320495485827416968962224010263497699545330\
+700657309536605222308797502818350426296399499436888453557895\
+867230278273510526890091559230412097455704458315552197774216\
+020745527743626346151485239632739221842741175405177684804394\
+361711074487719586587230018764876415713150171856819389147341\
+275669916553647687850492420266494611267030777224588709818335\
+130470138515564128370191474596569064918407585797604709553556\
+153119278534086702508240133812429162630997831448842506314109\
+096085389961648575948522991756162744630412635636848292144248\
+454353112463327392007249690205303145102507449765353317125075\
+809869430616460927871568186526610739964782640547967178516125\
+405550545621289728437343949195632975960067100886025662262995\
+603152291369500371247077545422478193737712990735596074413987\
+957973881092036286428057398201980915642421361590996553421555\
+316064082532807274813471773535367399675092780772709495672695\
+638383696748260197644726786065705886850676921416175143972878\
+598022936105171100945812789025606978738223958028881794991460\
+717838828707859620282931646221494189728518355751185688156172\
+707197545186901278242225037114294367925941035155563079724640\
+691338994542267517327767311818967695636738982145621453404681\
+597847179517622202885989672690265113711173934611717946823228\
+397269027374612101610291381645684907000127191954606896606821\
+590588324712918734294575638459194809203005860495067520818982\
+501215535430594372806160514507726395270189393064661968830908\
+304247420614491691520206185072149333329597584485319840857460\
+265175822272362267526401706014494934473630591895417261120077\
+133201893929459989521012503630498808303587706658289229523671\
+490086823643677193804640968971899497667525177372180606601357\
+946053731548464954766765148914121287985119918483345042934824\
+921516525874627647509368638818236001368121865230049945146050\
+915400988318811431699646592683887426055545037715235200928093\
+246677400833057921544547343859646810337159831128073581305667\
+357013148110868411733638100650377414586379725851070828342144\
+324871613425390515134466319365812090990461348903165220975937\
+942087587710809288871423718310748650171330836567440569630410\
+158371483868179555733183389141963880079090211810793589559200\
+341349405637234489991011938576106350455389513465949915412344\
+095068082292812278313616014687263054439671001595898696547120\
+071413092106692303936769895441754991768984405737441179222392\
+477690507985618624574174635988619556351531961292903622442398\
+465808497855672165108657385643858675294859076016771263488980\
+522695116051395273941662616850391834541635202685385855278463\
+251898869471939032633039670027544098536117464245519928068578\
+059287479506611827627630303758606108821427100635428077686167\
+838877563228833937206563827108338906357929116383562352410405\
+819098609305801465027923966325234651981390511492536734174727\
+254390774950693797823728058324006157763280570016526212182043\
+359093899236806643141856753863283409843786902795368575137111\
+428715987789800161590594633948264245607103000992774452293895\
+095821092685830313673954662073218494688153180395906146506745\
+561411975629305038852550421137841068003638882161156093692580\
+530194161044123524750036105635809277947168629873067749519842\
+957433509350316508339628224443809642374220084876711715865698\
+238309708050571369447923974325750197314968509790081061483804\
+453550810603239090298082506325805730097187923044635197024326\
+966746334305257051886113456387761013622870382593208533889592\
+238925214891289068690048585049758987775121620114117517878005\
+875020040085404765102967971726139392362711332104766149529294\
+277730971232752039868784363740304437529370880909321409176692\
+668840956756850124527879832299559696177391050297700824622043\
+866382460366020930152337219476058757174016585113549831063750\
+560749343236827486905002179231150529681970396017795115367543\
+697626587387836076075141284451928300176122499787310671827087\
+811887033677814397925059153373881836118105886419378651616798\
+592240268616476519445858857179518827325394147075773777729444\
+146380220504445359824894865222389302601440729048815894804537\
+204733015744064565559548968109597836406827155741056311263299\
+722947063908589431715872616727470668964127501101998064669236\
+547074458426237111173086536319506989478611558297416195273399\
+35302734375001e-4966L;
+/* 0x1.00000000000000000000000000008p16383 */
+static const long double ld3ae = 0x1p16383L, ld3be = 0x1p16383L, ld3ce = 0x1.0000000000000000000000000001p16383L;
+static const long double ld3a =
+5.9486574767861588254287966331400362266521016077566321470782\
+537912717956830282749074200158904838100315216442070246474582\
+902003466452178519493817532236893426065414065500349426609921\
+035191682920005861156266113904955955975156868485667432573303\
+878926292023832306985858165533616318247459636179261303962505\
+904914506095247123433601806274279678546351097459236573913920\
+031119173565521719790447288258729779003490433862818295682642\
+966216118764004792730459319737327354906008978235133081179386\
+661103577408353480771246949457853166617701522167422003413661\
+284349262437896929014552545611813747697933241007066137144800\
+742052491919942298834913628182656296203230288447275444631994\
+418174246363265098248611943128819168942591708210157385631417\
+956400560296628065072016801065604053356267458749418972817500\
+860163920552394032596390414022010839803056885484295371329659\
+344624001094572196271168792142488910586863048428263135994222\
+918660801863635503541746352435642903327106245556596971697306\
+154375736529491499973297647239267168544491542059174479409314\
+453930981788080813637734358380528957486229480817553751111130\
+404254432007093360403147894746265072027252334199618554793914\
+408408563073872776198001518686536858983411123156743992398602\
+085226973929708268146742705557350571330511483380748376403472\
+416543579901056379914358020396036857647833383066531875675143\
+906511120597222727322243981995901699031025427175941279288823\
+868963521340475095965307606235778429805072284801680535137734\
+383642104178041358430293569208331406005130704155581295151191\
+023575851522079817808333970280354640050199344622016227349001\
+158400930280667186488774262251890453600109065837537684194570\
+764422774923245437306731669764159584659798151950637627762794\
+773771743234047950402370403351226180108444229650943701626484\
+199813157683590670152514287926030050893275989087988431157294\
+053225152320381185461962202878894704210605536874860744635921\
+856800920799848781308318732102232154544901177747472418520161\
+539850654183977571241391795912749098112352006092865789718049\
+308722403022684428414862730635213534446271587083620368851394\
+539053886621230946713996355227159995125430034494483477708852\
+290917108703653719242299789100268057863851224567265334616704\
+172517852701300018859009181286438758473871366303386211559752\
+189988549719766361306120241141163757479824826687017385967199\
+730649217746155593260923125994938678356692052428393066501806\
+030161358556419313420716683771612548240263459903320490075985\
+482955242306590857238462197972208846146747634114611463194143\
+127229709932188005016692926586196070737427116881065809283735\
+578248117685225847553587906225824731173075427424421056682930\
+008434666477496431516691881829440430197100204332606435934395\
+919650053069892524027974091575173698894803107552411683630872\
+565514028274910395383420510115859479233531504702656455261624\
+525121293886827716275308028935388238178963278225114817400178\
+138358373030159940110845417191798464503817960506134575572552\
+914585335913528444536373142082490326061583126796147603336390\
+503084982226891516248370317420733394038771780044922478150880\
+480334844447412365553656029955296322473008695074712792828366\
+405738282245039545396582938290818627301780773130202921675326\
+417583673495241569334204568141534153408474297319168484568799\
+451491133718839097374713416523361939237171154953070144389353\
+699828605993755613252573941610133829557167740458222617685028\
+690018342727148122013513056358815140027414679795450105000784\
+206522215604435223172005007036171570530334304897008809135848\
+675229547083561399988252552429769084290516103080260036003448\
+294799988351419108088251107290628711358276092795741489822211\
+879153727229891058795497426373608319405317602924241055836665\
+412584135657242160003706626205312971822953452930840783143003\
+733239017808969394445195220787737174218027747221253900890536\
+730326425051240764874006627032589076376990325467270006751475\
+463920721323985366812116303998245085483206258613663624851716\
+293180303624443281556295689730668616708901429287181381627670\
+203893651414675005136379365959571811951919653635887567699289\
+348324076406793991923217469674198904524716009847788439650157\
+995310043698774137542541699134940585662745702625097983274489\
+141416414789061652098131796728731652650516767112149192122453\
+562328802846445391417036742140146906572447511494124473885963\
+235217227016424204095604485308686968373890645296189932416571\
+281295736247619241329068636405743573306087991776733585972793\
+132869616481671565021096885870153734254648327143225051745267\
+530463119926261147612098111086806545372953526471421579845285\
+862975776235466663857936867536855924718593170503922894779577\
+706239977813334283740751103082483280516469722321753891088699\
+714361755511843803441649441302693703577359971743834932539197\
+595873998629500074441134301810890941848881837426270390549007\
+490141375766653241037340192392236932759127069111401216220596\
+540958515892047794438580629374176225297401789362125586732528\
+367695144980519774116001979888033796577336271850743828263427\
+598863925843301048044096576340652808516459551933515596083641\
+0468395384831999e+4931L;
+static const long double ld3b =
+5.9486574767861588254287966331400362266521016077566321470782\
+537912717956830282749074200158904838100315216442070246474582\
+902003466452178519493817532236893426065414065500349426609921\
+035191682920005861156266113904955955975156868485667432573303\
+878926292023832306985858165533616318247459636179261303962505\
+904914506095247123433601806274279678546351097459236573913920\
+031119173565521719790447288258729779003490433862818295682642\
+966216118764004792730459319737327354906008978235133081179386\
+661103577408353480771246949457853166617701522167422003413661\
+284349262437896929014552545611813747697933241007066137144800\
+742052491919942298834913628182656296203230288447275444631994\
+418174246363265098248611943128819168942591708210157385631417\
+956400560296628065072016801065604053356267458749418972817500\
+860163920552394032596390414022010839803056885484295371329659\
+344624001094572196271168792142488910586863048428263135994222\
+918660801863635503541746352435642903327106245556596971697306\
+154375736529491499973297647239267168544491542059174479409314\
+453930981788080813637734358380528957486229480817553751111130\
+404254432007093360403147894746265072027252334199618554793914\
+408408563073872776198001518686536858983411123156743992398602\
+085226973929708268146742705557350571330511483380748376403472\
+416543579901056379914358020396036857647833383066531875675143\
+906511120597222727322243981995901699031025427175941279288823\
+868963521340475095965307606235778429805072284801680535137734\
+383642104178041358430293569208331406005130704155581295151191\
+023575851522079817808333970280354640050199344622016227349001\
+158400930280667186488774262251890453600109065837537684194570\
+764422774923245437306731669764159584659798151950637627762794\
+773771743234047950402370403351226180108444229650943701626484\
+199813157683590670152514287926030050893275989087988431157294\
+053225152320381185461962202878894704210605536874860744635921\
+856800920799848781308318732102232154544901177747472418520161\
+539850654183977571241391795912749098112352006092865789718049\
+308722403022684428414862730635213534446271587083620368851394\
+539053886621230946713996355227159995125430034494483477708852\
+290917108703653719242299789100268057863851224567265334616704\
+172517852701300018859009181286438758473871366303386211559752\
+189988549719766361306120241141163757479824826687017385967199\
+730649217746155593260923125994938678356692052428393066501806\
+030161358556419313420716683771612548240263459903320490075985\
+482955242306590857238462197972208846146747634114611463194143\
+127229709932188005016692926586196070737427116881065809283735\
+578248117685225847553587906225824731173075427424421056682930\
+008434666477496431516691881829440430197100204332606435934395\
+919650053069892524027974091575173698894803107552411683630872\
+565514028274910395383420510115859479233531504702656455261624\
+525121293886827716275308028935388238178963278225114817400178\
+138358373030159940110845417191798464503817960506134575572552\
+914585335913528444536373142082490326061583126796147603336390\
+503084982226891516248370317420733394038771780044922478150880\
+480334844447412365553656029955296322473008695074712792828366\
+405738282245039545396582938290818627301780773130202921675326\
+417583673495241569334204568141534153408474297319168484568799\
+451491133718839097374713416523361939237171154953070144389353\
+699828605993755613252573941610133829557167740458222617685028\
+690018342727148122013513056358815140027414679795450105000784\
+206522215604435223172005007036171570530334304897008809135848\
+675229547083561399988252552429769084290516103080260036003448\
+294799988351419108088251107290628711358276092795741489822211\
+879153727229891058795497426373608319405317602924241055836665\
+412584135657242160003706626205312971822953452930840783143003\
+733239017808969394445195220787737174218027747221253900890536\
+730326425051240764874006627032589076376990325467270006751475\
+463920721323985366812116303998245085483206258613663624851716\
+293180303624443281556295689730668616708901429287181381627670\
+203893651414675005136379365959571811951919653635887567699289\
+348324076406793991923217469674198904524716009847788439650157\
+995310043698774137542541699134940585662745702625097983274489\
+141416414789061652098131796728731652650516767112149192122453\
+562328802846445391417036742140146906572447511494124473885963\
+235217227016424204095604485308686968373890645296189932416571\
+281295736247619241329068636405743573306087991776733585972793\
+132869616481671565021096885870153734254648327143225051745267\
+530463119926261147612098111086806545372953526471421579845285\
+862975776235466663857936867536855924718593170503922894779577\
+706239977813334283740751103082483280516469722321753891088699\
+714361755511843803441649441302693703577359971743834932539197\
+595873998629500074441134301810890941848881837426270390549007\
+490141375766653241037340192392236932759127069111401216220596\
+540958515892047794438580629374176225297401789362125586732528\
+367695144980519774116001979888033796577336271850743828263427\
+598863925843301048044096576340652808516459551933515596083641\
+0468395384832e+4931L;
+static const long double ld3c =
+5.9486574767861588254287966331400362266521016077566321470782\
+537912717956830282749074200158904838100315216442070246474582\
+902003466452178519493817532236893426065414065500349426609921\
+035191682920005861156266113904955955975156868485667432573303\
+878926292023832306985858165533616318247459636179261303962505\
+904914506095247123433601806274279678546351097459236573913920\
+031119173565521719790447288258729779003490433862818295682642\
+966216118764004792730459319737327354906008978235133081179386\
+661103577408353480771246949457853166617701522167422003413661\
+284349262437896929014552545611813747697933241007066137144800\
+742052491919942298834913628182656296203230288447275444631994\
+418174246363265098248611943128819168942591708210157385631417\
+956400560296628065072016801065604053356267458749418972817500\
+860163920552394032596390414022010839803056885484295371329659\
+344624001094572196271168792142488910586863048428263135994222\
+918660801863635503541746352435642903327106245556596971697306\
+154375736529491499973297647239267168544491542059174479409314\
+453930981788080813637734358380528957486229480817553751111130\
+404254432007093360403147894746265072027252334199618554793914\
+408408563073872776198001518686536858983411123156743992398602\
+085226973929708268146742705557350571330511483380748376403472\
+416543579901056379914358020396036857647833383066531875675143\
+906511120597222727322243981995901699031025427175941279288823\
+868963521340475095965307606235778429805072284801680535137734\
+383642104178041358430293569208331406005130704155581295151191\
+023575851522079817808333970280354640050199344622016227349001\
+158400930280667186488774262251890453600109065837537684194570\
+764422774923245437306731669764159584659798151950637627762794\
+773771743234047950402370403351226180108444229650943701626484\
+199813157683590670152514287926030050893275989087988431157294\
+053225152320381185461962202878894704210605536874860744635921\
+856800920799848781308318732102232154544901177747472418520161\
+539850654183977571241391795912749098112352006092865789718049\
+308722403022684428414862730635213534446271587083620368851394\
+539053886621230946713996355227159995125430034494483477708852\
+290917108703653719242299789100268057863851224567265334616704\
+172517852701300018859009181286438758473871366303386211559752\
+189988549719766361306120241141163757479824826687017385967199\
+730649217746155593260923125994938678356692052428393066501806\
+030161358556419313420716683771612548240263459903320490075985\
+482955242306590857238462197972208846146747634114611463194143\
+127229709932188005016692926586196070737427116881065809283735\
+578248117685225847553587906225824731173075427424421056682930\
+008434666477496431516691881829440430197100204332606435934395\
+919650053069892524027974091575173698894803107552411683630872\
+565514028274910395383420510115859479233531504702656455261624\
+525121293886827716275308028935388238178963278225114817400178\
+138358373030159940110845417191798464503817960506134575572552\
+914585335913528444536373142082490326061583126796147603336390\
+503084982226891516248370317420733394038771780044922478150880\
+480334844447412365553656029955296322473008695074712792828366\
+405738282245039545396582938290818627301780773130202921675326\
+417583673495241569334204568141534153408474297319168484568799\
+451491133718839097374713416523361939237171154953070144389353\
+699828605993755613252573941610133829557167740458222617685028\
+690018342727148122013513056358815140027414679795450105000784\
+206522215604435223172005007036171570530334304897008809135848\
+675229547083561399988252552429769084290516103080260036003448\
+294799988351419108088251107290628711358276092795741489822211\
+879153727229891058795497426373608319405317602924241055836665\
+412584135657242160003706626205312971822953452930840783143003\
+733239017808969394445195220787737174218027747221253900890536\
+730326425051240764874006627032589076376990325467270006751475\
+463920721323985366812116303998245085483206258613663624851716\
+293180303624443281556295689730668616708901429287181381627670\
+203893651414675005136379365959571811951919653635887567699289\
+348324076406793991923217469674198904524716009847788439650157\
+995310043698774137542541699134940585662745702625097983274489\
+141416414789061652098131796728731652650516767112149192122453\
+562328802846445391417036742140146906572447511494124473885963\
+235217227016424204095604485308686968373890645296189932416571\
+281295736247619241329068636405743573306087991776733585972793\
+132869616481671565021096885870153734254648327143225051745267\
+530463119926261147612098111086806545372953526471421579845285\
+862975776235466663857936867536855924718593170503922894779577\
+706239977813334283740751103082483280516469722321753891088699\
+714361755511843803441649441302693703577359971743834932539197\
+595873998629500074441134301810890941848881837426270390549007\
+490141375766653241037340192392236932759127069111401216220596\
+540958515892047794438580629374176225297401789362125586732528\
+367695144980519774116001979888033796577336271850743828263427\
+598863925843301048044096576340652808516459551933515596083641\
+0468395384832001e+4931L;
+#endif
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+#ifdef FLT_OK
+ if (f1a != f1ae
+ || f1b != f1be
+ || f1c != f1ce
+ || f2a != f2ae
+ || f2b != f2be
+ || f2c != f2ce
+ || f3a != f3ae
+ || f3b != f3be
+ || f3c != f3ce)
+ abort ();
+#endif
+#ifdef DBL_OK
+ if (d1a != d1ae
+ || d1b != d1be
+ || d1c != d1ce
+ || d2a != d2ae
+ || d2b != d2be
+ || d2c != d2ce
+ || d3a != d3ae
+ || d3b != d3be
+ || d3c != d3ce)
+ abort ();
+#endif
+#ifdef LDBL_OK
+ if (ld1a != ld1ae
+ || ld1b != ld1be
+ || ld1c != ld1ce
+ || ld2a != ld2ae
+ || ld2b != ld2be
+ || ld2c != ld2ce
+ || ld3a != ld3ae
+ || ld3b != ld3be
+ || ld3c != ld3ce)
+ abort ();
+#endif
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr54300.C b/gcc/testsuite/gcc.target/arm/pr54300.C
new file mode 100644
index 00000000000..eb1a74e36cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr54300.C
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_neon } */
+
+#include <arm_neon.h>
+#include <stdlib.h>
+
+struct __attribute__ ((aligned(8))) _v16u8_ {
+ uint8x16_t val;
+ _v16u8_( const int16x8_t &src) { val = vreinterpretq_u8_s16(src); }
+ operator int16x8_t () const { return vreinterpretq_s16_u8(val); }
+};
+typedef struct _v16u8_ v16u8;
+
+struct __attribute__ ((aligned(4))) _v8u8_ {
+ uint8x8_t val;
+ _v8u8_( const uint8x8_t &src) { val = src; }
+ operator int16x4_t () const { return vreinterpret_s16_u8(val); }
+};
+typedef struct _v8u8_ v8u8;
+
+typedef v16u8 v8i16;
+typedef int32x4_t v4i32;
+typedef const short cv1i16;
+typedef const unsigned char cv1u8;
+typedef const v8i16 cv8i16;
+
+static inline __attribute__((always_inline)) v8u8 zero_64(){ return vdup_n_u8( 0 ); }
+
+static inline __attribute__((always_inline)) v8i16 loadlo_8i16( cv8i16* p ){
+ return vcombine_s16( vld1_s16( (cv1i16 *)p ), zero_64() );
+}
+static inline __attribute__((always_inline)) v8i16 _loadlo_8i16( cv8i16* p, int offset ){
+ return loadlo_8i16( (cv8i16*)(&((cv1u8*)p)[offset]) );
+}
+
+void __attribute__((noinline))
+test(unsigned short *_Inp, int32_t *_Out,
+ unsigned int s1v, unsigned int dv0,
+ unsigned int smask_v)
+{
+ int32x4_t c = vdupq_n_s32(0);
+
+ for(unsigned int sv=0 ; sv!=dv0 ; sv=(sv+s1v)&smask_v )
+ {
+ int32x4_t s;
+ s = vmovl_s16( vget_low_s16( _loadlo_8i16( (cv8i16*) _Inp, sv ) ) );
+ c = vaddq_s32( c, s );
+ }
+ vst1q_s32( _Out, c );
+}
+
+main()
+{
+ unsigned short a[4] = {1, 2, 3, 4};
+ int32_t b[4] = {0, 0, 0, 0};
+ test(a, b, 1, 1, ~0);
+ if (b[0] != 1 || b[1] != 2 || b[2] != 3 || b[3] != 4)
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59133.c b/gcc/testsuite/gcc.target/i386/pr59133.c
new file mode 100644
index 00000000000..ef8ef741de9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59133.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -ffast-math -march=core-avx2" } */
+
+#define XX 0
+#define YY 1
+#define ZZ 2
+#define DIM 3
+typedef float matrix[DIM][DIM];
+typedef float rvec[DIM];
+extern int det (matrix);
+extern void foo(matrix);
+
+void bar1 (int n,int *index,rvec x[],matrix trans)
+{
+ float xt,yt,zt;
+ int i,ii;
+
+ for(i=0; (i<n); i++) {
+ ii=index ? index[i] : i;
+ xt=x[ii][XX];
+ yt=x[ii][YY];
+ zt=x[ii][ZZ];
+ x[ii][XX]=trans[XX][XX]*xt+trans[XX][YY]*yt+trans[XX][ZZ]*zt;
+ x[ii][YY]=trans[YY][XX]*xt+trans[YY][YY]*yt+trans[YY][ZZ]*zt;
+ x[ii][ZZ]=trans[ZZ][XX]*xt+trans[ZZ][YY]*yt+trans[ZZ][ZZ]*zt;
+ }
+}
+
+
+void bar2 (int n, rvec x[])
+{
+ int m;
+ matrix trans;
+
+ foo (trans);
+
+ if (det (trans) < 0) {
+ for(m=0; (m<DIM); m++)
+ trans[ZZ][m] = -trans[ZZ][m];
+ }
+ bar1 (n,(int*) 0,x,trans);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c b/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
index 0692b3d8069..14b56d0828b 100644
--- a/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
@@ -11,7 +11,11 @@ int msw(long long in)
int i[2];
} ud;
ud.ll = in;
+#ifdef __LITTLE_ENDIAN__
+ return ud.i[1];
+#else
return ud.i[0];
+#endif
}
int main()
diff --git a/gcc/testsuite/gcc.target/powerpc/pr48258-1.c b/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
index 4f37815d384..3ccbf7693d9 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O3 -mcpu=power7 -mabi=altivec -ffast-math -fno-unroll-loops" } */
/* { dg-final { scan-assembler-times "xvaddsp" 3 } } */
diff --git a/gcc/testsuite/gcc.target/sh/pr53976-1.c b/gcc/testsuite/gcc.target/sh/pr53976-1.c
new file mode 100644
index 00000000000..4893b0668a5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr53976-1.c
@@ -0,0 +1,41 @@
+/* Check that the SH specific sh_optimize_sett_clrt RTL optimization pass
+ works as expected. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
+/* { dg-final { scan-assembler-times "clrt" 2 } } */
+/* { dg-final { scan-assembler-times "sett" 1 } } */
+
+long long
+test_00 (long long a, long long b, long long c, int d)
+{
+ /* One of the blocks should have a clrt and the other one should not. */
+ if (d > 5)
+ return a + b;
+ else
+ return a + c;
+}
+
+long long
+test_01 (long long a, long long b)
+{
+ /* Must see a clrt because T bit is undefined at function entry. */
+ return a + b;
+}
+
+int
+test_02 (const char* a)
+{
+ /* Must not see a sett after the inlined strlen. */
+ return __builtin_strlen (a);
+}
+
+int
+test_03 (int a, int b, int c, int d)
+{
+ /* One of the blocks should have a sett and the other one should not. */
+ if (d > 4)
+ return a + b + 1;
+ else
+ return a + c + 1;
+}
diff --git a/gcc/testsuite/gfortran.dg/erf_3.F90 b/gcc/testsuite/gfortran.dg/erf_3.F90
new file mode 100644
index 00000000000..d9d65898984
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/erf_3.F90
@@ -0,0 +1,53 @@
+! { dg-do run { xfail spu-*-* ia64-*-linux* } }
+! { dg-options "-fno-range-check -ffree-line-length-none -O0" }
+! { dg-add-options ieee }
+!
+! Check that simplification functions and runtime library agree on ERF,
+! ERFC and ERFC_SCALED, for quadruple-precision.
+!
+! XFAILed for SPU targets because our library implementation of
+! the double-precision erf/erfc functions is not accurate enough.
+!
+! XFAILed for IA64 Linux because of a glibc bug:
+! http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59227
+
+program test
+ use, intrinsic :: iso_fortran_env
+ implicit none
+
+ ! QP will be the largest supported real kind, possibly real(kind=16)
+ integer, parameter :: qp = real_kinds(ubound(real_kinds,dim=1))
+ real(kind=qp) :: x
+
+#define CHECK(a) \
+ x = a ; \
+ call check(erf(real(a,kind=qp)), erf(x)) ; \
+ call check(erfc(real(a,kind=qp)), erfc(x)) ; \
+ call check(erfc_scaled(real(a,kind=qp)), erfc_scaled(x))
+
+ CHECK(0.0)
+ CHECK(0.9)
+ CHECK(1.9)
+ CHECK(10.)
+ CHECK(11.)
+ CHECK(12.)
+ CHECK(13.)
+ CHECK(14.)
+ CHECK(49.)
+ CHECK(190.)
+
+ CHECK(-0.0)
+ CHECK(-0.9)
+ CHECK(-1.9)
+ CHECK(-19.)
+ CHECK(-190.)
+
+contains
+
+ subroutine check (a, b)
+ real(kind=qp), intent(in) :: a, b
+ print *, abs(a-b) / spacing(a)
+ if (abs(a - b) > 10 * spacing(a)) call abort
+ end subroutine
+
+end program test
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 4e5adc28a06..5ae70abc29e 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -237,7 +237,7 @@ cleanup_control_flow_bb (basic_block bb)
the start of the successor block.
As a precondition, we require that BB be not equal to
- ENTRY_BLOCK_PTR. */
+ the entry block. */
static bool
tree_forwarder_block_p (basic_block bb, bool phi_wanted)
@@ -250,7 +250,7 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
/* If PHI_WANTED is false, BB must not have any PHI nodes.
Otherwise, BB must have PHI nodes. */
|| gimple_seq_empty_p (phi_nodes (bb)) == phi_wanted
- /* BB may not be a predecessor of EXIT_BLOCK_PTR. */
+ /* BB may not be a predecessor of the exit block. */
|| single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun)
/* Nor should this be an infinite loop. */
|| single_succ (bb) == bb
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b95a1885216..e905ab8ebf1 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2431,9 +2431,10 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
/* Register specific tree functions. */
gimple_register_cfg_hooks ();
- /* If we are inlining just region of the function, make sure to connect new entry
- to ENTRY_BLOCK_PTR. Since new entry can be part of loop, we must compute
- frequency and probability of ENTRY_BLOCK_PTR based on the frequencies and
+ /* If we are inlining just region of the function, make sure to connect
+ new entry to ENTRY_BLOCK_PTR_FOR_FN (cfun). Since new entry can be
+ part of loop, we must compute frequency and probability of
+ ENTRY_BLOCK_PTR_FOR_FN (cfun) based on the frequencies and
probabilities of edges incoming from nonduplicated region. */
if (new_entry)
{
@@ -4517,7 +4518,6 @@ optimize_inline_calls (tree fn)
copy_body_data id;
basic_block bb;
int last = n_basic_blocks_for_fn (cfun);
- struct gimplify_ctx gctx;
bool inlined_p = false;
/* Clear out ID. */
@@ -4538,7 +4538,7 @@ optimize_inline_calls (tree fn)
id.transform_lang_insert_block = NULL;
id.statements_to_fold = pointer_set_create ();
- push_gimplify_context (&gctx);
+ push_gimplify_context ();
/* We make no attempts to keep dominance info up-to-date. */
free_dominance_info (CDI_DOMINATORS);
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 0afa52aff1e..b4ca2119d1e 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -480,6 +480,7 @@ typedef struct partition_s
data_reference_p main_dr;
data_reference_p secondary_dr;
tree niter;
+ bool plus_one;
} *partition_t;
@@ -703,13 +704,16 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
/* Build the size argument for a memory operation call. */
static tree
-build_size_arg_loc (location_t loc, data_reference_p dr, tree nb_iter)
+build_size_arg_loc (location_t loc, data_reference_p dr, tree nb_iter,
+ bool plus_one)
{
- tree size;
- size = fold_build2_loc (loc, MULT_EXPR, sizetype,
- fold_convert_loc (loc, sizetype, nb_iter),
+ tree size = fold_convert_loc (loc, sizetype, nb_iter);
+ if (plus_one)
+ size = size_binop (PLUS_EXPR, size, size_one_node);
+ size = fold_build2_loc (loc, MULT_EXPR, sizetype, size,
TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr))));
- return fold_convert_loc (loc, size_type_node, size);
+ size = fold_convert_loc (loc, size_type_node, size);
+ return size;
}
/* Build an address argument for a memory operation call. */
@@ -781,7 +785,8 @@ generate_memset_builtin (struct loop *loop, partition_t partition)
/* The new statements will be placed before LOOP. */
gsi = gsi_last_bb (loop_preheader_edge (loop)->src);
- nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter);
+ nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter,
+ partition->plus_one);
nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
mem = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
@@ -837,7 +842,8 @@ generate_memcpy_builtin (struct loop *loop, partition_t partition)
/* The new statements will be placed before LOOP. */
gsi = gsi_last_bb (loop_preheader_edge (loop)->src);
- nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter);
+ nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter,
+ partition->plus_one);
nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
dest = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
@@ -980,11 +986,13 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
tree nb_iter;
data_reference_p single_load, single_store;
bool volatiles_p = false;
+ bool plus_one = false;
partition->kind = PKIND_NORMAL;
partition->main_dr = NULL;
partition->secondary_dr = NULL;
partition->niter = NULL_TREE;
+ partition->plus_one = false;
EXECUTE_IF_SET_IN_BITMAP (partition->stmts, 0, i, bi)
{
@@ -1047,13 +1055,12 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
if (!single_store)
return;
- if (!dominated_by_p (CDI_DOMINATORS, single_exit (loop)->src,
- gimple_bb (DR_STMT (single_store))))
- nb_iter = number_of_latch_executions (loop);
- else
- nb_iter = number_of_exit_cond_executions (loop);
+ nb_iter = number_of_latch_executions (loop);
if (!nb_iter || nb_iter == chrec_dont_know)
return;
+ if (dominated_by_p (CDI_DOMINATORS, single_exit (loop)->src,
+ gimple_bb (DR_STMT (single_store))))
+ plus_one = true;
if (single_store && !single_load)
{
@@ -1075,6 +1082,7 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
partition->kind = PKIND_MEMSET;
partition->main_dr = single_store;
partition->niter = nb_iter;
+ partition->plus_one = plus_one;
}
else if (single_store && single_load)
{
@@ -1132,6 +1140,7 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
partition->main_dr = single_store;
partition->secondary_dr = single_load;
partition->niter = nb_iter;
+ partition->plus_one = plus_one;
}
}
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
index 8846fbe50cc..fc87251cabe 100644
--- a/gcc/tree-scalar-evolution.h
+++ b/gcc/tree-scalar-evolution.h
@@ -40,8 +40,8 @@ extern bool simple_iv (struct loop *, struct loop *, tree, struct affine_iv_d *,
bool);
extern tree compute_overall_effect_of_inner_loop (struct loop *, tree);
-/* Returns the basic block preceding LOOP or ENTRY_BLOCK_PTR when the
- loop is function's body. */
+/* Returns the basic block preceding LOOP, or the CFG entry block when
+ the loop is function's body. */
static inline basic_block
block_before_loop (loop_p loop)
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index e8a92ed6c16..a12c8e0c6ff 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2996,6 +2996,69 @@ combine_conversions (gimple_stmt_iterator *gsi)
return 0;
}
+/* Combine VIEW_CONVERT_EXPRs with their defining statement. */
+
+static bool
+simplify_vce (gimple_stmt_iterator *gsi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+ tree type = TREE_TYPE (gimple_assign_lhs (stmt));
+
+ /* Drop useless VIEW_CONVERT_EXPRs. */
+ tree op = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+ if (useless_type_conversion_p (type, TREE_TYPE (op)))
+ {
+ gimple_assign_set_rhs1 (stmt, op);
+ update_stmt (stmt);
+ return true;
+ }
+
+ if (TREE_CODE (op) != SSA_NAME)
+ return false;
+
+ gimple def_stmt = SSA_NAME_DEF_STMT (op);
+ if (!is_gimple_assign (def_stmt))
+ return false;
+
+ tree def_op = gimple_assign_rhs1 (def_stmt);
+ switch (gimple_assign_rhs_code (def_stmt))
+ {
+ CASE_CONVERT:
+ /* Strip integral conversions that do not change the precision. */
+ if ((INTEGRAL_TYPE_P (TREE_TYPE (op))
+ || POINTER_TYPE_P (TREE_TYPE (op)))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (def_op))
+ || POINTER_TYPE_P (TREE_TYPE (def_op)))
+ && (TYPE_PRECISION (TREE_TYPE (op))
+ == TYPE_PRECISION (TREE_TYPE (def_op))))
+ {
+ TREE_OPERAND (gimple_assign_rhs1 (stmt), 0) = def_op;
+ update_stmt (stmt);
+ return true;
+ }
+ break;
+
+ case VIEW_CONVERT_EXPR:
+ /* Series of VIEW_CONVERT_EXPRs on register operands can
+ be contracted. */
+ if (TREE_CODE (TREE_OPERAND (def_op, 0)) == SSA_NAME)
+ {
+ if (useless_type_conversion_p (type,
+ TREE_TYPE (TREE_OPERAND (def_op, 0))))
+ gimple_assign_set_rhs1 (stmt, TREE_OPERAND (def_op, 0));
+ else
+ TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)
+ = TREE_OPERAND (def_op, 0);
+ update_stmt (stmt);
+ return true;
+ }
+
+ default:;
+ }
+
+ return false;
+}
+
/* Combine an element access with a shuffle. Returns true if there were
any changes made, else it returns false. */
@@ -3493,6 +3556,8 @@ ssa_forward_propagate_and_combine (void)
changed = did_something != 0;
}
+ else if (code == VIEW_CONVERT_EXPR)
+ changed = simplify_vce (&gsi);
else if (code == VEC_PERM_EXPR)
{
int did_something = simplify_permutation (&gsi);
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index df45c286790..2e80649fe2d 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -243,6 +243,16 @@ copy_loop_headers (void)
are not now, since there was the loop exit condition. */
split_edge (loop_preheader_edge (loop));
split_edge (loop_latch_edge (loop));
+
+ /* We peeled off one iteration of the loop thus we can lower
+ the maximum number of iterations if we have a previously
+ recorded value for that. */
+ widest_int max;
+ if (get_max_loop_iterations (loop, &max))
+ {
+ max -= 1;
+ loop->nb_iterations_upper_bound = max;
+ }
}
update_ssa (TODO_update_ssa);
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index b9db34c5057..b45ff4755c2 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -503,7 +503,7 @@ ssa_prop_init (void)
cfg_blocks.safe_grow_cleared (20);
/* Initially assume that every edge in the CFG is not executable.
- (including the edges coming out of ENTRY_BLOCK_PTR). */
+ (including the edges coming out of the entry block). */
FOR_ALL_BB (bb)
{
gimple_stmt_iterator si;
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 35b8bbe0497..2e1df69b7bd 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -309,6 +309,7 @@ stmt_local_def (gimple stmt)
def_operand_p def_p;
if (gimple_has_side_effects (stmt)
+ || stmt_could_throw_p (stmt)
|| gimple_vdef (stmt) != NULL_TREE)
return false;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 8ac1d92f995..57d8a7211cb 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -1400,151 +1400,6 @@ find_loop_location (struct loop *loop)
}
-/* This function builds ni_name = number of iterations loop executes
- on the loop preheader. If SEQ is given the stmt is instead emitted
- there. */
-
-static tree
-vect_build_loop_niters (loop_vec_info loop_vinfo, gimple_seq seq)
-{
- tree ni_name, var;
- gimple_seq stmts = NULL;
- edge pe;
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree ni = unshare_expr (LOOP_VINFO_NITERS (loop_vinfo));
-
- var = create_tmp_var (TREE_TYPE (ni), "niters");
- ni_name = force_gimple_operand (ni, &stmts, false, var);
-
- pe = loop_preheader_edge (loop);
- if (stmts)
- {
- if (seq)
- gimple_seq_add_seq (&seq, stmts);
- else
- {
- basic_block new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
- gcc_assert (!new_bb);
- }
- }
-
- return ni_name;
-}
-
-
-/* This function generates the following statements:
-
- ni_name = number of iterations loop executes
- ratio = ni_name / vf
- ratio_mult_vf_name = ratio * vf
-
- and places them at the loop preheader edge or in COND_EXPR_STMT_LIST
- if that is non-NULL. */
-
-void
-vect_generate_tmps_on_preheader (loop_vec_info loop_vinfo,
- tree *ni_name_ptr,
- tree *ratio_mult_vf_name_ptr,
- tree *ratio_name_ptr,
- gimple_seq cond_expr_stmt_list)
-{
-
- edge pe;
- basic_block new_bb;
- gimple_seq stmts;
- tree ni_name, ni_minus_gap_name;
- tree var;
- tree ratio_name;
- tree ratio_mult_vf_name;
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree ni = LOOP_VINFO_NITERS (loop_vinfo);
- int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
- tree log_vf;
-
- pe = loop_preheader_edge (loop);
-
- /* Generate temporary variable that contains
- number of iterations loop executes. */
-
- ni_name = vect_build_loop_niters (loop_vinfo, cond_expr_stmt_list);
- log_vf = build_int_cst (TREE_TYPE (ni), exact_log2 (vf));
-
- /* If epilogue loop is required because of data accesses with gaps, we
- subtract one iteration from the total number of iterations here for
- correct calculation of RATIO. */
- if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo))
- {
- ni_minus_gap_name = fold_build2 (MINUS_EXPR, TREE_TYPE (ni_name),
- ni_name,
- build_one_cst (TREE_TYPE (ni_name)));
- if (!is_gimple_val (ni_minus_gap_name))
- {
- var = create_tmp_var (TREE_TYPE (ni), "ni_gap");
-
- stmts = NULL;
- ni_minus_gap_name = force_gimple_operand (ni_minus_gap_name, &stmts,
- true, var);
- if (cond_expr_stmt_list)
- gimple_seq_add_seq (&cond_expr_stmt_list, stmts);
- else
- {
- pe = loop_preheader_edge (loop);
- new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
- gcc_assert (!new_bb);
- }
- }
- }
- else
- ni_minus_gap_name = ni_name;
-
- /* Create: ratio = ni >> log2(vf) */
-
- ratio_name = fold_build2 (RSHIFT_EXPR, TREE_TYPE (ni_minus_gap_name),
- ni_minus_gap_name, log_vf);
- if (!is_gimple_val (ratio_name))
- {
- var = create_tmp_var (TREE_TYPE (ni), "bnd");
-
- stmts = NULL;
- ratio_name = force_gimple_operand (ratio_name, &stmts, true, var);
- if (cond_expr_stmt_list)
- gimple_seq_add_seq (&cond_expr_stmt_list, stmts);
- else
- {
- pe = loop_preheader_edge (loop);
- new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
- gcc_assert (!new_bb);
- }
- }
-
- /* Create: ratio_mult_vf = ratio << log2 (vf). */
-
- ratio_mult_vf_name = fold_build2 (LSHIFT_EXPR, TREE_TYPE (ratio_name),
- ratio_name, log_vf);
- if (!is_gimple_val (ratio_mult_vf_name))
- {
- var = create_tmp_var (TREE_TYPE (ni), "ratio_mult_vf");
-
- stmts = NULL;
- ratio_mult_vf_name = force_gimple_operand (ratio_mult_vf_name, &stmts,
- true, var);
- if (cond_expr_stmt_list)
- gimple_seq_add_seq (&cond_expr_stmt_list, stmts);
- else
- {
- pe = loop_preheader_edge (loop);
- new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
- gcc_assert (!new_bb);
- }
- }
-
- *ni_name_ptr = ni_name;
- *ratio_mult_vf_name_ptr = ratio_mult_vf_name;
- *ratio_name_ptr = ratio_name;
-
- return;
-}
-
/* Function vect_can_advance_ivs_p
In case the number of iterations that LOOP iterates is unknown at compile
@@ -1762,10 +1617,10 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
test. */
void
-vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio,
+vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo,
+ tree ni_name, tree ratio_mult_vf_name,
unsigned int th, bool check_profitability)
{
- tree ni_name, ratio_mult_vf_name;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
struct loop *new_loop;
edge update_e;
@@ -1781,15 +1636,6 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio,
initialize_original_copy_tables ();
- /* Generate the following variables on the preheader of original loop:
-
- ni_name = number of iteration the original loop executes
- ratio = ni_name / vf
- ratio_mult_vf_name = ratio * vf */
- vect_generate_tmps_on_preheader (loop_vinfo, &ni_name,
- &ratio_mult_vf_name, ratio,
- cond_expr_stmt_list);
-
loop_num = loop->num;
new_loop = slpeel_tree_peel_loop_to_edge (loop, single_exit (loop),
@@ -2025,11 +1871,11 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
peeling is recorded in LOOP_VINFO_UNALIGNED_DR. */
void
-vect_do_peeling_for_alignment (loop_vec_info loop_vinfo,
+vect_do_peeling_for_alignment (loop_vec_info loop_vinfo, tree ni_name,
unsigned int th, bool check_profitability)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree niters_of_prolog_loop, ni_name;
+ tree niters_of_prolog_loop;
tree n_iters;
tree wide_prolog_niters;
struct loop *new_loop;
@@ -2043,7 +1889,8 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo,
initialize_original_copy_tables ();
- ni_name = vect_build_loop_niters (loop_vinfo, NULL);
+ gimple_seq stmts = NULL;
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
niters_of_prolog_loop = vect_gen_niters_for_prolog_loop (loop_vinfo,
ni_name,
&bound);
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 8883852a08a..915664dab07 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -5572,6 +5572,110 @@ vect_loop_kill_debug_uses (struct loop *loop, gimple stmt)
}
}
+
+/* This function builds ni_name = number of iterations. Statements
+ are queued onto SEQ. */
+
+static tree
+vect_build_loop_niters (loop_vec_info loop_vinfo, gimple_seq *seq)
+{
+ tree ni_name, var;
+ gimple_seq stmts = NULL;
+ tree ni = unshare_expr (LOOP_VINFO_NITERS (loop_vinfo));
+
+ var = create_tmp_var (TREE_TYPE (ni), "niters");
+ ni_name = force_gimple_operand (ni, &stmts, false, var);
+
+ if (stmts)
+ gimple_seq_add_seq (seq, stmts);
+
+ return ni_name;
+}
+
+
+/* This function generates the following statements:
+
+ ni_name = number of iterations loop executes
+ ratio = ni_name / vf
+ ratio_mult_vf_name = ratio * vf
+
+ and places them in COND_EXPR_STMT_LIST. */
+
+static void
+vect_generate_tmps_on_preheader (loop_vec_info loop_vinfo,
+ tree ni_name,
+ tree *ratio_mult_vf_name_ptr,
+ tree *ratio_name_ptr,
+ gimple_seq *cond_expr_stmt_list)
+{
+ gimple_seq stmts;
+ tree ni_minus_gap_name;
+ tree var;
+ tree ratio_name;
+ tree ratio_mult_vf_name;
+ tree ni = LOOP_VINFO_NITERS (loop_vinfo);
+ int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+ tree log_vf;
+
+ log_vf = build_int_cst (TREE_TYPE (ni), exact_log2 (vf));
+
+ /* If epilogue loop is required because of data accesses with gaps, we
+ subtract one iteration from the total number of iterations here for
+ correct calculation of RATIO. */
+ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo))
+ {
+ ni_minus_gap_name = fold_build2 (MINUS_EXPR, TREE_TYPE (ni_name),
+ ni_name,
+ build_one_cst (TREE_TYPE (ni_name)));
+ if (!is_gimple_val (ni_minus_gap_name))
+ {
+ var = create_tmp_var (TREE_TYPE (ni), "ni_gap");
+
+ stmts = NULL;
+ ni_minus_gap_name = force_gimple_operand (ni_minus_gap_name, &stmts,
+ true, var);
+ gimple_seq_add_seq (cond_expr_stmt_list, stmts);
+ }
+ }
+ else
+ ni_minus_gap_name = ni_name;
+
+ /* Create: ratio = ni >> log2(vf) */
+
+ ratio_name = fold_build2 (RSHIFT_EXPR, TREE_TYPE (ni_minus_gap_name),
+ ni_minus_gap_name, log_vf);
+ if (!is_gimple_val (ratio_name))
+ {
+ var = create_tmp_var (TREE_TYPE (ni), "bnd");
+
+ stmts = NULL;
+ ratio_name = force_gimple_operand (ratio_name, &stmts, true, var);
+ gimple_seq_add_seq (cond_expr_stmt_list, stmts);
+ }
+ *ratio_name_ptr = ratio_name;
+
+ /* Create: ratio_mult_vf = ratio << log2 (vf). */
+
+ if (ratio_mult_vf_name_ptr)
+ {
+ ratio_mult_vf_name = fold_build2 (LSHIFT_EXPR, TREE_TYPE (ratio_name),
+ ratio_name, log_vf);
+ if (!is_gimple_val (ratio_mult_vf_name))
+ {
+ var = create_tmp_var (TREE_TYPE (ni), "ratio_mult_vf");
+
+ stmts = NULL;
+ ratio_mult_vf_name = force_gimple_operand (ratio_mult_vf_name, &stmts,
+ true, var);
+ gimple_seq_add_seq (cond_expr_stmt_list, stmts);
+ }
+ *ratio_mult_vf_name_ptr = ratio_mult_vf_name;
+ }
+
+ return;
+}
+
+
/* Function vect_transform_loop.
The analysis phase has determined that the loop is vectorizable.
@@ -5636,11 +5740,18 @@ vect_transform_loop (loop_vec_info loop_vinfo)
}
/* Peel the loop if there are data refs with unknown alignment.
- Only one data ref with unknown store is allowed. */
+ Only one data ref with unknown store is allowed.
+ This clobbers LOOP_VINFO_NITERS but retains the original
+ in LOOP_VINFO_NITERS_UNCHANGED. So we cannot avoid re-computing
+ niters. */
if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
{
- vect_do_peeling_for_alignment (loop_vinfo, th, check_profitability);
+ gimple_seq stmts = NULL;
+ tree ni_name = vect_build_loop_niters (loop_vinfo, &stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ vect_do_peeling_for_alignment (loop_vinfo, ni_name,
+ th, check_profitability);
check_profitability = false;
}
@@ -5655,16 +5766,27 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if ((int) tree_ctz (LOOP_VINFO_NITERS (loop_vinfo))
< exact_log2 (vectorization_factor)
|| LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo))
- vect_do_peeling_for_loop_bound (loop_vinfo, &ratio,
- th, check_profitability);
+ {
+ tree ni_name, ratio_mult_vf;
+ gimple_seq stmts = NULL;
+ ni_name = vect_build_loop_niters (loop_vinfo, &stmts);
+ vect_generate_tmps_on_preheader (loop_vinfo, ni_name, &ratio_mult_vf,
+ &ratio, &stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ vect_do_peeling_for_loop_bound (loop_vinfo, ni_name, ratio_mult_vf,
+ th, check_profitability);
+ }
else if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
ratio = build_int_cst (TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo)),
LOOP_VINFO_INT_NITERS (loop_vinfo) / vectorization_factor);
else
{
- tree ni_name, ratio_mult_vf;
- vect_generate_tmps_on_preheader (loop_vinfo, &ni_name, &ratio_mult_vf,
- &ratio, NULL);
+ tree ni_name;
+ gimple_seq stmts = NULL;
+ ni_name = vect_build_loop_niters (loop_vinfo, &stmts);
+ vect_generate_tmps_on_preheader (loop_vinfo, ni_name, NULL,
+ &ratio, &stmts);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
}
/* 1) Make sure the loop header has exactly two entries
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 1634d7fa7f5..1297fab6cfe 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -937,11 +937,10 @@ extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
extern void vect_loop_versioning (loop_vec_info, unsigned int, bool);
-extern void vect_generate_tmps_on_preheader (loop_vec_info, tree *, tree *,
- tree *, gimple_seq);
-extern void vect_do_peeling_for_loop_bound (loop_vec_info, tree *,
+extern void vect_do_peeling_for_loop_bound (loop_vec_info, tree, tree,
unsigned int, bool);
-extern void vect_do_peeling_for_alignment (loop_vec_info, unsigned int, bool);
+extern void vect_do_peeling_for_alignment (loop_vec_info, tree,
+ unsigned int, bool);
extern LOC find_loop_location (struct loop *);
extern bool vect_can_advance_ivs_p (loop_vec_info);
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 06b93a30d5f..f79cf49cc55 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -205,6 +205,8 @@ dump_varpool_node (FILE *f, struct varpool_node *node)
fprintf (f, " initialized");
if (node->output)
fprintf (f, " output");
+ if (node->need_bounds_init)
+ fprintf (f, " need-bounds-init");
if (TREE_READONLY (node->decl))
fprintf (f, " read-only");
if (ctor_for_folding (node->decl) != error_mark_node)
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index fcbc5483472..5bded877e0f 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,15 @@
+2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * intrinsics/erfc_scaled.c (erfc_scaled_r16): Don't define if
+ __float128 is not available.
+
+2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/49024
+ * intrinsics/erfc_scaled.c (erfc_scaled_r16): New function.
+ * intrinsics/erfc_scaled_inc.c: Do not provide quadruple
+ precision variant.
+
2013-11-18 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/51828
diff --git a/libgfortran/intrinsics/erfc_scaled.c b/libgfortran/intrinsics/erfc_scaled.c
index 1c58a08938e..f69e1fc7357 100644
--- a/libgfortran/intrinsics/erfc_scaled.c
+++ b/libgfortran/intrinsics/erfc_scaled.c
@@ -45,8 +45,61 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "erfc_scaled_inc.c"
#endif
-#ifdef HAVE_GFC_REAL_16
+#if defined(HAVE_GFC_REAL_16) && defined(GFC_REAL_16_IS_LONG_DOUBLE)
#undef KIND
#define KIND 16
#include "erfc_scaled_inc.c"
#endif
+
+
+#ifdef GFC_REAL_16_IS_FLOAT128
+
+/* For quadruple-precision (__float128), netlib's implementation is
+ not accurate enough. We provide another one. */
+
+extern GFC_REAL_16 erfc_scaled_r16 (GFC_REAL_16);
+export_proto(erfc_scaled_r16);
+
+GFC_REAL_16
+erfc_scaled_r16 (GFC_REAL_16 x)
+{
+ if (x < -106.566990228185312813205074546585730Q)
+ {
+ return __builtin_infq();
+ }
+ if (x < 12)
+ {
+ /* Compute directly as ERFC_SCALED(x) = ERFC(x) * EXP(X**2).
+ This is not perfect, but much better than netlib. */
+ return erfcq(x) * expq(x * x);
+ }
+ else
+ {
+ /* Calculate ERFC_SCALED(x) using a power series in 1/x:
+ ERFC_SCALED(x) = 1 / (x * sqrt(pi))
+ * (1 + Sum_n (-1)**n * (1 * 3 * 5 * ... * (2n-1))
+ / (2 * x**2)**n)
+ */
+ GFC_REAL_16 sum = 0, oldsum;
+ GFC_REAL_16 inv2x2 = 1 / (2 * x * x);
+ GFC_REAL_16 fac = 1;
+ int n = 1;
+
+ while (n < 200)
+ {
+ fac *= - (2*n - 1) * inv2x2;
+ oldsum = sum;
+ sum += fac;
+
+ if (sum == oldsum)
+ break;
+
+ n++;
+ }
+
+ return (1 + sum) / x * (M_2_SQRTPIq / 2);
+ }
+}
+
+#endif
+
diff --git a/libgfortran/intrinsics/erfc_scaled_inc.c b/libgfortran/intrinsics/erfc_scaled_inc.c
index 57a6b71f995..107d91a6c9d 100644
--- a/libgfortran/intrinsics/erfc_scaled_inc.c
+++ b/libgfortran/intrinsics/erfc_scaled_inc.c
@@ -48,11 +48,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define TRUNC(x) truncl(x)
# endif
-#elif (KIND == 16 && defined(GFC_REAL_16_IS_FLOAT128))
-
-# define EXP(x) expq(x)
-# define TRUNC(x) truncq(x)
-
#else
# error "What exactly is it that you want me to do?"
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f372d62dcbc..d3d6405320f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,69 @@
+2013-11-21 Edward Smith-Rowland <3dw4rd@verizon.net>
+
+ * include/experimental/string_view: Rep empty string with unit-length
+ static constexpr string. Uncomment _GLIBCXX_VISIBILITY. Enforce
+ invariant of no nullptr string pointer.
+ * include/experimental/string_view.tcc: Ditto.
+ * testsuite/experimental/string_view/cons/char/1.cc: data() for empty
+ string_view is no longer nullptr.
+ * testsuite/experimental/string_view/cons/wchar_t/1.cc: Ditto.
+ * testsuite/experimental/string_view/operations/data/char/1.cc: Ditto.
+ * testsuite/experimental/string_view/operations/data/wchar_t/1.cc:
+ Ditto.
+
+2013-11-21 Edward Smith-Rowland <3dw4rd@verizon.net>
+
+ Implement __gnu_cxx::hypergeometric_distribution.
+ * include/ext/random: Add hypergeometric_distribution.
+ * include/ext/random.tcc: Add hypergeometric_distribution.
+ * testsuite/util/testsuite_random.h (hypergeometric_pdf): New pdf
+ for the hypergeometric discreet distribution;
+ (lbincoef): New supporting function for binomial coefficients.
+ * testsuite/ext/random/hypergeometric_distribution/operators/
+ serialize.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/operators/
+ equal.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/operators/
+ inequal.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/operators/
+ values.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/cons/parms.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/cons/default.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/requirements/
+ explicit_instantiation/1.cc: New.
+ * testsuite/ext/random/hypergeometric_distribution/requirements/
+ typedefs.cc: New.
+
+2013-11-20 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR c++/59173
+ * include/ext/pointer.h (pointer_traits<>::rebind<>): Add template
+ keyword in nested name.
+
+ PR libstdc++/49204
+ * include/std/future (__future_base::_State_base): Rename to
+ __future_base::_State_baseV2.
+ (__future_base::_State_baseV2::~_State_baseV2): Define as defaulted.
+ (__future_base::_State_baseV2::_M_run_deferred): Rename to
+ _M_complete_async.
+ (__future_base::_State_baseV2::_M_has_deferred): Add new virtual.
+ (__future_base::_State_baseV2::wait_for): Call _M_has_deferred() to
+ test for a deferred function, or call _M_complete_async() to join an
+ async thread that has made the shared state ready.
+ (__future_base::_State_baseV2::wait_until): Likewise.
+ (__future_base::_Async_state_common): Rename to _Async_state_commonV2.
+ (__future_base::_Async_state_commonV2::_M_run_deferred): Rename to
+ _M_complete_async.
+ * src/c++11/compatibility-thread-c++0x.cc (__future_base::_State_base):
+ Export old definition.
+ (__future_base::_Async_state_common): Likewise.
+ * src/c++11/future.cc (__future_base::_State_base::~_State_base):
+ Remove.
+ * doc/xml/manual/status_cxx2011.xml: Update status.
+ * testsuite/30_threads/async/async.cc: Test future_status::timeout
+ and future_status::ready.
+ * testsuite/30_threads/async/sync.cc: Test future_status::deferred.
+
2013-11-20 David Edelsohn <dje.gcc@gmail.com>
* testsuite/17_intro/static.cc: Ignore AIX TOC reload warnings.
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index 3c4ec69dcad..bda8a79a30d 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -2503,18 +2503,16 @@ particular release.
<entry>Missing set_*_at_thread_exit</entry>
</row>
<row>
- <?dbhtml bgcolor="#B0B0B0" ?>
<entry>30.6.6</entry>
<entry>Class template <code>future</code></entry>
- <entry>Partial</entry>
- <entry>Timed waiting functions do not return future_status::deferred</entry>
+ <entry>Y</entry>
+ <entry/>
</row>
<row>
- <?dbhtml bgcolor="#B0B0B0" ?>
<entry>30.6.7</entry>
<entry>Class template <code>shared_future</code></entry>
- <entry>Partial</entry>
- <entry>Timed waiting functions do not return future_status::deferred</entry>
+ <entry>Y</entry>
+ <entry/>
</row>
<row>
<entry>30.6.8</entry>
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 6a95e8d0bd0..000d317c5c5 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -43,7 +43,7 @@
#include <string>
#include <limits>
-namespace std //_GLIBCXX_VISIBILITY(default)
+namespace std _GLIBCXX_VISIBILITY(default)
{
namespace experimental
{
@@ -66,6 +66,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* _CharT* _M_str
* size_t _M_len
* @endcode
+ *
+ * A basic_string_view represents an empty string with a static constexpr
+ * length one string:
+ *
+ * @code
+ * static constexpr value_type _S_empty_str[1]{0};
+ * @endcode
*/
template<typename _CharT, typename _Traits = char_traits<_CharT>>
class basic_string_view
@@ -92,7 +99,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr
basic_string_view() noexcept
- : _M_len{0}, _M_str{nullptr}
+ : _M_len{0}, _M_str{_S_empty_str}
{ }
constexpr basic_string_view(const basic_string_view&) noexcept = default;
@@ -104,11 +111,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ }
constexpr basic_string_view(const _CharT* __str)
- : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, _M_str{__str}
+ : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
+ _M_str{__str == nullptr ? _S_empty_str : __str}
{ }
constexpr basic_string_view(const _CharT* __str, size_type __len)
- : _M_len{__len}, _M_str{__str}
+ : _M_len{__str == nullptr ? 0 :__len},
+ _M_str{__str == nullptr || __len == 0 ? _S_empty_str : __str}
{ }
basic_string_view&
@@ -185,7 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"(which is %zu) >= this->size() "
"(which is %zu)"),
__pos, this->size()),
- *static_cast<pointer>(nullptr));
+ _S_empty_str[0]);
}
constexpr const _CharT&
@@ -211,7 +220,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
clear() noexcept
{
this->_M_len = 0;
- this->_M_str = nullptr;
+ this->_M_str = _S_empty_str;
}
void
@@ -408,6 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
private:
+
static constexpr const int
_S_compare(size_type __n1, size_type __n2) noexcept
{
@@ -418,6 +428,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: static_cast<int>(difference_type{__n1 - __n2});
}
+ static constexpr value_type _S_empty_str[1]{};
+
size_t _M_len;
const _CharT* _M_str;
};
diff --git a/libstdc++-v3/include/experimental/string_view.tcc b/libstdc++-v3/include/experimental/string_view.tcc
index af334b456ca..eeccb026344 100644
--- a/libstdc++-v3/include/experimental/string_view.tcc
+++ b/libstdc++-v3/include/experimental/string_view.tcc
@@ -40,13 +40,17 @@
# include <bits/c++14_warning.h>
#else
-namespace std //_GLIBCXX_VISIBILITY(default)
+namespace std _GLIBCXX_VISIBILITY(default)
{
namespace experimental
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits>
+ constexpr _CharT
+ basic_string_view<_CharT, _Traits>::_S_empty_str[1];
+
+ template<typename _CharT, typename _Traits>
typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index 12bc749c063..d1730be07f2 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -580,7 +580,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Up>
using rebind = typename __gnu_cxx::_Pointer_adapter<
- typename pointer_traits<_Storage_policy>::rebind<_Up>>;
+ typename pointer_traits<_Storage_policy>::template rebind<_Up>>;
static pointer pointer_to(typename pointer::reference __r) noexcept
{ return pointer(std::addressof(__r)); }
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 347ebed449c..c82430e0746 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -2845,6 +2845,267 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const __gnu_cxx::von_mises_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
+
+ /**
+ * @brief A discrete hypergeometric random number distribution.
+ *
+ * The hypergeometric distribution is a discrete probability distribution
+ * that describes the probability of @p k successes in @p n draws @a without
+ * replacement from a finite population of size @p N containing exactly @p K
+ * successes.
+ *
+ * The formula for the hypergeometric probability density function is
+ * @f[
+ * p(k|N,K,n) = \frac{\binom{K}{k} \binom{N-K}{n-k}}{\binom{N}{n}}
+ * @f]
+ * where @f$N@f$ is the total population of the distribution,
+ * @f$K@f$ is the total population of the distribution.
+ *
+ * <table border=1 cellpadding=10 cellspacing=0>
+ * <caption align=top>Distribution Statistics</caption>
+ * <tr><td>Mean</td><td>@f$ n\frac{K}{N} @f$</td></tr>
+ * <tr><td>Variance</td><td>@f$ n\frac{K}{N}\frac{N-K}{N}\frac{N-n}{N-1}
+ * @f$</td></tr>
+ * <tr><td>Range</td><td>@f$[max(0, n+K-N), min(K, n)]@f$</td></tr>
+ * </table>
+ */
+ template<typename _UIntType = unsigned int>
+ class hypergeometric_distribution
+ {
+ static_assert(std::is_unsigned<_UIntType>::value, "template argument "
+ "substituting _UIntType not an unsigned integral type");
+
+ public:
+ /** The type of the range of the distribution. */
+ typedef _UIntType result_type;
+
+ /** Parameter type. */
+ struct param_type
+ {
+ typedef hypergeometric_distribution<_UIntType> distribution_type;
+ friend class hypergeometric_distribution<_UIntType>;
+
+ explicit
+ param_type(result_type __N = 10, result_type __K = 5,
+ result_type __n = 1)
+ : _M_N{__N}, _M_K{__K}, _M_n{__n}
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_N >= _M_K);
+ _GLIBCXX_DEBUG_ASSERT(_M_N >= _M_n);
+ }
+
+ result_type
+ total_size() const
+ { return _M_N; }
+
+ result_type
+ successful_size() const
+ { return _M_K; }
+
+ result_type
+ unsuccessful_size() const
+ { return _M_N - _M_K; }
+
+ result_type
+ total_draws() const
+ { return _M_n; }
+
+ friend bool
+ operator==(const param_type& __p1, const param_type& __p2)
+ { return (__p1._M_N == __p2._M_N)
+ && (__p1._M_K == __p2._M_K)
+ && (__p1._M_n == __p2._M_n); }
+
+ private:
+
+ result_type _M_N;
+ result_type _M_K;
+ result_type _M_n;
+ };
+
+ // constructors and member function
+ explicit
+ hypergeometric_distribution(result_type __N = 10, result_type __K = 5,
+ result_type __n = 1)
+ : _M_param{__N, __K, __n}
+ { }
+
+ explicit
+ hypergeometric_distribution(const param_type& __p)
+ : _M_param{__p}
+ { }
+
+ /**
+ * @brief Resets the distribution state.
+ */
+ void
+ reset()
+ { }
+
+ /**
+ * @brief Returns the distribution parameter @p N,
+ * the total number of items.
+ */
+ result_type
+ total_size() const
+ { return this->_M_param.total_size(); }
+
+ /**
+ * @brief Returns the distribution parameter @p K,
+ * the total number of successful items.
+ */
+ result_type
+ successful_size() const
+ { return this->_M_param.successful_size(); }
+
+ /**
+ * @brief Returns the total number of unsuccessful items @f$ N - K @f$.
+ */
+ result_type
+ unsuccessful_size() const
+ { return this->_M_param.unsuccessful_size(); }
+
+ /**
+ * @brief Returns the distribution parameter @p n,
+ * the total number of draws.
+ */
+ result_type
+ total_draws() const
+ { return this->_M_param.total_draws(); }
+
+ /**
+ * @brief Returns the parameter set of the distribution.
+ */
+ param_type
+ param() const
+ { return this->_M_param; }
+
+ /**
+ * @brief Sets the parameter set of the distribution.
+ * @param __param The new parameter set of the distribution.
+ */
+ void
+ param(const param_type& __param)
+ { this->_M_param = __param; }
+
+ /**
+ * @brief Returns the greatest lower bound value of the distribution.
+ */
+ result_type
+ min() const
+ {
+ using _IntType = typename std::make_signed<result_type>::type;
+ return static_cast<result_type>(std::max(static_cast<_IntType>(0),
+ static_cast<_IntType>(this->total_draws()
+ - this->unsuccessful_size())));
+ }
+
+ /**
+ * @brief Returns the least upper bound value of the distribution.
+ */
+ result_type
+ max() const
+ { return std::min(this->successful_size(), this->total_draws()); }
+
+ /**
+ * @brief Generating functions.
+ */
+ template<typename _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng)
+ { return this->operator()(__urng, this->_M_param); }
+
+ template<typename _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng,
+ const param_type& __p);
+
+ template<typename _ForwardIterator,
+ typename _UniformRandomNumberGenerator>
+ void
+ __generate(_ForwardIterator __f, _ForwardIterator __t,
+ _UniformRandomNumberGenerator& __urng)
+ { this->__generate(__f, __t, __urng, this->_M_param); }
+
+ template<typename _ForwardIterator,
+ typename _UniformRandomNumberGenerator>
+ void
+ __generate(_ForwardIterator __f, _ForwardIterator __t,
+ _UniformRandomNumberGenerator& __urng,
+ const param_type& __p)
+ { this->__generate_impl(__f, __t, __urng, __p); }
+
+ template<typename _UniformRandomNumberGenerator>
+ void
+ __generate(result_type* __f, result_type* __t,
+ _UniformRandomNumberGenerator& __urng,
+ const param_type& __p)
+ { this->__generate_impl(__f, __t, __urng, __p); }
+
+ /**
+ * @brief Return true if two hypergeometric distributions have the same
+ * parameters and the sequences that would be generated
+ * are equal.
+ */
+ friend bool
+ operator==(const hypergeometric_distribution& __d1,
+ const hypergeometric_distribution& __d2)
+ { return __d1._M_param == __d2._M_param; }
+
+ /**
+ * @brief Inserts a %hypergeometric_distribution random number
+ * distribution @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %hypergeometric_distribution random number
+ * distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _UIntType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const __gnu_cxx::hypergeometric_distribution<_UIntType1>&
+ __x);
+
+ /**
+ * @brief Extracts a %hypergeometric_distribution random number
+ * distribution @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %hypergeometric_distribution random number generator
+ * distribution.
+ *
+ * @returns The input stream with @p __x extracted or in an error
+ * state.
+ */
+ template<typename _UIntType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ __gnu_cxx::hypergeometric_distribution<_UIntType1>& __x);
+
+ private:
+
+ template<typename _ForwardIterator,
+ typename _UniformRandomNumberGenerator>
+ void
+ __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
+ _UniformRandomNumberGenerator& __urng,
+ const param_type& __p);
+
+ param_type _M_param;
+ };
+
+ /**
+ * @brief Return true if two hypergeometric distributions are different.
+ */
+ template<typename _UIntType>
+ inline bool
+ operator!=(const __gnu_cxx::hypergeometric_distribution<_UIntType>& __d1,
+ const __gnu_cxx::hypergeometric_distribution<_UIntType>& __d2)
+ { return !(__d1 == __d2); }
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc
index 009e0effba8..7d68958c093 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -32,7 +32,6 @@
#pragma GCC system_header
-
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1307,6 +1306,113 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __is;
}
+
+ template<typename _UIntType>
+ template<typename _UniformRandomNumberGenerator>
+ typename hypergeometric_distribution<_UIntType>::result_type
+ hypergeometric_distribution<_UIntType>::
+ operator()(_UniformRandomNumberGenerator& __urng,
+ const param_type& __param)
+ {
+ std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+ __aurng(__urng);
+
+ result_type __a = __param.successful_size();
+ result_type __b = __param.total_size();
+ result_type __k = 0;
+
+ if (__param.total_draws() < __param.total_size() / 2)
+ {
+ for (result_type __i = 0; __i < __param.total_draws(); ++__i)
+ {
+ if (__b * __aurng() < __a)
+ {
+ ++__k;
+ if (__k == __param.successful_size())
+ return __k;
+ --__a;
+ }
+ --__b;
+ }
+ return __k;
+ }
+ else
+ {
+ for (result_type __i = 0; __i < __param.unsuccessful_size(); ++__i)
+ {
+ if (__b * __aurng() < __a)
+ {
+ ++__k;
+ if (__k == __param.successful_size())
+ return __param.successful_size() - __k;
+ --__a;
+ }
+ --__b;
+ }
+ return __param.successful_size() - __k;
+ }
+ }
+
+ template<typename _UIntType>
+ template<typename _OutputIterator,
+ typename _UniformRandomNumberGenerator>
+ void
+ hypergeometric_distribution<_UIntType>::
+ __generate_impl(_OutputIterator __f, _OutputIterator __t,
+ _UniformRandomNumberGenerator& __urng,
+ const param_type& __param)
+ {
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>)
+
+ while (__f != __t)
+ *__f++ = this->operator()(__urng);
+ }
+
+ template<typename _UIntType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const __gnu_cxx::hypergeometric_distribution<_UIntType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__space);
+ __os.precision(std::numeric_limits<_UIntType>::max_digits10);
+
+ __os << __x.total_size() << __space << __x.successful_size() << __space
+ << __x.total_draws();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _UIntType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ __gnu_cxx::hypergeometric_distribution<_UIntType>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ _UIntType __total_size, __successful_size, __total_draws;
+ __is >> __total_size >> __successful_size >> __total_draws;
+ __x.param(typename __gnu_cxx::hypergeometric_distribution<_UIntType>::
+ param_type(__total_size, __successful_size, __total_draws));
+
+ __is.flags(__flags);
+ return __is;
+ }
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 6d6b32b1f4d..b37578600d9 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -298,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Base class for state between a promise and one or more
/// associated futures.
- class _State_base
+ class _State_baseV2
{
typedef _Ptr<_Result_base> _Ptr_type;
@@ -309,15 +309,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
once_flag _M_once;
public:
- _State_base() noexcept : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT) { }
- _State_base(const _State_base&) = delete;
- _State_base& operator=(const _State_base&) = delete;
- virtual ~_State_base();
+ _State_baseV2() noexcept : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT)
+ { }
+ _State_baseV2(const _State_baseV2&) = delete;
+ _State_baseV2& operator=(const _State_baseV2&) = delete;
+ virtual ~_State_baseV2() = default;
_Result_base&
wait()
{
- _M_run_deferred();
+ _M_complete_async();
unique_lock<mutex> __lock(_M_mutex);
_M_cond.wait(__lock, [&] { return _M_ready(); });
return *_M_result;
@@ -328,8 +329,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
wait_for(const chrono::duration<_Rep, _Period>& __rel)
{
unique_lock<mutex> __lock(_M_mutex);
- if (_M_cond.wait_for(__lock, __rel, [&] { return _M_ready(); }))
+ if (_M_ready())
return future_status::ready;
+ if (_M_has_deferred())
+ return future_status::deferred;
+ if (_M_cond.wait_for(__lock, __rel, [&] { return _M_ready(); }))
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2100. timed waiting functions must also join
+ _M_complete_async();
+ return future_status::ready;
+ }
return future_status::timeout;
}
@@ -338,8 +348,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
wait_until(const chrono::time_point<_Clock, _Duration>& __abs)
{
unique_lock<mutex> __lock(_M_mutex);
- if (_M_cond.wait_until(__lock, __abs, [&] { return _M_ready(); }))
+ if (_M_ready())
return future_status::ready;
+ if (_M_has_deferred())
+ return future_status::deferred;
+ if (_M_cond.wait_until(__lock, __abs, [&] { return _M_ready(); }))
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2100. timed waiting functions must also join
+ _M_complete_async();
+ return future_status::ready;
+ }
return future_status::timeout;
}
@@ -349,7 +368,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool __set = __ignore_failure;
// all calls to this function are serialized,
// side-effects of invoking __res only happen once
- call_once(_M_once, &_State_base::_M_do_set, this, ref(__res),
+ call_once(_M_once, &_State_baseV2::_M_do_set, this, ref(__res),
ref(__set));
if (!__set)
__throw_future_error(int(future_errc::promise_already_satisfied));
@@ -393,7 +412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename promise<_Res>::_Ptr_type operator()()
{
- _State_base::_S_check(_M_promise->_M_future);
+ _State_baseV2::_S_check(_M_promise->_M_future);
_M_promise->_M_storage->_M_set(_M_arg);
return std::move(_M_promise->_M_storage);
}
@@ -407,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
typename promise<_Res>::_Ptr_type operator()()
{
- _State_base::_S_check(_M_promise->_M_future);
+ _State_baseV2::_S_check(_M_promise->_M_future);
_M_promise->_M_storage->_M_set(std::move(_M_arg));
return std::move(_M_promise->_M_storage);
}
@@ -423,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
typename promise<_Res>::_Ptr_type operator()()
{
- _State_base::_S_check(_M_promise->_M_future);
+ _State_baseV2::_S_check(_M_promise->_M_future);
_M_promise->_M_storage->_M_error = _M_ex;
return std::move(_M_promise->_M_storage);
}
@@ -472,15 +491,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool _M_ready() const noexcept { return static_cast<bool>(_M_result); }
- // Misnamed: waits for completion of async function.
- virtual void _M_run_deferred() { }
+ // Wait for completion of async function.
+ virtual void _M_complete_async() { }
+
+ // Return true if state contains a deferred function.
+ virtual bool _M_has_deferred() const { return false; }
};
+#ifdef _GLIBCXX_ASYNC_ABI_COMPAT
+ class _State_base;
+ class _Async_state_common;
+#else
+ using _State_base = _State_baseV2;
+ class _Async_state_commonV2;
+#endif
+
template<typename _BoundFn, typename = typename _BoundFn::result_type>
class _Deferred_state;
- class _Async_state_common;
-
template<typename _BoundFn, typename = typename _BoundFn::result_type>
class _Async_state_impl;
@@ -538,6 +566,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void _M_destroy() { delete this; }
};
+#ifndef _GLIBCXX_ASYNC_ABI_COMPAT
/// Common implementation for future and shared_future.
template<typename _Res>
@@ -1439,26 +1468,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Ptr_type _M_result;
_BoundFn _M_fn;
+ // Run the deferred function.
virtual void
- _M_run_deferred()
+ _M_complete_async()
{
// safe to call multiple times so ignore failure
_M_set_result(_S_task_setter(_M_result, _M_fn), true);
}
+
+ virtual bool
+ _M_has_deferred() const { return static_cast<bool>(_M_result); }
};
- class __future_base::_Async_state_common : public __future_base::_State_base
+ class __future_base::_Async_state_commonV2
+ : public __future_base::_State_base
{
protected:
-#ifdef _GLIBCXX_ASYNC_ABI_COMPAT
- ~_Async_state_common();
-#else
- ~_Async_state_common() = default;
-#endif
+ ~_Async_state_commonV2() = default;
- // Allow non-timed waiting functions to block until the thread completes,
- // as if joined.
- virtual void _M_run_deferred() { _M_join(); }
+ // Make waiting functions block until the thread completes, as if joined.
+ virtual void _M_complete_async() { _M_join(); }
void _M_join() { std::call_once(_M_once, &thread::join, ref(_M_thread)); }
@@ -1468,7 +1497,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _BoundFn, typename _Res>
class __future_base::_Async_state_impl final
- : public __future_base::_Async_state_common
+ : public __future_base::_Async_state_commonV2
{
public:
explicit
@@ -1536,6 +1565,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::forward<_Args>(__args)...);
}
+#endif // _GLIBCXX_ASYNC_ABI_COMPAT
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
// && ATOMIC_INT_LOCK_FREE
diff --git a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
index ecc4ca4b558..bec7a2b6a64 100644
--- a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
+++ b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
@@ -23,7 +23,7 @@
// <http://www.gnu.org/licenses/>.
#include <bits/c++config.h>
-#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_SHARED)
+#if defined(_GLIBCXX_SHARED)
#define _GLIBCXX_ASYNC_ABI_COMPAT
#endif
@@ -78,20 +78,49 @@ _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE, _ZSt11try_to_lock, GLIBCXX_3.4.
// XXX GLIBCXX_ABI Deprecated
-// gcc-4.7.0
+// gcc-4.7.0, gcc-4.9.0
// <future> export changes
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
&& (ATOMIC_INT_LOCK_FREE > 1)
-#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_SHARED)
+#if defined(_GLIBCXX_SHARED)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ // Replaced by _State_baseV2 in gcc-4.9.0
+ class __future_base::_State_base
+ {
+ typedef _Ptr<_Result_base> _Ptr_type;
+
+ _Ptr_type _M_result;
+ mutex _M_mutex;
+ condition_variable _M_cond;
+ atomic_flag _M_retrieved;
+ once_flag _M_once;
+ public:
+ virtual ~_State_base();
+ virtual void _M_run_deferred() { }
+ };
+ __future_base::_State_base::~_State_base() { }
+
+ // Replaced by _Async_state_commonV2 in gcc-4.9.0
+ class __future_base::_Async_state_common : public __future_base::_State_base
+ {
+ protected:
+ ~_Async_state_common();
+ virtual void _M_run_deferred() { _M_join(); }
+ void _M_join() { std::call_once(_M_once, &thread::join, ref(_M_thread)); }
+ thread _M_thread;
+ once_flag _M_once;
+ };
+#if defined(_GLIBCXX_HAVE_TLS)
+ // Replaced with inline definition in gcc-4.8.0
__future_base::_Async_state_common::~_Async_state_common() { _M_join(); }
// Explicit instantiation due to -fno-implicit-instantiation.
template void call_once(once_flag&, void (thread::*&&)(), reference_wrapper<thread>&&);
template _Bind_simple_helper<void (thread::*)(), reference_wrapper<thread>>::__type __bind_simple(void (thread::*&&)(), reference_wrapper<thread>&&);
+#endif // _GLIBCXX_HAVE_TLS
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif
+#endif // _GLIBCXX_SHARED
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/src/c++11/future.cc b/libstdc++-v3/src/c++11/future.cc
index 906ded5476f..e253ac3cee9 100644
--- a/libstdc++-v3/src/c++11/future.cc
+++ b/libstdc++-v3/src/c++11/future.cc
@@ -82,8 +82,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__future_base::_Result_base::_Result_base() = default;
__future_base::_Result_base::~_Result_base() = default;
-
- __future_base::_State_base::~_State_base() = default;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/testsuite/30_threads/async/async.cc b/libstdc++-v3/testsuite/30_threads/async/async.cc
index f2ce205b20d..1f94494d0a3 100644
--- a/libstdc++-v3/testsuite/30_threads/async/async.cc
+++ b/libstdc++-v3/testsuite/30_threads/async/async.cc
@@ -40,18 +40,37 @@ struct work {
void test01()
{
+ mutex m;
+ condition_variable cv;
+ unique_lock<mutex> l(m);
+ future<void> f1 = async(launch::async, work(), ref(m), ref(cv));
+ cv.wait(l);
+ f1.get();
+}
+
+void test02()
+{
bool test __attribute__((unused)) = true;
mutex m;
condition_variable cv;
unique_lock<mutex> l(m);
future<void> f1 = async(launch::async, work(), ref(m), ref(cv));
+ std::future_status status;
+ status = f1.wait_for(std::chrono::milliseconds(1));
+ VERIFY( status == std::future_status::timeout );
+ status = f1.wait_until(std::chrono::system_clock::now());
+ VERIFY( status == std::future_status::timeout );
cv.wait(l);
- f1.get();
+ status = f1.wait_for(std::chrono::milliseconds(0));
+ VERIFY( status == std::future_status::ready );
+ status = f1.wait_until(std::chrono::system_clock::now());
+ VERIFY( status == std::future_status::ready );
}
int main()
{
test01();
+ test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/30_threads/async/sync.cc b/libstdc++-v3/testsuite/30_threads/async/sync.cc
index e9b112ddf57..3e9cd34cd55 100644
--- a/libstdc++-v3/testsuite/30_threads/async/sync.cc
+++ b/libstdc++-v3/testsuite/30_threads/async/sync.cc
@@ -39,12 +39,32 @@ void test01()
using namespace std;
int a = 1;
- int b = 10;
- int c = 100;
+ int b = 1;
+ int c = 1;
future<int> f1 = async(launch::deferred, sum(), a, ref(b), cref(c));
+ a = 0;
+ b = 10;
+ c = 100;
+
+ const std::chrono::seconds delay(10);
+ const auto then = std::chrono::system_clock::now() + delay;
VERIFY( f1.valid() );
+ // timed waiting functions should return 'deferred' immediately
+ VERIFY( f1.wait_until(then) == std::future_status::deferred );
+ VERIFY( f1.wait_for(delay) == std::future_status::deferred );
+ VERIFY( std::chrono::system_clock::now() < then );
+
+ f1.wait();
+
+ VERIFY( f1.valid() );
+ // timed waiting functions should return 'ready' immediately
+ VERIFY( f1.wait_until(then) == std::future_status::ready );
+ VERIFY( f1.wait_for(delay) == std::future_status::ready );
+ VERIFY( std::chrono::system_clock::now() < then );
+
VERIFY( f1.get() == 111 );
+ VERIFY( !f1.valid() );
}
int main()
diff --git a/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc b/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
index 4bb22098df1..982a4c76fb5 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
@@ -33,7 +33,7 @@ test01()
// basic_string_view()
const std::experimental::string_view str00{};
VERIFY( str00.length() == 0 );
- VERIFY( str00.data() == nullptr );
+ VERIFY( str00.data() != nullptr );
// basic_string_view(const char*)
const char str_lit01[] = "rodeo beach, marin";
@@ -53,10 +53,11 @@ test01()
std::experimental::string_view str05{str_lit01, len_lit01};
VERIFY( str05.length() == len_lit01 );
VERIFY( str05.data() == str_lit01 );
- // This is invalid and unchecked.
- //std::experimental::string_view str06{nullptr, len_lit01};
- //VERIFY( str06.length() == 0 );
- //VERIFY( str06.data() == nullptr );
+
+ // basic_string_view(const char* s, std::size_t l)
+ std::experimental::string_view str06{nullptr, len_lit01};
+ VERIFY( str06.length() == 0 );
+ VERIFY( str06.data() != nullptr );
// basic_string_view(basic_string& s)
std::string istr07(10, 'z');
diff --git a/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
index 3028f654bf0..eb115fd5528 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
@@ -33,7 +33,7 @@ test01()
// basic_string_view()
const std::experimental::wstring_view str00{};
VERIFY( str00.length() == 0 );
- VERIFY( str00.data() == nullptr );
+ VERIFY( str00.data() != nullptr );
// basic_string_view(const char*)
const wchar_t str_lit01[] = L"rodeo beach, marin";
@@ -53,10 +53,11 @@ test01()
std::experimental::wstring_view str05{str_lit01, len_lit01};
VERIFY( str05.length() == len_lit01 );
VERIFY( str05.data() == str_lit01 );
- // This is invalid and unchecked.
- //std::experimental::wstring_view str06{nullptr, len_lit01};
- //VERIFY( str06.length() == 0 );
- //VERIFY( str06.data() == nullptr );
+
+ // basic_string_view(const wchar_t* s, std::size_t l)
+ std::experimental::wstring_view str06{nullptr, len_lit01};
+ VERIFY( str06.length() == 0 );
+ VERIFY( str06.data() != nullptr );
// basic_string_view(basic_string& s)
std::wstring istr07(10, L'z');
diff --git a/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc b/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
index 4f2bd3dba5c..be75de91791 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
@@ -29,10 +29,10 @@ test01()
std::experimental::string_view empty;
- // data() for size == 0 is non-NULL?
+ // data() for size == 0 is non-NULL.
VERIFY( empty.size() == 0 );
const std::experimental::string_view::value_type* p = empty.data();
- VERIFY( p == nullptr );
+ VERIFY( p );
return 0;
}
diff --git a/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc b/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
index d577c9f3c0a..5e00b00b601 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
@@ -29,10 +29,10 @@ test01()
std::experimental::wstring_view empty;
- // data() for size == 0 is non-NULL?
+ // data() for size == 0 is non-NULL.
VERIFY( empty.size() == 0 );
const std::experimental::wstring_view::value_type* p = empty.data();
- VERIFY( p == nullptr );
+ VERIFY( p );
return 0;
}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc
new file mode 100644
index 00000000000..34978075d71
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.* Class template hypergeometric_distribution [rand.dist.ext.hypergeometric]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <ext/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test [[gnu::unused]] = true;
+
+ __gnu_cxx::hypergeometric_distribution<> u;
+ VERIFY( u.total_size() == 10 );
+ VERIFY( u.successful_size() == 5 );
+ VERIFY( u.total_draws() == 1 );
+ VERIFY( u.min() == 0 );
+ VERIFY( u.max() == 1 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/parms.cc
new file mode 100644
index 00000000000..09aec0f1451
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/parms.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.* Class template hypergeometric_distribution [rand.dist.ext.hypergeometric]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <ext/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test [[gnu::unused]] = true;
+
+ __gnu_cxx::hypergeometric_distribution<> u(15, 3, 2);
+ VERIFY( u.total_size() == 15 );
+ VERIFY( u.successful_size() == 3 );
+ VERIFY( u.total_draws() == 2 );
+ VERIFY( u.min() == 0 );
+ VERIFY( u.max() == 2 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/equal.cc
new file mode 100644
index 00000000000..1887457a727
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/equal.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.5.8.4.5 Class template rice_distribution [rand.dist.ext.hypergeometric]
+
+#include <ext/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test [[gnu::unused]] = true;
+
+ __gnu_cxx::hypergeometric_distribution<unsigned int> u(20, 3, 2), v, w;
+
+ VERIFY( v == w );
+ VERIFY( !(u == v) );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/inequal.cc
new file mode 100644
index 00000000000..4b56f4dc817
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/inequal.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.5.8.4.5 Class template rice_distribution [rand.dist.ext.hypergeometric]
+
+#include <ext/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test [[gnu::unused]] = true;
+
+ __gnu_cxx::hypergeometric_distribution<unsigned int> u(20, 3, 5), v, w;
+
+ VERIFY( u != v );
+ VERIFY( !(v != w) );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..583993a951c
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.* Class template hypergeometric_distribution [rand.dist.ext.hypergeometric]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <ext/random>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test [[gnu::unused]] = true;
+
+ std::stringstream str;
+ __gnu_cxx::hypergeometric_distribution<unsigned int> u(15, 3, 6), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/values.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/values.cc
new file mode 100644
index 00000000000..78c0475c935
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/operators/values.cc
@@ -0,0 +1,57 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.* Class template hypergeometric_distribution [rand.dist.ext.hypergeometric]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <ext/random>
+#include <testsuite_random.h>
+
+void
+test01()
+{
+ using namespace __gnu_test;
+
+ std::mt19937 eng;
+
+ __gnu_cxx::hypergeometric_distribution hd1{15, 3, 2};
+ auto bhd1 = std::bind(hd1, eng);
+ testDiscreteDist(bhd1, [](int k)
+ { return hypergeometric_pdf(k, 15, 3, 2); });
+
+ __gnu_cxx::hypergeometric_distribution hd2{500, 50, 30};
+ auto bhd2 = std::bind(hd2, eng);
+ testDiscreteDist(bhd2, [](int k)
+ { return hypergeometric_pdf(k, 500, 50, 30); });
+
+ __gnu_cxx::hypergeometric_distribution hd3{100, 20, 5};
+ auto bhd3 = std::bind(hd3, eng);
+ testDiscreteDist(bhd3, [](int k)
+ { return hypergeometric_pdf(k, 100, 20, 5); });
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/explicit_instantiation/1.cc
new file mode 100644
index 00000000000..016adb0837f
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ext/random>
+
+template class __gnu_cxx::hypergeometric_distribution<unsigned short>;
+template class __gnu_cxx::hypergeometric_distribution<unsigned int>;
+template class __gnu_cxx::hypergeometric_distribution<unsigned long>;
+template class __gnu_cxx::hypergeometric_distribution<unsigned long long>;
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/typedefs.cc
new file mode 100644
index 00000000000..779aad784e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+// { dg-require-cstdint "" }
+//
+// 2013-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.* Class template hypergeometric_distribution [rand.dist.ext.hypergeometric]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <ext/random>
+
+void
+test01()
+{
+ typedef __gnu_cxx::hypergeometric_distribution<unsigned int> test_type;
+
+ typedef test_type::result_type result_type;
+ typedef test_type::param_type param_type;
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_random.h b/libstdc++-v3/testsuite/util/testsuite_random.h
index bdac81ed006..84b6bc3ea36 100644
--- a/libstdc++-v3/testsuite/util/testsuite_random.h
+++ b/libstdc++-v3/testsuite/util/testsuite_random.h
@@ -176,6 +176,25 @@ namespace __gnu_test
return 1.0 / (b - a + 1.0);
}
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+ inline double
+ lbincoef(int n, int k)
+ {
+ return std::lgamma(double(1 + n))
+ - std::lgamma(double(1 + k))
+ - std::lgamma(double(1 + n - k));
+ }
+
+ inline double
+ hypergeometric_pdf(int k, int N, int K, int n)
+ {
+ if (k < 0 || k < std::max(0, n - (N - K)) || k > std::min(K, n))
+ return 0.0;
+ else
+ return lbincoef(K, k) + lbincoef(N - K, n - k) - lbincoef(N, n);
+ }
+#endif
+
} // namespace __gnu_test
#endif // #ifndef _GLIBCXX_TESTSUITE_RANDOM_H