Commit Graph

179066 Commits

Author SHA1 Message Date
Maciej W. Rozycki
cad843c7e7 gotest: use a space rather than a middle dot in target lists
Replace the U+00B7 middle dot character, placed after "mips64p32le"
in the target lists, with a space.  The U+00B7 character may not be
considered whitespace by Bourne shell and any non-ASCII character
may render incorrectly in some terminal devices.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/251177
2020-08-27 16:18:01 -07:00
Jonathan Wakely
82030d5101 libstdc++: Make std::chrono::duration use reduced ratio for period
This implements the changes from P0548 "common_type and duration". That
was a change for C++17, but as it corrects some issues introduced by DRs
I'm also treating it as a DR and changing it for all modes from C++11
up.

The main change is that duration<R,P>::period no longer denotes P, but
rather P::type, the reduced ratio. The unary operator+ and operator-
members of duration should now return a duration using that reduced
ratio.

The requirement that common_type<T>::type is the same type as
common_type<T, T>::type (rather than simply T) was already implemented
for PR 89102.

The standard says that duration::operator+() and duration::operator-()
should return common_type_t<duration>, but that seems unnecessarily
expensive to compute. This change just uses duration<rep, period> which
is the same type, so we don't need to instantiate common_type.

As an optimization, this also adds partial specializations of
common_type for two durations of the same type, a single duration, two
time_points of the same type, and a single time_point. These
specializations avoid instantiating other specializations of common_type
and one or both of __duration_common_type or __timepoint_common_type for
the cases where the answer is trivial to obtain.

libstdc++-v3/ChangeLog:

	* include/std/chrono (__duration_common_type): Ensure the
	reduced ratio is used. Remove unused partial specialization
	using __failure_type.
	(common_type): Pass reduced ratios to __duration_common_type.
	Add partial specializations for simple cases involving a single
	duration or time_point type.
	(duration::period): Use reduced ratio.
	(duration::operator+(), duration::operator-()): Return duration
	type using the reduced ratio.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc:
	Adjust expected errors.
	* testsuite/20_util/duration/requirements/reduced_period.cc: New test.
2020-08-27 22:36:03 +01:00
John David Anglin
33a55fdb1e Fix shadd-2.c scan assembler count.
2020-08-27  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/
	* gcc.target/hppa/shadd-2.c: Adjust times to 4.
2020-08-27 19:21:22 +00:00
Patrick Palka
71e9716137 libstdc++: Fix arithmetic bug in chrono::year_month::operator+
This fixes the months-based addition for year_month when the
year_month's month component is 0.

libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month::operator+): Properly handle a
	month value of 0 by casting the month value to int before
	subtracting 1 from it so that the difference is sign-extended in
	the subsequent addition.
	* testsuite/std/time/year_month/1.cc: Test adding months to a
	year_month whose month component is below or above the
	normalized range of [1,12].
2020-08-27 14:11:24 -04:00
Patrick Palka
7b743c67f0 libstdc++: Fix operator overload ambiguity with calendar types
We currently don't enforce a constraint on some of the calendar types'
addition/subtraction operator overloads that take a 'months' arguments:

  Constraints: If the argument supplied by the caller for the months
  parameter is convertible to years, its implicit conversion sequence to
  years is worse than its implicit conversion sequence to months.

This constraint is relevant when adding/subtracting a duration to/from,
say, a year_month where the given duration is convertible to both
'months' and to 'years' (as in the new testcases below).  The correct
behavior here in light of this constraint is to perform the operation
through the (more efficient) 'years'-based overload, but we currently
emit an ambiguous overload error.

This patch templatizes the 'months'-based addition/subtraction operator
overloads so that in the event of an implicit-conversion tie, we select
the non-template 'years'-based overload.  This is the same approach
that the date library takes for enforcing this constraint.

libstdc++-v3/ChangeLog:

	* include/std/chrono
	(__detail::__months_years_conversion_disambiguator): Define.
	(year_month::operator+=): Templatize the 'months'-based overload
	so that the 'years'-based overload is selected in case of
	equally-ranked implicit conversion sequences to both 'months'
	and 'years' from the supplied argument.
	(year_month::operator-=): Likewise.
	(year_month::operator+): Likewise.
	(year_month::operator-): Likewise.
	(year_month_day::operator+=): Likewise.
	(year_month_day::operator-=): Likewise.
	(year_month_day::operator+): Likewise.
	(year_month_day::operator-): Likewise.
	(year_month_day_last::operator+=): Likewise.
	(year_month_day_last::operator-=): Likewise.
	(year_month_day_last::operator+): Likewise
	(year_month_day_last::operator-): Likewise.
	(year_month_day_weekday::operator+=): Likewise
	(year_month_day_weekday::operator-=): Likewise.
	(year_month_day_weekday::operator+): Likewise.
	(year_month_day_weekday::operator-): Likewise.
	(year_month_day_weekday_last::operator+=): Likewise
	(year_month_day_weekday_last::operator-=): Likewise.
	(year_month_day_weekday_last::operator+): Likewise.
	(year_month_day_weekday_last::operator-): Likewise.
	(testsuite/std/time/year_month/2.cc): New test.
	(testsuite/std/time/year_month_day/2.cc): New test.
	(testsuite/std/time/year_month_day_last/2.cc): New test.
	(testsuite/std/time/year_month_weekday/2.cc): New test.
	(testsuite/std/time/year_month_weekday_last/2.cc): New test.
2020-08-27 14:09:52 -04:00
Jakub Jelinek
04df5e7de2 ia32: Fix alignment of _Atomic fields [PR65146]
For _Atomic fields, lowering the alignment of long long or double etc.
fields on ia32 is undesirable, because then one really can't perform atomic
operations on those using cmpxchg8b.

