Commit Graph

186223 Commits

Author SHA1 Message Date
Jonathan Wakely
e83a5a6b68 libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
Conditionally #undef some more names that are used in system headers.

libstdc++-v3/ChangeLog:

	PR libstdc++/97088
	* testsuite/17_intro/names.cc: Undef more names for newlib and
	also for arm-none-linux-gnueabi.
	* testsuite/experimental/names.cc: Disable PCH.
2021-06-25 18:41:24 +01:00
Chung-Lin Tang
e067201737 testsuite/101114: Adjust libgomp.c-c++-common/struct-elem-5.c testcase
The dg-shouldfail testcase libgomp.c-c++-common/struct-elem-5.c does not
properly fail for non-shared address space offloading. Adjust testcase
to limit testing only for "target offload_device_nonshared_as".

libgomp/ChangeLog:

	PR testsuite/101114
	* testsuite/libgomp.c-c++-common/struct-elem-5.c:
	Add "target offload_device_nonshared_as" condition for enabling test.
2021-06-26 00:46:11 +08:00
Matthias Kretz
74ebd1297e libstdc++: Make use of __builtin_bit_cast for simd
The __bit_cast function was a hack to achieve what __builtin_bit_cast
can do, therefore use __builtin_bit_cast if possible. However,
__builtin_bit_cast cannot be used to cast from/to fixed_size_simd, since
it isn't trivially copyable (in the language sense — in principle it
is). Therefore add __proposed::simd_bit_cast to enable the use case
required in the test framework.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h (__bit_cast): Implement via
	__builtin_bit_cast #if available.
	(__proposed::simd_bit_cast): Add overloads for simd and
	simd_mask, which use __builtin_bit_cast (or __bit_cast #if not
	available), which return an object of the requested type with
	the same bits as the argument.
	* include/experimental/bits/simd_math.h: Use simd_bit_cast
	instead of __bit_cast to allow casts to fixed_size_simd.
	(copysign): Remove branch that was only required if __bit_cast
	cannot be constexpr.
	* testsuite/experimental/simd/tests/bits/test_values.h: Switch
	from __bit_cast to __proposed::simd_bit_cast since the former
	will not cast fixed_size objects anymore.
2021-06-25 17:32:13 +02:00
Matthias Kretz
3c34746794 MAINTAINERS: Add myself for write after approval and DCO
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

ChangeLog:

	* MAINTAINERS: Add myself for write after approval and DCO
2021-06-25 15:59:15 +02:00
Jeff Law
3a50aed09e Use right shifts to eliminate redundant test/compare insns on the H8
gcc/
	* config/h8300/h8300.c (select_cc_mode): Handle ASHIFTRT and LSHIFTRT.
2021-06-25 09:22:28 -04:00
Richard Biener
55a1546b73 tree-optimization/101202 - fix ICE with failed backedge SLP nodes
This fixes an ICE with failed backedge SLP nodes still in the graph
while doing permute optimization by explicitely handling those.

2021-06-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101202
	* tree-vect-slp.c (vect_optimize_slp): Explicitely handle
	failed nodes.

	* gcc.dg/torture/pr101202.c: New testcase.
2021-06-25 12:03:23 +02:00
Richard Biener
05516402f8 Fixup reduction info on addsub SLP pattern
gcc.dg/vect/pr96854.c shows we need to copy over reduction info
to the SLP pattern as already done for the complex patterns.

2021-06-25  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp-patterns.c (addsub_pattern::build): Copy
	STMT_VINFO_REDUC_DEF from the original representative.
2021-06-25 10:18:56 +02:00
Richard Biener
c6c7ac0499 add -ltrans-objects lto-plugin debug option
This adds a -ltrans-objects option to lto-plugin that by-passes
lto-wrapper invocation and instead feeds LD the final LTRANS objects
directly from the response file given as argument to the option.
This allows LD issues involving the linker-plugin path to be
debugged in an easier way with just the IR objects (their symtab)
and the LTRANS objects as testcase.

I've tested the path re-building stage2 build/genmatch from an
LTO bootstrap and got a bit-identical executable by adding
-plugin-opt=-ltrans-objects=y to the original collect2 invocation,
seeding y with the final objects as printed by building genmatch
with -save-temps -v.

2021-06-22  Richard Biener  <rguenther@suse.de>

lto-plugin/
	* lto-plugin.c (ltrans_objects): New global.
	(all_symbols_read_handler): If -ltrans-objects was specified,
	add the output files from the specified file directly.
	(process_option): Handle -ltrans-objects.
2021-06-25 08:48:52 +02:00
Xi Ruoyao
607c558804
testsuite: avoid no-stack-protector-attr-3 fail on mips*-*-*
On MIPS a call to __stack_chk_fail needs an additional .reloc pseudo-op,
so "stack_chk_fail" will appear two times.

gcc/testsuite/

	* g++.dg/no-stack-protector-attr-3.C (dg-final): Adjust for MIPS.