The following patch stops lowering the alignment in fields for _Atomic
types (the x86_field_alignment change) and for -mpreferred-stack-boundary=2
also ensures we don't misalign _Atomic long long etc. automatic variables
(the ix86_{local,minimum}_alignment changes).
Not sure about iamcu_alignment change, I know next to nothing about IA MCU,
but unless it doesn't have cmpxchg8b instruction, it would surprise me if we
don't want to do it as well.
clang apparently doesn't lower the field alignment for _Atomic.

2020-08-27  Jakub Jelinek  <jakub@redhat.com>

	PR target/65146
	* config/i386/i386.c (iamcu_alignment): Don't decrease alignment
	for TYPE_ATOMIC types.
	(ix86_local_alignment): Likewise.
	(ix86_minimum_alignment): Likewise.
	(x86_field_alignment): Likewise, and emit a -Wpsabi diagnostic
	for it.

	* gcc.target/i386/pr65146.c: New test.
2020-08-27 18:44:40 +02:00
Bill Schmidt
abca87c578 rs6000: Support ELFv2 sibcall for indirect calls [PR96787]
Prior to P10, ELFv2 hasn't implemented nonlocal sibcalls.  Now that we do,
we need to be sure that r12 is set up prior to such a call.

2020-08-27  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/96787
	* config/rs6000/rs6000.c (rs6000_sibcall_aix): Support
	indirect call for ELFv2.

gcc/testsuite/

	PR target/96787
	* gcc.target/powerpc/pr96787-1.c: New.
	* gcc.target/powerpc/pr96787-2.c: New.
2020-08-27 11:18:33 -05:00
Mark Eggleston
c336eda750 Fortran : ICE for division by zero in declaration PR95882
A length expression containing a divide by zero in a character
declaration will result in an ICE if the constant is anymore
complicated that a contant divided by a constant.

The cause was that char_len_param_value can return MATCH_YES
even if a divide by zero was seen.  Prior to returning check
whether a divide by zero was seen and if so set it to MATCH_ERROR.

2020-08-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran

	PR fortran/95882
	* decl.c (char_len_param_value): Check gfc_seen_div0 and
	if it is set return MATCH_ERROR.

2020-08-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

	PR fortran/95882
	* gfortran.dg/pr95882_1.f90: New test.
	* gfortran.dg/pr95882_2.f90: New test.
	* gfortran.dg/pr95882_3.f90: New test.
	* gfortran.dg/pr95882_4.f90: New test.
	* gfortran.dg/pr95882_5.f90: New test.
2020-08-27 15:12:10 +01:00
Richard Biener
eb68d9d828 tree-optimization/96522 - transfer of flow-sensitive info in copy_ref_info
This removes the bogus tranfer of flow-sensitive info in copy_ref_info
plus fixes one oversight in FRE when flow-sensitive non-NULLness was added to
points-to info.

2020-08-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96522
	* tree-ssa-address.c (copy_ref_info): Reset flow-sensitive
	info of the copied points-to.  Transfer bigger alignment
	via the access type.
	* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
	Reset all flow-sensitive info.

	* gcc.dg/torture/pr96522.c: New testcase.
2020-08-27 14:25:55 +02:00
Martin Liska
cb3874dcf8 vec: add exact argument for various grow functions.
gcc/ada/ChangeLog:

	* gcc-interface/trans.c (gigi): Set exact argument of a vector
	growth function to true.
	(Attribute_to_gnu): Likewise.

gcc/ChangeLog:

	* alias.c (init_alias_analysis): Set exact argument of a vector
	growth function to true.
	* calls.c (internal_arg_pointer_based_exp_scan): Likewise.
	* cfgbuild.c (find_many_sub_basic_blocks): Likewise.
	* cfgexpand.c (expand_asm_stmt): Likewise.
	* cfgrtl.c (rtl_create_basic_block): Likewise.
	* combine.c (combine_split_insns): Likewise.
	(combine_instructions): Likewise.
	* config/aarch64/aarch64-sve-builtins.cc (function_expander::add_output_operand): Likewise.
	(function_expander::add_input_operand): Likewise.
	(function_expander::add_integer_operand): Likewise.
	(function_expander::add_address_operand): Likewise.
	(function_expander::add_fixed_operand): Likewise.
	* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
	* dwarf2cfi.c (update_row_reg_save): Likewise.
	* early-remat.c (early_remat::init_block_info): Likewise.
	(early_remat::finalize_candidate_indices): Likewise.
	* except.c (sjlj_build_landing_pads): Likewise.
	* final.c (compute_alignments): Likewise.
	(grow_label_align): Likewise.
	* function.c (temp_slots_at_level): Likewise.
	* fwprop.c (build_single_def_use_links): Likewise.
	(update_uses): Likewise.
	* gcc.c (insert_wrapper): Likewise.
	* genautomata.c (create_state_ainsn_table): Likewise.
	(add_vect): Likewise.
	(output_dead_lock_vect): Likewise.
	* genmatch.c (capture_info::capture_info): Likewise.
	(parser::finish_match_operand): Likewise.
	* genrecog.c (optimize_subroutine_group): Likewise.
	(merge_pattern_info::merge_pattern_info): Likewise.
	(merge_into_decision): Likewise.
	(print_subroutine_start): Likewise.
	(main): Likewise.
	* gimple-loop-versioning.cc (loop_versioning::loop_versioning): Likewise.
	* gimple.c (gimple_set_bb): Likewise.
	* graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user): Likewise.
	* haifa-sched.c (sched_extend_luids): Likewise.
	(extend_h_i_d): Likewise.
	* insn-addr.h (insn_addresses_new): Likewise.
	* ipa-cp.c (gather_context_independent_values): Likewise.
	(find_more_contexts_for_caller_subset): Likewise.
	* ipa-devirt.c (final_warning_record::grow_type_warnings): Likewise.
	(ipa_odr_read_section): Likewise.
	* ipa-fnsummary.c (evaluate_properties_for_edge): Likewise.
	(ipa_fn_summary_t::duplicate): Likewise.
	(analyze_function_body): Likewise.
	(ipa_merge_fn_summary_after_inlining): Likewise.
	(read_ipa_call_summary): Likewise.
	* ipa-icf.c (sem_function::bb_dict_test): Likewise.
	* ipa-prop.c (ipa_alloc_node_params): Likewise.
	(parm_bb_aa_status_for_bb): Likewise.
	(ipa_compute_jump_functions_for_edge): Likewise.
	(ipa_analyze_node): Likewise.
	(update_jump_functions_after_inlining): Likewise.
	(ipa_read_edge_info): Likewise.
	(read_ipcp_transformation_info): Likewise.
	(ipcp_transform_function): Likewise.
	* ipa-reference.c (ipa_reference_write_optimization_summary): Likewise.
	* ipa-split.c (execute_split_functions): Likewise.
	* ira.c (find_moveable_pseudos): Likewise.
	* lower-subreg.c (decompose_multiword_subregs): Likewise.
	* lto-streamer-in.c (input_eh_regions): Likewise.
	(input_cfg): Likewise.
	(input_struct_function_base): Likewise.
	(input_function): Likewise.
	* modulo-sched.c (set_node_sched_params): Likewise.
	(extend_node_sched_params): Likewise.
	(schedule_reg_moves): Likewise.
	* omp-general.c (omp_construct_simd_compare): Likewise.
	* passes.c (pass_manager::create_pass_tab): Likewise.
	(enable_disable_pass): Likewise.
	* predict.c (determine_unlikely_bbs): Likewise.
	* profile.c (compute_branch_probabilities): Likewise.
	* read-rtl-function.c (function_reader::parse_block): Likewise.
	* read-rtl.c (rtx_reader::read_rtx_code): Likewise.
	* reg-stack.c (stack_regs_mentioned): Likewise.
	* regrename.c (regrename_init): Likewise.
	* rtlanal.c (T>::add_single_to_queue): Likewise.
	* sched-deps.c (init_deps_data_vector): Likewise.
	* sel-sched-ir.c (sel_extend_global_bb_info): Likewise.
	(extend_region_bb_info): Likewise.
	(extend_insn_data): Likewise.
	* symtab.c (symtab_node::create_reference): Likewise.
	* tracer.c (tail_duplicate): Likewise.
	* trans-mem.c (tm_region_init): Likewise.
	(get_bb_regions_instrumented): Likewise.
	* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
	(build_gimple_cfg): Likewise.
	(create_bb): Likewise.
	(move_block_to_fn): Likewise.
	* tree-complex.c (tree_lower_complex): Likewise.
	* tree-if-conv.c (predicate_rhs_code): Likewise.
	* tree-inline.c (copy_bb): Likewise.
	* tree-into-ssa.c (get_ssa_name_ann): Likewise.
	(mark_phi_for_rewrite): Likewise.
	* tree-object-size.c (compute_builtin_object_size): Likewise.
	(init_object_sizes): Likewise.
	* tree-predcom.c (initialize_root_vars_store_elim_1): Likewise.
	(initialize_root_vars_store_elim_2): Likewise.
	(prepare_initializers_chain_store_elim): Likewise.
	* tree-ssa-address.c (addr_for_mem_ref): Likewise.
	(multiplier_allowed_in_address_p): Likewise.
	* tree-ssa-coalesce.c (ssa_conflicts_new): Likewise.
	* tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
	* tree-ssa-loop-ivopts.c (addr_offset_valid_p): Likewise.
	(get_address_cost_ainc): Likewise.
	* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise.
	* tree-ssa-pre.c (add_to_value): Likewise.
	(phi_translate_1): Likewise.
	(do_pre_regular_insertion): Likewise.
	(do_pre_partial_partial_insertion): Likewise.
	(init_pre): Likewise.
	* tree-ssa-propagate.c (ssa_prop_init): Likewise.
	(update_call_from_tree): Likewise.
	* tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	(vn_reference_lookup_pieces): Likewise.
	(eliminate_dom_walker::eliminate_push_avail): Likewise.
	* tree-ssa-strlen.c (set_strinfo): Likewise.
	(get_stridx_plus_constant): Likewise.
	(zero_length_string): Likewise.
	(find_equal_ptrs): Likewise.
	(printf_strlen_execute): Likewise.
	* tree-ssa-threadedge.c (set_ssa_name_value): Likewise.
	* tree-ssanames.c (make_ssa_name_fn): Likewise.
	* tree-streamer-in.c (streamer_read_tree_bitfields): Likewise.
	* tree-vect-loop.c (vect_record_loop_mask): Likewise.
	(vect_get_loop_mask): Likewise.
	(vect_record_loop_len): Likewise.
	(vect_get_loop_len): Likewise.
	* tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Likewise.
	* tree-vect-slp.c (vect_slp_convert_to_external): Likewise.
	(vect_bb_slp_scalar_cost): Likewise.
	(vect_bb_vectorization_profitable_p): Likewise.
	(vectorizable_slp_permutation): Likewise.
	* tree-vect-stmts.c (vectorizable_call): Likewise.
	(vectorizable_simd_clone_call): Likewise.
	(scan_store_can_perm_p): Likewise.
	(vectorizable_store): Likewise.
	* expr.c: Likewise.
	* vec.c (test_safe_grow_cleared): Likewise.
	* vec.h (vec_safe_grow): Likewise.
	(vec_safe_grow_cleared): Likewise.
	(vl_ptr>::safe_grow): Likewise.
	(vl_ptr>::safe_grow_cleared): Likewise.
	* config/c6x/c6x.c (insn_set_clock): Likewise.