2021-06-25 10:31:31 +08:00
Martin Sebor
e9e2bad725 middle-end: add support for per-location warning groups.
gcc/ChangeLog:

	* builtins.c (warn_string_no_nul): Replace uses of TREE_NO_WARNING,
	gimple_no_warning_p and gimple_set_no_warning with
	warning_suppressed_p, and suppress_warning.
	(c_strlen): Same.
	(maybe_warn_for_bound): Same.
	(warn_for_access): Same.
	(check_access): Same.
	(expand_builtin_strncmp): Same.
	(fold_builtin_varargs): Same.
	* calls.c (maybe_warn_nonstring_arg): Same.
	(maybe_warn_rdwr_sizes): Same.
	* cfgexpand.c (expand_call_stmt): Same.
	* cgraphunit.c (check_global_declaration): Same.
	* fold-const.c (fold_undefer_overflow_warnings): Same.
	(fold_truth_not_expr): Same.
	(fold_unary_loc): Same.
	(fold_checksum_tree): Same.
	* gimple-array-bounds.cc (array_bounds_checker::check_array_ref): Same.
	(array_bounds_checker::check_mem_ref): Same.
	(array_bounds_checker::check_addr_expr): Same.
	(array_bounds_checker::check_array_bounds): Same.
	* gimple-expr.c (copy_var_decl): Same.
	* gimple-fold.c (gimple_fold_builtin_strcpy): Same.
	(gimple_fold_builtin_strncat): Same.
	(gimple_fold_builtin_stxcpy_chk): Same.
	(gimple_fold_builtin_stpcpy): Same.
	(gimple_fold_builtin_sprintf): Same.
	(fold_stmt_1): Same.
	* gimple-ssa-isolate-paths.c (diag_returned_locals): Same.
	* gimple-ssa-nonnull-compare.c (do_warn_nonnull_compare): Same.
	* gimple-ssa-sprintf.c (handle_printf_call): Same.
	* gimple-ssa-store-merging.c (imm_store_chain_info::output_merged_store): Same.
	* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Same.
	* gimple-ssa-warn-restrict.h: Adjust declarations.
	(maybe_diag_access_bounds): Replace uses of TREE_NO_WARNING,
	gimple_no_warning_p and gimple_set_no_warning with
	warning_suppressed_p, and suppress_warning.
	(check_call): Same.
	(check_bounds_or_overlap): Same.
	* gimple.c (gimple_build_call_from_tree): Same.
	* gimplify.c (gimplify_return_expr): Same.
	(gimplify_cond_expr): Same.
	(gimplify_modify_expr_complex_part): Same.
	(gimplify_modify_expr): Same.
	(gimple_push_cleanup): Same.
	(gimplify_expr): Same.
	* omp-expand.c (expand_omp_for_generic): Same.
	(expand_omp_taskloop_for_outer): Same.
	* omp-low.c (lower_rec_input_clauses): Same.
	(lower_lastprivate_clauses): Same.
	(lower_send_clauses): Same.
	(lower_omp_target): Same.
	* tree-cfg.c (pass_warn_function_return::execute): Same.
	* tree-complex.c (create_one_component_var): Same.
	* tree-inline.c (remap_gimple_op_r): Same.
	(copy_tree_body_r): Same.
	(declare_return_variable): Same.
	(expand_call_inline): Same.
	* tree-nested.c (lookup_field_for_decl): Same.
	* tree-sra.c (create_access_replacement): Same.
	(generate_subtree_copies): Same.
	* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Same.
	* tree-ssa-forwprop.c (combine_cond_expr_cond): Same.
	* tree-ssa-loop-ch.c (ch_base::copy_headers): Same.
	* tree-ssa-loop-im.c (execute_sm): Same.
	* tree-ssa-phiopt.c (cond_store_replacement): Same.
	* tree-ssa-strlen.c (maybe_warn_overflow): Same.
	(handle_builtin_strcpy): Same.
	(maybe_diag_stxncpy_trunc): Same.
	(handle_builtin_stxncpy_strncat): Same.
	(handle_builtin_strcat): Same.
	* tree-ssa-uninit.c (get_no_uninit_warning): Same.
	(set_no_uninit_warning): Same.
	(uninit_undefined_value_p): Same.
	(warn_uninit): Same.
	(maybe_warn_operand): Same.
	* tree-vrp.c (compare_values_warnv): Same.
	* vr-values.c (vr_values::extract_range_for_var_from_comparison_expr): Same.
	(test_for_singularity): Same.

	* gimple.h (warning_suppressed_p): New function.
	(suppress_warning): Same.
	(copy_no_warning): Same.
	(gimple_set_block): Call gimple_set_location.
	(gimple_set_location): Call copy_warning.
2021-06-24 19:30:47 -06:00
Martin Sebor
65870e7561 cp: add support for per-location warning groups.
gcc/cp/ChangeLog:

	* call.c (build_over_call): Replace direct uses of TREE_NO_WARNING
	with warning_suppressed_p, suppress_warning, and copy_no_warning, or
	nothing if not necessary.
	(set_up_extended_ref_temp): Same.
	* class.c (layout_class_type): Same.
	* constraint.cc (constraint_satisfaction_value): Same.
	* coroutines.cc (finish_co_await_expr): Same.
	(finish_co_yield_expr): Same.
	(finish_co_return_stmt): Same.
	(build_actor_fn): Same.
	(coro_rewrite_function_body): Same.
	(morph_fn_to_coro): Same.
	* cp-gimplify.c (genericize_eh_spec_block): Same.
	(gimplify_expr_stmt): Same.
	(cp_genericize_r): Same.
	(cp_fold): Same.
	* cp-ubsan.c (cp_ubsan_instrument_vptr): Same.
	* cvt.c (cp_fold_convert): Same.
	(convert_to_void): Same.
	* decl.c (wrapup_namespace_globals): Same.
	(grokdeclarator): Same.
	(finish_function): Same.
	(require_deduced_type): Same.
	* decl2.c (no_linkage_error): Same.
	(c_parse_final_cleanups): Same.
	* except.c (expand_end_catch_block): Same.
	* init.c (build_new_1): Same.
	(build_new): Same.
	(build_vec_delete_1): Same.
	(build_vec_init): Same.
	(build_delete): Same.
	* method.c (defaultable_fn_check): Same.
	* parser.c (cp_parser_fold_expression): Same.
	(cp_parser_primary_expression): Same.
	* pt.c (push_tinst_level_loc): Same.
	(tsubst_copy): Same.
	(tsubst_omp_udr): Same.
	(tsubst_copy_and_build): Same.
	* rtti.c (build_if_nonnull): Same.
	* semantics.c (maybe_convert_cond): Same.
	(finish_return_stmt): Same.
	(finish_parenthesized_expr): Same.
	(cp_check_omp_declare_reduction): Same.
	* tree.c (build_cplus_array_type): Same.
	* typeck.c (build_ptrmemfunc_access_expr): Same.
	(cp_build_indirect_ref_1): Same.
	(cp_build_function_call_vec): Same.
	(warn_for_null_address): Same.
	(cp_build_binary_op): Same.
	(unary_complex_lvalue): Same.
	(cp_build_modify_expr): Same.
	(build_x_modify_expr): Same.
	(convert_for_assignment): Same.