gcc/c/ChangeLog:

	* gimple-parser.c (c_parser_gimple_compound_statement): Set exact argument of a vector
	growth function to true.

gcc/cp/ChangeLog:

	* class.c (build_vtbl_initializer): Set exact argument of a vector
	growth function to true.
	* constraint.cc (get_mapped_args): Likewise.
	* decl.c (cp_maybe_mangle_decomp): Likewise.
	(cp_finish_decomp): Likewise.
	* parser.c (cp_parser_omp_for_loop): Likewise.
	* pt.c (canonical_type_parameter): Likewise.
	* rtti.c (get_pseudo_ti_init): Likewise.

gcc/fortran/ChangeLog:

	* trans-openmp.c (gfc_trans_omp_do): Set exact argument of a vector
	growth function to true.

gcc/lto/ChangeLog:

	* lto-common.c (lto_file_finalize): Set exact argument of a vector
	growth function to true.
2020-08-27 13:29:43 +02:00
Richard Biener
9ceb3b8d8f streamline TARGET_MEM_REF dumping
The following streamlines TARGET_MEM_REF dumping building
on what we do for MEM_REF and thus dumping things like
access type, TBAA type and base/clique.  I've changed it
to do semantic dumping aka base + offset + step * index
rather than the odd base: A, step: way.

2020-08-27  Richard Biener  <rguenther@suse.de>

	* tree-pretty-print.c (dump_mem_ref): Handle TARGET_MEM_REFs.
	(dump_generic_node): Use dump_mem_ref also for TARGET_MEM_REF.

	* gcc.dg/tree-ssa/loop-19.c: Adjust.
	* gcc.dg/tree-ssa/loop-2.c: Likewise.
	* gcc.dg/tree-ssa/loop-3.c: Likewise.
2020-08-27 13:08:13 +02:00
Alex Coplan
6b3034eaba lra: Canonicalize mult to shift in address reloads
Inside a (mem) RTX, it is canonical to write multiplications by powers
of two using a (mult) [0]. Outside of a (mem), the canonical way to
write multiplications by powers of two is using (ashift).

Now I observed that LRA does not quite respect this RTL canonicalization
rule.  When compiling gcc/testsuite/gcc.dg/torture/pr34330.c with -Os
-ftree-vectorize, the RTL in the dump "281r.ira" has the insn:

(set (reg:SI 111)
     (mem:SI (plus:DI (mult:DI (reg:DI 101 [ ivtmp.9 ])
                 (const_int 4 [0x4]))
             (reg/v/f:DI 105 [ b ]))))

but LRA then proceeds to generate a reload, and we get the following
non-canonical insn in "282r.reload":

(set (reg:DI 7 x7 [121])
     (plus:DI (mult:DI (reg:DI 5 x5 [orig:101 ivtmp.9 ] [101])
             (const_int 4 [0x4]))
         (reg/v/f:DI 1 x1 [orig:105 b ] [105])))

This patch fixes LRA to ensure that we generate canonical RTL in this
case. After the patch, we get the following insn in "282r.reload":

(set (reg:DI 7 x7 [121])
        (plus:DI (ashift:DI (reg:DI 5 x5 [orig:101 ivtmp.9 ] [101])
                (const_int 2 [0x2]))
            (reg/v/f:DI 1 x1 [orig:105 b ] [105])))

[0] : https://gcc.gnu.org/onlinedocs/gccint/Insn-Canonicalizations.html

gcc/ChangeLog:

	* lra-constraints.c (canonicalize_reload_addr): New.
	(curr_insn_transform): Use canonicalize_reload_addr to ensure we
	generate canonical RTL for an address reload.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/mem-shift-canonical.c: New test.
2020-08-27 09:49:57 +01:00
xiezhiheng
795944c456 AArch64: Add FLAG for rounding intrinsics [PR94442]
2020-08-27  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
	for rounding intrinsics.
2020-08-27 09:07:26 +01:00
xiezhiheng
d7738d4fde AArch64: Add FLAG for min/max intrinsics [PR94442]
2020-08-27  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
	for min/max intrinsics.
2020-08-27 09:07:26 +01:00
Richard Biener
ff7463172e tree-optimization/96579 - another special-operands fix in reassoc
This makes sure to put special-ops expanded rhs left where
expression rewrite expects it.

2020-08-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96579
	* tree-ssa-reassoc.c (linearize_expr_tree): If we expand
	rhs via special ops make sure to swap operands.

	* gcc.dg/pr96579.c: New testcase.
2020-08-27 10:02:22 +02:00
Richard Biener
989bc4ca2f tree-optimization/96565 - improve DSE with paths ending in noreturn
This improves DSEs stmt walking by not considering a DEF without
uses for further processing (and thus giving up when there's two
paths to follow).

2020-08-26  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96565
	* tree-ssa-dse.c (dse_classify_store): Remove defs with
	no uses from further processing.

	* gcc.dg/tree-ssa/ssa-dse-40.c: New testcase.
	* gcc.dg/builtin-object-size-4.c: Adjust.
2020-08-27 08:07:34 +02:00
Patrick Palka
3ae0cd94ab libstdc++: Implement remaining piece of LWG 3448
Almost all of the proposed resolution for LWG 3448 is already
implemented; the only part left is to adjust the return type of
transform_view::sentinel::operator-.

libstdc++-v3/ChangeLog:

	PR libstdc++/95322
	* include/std/ranges (transform_view::sentinel::__distance_from):
	Give this a deduced return type.
	(transform_view::sentinel::operator-): Adjust the return type so
	that it's based on the constness of the iterator rather than
	that of the sentinel.
	* testsuite/std/ranges/adaptors/95322.cc: Refer to LWG 3488.
2020-08-26 21:53:04 -04:00
Patrick Palka
4be16d1c1c libstdc++: elements_view's sentinel and iterator not comparable [LWG 3406]
This implements the proposed resolution for LWG 3406, and adds a
testcase for the example from P1994R1.