2021-06-24 19:23:43 -06:00
Martin Sebor
43c3f96f29 c-family: add support for per-location warning groups.
gcc/c-family/ChangeLog:

	* c-common.c (c_wrap_maybe_const): Remove TREE_NO_WARNING.
	(c_common_truthvalue_conversion): Replace direct uses of
	TREE_NO_WARNING with warning_suppressed_p, suppress_warning, and
	copy_no_warning.
	(check_function_arguments_recurse): Same.
	* c-gimplify.c (c_gimplify_expr): Same.
	* c-warn.c (overflow_warning): Same.
	(warn_logical_operator): Same.
	(warn_if_unused_value): Same.
	(do_warn_unused_parameter): Same.
2021-06-24 19:23:43 -06:00
Martin Sebor
1ebd2b2c94 c: add support for per-location warning groups.
gcc/ChangeLog:
	* tree.h (warning_suppressed_at, copy_warning,
	warning_suppressed_p, suppress_warning): New functions.

gcc/c/ChangeLog:

	* c-decl.c (pop_scope): Replace direct uses of TREE_NO_WARNING with
	warning_suppressed_p, suppress_warning, and copy_no_warning.
	(diagnose_mismatched_decls): Same.
	(duplicate_decls): Same.
	(grokdeclarator): Same.
	(finish_function): Same.
	(c_write_global_declarations_1): Same.
	* c-fold.c (c_fully_fold_internal): Same.
	* c-parser.c (c_parser_expr_no_commas): Same.
	(c_parser_postfix_expression): Same.
	* c-typeck.c (array_to_pointer_conversion): Same.
	(function_to_pointer_conversion): Same.
	(default_function_array_conversion): Same.
	(convert_lvalue_to_rvalue): Same.
	(default_conversion): Same.
	(build_indirect_ref): Same.
	(build_function_call_vec): Same.
	(build_atomic_assign): Same.
	(build_unary_op): Same.
	(c_finish_return): Same.
	(emit_side_effect_warnings): Same.
	(c_finish_stmt_expr): Same.
	(c_omp_clause_copy_ctor): Same.
2021-06-24 19:23:43 -06:00
Martin Sebor
7036e9ef46 Add support for per-location warning groups.
gcc/ChangeLog:

	* Makefile.in (OBJS-libcommon): Add diagnostic-spec.o.
	* gengtype.c (open_base_files): Add diagnostic-spec.h.
	* diagnostic-spec.c: New file.
	* diagnostic-spec.h: New file.
	* tree.h (no_warning, all_warnings, suppress_warning_at): New
	declarations.
	* warning-control.cc: New file.
2021-06-24 19:23:42 -06:00
liuhongt
980e278dbe Revert x86_order_regs_for_local_alloc changes in r12-1669.
Still put general regs as first alloca order.

gcc/ChangeLog:

	PR target/101185
	* config/i386/i386.c (x86_order_regs_for_local_alloc):
	Revert r12-1669.

gcc/testsuite/ChangeLog

	PR target/101185
	* gcc.target/i386/bitwise_mask_op-3.c: Add xfail to
	temporarily avoid regression, eventually xfail should be
	removed.
2021-06-25 09:17:18 +08:00
GCC Administrator
9aa8327e86 Daily bump. 2021-06-25 00:16:53 +00:00
Andrew MacLeod
ce3316e9c0 Add a testcase to confirm the equivalence's are being checked by EVRP.
* gcc.dg/tree-ssa/evrp30.c: New.
2021-06-24 16:01:54 -04:00
Andrew MacLeod
a0accaa998 Only register relations on live edges
Register a relation on a conditional edge only if the LHS supports
this edge being taken.

	gcc/
	PR tree-optimization/101189
	* gimple-range-fold.cc (fold_using_range::range_of_range_op): Pass
	LHS range of condition to postfold routine.
	(fold_using_range::postfold_gcond_edges): Only process the TRUE or
	FALSE edge if the LHS range supports it being taken.
	* gimple-range-fold.h (postfold_gcond_edges): Add range parameter.

	gcc/testsuite/
	* gcc.dg/tree-ssa/pr101189.c: New.
2021-06-24 16:01:55 -04:00
Andrew MacLeod
ce0b409f56 Fix relation query of equivalences.
When looking for relations between equivalencies, a typo was causing
the wrong bitmap to be checked. Effect was is missed them.
Plus don't dump blocks which don't exist.

	* value-relation.cc (equiv_oracle::dump): Do not dump NULL blocks.
	(relation_oracle::find_relation_block): Check correct bitmap.
	(relation_oracle::dump): Do not dump NULL blocks.
2021-06-24 13:25:58 -04:00
Andrew MacLeod
5bdcfb74ff Correctly unify recomputation with existing range.
When propagating the on-entry cache, new block ranges are calculated
by combining all the incoming edges and comparing to the old value.
When a recomputation was performed on an edge, it didn't take into account
that the value in the block may already be better than a potential
recompuation... Thus a worse values was sometimes propagated.
Fixed by simply calling the now correct range_on_edge the cache provides.

	* gimple-range-cache.cc (ranger_cache::propagate_cache): Call
	range_on_edge instead of manually calculating.
2021-06-24 13:25:58 -04:00
Andrew MacLeod
90fa63e134 Fix comment typo.
* range-op.cc: Fix comment.
2021-06-24 13:25:57 -04:00
Patrick Palka
c761be53f6 c++: alias CTAD and aggregate deduction cand [PR98832]
During alias CTAD, we're accidentally ignoring the aggregate deduction
candidate for the underlying template because this guide is added
separately via maybe_aggr_guide (which doesn't yet handle alias
templates) instead of via deduction_guides_for (which does).  This patch
makes maybe_aggr_guide handle alias templates in a manner similar to
deduction_guides_for.

	PR c++/98832

gcc/cp/ChangeLog:

	* pt.c (maybe_aggr_guide): Handle alias templates appropriately.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/class-deduction-alias9.C: New test.
2021-06-24 13:11:44 -04:00
Patrick Palka
c06493dc30 c++: requires-expression folding [PR101182]
Here we're crashing because cp_fold_function walks into the (templated)
requirements of a requires-expression outside a template, but the
folding routines aren't prepared to handle templated trees.  This patch
fixes this by making cp_fold use evaluate_requires_expr to fold a
requires-expression as a whole, which also means we no longer need to
explicitly do so during gimplification.  (Note that we delay folding
of such requires-expressions for sake of better diagnostics when one is
used as the condition of a failed static_assert.)

	PR c++/101182

gcc/cp/ChangeLog:

	* constraint.cc (evaluate_requires_expr): Adjust function comment.
	* cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: Move to ...
	(cp_fold) <case REQUIRES_EXPR>: ... here.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-requires25.C: New test.
2021-06-24 11:29:02 -04:00
Jakub Jelinek
178fb8df93 c: Fix up c_parser_has_attribute_expression [PR101176]
This function keeps src_range member of the result uninitialized, which at
least under valgrind can show up later when those uninitialized location_t's
can make it into the IL or location_t hash tables.

2021-06-24  Jakub Jelinek  <jakub@redhat.com>

	PR c/101176
	* c-parser.c (c_parser_has_attribute_expression): Set source range for
	the result.
2021-06-24 15:58:02 +02:00
Jakub Jelinek
fdc5522fb0 c: Fix C cast error-recovery [PR101171]
The following testcase ICEs during error-recovery, as build_c_cast calls
note_integer_operands on error_mark_node and that wraps it into
C_MAYBE_CONST_EXPR which is unexpected and causes ICE later on.
Seems most other callers of note_integer_operands check early if something
is error_mark_node and return before calling note_integer_operands on it.

The following patch fixes it by not calling on error_mark_node, another
possibility would be to handle error_mark_node in note_integer_operands and
just return it.

2021-06-24  Jakub Jelinek  <jakub@redhat.com>

	PR c/101171
	* c-typeck.c (build_c_cast): Don't call note_integer_operands on
	error_mark_node.

	* gcc.dg/pr101171.c: New test.
2021-06-24 15:55:28 +02:00
Uros Bizjak
836328b2c9 i386: Add pack/unpack patterns for 64bit vectors [PR89021]
2021-06-24  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/89021
	* config/i386/i386-expand.c (ix86_expand_sse_unpack):
	Handle V8QI and V4HI modes.
	* config/i386/mmx.md (sse4_1_<any_extend:code>v4qiv4hi2):
	New insn pattern.
	(sse4_1_<any_extend:code>v4qiv4hi2): Ditto.
	(mmxpackmode): New mode attribute.
	(vec_pack_trunc_<mmxpackmode:mode>): New expander.
	(mmxunpackmode): New mode attribute.
	(vec_unpacks_lo_<mmxunpackmode:mode>): New expander.
	(vec_unpacks_hi_<mmxunpackmode:mode>): Ditto.
	(vec_unpacku_lo_<mmxunpackmode:mode>): Ditto.
	(vec_unpacku_hi_<mmxunpackmode:mode>): Ditto.
	* config/i386/i386.md (extsuffix): Move from ...
	* config/i386/sse.md: ... here.

gcc/testsuite/

	PR target/89021
	* gcc.dg/vect/vect-nb-iter-ub-3.c (dg-additional-options):
	Add --param vect-epilogues-nomask=0.
	* gcc.target/i386/pr97249-1.c (foo): Add #pragma GCC unroll
	to avoid loop vectorization.
	(foo1): Ditto.
	(foo2): Ditto.
2021-06-24 15:40:28 +02:00
Matthias Kretz
addd5f0e61 libstdc++: Fix internal names: add missing underscores
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_math.h
	(_GLIBCXX_SIMD_MATH_CALL2_): Rename arg2_ to __arg2.
	(_GLIBCXX_SIMD_MATH_CALL3_): Rename arg2_ to __arg2 and arg3_ to
	__arg3.