libstdc++-v3/ChangeLog:

	* include/std/ranges (elements_view::begin): Adjust constraints.
	(elements_view::end): Likewise.
	(elements_view::_Sentinel::operator==): Templatize to take both
	_Iterator<true> and _Iterator<false>.
	(elements_view::_Sentinel::operator-): Likewise.
	* testsuite/std/ranges/adaptors/elements.cc: Add testcase for
	the example from P1994R1.
	* testsuite/std/ranges/adaptors/lwg3406.cc: New test.
2020-08-26 21:52:58 -04:00
Patrick Palka
97ab5daa6c libstdc++: Implement P1994R1 changes to ranges::elements_view
The example from the paper doesn't compile without the proposed
resolution for LWG 3406, so we'll add a testcase for this once the
proposed resolution is implemented.

libstdc++-v3/ChangeLog:

	* include/std/ranges (elements_view::end): Replace these two
	overloads with four new overloads.
	(elements_view::_Iterator::operator==): Remove.
	(elements_view::_Iterator::operator-): Likewise.
	(elements_view::_Sentinel): Define.
2020-08-26 21:49:51 -04:00
GCC Administrator
57ea089421 Daily bump. 2020-08-27 00:16:27 +00:00
Clément Chigot
0c223b02b6 cmd: add -maix32 to gcc calls for aix/ppc
As gcc might now be compiled in 64bit, -maix32 must always be added
to ensure that created objects will be 32bit.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/250778
2020-08-26 16:29:03 -07:00
Clément Chigot
6b0b6a3868 libgo: add FAT library support for static libraries on AIX
Like shared libraries, AIX static libraries must also have both 32 and
64 bit objects.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/250777
2020-08-26 16:18:06 -07:00
Jeff Law
07545fbd2d Mark various tests that require a c99 libm
A number of i386 math optimisation tests are looking assembly instructions
that are only emitted when the compiler knows the target has a C99 libm
available. Since targets like *-elf may not have such a libm, a C99 runtime
requirement is added to these tests.

gcc/testsuite/ChangeLog

	* gcc.target/i386/387-7.c: Add dg-require-effective-target c99_runtime.
	* gcc.target/i386/387-9.c: Likewise.
	* g++.target/i386/avx512bw-pr96246-1.C: Likewise.
	* gcc.target/i386/avx512f-rint-sfix-vec-2.c: Likewise.
	* gcc.target/i386/avx512f-rintf-sfix-vec-2.c: Likewise.
	* g++.target/i386/avx512vl-pr96246-1.C: Likewise.
	* gcc.target/i386/pr61403.c: Likewise.
	* gcc.target/i386/sse4_1-ceil-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-ceilf-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-floor-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-floorf-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-rint-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-rintf-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-round-sfix-vec.c: Likewise.
	* gcc.target/i386/sse4_1-roundf-sfix-vec.c: Likewise.
2020-08-26 17:12:07 -06:00
Göran Uddeborg
8ca43e4ea5 Fix documentation of -fprofile-exclude-files
The wording of the description of -fprofile-exclude-files is easy to
misunderstand.  One can be led to believe a file is excluded only if
it matches all of the patterns, not just one.  This patch tries to
clarify the function.  It also adjusts the wording of
-fprofile-filter-files accordingly.

gcc/

	PR gcov-profile/96285
	* common.opt, doc/invoke.texi: Clarify wording of
	-fprofile-exclude-files and adjust -fprofile-filter-files to
	match.
2020-08-26 17:07:36 -06:00
H.J. Lu
8f1ea8ddcc x86: Reject target("no-general-regs-only")
Reject target("no-general-regs-only") pragma and attribute.

gcc/

	PR target/96802
	* config/i386/i386-options.c (ix86_valid_target_attribute_inner_p):
	Reject target("no-general-regs-only").

gcc/testsuite/

	PR target/96802
	* gcc.target/i386/pr96802-1.c: New test.
	* gcc.target/i386/pr96802-2.c: Likewise.
2020-08-26 12:56:18 -07:00
Jozef Lawrynowicz
703e049aa7 MSP430: Simplify and extend shift instruction patterns
The implementation of define_expand and define_insn patterns to handle
shifts in the MSP430 backend is inconsistent, resulting in missed
opportunities to make best use of the architecture's features.

There's now a single define_expand used as the entry point for all valid
shifts, and the decision to either use a helper function to perform the
shift (often required for the 430 ISA), or fall through to the
define_insn patterns can be made from that expander function.

Shifts by a constant amount have been grouped into one define_insn for
each type of shift, instead of having different define_insn patterns for
shifts by different amounts.

A new target option "-mmax-inline-shift=" has been added to allow tuning
of the number of shift instructions to emit inline, instead of using
a library helper function.

gcc/ChangeLog:

	* config/msp430/constraints.md (K): Change unused constraint to
	constraint to a const_int between 1 and 19.
	(P): New constraint.
	* config/msp430/msp430-protos.h (msp430x_logical_shift_right): Remove.
	(msp430_expand_shift): New.
	(msp430_output_asm_shift_insns): New.
	* config/msp430/msp430.c (msp430_rtx_costs): Remove shift costs.
	(CSH): Remove.
	(msp430_expand_helper): Remove hard-coded generation of some inline
	shift insns.
	(use_helper_for_const_shift): New.
	(msp430_expand_shift): New.
	(msp430_output_asm_shift_insns): New.
	(msp430_print_operand): Add new 'W' operand selector.
	(msp430x_logical_shift_right): Remove.
	* config/msp430/msp430.md (HPSI): New define_mode_iterator.
	(HDI): Likewise.
	(any_shift): New define_code_iterator.
	(shift_insn): New define_code_attr.
	Adjust unnamed insn patterns searched for by combine.
	(ashlhi3): Remove.
	(slli_1): Remove.
	(430x_shift_left): Remove.
	(slll_1): Remove.
	(slll_2): Remove.
	(ashlsi3): Remove.
	(ashldi3): Remove.
	(ashrhi3): Remove.
	(srai_1): Remove.
	(430x_arithmetic_shift_right): Remove.
	(srap_1): Remove.
	(srap_2): Remove.
	(sral_1): Remove.
	(sral_2): Remove.
	(ashrsi3): Remove.
	(ashrdi3): Remove.
	(lshrhi3): Remove.
	(srli_1): Remove.
	(430x_logical_shift_right): Remove.
	(srlp_1): Remove.
	(srll_1): Remove.
	(srll_2x): Remove.
	(lshrsi3): Remove.
	(lshrdi3): Remove.
	(<shift_insn><mode>3): New define_expand.
	(<shift_insn>hi3_430): New define_insn.
	(<shift_insn>si3_const): Likewise.
	(ashl<mode>3_430x): Likewise.
	(ashr<mode>3_430x): Likewise.
	(lshr<mode>3_430x): Likewise.
	(*bitbranch<mode>4_z): Replace renamed predicate msp430_bitpos with
	const_0_to_15_operand.
	* config/msp430/msp430.opt: New option -mmax-inline-shift=.
	* config/msp430/predicates.md (const_1_to_8_operand): New predicate.
	(const_0_to_15_operand): Rename msp430_bitpos predicate.
	(const_1_to_19_operand): New predicate.
	* doc/invoke.texi: Document -mmax-inline-shift=.

libgcc/ChangeLog:

	* config/msp430/slli.S (__gnu_mspabi_sllp): New.
	* config/msp430/srai.S (__gnu_mspabi_srap): New.
	* config/msp430/srli.S (__gnu_mspabi_srlp): New.

gcc/testsuite/ChangeLog:

	* gcc.target/msp430/emulate-srli.c: Fix expected assembler text.
	* gcc.target/msp430/max-inline-shift-430-no-opt.c: New test.
	* gcc.target/msp430/max-inline-shift-430.c: New test.
	* gcc.target/msp430/max-inline-shift-430x.c: New test.
2020-08-26 20:50:58 +01:00
Jonathan Wakely
af06acfc8d libstdc++: Whitespace changes in <tuple>
libstdc++-v3/ChangeLog:

	* include/std/tuple (_Tuple_impl): Whitespaces changes for
	consistent indentation. Also use __enable_if_t alias template.
2020-08-26 19:32:30 +01:00
Jonathan Wakely
5494edae83 libstdc++: Use correct argument type for __use_alloc [PR 96803]
The _Tuple_impl constructor for allocator-extended construction from a
different tuple type uses the _Tuple_impl's own _Head type in the
__use_alloc test. That is incorrect, because the argument tuple could
have a different type. Using the wrong type might select the
leading-allocator convention when it should use the trailing-allocator
convention, or vice versa.

libstdc++-v3/ChangeLog:

	PR libstdc++/96803
	* include/std/tuple
	(_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl<U...>&)):
	Replace parameter pack with a type parameter and a pack and pass
	the first type to __use_alloc.
	* testsuite/20_util/tuple/cons/96803.cc: New test.
2020-08-26 19:32:30 +01:00
Patrick Palka
0c5df67ffc libstdc++: Fix typo in chrono::year_month_weekday::operator==
libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month_weekday::operator==): Compare
	weekday_indexed instead of weekday.
	* testsuite/std/time/year_month_weekday/1.cc: Augment testcase.
2020-08-26 12:58:37 -04:00
Jonathan Wakely
9f9c0549dd libstdc++: Fix regression in hash containers
A recent change altered the layout of EBO-helper base classes, resulting
in an ambiguity when the hash function and equality predicate are the
same type.

This modifies the type of one of the base classes, so that we don't get
two base classes of the same type.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (_Hash_code_base): Change
	index of _Hashtable_ebo_helper base class.
	* testsuite/23_containers/unordered_map/dup_types.cc: New test.
2020-08-26 17:44:23 +01:00
Tobias Burnus
b6cd5c3786 MAINTAINERS: Add myself as OpenACC maintainer
ChangeLog:

	* MAINTAINERS (Various Maintainers): Add myself as OpenACC maintainer.
2020-08-26 17:58:22 +02:00
Aldy Hernandez
bf19cbc9ce Adjust tree-ssa-dom.c for irange API.
This removes all uses of VR_ANTI_RANGE.

gcc/ChangeLog:

	* tree-ssa-dom.c (simplify_stmt_for_jump_threading): Abstract code out to...
	* tree-vrp.c (find_case_label_range): ...here.  Rewrite for to use irange
	API.
	(simplify_stmt_for_jump_threading): Call find_case_label_range instead of
	duplicating the code in simplify_stmt_for_jump_threading.
	* tree-vrp.h (find_case_label_range): New prototype.
2020-08-26 16:03:00 +02:00
Richard Biener
2130efe6ac tree-optimization/96698 - fix ICE when vectorizing nested cycles
This fixes vectorized PHI latch edge updating and delay it until
all of the loop is code generated to deal with the case that the
latch def is a PHI in the same block.

2020-08-26  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96698
	* tree-vectorizer.h (loop_vec_info::reduc_latch_defs): New.
	(loop_vec_info::reduc_latch_slp_defs): Likewise.
	* tree-vect-stmts.c (vect_transform_stmt): Only record
	stmts to update PHI latches from, perform the update ...
	* tree-vect-loop.c (vect_transform_loop): ... here after
	vectorizing those PHIs.
	(info_for_reduction): Properly handle non-reduction PHIs.

	* gcc.dg/vect/pr96698.c: New testcase.