2021-06-24 14:33:21 +01:00
Matthias Kretz
8888795ad1 libstdc++: Ensure unrolled loops inline the lambda
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h (__execute_on_index_sequence)
	(__execute_on_index_sequence_with_return)
	(__call_with_n_evaluations, __call_with_subscripts): Add flatten
	attribute.
2021-06-24 14:33:21 +01:00
Matthias Kretz
d5125819d8 libstdc++: Avoid raising fp exceptions in trunc, floor, and ceil
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_x86.h (_S_trunc, _S_floor)
	(_S_ceil): Set bit 8 (_MM_FROUND_NO_EXC) on AVX and SSE4.1
	roundp[sd] calls.
2021-06-24 14:33:20 +01:00
Matthias Kretz
5014f12509 libstdc++: Fix condition when AVX512F ldexp implementation is used
This improves codegen of ldexp if AVX512VL is available.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_x86.h (_S_ldexp): The AVX512F
	implementation doesn't require a _VecBltnBtmsk ABI tag, it
	requires either a 64-Byte input (in which case AVX512F must be
	available) or AVX512VL.
2021-06-24 14:33:20 +01:00
Matthias Kretz
62a989ea66 libstdc++: Minor simd_math cleanups
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_math.h: Undefine internal
	macros after use.
	(frexp): Move #if to a more sensible position and reformat
	preceding code.
	(logb): Call _SimdImpl::_S_logb for fixed_size instead of
	duplicating the code here.
	(modf): Simplify condition.
2021-06-24 14:33:20 +01:00
Matthias Kretz
dd1c7792d6 libstdc++: Remove incorrect fabs(simd) overload
fabs(int) returns double, this one didn't. This overload is not
specified in the Parallelism TS 2. Also remove the comment about labs
and llabs: it doesn't belong here.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_math.h (fabs): Remove
	fabs(simd<integral>) overload.
2021-06-24 14:33:19 +01:00
Matthias Kretz
343f01f4cd libstdc++: Improve simd fixed_size codegen
Sometimes fixed_size objects will get unnecessarily copied on the stack.
The simd implementation should never pass _SimdTuple by value to avoid
requiring the optimizer to see through these copies.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_converter.h
	(_SimdConverter::operator()): Pass _SimdTuple by const-ref.
	* include/experimental/bits/simd_fixed_size.h
	(_GLIBCXX_SIMD_FIXED_OP): Pass binary operator _SimdTuple
	arguments by const-ref.
	(_S_masked_unary): Pass _SimdTuple by const-ref.
2021-06-24 14:20:14 +01:00
Matthias Kretz
ebb45cb816 libstdc++: Remove dead code in simd
This helper type became unused at some point.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_fixed_size.h
	(_AbisInSimdTuple): Removed.
2021-06-24 14:20:14 +01:00
Matthias Kretz
0237aa8c70 libstdc++: Improve copysign(simd) codegen
This also resolves a test failure on aarch64 with -ffast-math and
fixed_size<N> with large N.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h: Add missing operator~
	overload for simd<floating-point> to __float_bitwise_operators.
	* include/experimental/bits/simd_builtin.h
	(_SimdImplBuiltin::_S_complement): Bitcast to int (and back) to
	implement complement for floating-point vectors.
	* include/experimental/bits/simd_fixed_size.h
	(_SimdImplFixedSize::_S_copysign): New function, forwarding to
	copysign implementation of _SimdTuple members.
	* include/experimental/bits/simd_math.h (copysign): Call
	_SimdImpl::_S_copysign for fixed_size arguments. Simplify
	generic copysign implementation using the new ~ operator.
2021-06-24 14:20:13 +01:00
Jonathan Wakely
07ba52849f libstdc++: Fix typos and markdown errors in new simd/README.md
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/README.md: Fix typos.
2021-06-24 14:04:02 +01:00
Jonathan Wakely
17bc3848e0 libstdc++: Implement LWG 2762 for std::unique_ptr::operator*
The LWG issue proposes to add a conditional noexcept-specifier to
std::unique_ptr's dereference operator. The issue is currently in
Tentatively Ready status, but even if it isn't voted into the draft, we
can do it as a conforming extensions. This commit also adds a similar
noexcept-specifier to operator[] for the unique_ptr<T[], D> partial
specialization.

Also ensure that all dereference operators for shared_ptr are noexcept,
and adds tests for the std::optional accessors modified by the issue,
which were already noexcept in our implementation.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_base.h (__shared_ptr_access::operator[]):
	Add noexcept.
	* include/bits/unique_ptr.h (unique_ptr::operator*): Add
	conditional noexcept as per LWG 2762.
	* testsuite/20_util/shared_ptr/observers/array.cc: Check that
	dereferencing cannot throw.
	* testsuite/20_util/shared_ptr/observers/get.cc: Likewise.
	* testsuite/20_util/optional/observers/lwg2762.cc: New test.
	* testsuite/20_util/unique_ptr/lwg2762.cc: New test.
2021-06-24 14:04:02 +01:00
Eric Botcazou
a21dc9d152 Emit .file 0 directive earlier in DWARF 5
When the assembler supports it, the compiler automatically passes --gdwarf-5
to it, which has an interesting side effect: any assembly instruction prior
to the first .file directive defines a new line associated with .file 0 in
the .debug_line section and of course the numbering of these implicit lines
has nothing to do with that of the source code.  This can be problematic in
Ada when we do not generate .file/.loc directives for compiled-generated
functions to avoid too jumpy a debugging experience.