2020-08-26 16:02:32 +02:00
Jonathan Wakely
3eefb302d2 libstdc++: Enable assertions in constexpr string_view members [PR 71960]
Since GCC 6.1 there is no reason we can't just use __glibcxx_assert in
constexpr functions in string_view. As long as the condition is true,
there will be no call to std::__replacement_assert that would make the
function ineligible for constant evaluation.

	PR libstdc++/71960
	* include/experimental/string_view (basic_string_view):
	Enable debug assertions.
	* include/std/string_view (basic_string_view):
	Likewise.
2020-08-26 14:48:49 +01:00
Martin Liska
2236c45479 symver: fix attribute matching.
gcc/ChangeLog:

	* cgraphunit.c (process_symver_attribute): Match only symver
	TREE_PURPOSE.
2020-08-26 15:42:31 +02:00
Patrick Palka
e9a2b5b8a3 libstdc++: Add missing extra space to ChangeLog author lines 2020-08-26 09:35:07 -04:00
Patrick Palka
121dc0c378 libstdc++: Add missing coauthors to ChangeLog entry
The corresponding commit had the Co-authored-by: lines in the middle of
the commit message instead of at the end, so the ChangeLog script didn't
consider them.
2020-08-26 09:29:39 -04:00
Richard Biener
71b6257e3a tree-optimization/96783 - fix vectorization of negative step SLP
This appropriately uses VMAT_ELEMENTWISE when the vectors cannot be
filled from a single SLP group until we get more explicit support
for negative stride SLP.

2020-08-26  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96783
	* tree-vect-stmts.c (get_group_load_store_type): Use
	VMAT_ELEMENTWISE for negative strides when we cannot
	use VMAT_STRIDED_SLP.

	* gcc.dg/vect/pr96783-1.c: New testcase.
	* gcc.dg/vect/pr96783-2.c: Likewise.
2020-08-26 14:28:49 +02:00
Nathan Sidwell
1f53d8f1d3 c++: template operator lookup caching
Jason's fix to retain operator lookups inside dependent lambda
functions turns out to be needed on the modules branch for all
template functions.  Because the context for that lookup no longer
exists in imports.  There were also a couple of shortcomings, which
this patch fixes.

(a) we conflate 'we found nothing' and 'we can redo this at
instantiation time'.  Fixed by making the former produce
error_mark_node.  That needs a fix in name-lookup to know that finding
a binding containing error_mark_node, means 'stop looking' you found
nothing.

(b) we'd continually do lookups for every operator, if nothing needed
to be retained.  Fixed by always caching that information, and then
dealing with it when pushing the bindings.

(c) if what we found was that find by a global namespace lookup, we'd
not cache that.  But that'd cause us to either find decls declared
after the template, potentially hiding those we expected to find.  So
don't do that check.

This still retains only recording on lambdas.  As the comment says, we
could enable for all templates.

	gcc/cp/
	* decl.c (poplevel): A local-binding tree list holds the name in
	TREE_PURPOSE.
	* name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
	(lookup_name_1): Deal with local-binding error_mark_node marker.
	(op_unqualified_lookup): Return error_mark_node for 'nothing
	found'.  Retain global binding, check class binding here.
	(maybe_save_operator_binding): Reimplement to always cache a
	result.
	(push_operator_bindings): Deal with 'ignore' marker.
	gcc/testsuite/
	* g++.dg/lookup/operator-1.C: New.
	* g++.dg/lookup/operator-2.C: New.
2020-08-26 05:26:53 -07:00
Martin Liska
f523aaa039 lto: fix documentation about -fpie and -fpic options
gcc/ChangeLog:

	* doc/invoke.texi: Document how are pie and pic options merged.
2020-08-26 13:18:51 +02:00
xiezhiheng
e3684bcbf8 AArch64: Add FLAG for add/sub arithmetic intrinsics [PR94442]
2020-08-26  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
	for add/sub arithmetic intrinsics.
2020-08-26 11:12:56 +01:00
Qian Jianhua
764a67aafc aarch64: Fix testcase gcc.target/aarch64/insv_1.c
There are three failures in gcc.target/aarch64/insv_1.c.
 FAIL: gcc.target/aarch64/insv_1.c scan-assembler bfi\tx[0-9]+, x[0-9]+, 0, 8
 FAIL: gcc.target/aarch64/insv_1.c scan-assembler bfi\tx[0-9]+, x[0-9]+, 16, 5
 FAIL: gcc.target/aarch64/insv_1.c scan-assembler movk\tx[0-9]+, 0x1d6b, lsl 32

This patch fix the third failure which was missed "#" before immediate value
in scan-assembler.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/insv_1.c: Add '#' in scan-assembler
2020-08-26 11:08:10 +01:00
Jakub Jelinek
ca1afa261d dwarf2out: Fix up dwarf2out_next_real_insn caching [PR96729]
The addition of NOTE_INSN_BEGIN_STMT and NOTE_INSN_INLINE_ENTRY notes
reintroduced quadratic behavior into dwarf2out_var_location.
This function needs to know the next real instruction to which the var
location note applies, but the way final_scan_insn is called outside of
final.c main loop doesn't make it easy to look up the next real insn in
there (and for non-dwarf it is even useless).  Usually next real insn is
only a few notes away, but we can have hundreds of thousands of consecutive
notes only followed by a real insn.  dwarf2out_var_location to avoid the
quadratic behavior contains a cache, it remembers the next note and when it
is called again on that loc_note, it can use the previously computed
dwarf2out_next_real_insn result, rather than walking the insn chain once
again.  But, for NOTE_INSN_{BEGIN_STMT,INLINE_ENTRY} dwarf2out_var_location
is not called while the code puts into the cache those notes, which means if
we have e.g. in the worst case NOTE_INSN_VAR_LOCATION and
NOTE_INSN_BEGIN_STMT notes alternating, the cache is not really used.