gcc/
	* dwarf2out.c (dwarf2out_assembly_start): Emit .file 0 marker here..
	(dwarf2out_finish): ...instead of here.
2021-06-24 14:11:32 +02:00
Eric Botcazou
aca1213627 Fix --gdwarf-5 configure tests for Windows
The issues are that 1) they use readelf instead of objdump and 2) they use
ELF syntax in the assembly code.

gcc/
	* configure.ac (--gdwarf-5 option): Use objdump instead of readelf.
	(working --gdwarf-4/--gdwarf-5 for all sources): Likewise.
	(--gdwarf-4 not refusing generated .debug_line): Adjust for Windows.
	* configure: Regenerate.
2021-06-24 14:11:32 +02:00
prathamesh.kulkarni
2898a02fd5 Add cscope.out to git ignore.
ChangeLog:

	* .gitignore: Add entry for cscope.out.
2021-06-24 16:51:40 +05:30
Richard Biener
67e872336d Merge vec_addsub patterns
This merges the vec_addsub<mode>3 patterns using a mode attribute
for the vec_merge merge operand.

2021-06-18  Richard Biener  <rguenther@suse.de>

	* config/i386/sse.md (vec_addsubv4df3, vec_addsubv2df3,
	vec_addsubv8sf3, vec_addsubv4sf3): Merge into ...
	(vec_addsub<mode>3): ... using a new addsub_cst mode attribute.
2021-06-24 13:09:14 +02:00
Richard Biener
7a6c31f0f8 Add x86 addsub SLP pattern
This addds SLP pattern recognition for the SSE3/AVX [v]addsubp{ds} v0, v1
instructions which compute { v0[0] - v1[0], v0[1], + v1[1], ... }
thus subtract, add alternating on lanes, starting with subtract.

It adds a corresponding optab and direct internal function,
vec_addsub$a3 and renames the existing i386 backend patterns to
the new canonical name.

The SLP pattern matches the exact alternating lane sequence rather
than trying to be clever and anticipating incoming permutes - we
could permute the two input vectors to the needed lane alternation,
do the addsub and then permute the result vector back but that's
only profitable in case the two input or the output permute will
vanish - something Tamars refactoring of SLP pattern recog should
make possible.

2021-06-17  Richard Biener  <rguenther@suse.de>

	* config/i386/sse.md (avx_addsubv4df3): Rename to
	vec_addsubv4df3.
	(avx_addsubv8sf3): Rename to vec_addsubv8sf3.
	(sse3_addsubv2df3): Rename to vec_addsubv2df3.
	(sse3_addsubv4sf3): Rename to vec_addsubv4sf3.
	* config/i386/i386-builtin.def: Adjust.
	* internal-fn.def (VEC_ADDSUB): New internal optab fn.
	* optabs.def (vec_addsub_optab): New optab.
	* tree-vect-slp-patterns.c (class addsub_pattern): New.
	(slp_patterns): Add addsub_pattern.
	* tree-vect-slp.c (vect_optimize_slp): Disable propagation
	across CFN_VEC_ADDSUB.
	* tree-vectorizer.h (vect_pattern::vect_pattern): Make
	m_ops optional.
	* doc/md.texi (vec_addsub<mode>3): Document.

	* gcc.target/i386/vect-addsubv2df.c: New testcase.
	* gcc.target/i386/vect-addsubv4sf.c: Likewise.
	* gcc.target/i386/vect-addsubv4df.c: Likewise.
	* gcc.target/i386/vect-addsubv8sf.c: Likewise.
	* gcc.target/i386/vect-addsub-2.c: Likewise.
	* gcc.target/i386/vect-addsub-3.c: Likewise.
2021-06-24 13:08:25 +02:00
Jakub Jelinek
9872bd8c35 df: Fix up handling of paradoxical subregs in debug insns [PR101170]
The recent addition of gcc_assert (regno < endregno); triggers during
glibc build on m68k.
The problem is that RA decisions shouldn't depend on expressions in
DEBUG_INSNs and those expressions can contain paradoxical subregs of certain
pseudos.  If RA then decides to allocate the pseudo to a register
with very small hard register REGNO, we can trigger the new assert,
as (int) subreg_regno_offset may be negative on big endian and the small
REGNO + the negative offset can wrap around.

The following patch in that case records the range from the REGNO 0 to
endregno, before the addition of the assert as both regno and endregno are
unsigned it wouldn't record anything at all silently.

2021-06-24  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/101170
	* df-scan.c (df_ref_record): For paradoxical big-endian SUBREGs
	where regno + subreg_regno_offset wraps around use 0 as starting
	regno.

	* gcc.dg/pr101170.c: New test.
2021-06-24 12:24:48 +02:00
Jakub Jelinek
65371066d8 stor-layout: Avoid DECL_BIT_FIELD_REPRESENTATIVE with NULL TREE_TYPE [PR101172]
finish_bitfield_representative has an early out if the field after a
bitfield has error_mark_node type, but that early out leads to TREE_TYPE
of the DECL_BIT_FIELD_REPRESENTATIVE being NULL, which breaks assumptions
on code that uses the DECL_BIT_FIELD_REPRESENTATIVE during error-recovery.

The following patch instead sets TREE_TYPE of the representative to
error_mark_node, something the users can deal with better.  At this point
the representative can be set as DECL_BIT_FIELD_REPRESENTATIVE for multiple
bitfields, so making sure that we clear the DECL_BIT_FIELD_REPRESENTATIVE
instead would be harder (but doable, e.g. with the error_mark_node TREE_TYPE
set by this patch set some flag in the caller and if the flag is there, walk
all the fields once again and clear all DECL_BIT_FIELD_REPRESENTATIVE that
have error_mark_node TREE_TYPE).