The following patch fixes it by looking up the next NOTE_INSN_VAR_LOCATION
if any.  While the lookup could be perhaps done together with looking for
the next real insn once (e.g. in dwarf2out_next_real_insn or its copy),
there are other dwarf2out_next_real_insn callers which don't need/want that
behavior and if there are more than two NOTE_INSN_VAR_LOCATION notes
followed by the same real insn, we need to do that "find next
NOTE_INSN_VAR_LOCATION" walk anyway.

On the testcase from the PR this patch speeds it 2.8times, from 0m0.674s
to 0m0.236s (why it takes for the reporter more than 60s is unknown).

2020-08-26  Jakub Jelinek  <jakub@redhat.com>

	PR debug/96729
	* dwarf2out.c (dwarf2out_next_real_insn): Adjust function comment.
	(dwarf2out_var_location): Look for next_note only if next_real is
	non-NULL, in that case look for the first non-deleted
	NOTE_INSN_VAR_LOCATION between loc_note and next_real, if any.
2020-08-26 10:30:15 +02:00
Iain Buclaw
387d0773f3 libiberty: Add support for in' and in ref' storage classes.
The storage class `in' is now a first-class citizen with its own mangle
symbol, of which also permits `in ref'.  Previously, `in' was an alias
to `const [scope]', which is a type constructor.

The mangle symbol repurposed for this is `I', which was originally used
by identifier types.  However, while TypeIdentifier is part of the
grammar, it must be resolved to some other entity during the semantic
passes, and so shouldn't appear anywhere in the mangled name.

Old tests that are now no longer valid have been removed.

libiberty/ChangeLog:

	* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
	parameter storage classes.
	(dlang_type): Remove identifier type.
	* testsuite/d-demangle-expected: Update tests.
2020-08-26 10:03:56 +02:00
Iain Buclaw
f0a0a84cd9 d: Merge upstream dmd e49192807
1. Removes prelude assert for constructors and destructors.  To trigger
these asserts one needed to construct or destruct an aggregate at the
null memory location.  This would crash upon any data member access,
which is required for a constructor or destructor to do anything useful.

2. Disables bounds checking in foreach statements, when the array is
either a static or dynamic array.  If we trust the array `.length' to
be correct, then all elements are between `[0 .. length]', and can't
can't be out of bounds.

Reviewed-on: https://github.com/dlang/dmd/pull/11623

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd e49192807
2020-08-26 10:03:56 +02:00
Iain Buclaw
87e36d9baf d: Fix no RVO when returning struct literals initialized with constructor.
Backports a change from upstream dmd that moves front-end NRVO checking
from ReturnStatement semantic to the end of FuncDeclaration semantic.

In the codegen, retStyle has been partially implemented so that only
structs and static arrays return RETstack.  This isn't accurate, but
don't need to be for the purposes of semantic analysis.

If a function either has TREE_ADDRESSABLE or must return in memory, then
DECL_RESULT is set as the shidden field for the function.  This is used
in the codegen pass for ReturnStatement where it is now detected whether
a function is returning a struct literal or a constructor function, then
the DECL_RESULT is used to directly construct the return value, instead
of doing so via temporaries.

Reviewed-on: https://github.com/dlang/dmd/pull/11622

gcc/d/ChangeLog:

	PR d/96156
	* d-frontend.cc (retStyle): Only return RETstack for struct and static
	array types.
	* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Use NRVO return
	for all TREE_ADDRESSABLE types.  Set shidden to the RESULT_DECL.
	* expr.cc (ExprVisitor::visit (CallExp *)): Force TARGET_EXPR if the
	'this' pointer reference is a CONSTRUCTOR.
	(ExprVisitor::visit (StructLiteralExp *)): Generate assignment to the
	symbol to initialize with literal.
	* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returning
	struct literals and write directly into the RESULT_DECL.
	* dmd/MERGE: Merge upstream dmd fe5f388d8.

gcc/testsuite/ChangeLog:

	PR d/96156
	* gdc.dg/pr96156.d: New test.
2020-08-26 10:03:56 +02:00
Iain Buclaw
27e5d7c772 tilepro: Update generator file to define IN_TARGET_CODE in target file.
The target files tilegx/mul-tables.c and tilepri/mul-tables.c were
updated in SVN r255743, but the generator file that produces them
wasn't, so it was reverting this change during builds.

gcc/ChangeLog:

	* config/tilepro/gen-mul-tables.cc (main): Define IN_TARGET_CODE to 1
	in the target file.
2020-08-26 10:03:56 +02:00
Iain Buclaw
64c6042246 contrib: Add OPT-enable-obsolete to tile*-*-*
The tile*-*-* targets were marked as obsolete in SVN r259724.

contrib/ChangeLog:

	* config-list.mk (LIST): Add OPT-enable-obsolete to tilegx-linux-gnu,
	tilegxbe-linux-gnu, and tilepro-linux-gnu.
2020-08-26 10:03:56 +02:00
Iain Buclaw
0f5c98b6a1 d: Merge upstream dmd cb4a96fae
Fixes both a bug where compilation would hang, and an issue where recursive
template limits are hit too early.

Reviewed-on: https://github.com/dlang/dmd/pull/11621

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd cb4a96fae
2020-08-26 10:03:55 +02:00
Iain Buclaw
7421802276 d: Use read() to load contents of stdin into memory.
This would be an improvement over reading one character at a time.

An ICE was discovered when mixing reading from stdin with `-v', this has been
fixed in upstream DMD and backported as well.

Reviewed-on: https://github.com/dlang/dmd/pull/11620

gcc/d/ChangeLog:

	* d-lang.cc (d_parse_file): Use read() to load contents from stdin,
	allow the front-end to free the memory after parsing.
	* dmd/MERGE: Merge upstream dmd 2cc25c219.
2020-08-26 10:03:55 +02:00