2021-06-24  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/101172
	* stor-layout.c (finish_bitfield_representative): If nextf has
	error_mark_node type, set repr type to error_mark_node too.

	* gcc.dg/pr101172.c: New test.
2021-06-24 12:22:14 +02:00
Ilya Leoshkevich
a1c1b7a888 IBM Z: Define NO_PROFILE_COUNTERS
s390 glibc does not need counters in the .data section, since it stores
edge hits in its own data structure.  Therefore counters only waste
space and confuse diffing tools (e.g. kpatch), so don't generate them.

gcc/ChangeLog:

	* config/s390/s390.c (s390_function_profiler): Ignore labelno
	parameter.
	* config/s390/s390.h (NO_PROFILE_COUNTERS): Define.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/mnop-mcount-m31-mzarch.c: Adapt to the new
	prologue size.
	* gcc.target/s390/mnop-mcount-m64.c: Likewise.
2021-06-24 11:53:21 +02:00
Richard Biener
82ab149276 Fix SLP permute propagation error
This fixes SLP permute propagation to not propagate across operations
that have different semantics on different lanes like for example
the recently added COMPLEX_ADD_ROT90.

2021-06-24  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_optimize_slp): Do not propagate
	across operations that have different semantics on different
	lanes.
2021-06-24 11:42:09 +02:00
Jakub Jelinek
7619d33471 openmp: in_reduction clause support on target construct
This patch adds support for in_reduction clause on target construct, though
for now only for synchronous targets (without nowait clause).
The encountering thread in that case runs the target task and blocks until
the target region ends, so it is implemented by remapping it before entering
the target, initializing the private copy if not yet initialized for the
current thread and then using the remapped addresses for the mapping
addresses.
For nowait combined with in_reduction the patch contains a hack where the
nowait clause is ignored.  To implement it correctly, I think we would need
to create a new private variable for the in_reduction and initialize it before
doing the async target and adjust the map addresses to that private variable
and then pass a function pointer to the library routine with code where the callback
would remap the address to the current threads private variable and use in_reduction
combiner to combine the private variable we've created into the thread's copy.
The library would then need to make sure that the routine is called in some thread
participating in the parallel (and not in an unshackeled thread).

2021-06-24  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree.h (OMP_CLAUSE_MAP_IN_REDUCTION): Document meaning for OpenMP.
	* gimplify.c (gimplify_scan_omp_clauses): For OpenMP map clauses
	with OMP_CLAUSE_MAP_IN_REDUCTION flag partially defer gimplification
	of non-decl OMP_CLAUSE_DECL.  For OMP_CLAUSE_IN_REDUCTION on
	OMP_TARGET user outer_ctx instead of ctx for placeholders and
	initializer/combiner gimplification.
	* omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_MAP_IN_REDUCTION
	on target constructs.
	(lower_rec_input_clauses): Likewise.
	(lower_omp_target): Likewise.
	* omp-expand.c (expand_omp_target): Temporarily ignore nowait clause
	on target if in_reduction is present.
gcc/c-family/
	* c-common.h (enum c_omp_region_type): Add C_ORT_TARGET and
	C_ORT_OMP_TARGET.
	* c-omp.c (c_omp_split_clauses): For OMP_CLAUSE_IN_REDUCTION on
	combined target constructs also add map (always, tofrom:) clause.
gcc/c/
	* c-parser.c (omp_split_clauses): Pass C_ORT_OMP_TARGET instead of
	C_ORT_OMP for clauses on target construct.
	(OMP_TARGET_CLAUSE_MASK): Add in_reduction clause.
	(c_parser_omp_target): For non-combined target add
	map (always, tofrom:) clauses for OMP_CLAUSE_IN_REDUCTION.  Pass
	C_ORT_OMP_TARGET to c_finish_omp_clauses.
	* c-typeck.c (handle_omp_array_sections): Adjust ort handling
	for addition of C_ORT_OMP_TARGET and simplify, mapping clauses are
	never present on C_ORT_*DECLARE_SIMD.
	(c_finish_omp_clauses): Likewise.  Handle OMP_CLAUSE_IN_REDUCTION
	on C_ORT_OMP_TARGET, set OMP_CLAUSE_MAP_IN_REDUCTION on
	corresponding map clauses.
gcc/cp/
	* parser.c (cp_omp_split_clauses): Pass C_ORT_OMP_TARGET instead of
	C_ORT_OMP for clauses on target construct.
	(OMP_TARGET_CLAUSE_MASK): Add in_reduction clause.
	(cp_parser_omp_target): For non-combined target add
	map (always, tofrom:) clauses for OMP_CLAUSE_IN_REDUCTION.  Pass
	C_ORT_OMP_TARGET to finish_omp_clauses.
	* semantics.c (handle_omp_array_sections_1): Adjust ort handling
	for addition of C_ORT_OMP_TARGET and simplify, mapping clauses are
	never present on C_ORT_*DECLARE_SIMD.
	(handle_omp_array_sections): Likewise.
	(finish_omp_clauses): Likewise.  Handle OMP_CLAUSE_IN_REDUCTION
	on C_ORT_OMP_TARGET, set OMP_CLAUSE_MAP_IN_REDUCTION on
	corresponding map clauses.
	* pt.c (tsubst_expr): Pass C_ORT_OMP_TARGET instead of C_ORT_OMP for
	clauses on target construct.
gcc/testsuite/
	* c-c++-common/gomp/target-in-reduction-1.c: New test.
	* c-c++-common/gomp/clauses-1.c: Add in_reduction clauses on
	target or combined target constructs.
libgomp/
	* testsuite/libgomp.c-c++-common/target-in-reduction-1.c: New test.
	* testsuite/libgomp.c-c++-common/target-in-reduction-2.c: New test.
	* testsuite/libgomp.c++/target-in-reduction-1.C: New test.
	* testsuite/libgomp.c++/target-in-reduction-2.C: New test.
2021-06-24 11:35:08 +02:00
Kewen Lin
8d8ed5c8b5 predcom: Refactor more by encapsulating global states
This patch is to encapsulate global states into a class and
making their accessors as member functions, remove some
consequent useless clean up code, and do some clean up with
RAII.

Bootstrapped/regtested on powerpc64le-linux-gnu P9,
x86_64-redhat-linux and aarch64-linux-gnu, also
bootstrapped on ppc64le P9 with bootstrap-O3 config.

gcc/ChangeLog:

	* tree-predcom.c (class pcom_worker): New class.
	(release_chain): Renamed to...
	(pcom_worker::release_chain): ...this.
	(release_chains): Renamed to...
	(pcom_worker::release_chains): ...this.
	(aff_combination_dr_offset): Renamed to...
	(pcom_worker::aff_combination_dr_offset): ...this.
	(determine_offset): Renamed to...
	(pcom_worker::determine_offset): ...this.
	(class comp_ptrs): New class.
	(split_data_refs_to_components): Renamed to...
	(pcom_worker::split_data_refs_to_components): ...this,
	and update with class comp_ptrs.
	(suitable_component_p): Renamed to...
	(pcom_worker::suitable_component_p): ...this.
	(filter_suitable_components): Renamed to...
	(pcom_worker::filter_suitable_components): ...this.
	(valid_initializer_p): Renamed to...
	(pcom_worker::valid_initializer_p): ...this.
	(find_looparound_phi): Renamed to...
	(pcom_worker::find_looparound_phi): ...this.
	(add_looparound_copies): Renamed to...
	(pcom_worker::add_looparound_copies): ...this.
	(determine_roots_comp): Renamed to...
	(pcom_worker::determine_roots_comp): ...this.
	(determine_roots): Renamed to...
	(pcom_worker::determine_roots): ...this.
	(single_nonlooparound_use): Renamed to...
	(pcom_worker::single_nonlooparound_use): ...this.
	(remove_stmt): Renamed to...
	(pcom_worker::remove_stmt): ...this.
	(execute_pred_commoning_chain): Renamed to...
	(pcom_worker::execute_pred_commoning_chain): ...this.
	(execute_pred_commoning): Renamed to...
	(pcom_worker::execute_pred_commoning): ...this.
	(struct epcc_data): New member worker.
	(execute_pred_commoning_cbck): Call execute_pred_commoning
	with pcom_worker pointer.
	(find_use_stmt): Renamed to...
	(pcom_worker::find_use_stmt): ...this.
	(find_associative_operation_root): Renamed to...
	(pcom_worker::find_associative_operation_root): ...this.
	(find_common_use_stmt): Renamed to...
	(pcom_worker::find_common_use_stmt): ...this.
	(combinable_refs_p): Renamed to...
	(pcom_worker::combinable_refs_p): ...this.
	(reassociate_to_the_same_stmt): Renamed to...
	(pcom_worker::reassociate_to_the_same_stmt): ...this.
	(stmt_combining_refs): Renamed to...
	(pcom_worker::stmt_combining_refs): ...this.
	(combine_chains): Renamed to...
	(pcom_worker::combine_chains): ...this.
	(try_combine_chains): Renamed to...
	(pcom_worker::try_combine_chains): ...this.
	(prepare_initializers_chain): Renamed to...
	(pcom_worker::prepare_initializers_chain): ...this.
	(prepare_initializers): Renamed to...
	(pcom_worker::prepare_initializers): ...this.
	(prepare_finalizers_chain): Renamed to...
	(pcom_worker::prepare_finalizers_chain): ...this.
	(prepare_finalizers): Renamed to...
	(pcom_worker::prepare_finalizers): ...this.
	(tree_predictive_commoning_loop): Renamed to...
	(pcom_worker::tree_predictive_commoning_loop): ...this, adjust
	some calls and remove some cleanup code.
	(tree_predictive_commoning): Adjusted to use pcom_worker instance.
	(static variable looparound_phis): Remove.
	(static variable name_expansions): Remove.
2021-06-24 03:45:29 -05:00
Richard Biener
7dcf139a2b refactor SLP permute propagation
This refactors SLP permute propagation to record the outgoing permute
separately from the incoming/materialized one.  Instead of separate
arrays/bitmaps I've now created a struct to represent the state.

2021-06-23  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (slpg_vertex): New struct.
	(vect_slp_build_vertices): Adjust.
	(vect_optimize_slp): Likewise.  Maintain an outgoing permute
	and a materialized one.
2021-06-24 09:07:06 +02:00
Richard Biener
50374fdacb tree-optimization/101105 - fix runtime alias test optimization
We were ignoring DR_STEP for VF == 1 which is OK only in case
the scalar order is preserved or both DR steps are the same.

2021-06-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101105
	* tree-vect-data-refs.c (vect_prune_runtime_alias_test_list):
	Only ignore steps when they are equal or scalar order is preserved.

	* gcc.dg/torture/pr101105.c: New testcase.
2021-06-24 09:07:05 +02:00