Commit Graph

186260 Commits

Author SHA1 Message Date
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
liuhongt 3bd86940c4 i386: Add vashlm3/vashrm3/vlshrm3 to enable vectorization of vector shift vector. [PR98434]
Add expanders for vashl<VI12_AVX512BW>, vlshr<VI12_AVX512BW>,
vashr<VI1_AVX512BW> and vashr<v32hi,v16hi,v4di,v8di>.

Besides there's some assumption in expand_mult_const that mul and
add must be available at the same time, but for i386, addv8qi is
restricted under TARGET_64BIT, but mulv8qi not, that could cause ICE.
So restrict mulv8qi and shiftv8qi under TARGET_64BIT.

gcc/ChangeLog:

	PR target/98434
	* config/i386/i386-expand.c (ix86_expand_vec_interleave):
	Adjust comments for ix86_expand_vecop_qihi2.
	(ix86_expand_vecmul_qihi): Renamed to ..
	(ix86_expand_vecop_qihi2): Adjust function prototype to
	support shift operation, add static to definition.
	(ix86_expand_vec_shift_qihi_constant): Add static to definition.
	(ix86_expand_vecop_qihi): Call ix86_expand_vecop_qihi2 and
	ix86_expand_vec_shift_qihi_constant.
	* config/i386/i386-protos.h (ix86_expand_vecmul_qihi): Deleted.
	(ix86_expand_vec_shift_qihi_constant): Deleted.
	* config/i386/sse.md (VI12_256_512_AVX512VL): New mode
	iterator.
	(mulv8qi3): Call ix86_expand_vecop_qihi directly, add
	condition TARGET_64BIT.
	(mul<mode>3): Ditto.
	(<insn><mode>3): Ditto.
	(vlshr<mode>3): Extend to support avx512 vlshr.
	(v<insn><mode>3): New expander for
	vashr/vlshr/vashl.
	(v<insn>v8qi3): Ditto.
	(vashrv8hi3<mask_name>): Renamed to ..
	(vashr<mode>3): And extend to support V16QImode for avx512.
	(vashrv16qi3): Deleted.
	(vashrv2di3<mask_name>): Extend expander to support avx512
	instruction.

gcc/testsuite/ChangeLog:

	PR target/98434
	* gcc.target/i386/pr98434-1.c: New test.
	* gcc.target/i386/pr98434-2.c: New test.
	* gcc.target/i386/avx512vl-pr95488-1.c: Adjust testcase.
2021-06-24 12:49:06 +08:00
GCC Administrator fcf617f0d2 Daily bump. 2021-06-24 00:16:30 +00:00
Patrick Palka 7da4eae3dc c++: excessive instantiation during CTAD [PR101174]
We set DECL_CONTEXT on implicitly generated deduction guides so that
their access is consistent with that of the constructor.  But this
apparently leads to excessive instantiation in some cases, ultimately
because instantiation of a deduction guide should be independent of
instantiation of the resulting class specialization, but setting the
DECL_CONTEXT of the former to the latter breaks this independence.

To fix this, this patch makes push_access_scope handle artificial
deduction guides specifically rather than setting their DECL_CONTEXT
in build_deduction_guide.  We could alternatively make the class
befriend the guide via DECL_BEFRIENDING_CLASSES, but that wouldn't
be a complete fix and would break class-deduction-access3.C below
since friendship isn't transitive.

	PR c++/101174

gcc/cp/ChangeLog:

	* pt.c (push_access_scope): For artificial deduction guides,
	set the access scope to that of the constructor.
	(pop_access_scope): Likewise.
	(build_deduction_guide): Don't set DECL_CONTEXT on the guide.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/multiset/cons/deduction.cc:
	Uncomment CTAD example that was rejected by this bug.
	* testsuite/23_containers/set/cons/deduction.cc: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/class-deduction-access3.C: New test.
	* g++.dg/cpp1z/class-deduction91.C: New test.
2021-06-23 17:23:39 -04:00
Dimitar Dimitrov f72f71c52e doc/lto.texi: List slim object format as the default
Slim LTO object files have been the default for quite a while, since:
  commit e9f67e625c
  Author:     Jan Hubicka <hubicka@gcc.gnu.org>
  common.opt (ffat-lto-objects): Disable by default.

That commit did not update lto.texi, so do it now.

gcc/ChangeLog:

	* doc/lto.texi (Design Overview): Update that slim objects are
	the default.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-06-23 23:13:43 +03:00
Tobias Burnus cac3527793 fortran/dump-parse-tree.c: Use proper enum type
gcc/fortran/ChangeLog:

	* dump-parse-tree.c (show_omp_clauses): Fix enum type used
	for dumping gfc_omp_defaultmap_category.
2021-06-23 22:10:43 +02:00
Aaron Sawdey b7574ca6ed Do not enable pcrel-opt by default
SPEC2017 testing on p10 shows that this optimization does not have a
positive impact on performance. So we are no longer going to enable it
by default. The test cases for it needed to be updated so they always
enable it to test it.

gcc/

	* config/rs6000/rs6000-cpus.def: Take OPTION_MASK_PCREL_OPT out
	of OTHER_POWER10_MASKS so it will not be enabled by default.

gcc/testsuite/

	* gcc.target/powerpc/pcrel-opt-inc-di.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-df.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-di.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-hi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-qi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-sf.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-si.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-vector.c: Enable -mpcrel-opt to
	test it.
	* gcc.target/powerpc/pcrel-opt-st-df.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-di.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-hi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-qi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-sf.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-si.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-vector.c: Enable -mpcrel-opt to
	test it.
2021-06-23 15:07:44 -05:00
Xi Ruoyao d48320083c testsuite: add -fwrapv for 950704-1.c
gcc/testsuite
	* gcc.c-torture/execute/950704-1.c: Add -fwrapv to avoid
	undefined behavior.
2021-06-23 14:45:06 -04:00
Jonathan Wakely 4a404f66b0 libstdc++: Fix comment in chrono::year::is_leap()
libstdc++-v3/ChangeLog:

	* include/std/chrono (chrono::year::is_leap()): Fix incorrect
	logic in comment.
2021-06-23 18:50:03 +01:00
Matthias Kretz 8509a50010 libstdc++: Document simd testsuite
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/README.md: New file.
2021-06-23 18:29:06 +01:00
Matthias Kretz 848bc05a98 libstdc++: Improve output verbosity options and default
For most uses --quiet was too quiet while the default was too noisy. Now
the default output, if stdout is a tty, shows the last successful test
on the same line. With --percentage it adds a percentage at the start of
the line. --percentage is not default because it requires more resources
and might not be 100% compatible to all environments.
If stdout is not a tty the default is quiet output like for dejagnu.

Additionally, argument parsing now recognizes contracted short options
which is easier to use with e.g. DRIVEROPTS=-pxk.

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

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/driver.sh: Rewrite output
	verbosity logic. Add -p/--percentage option. Allow -v/--verbose
	to be used twice. Add -x and -o short options. Parse long
	options with = instead of separating space generically. Parce
	contracted short options. Make unrecognized options an error.
	If same-line output is active, trap on EXIT to increment the
	progress (only with --percentage), erase the line and print the
	current status.
	* testsuite/experimental/simd/generate_makefile.sh: Initialize
	helper files for progress account keeping. Update help target
	for changes to DRIVEROPTS.
2021-06-23 18:29:06 +01:00
Matthias Kretz 15f2669c9d libstdc++: Remove -fno-tree-vrp after PR98834 was resolved
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* testsuite/Makefile.am (check-simd): Remove -fno-tree-vrp flag
	and associated warning.
	* testsuite/Makefile.in: Regenerate.
2021-06-23 18:28:59 +01:00
Cassio Neri b92d12d3fe libstdc++: More efficient std::chrono::year::leap
Simple change to std::chrono::year::is_leap. If a year is multiple of 100,
then it's divisible by 400 if and only if it's divisible by 16. The latter
allows for better code generation.

The expression is then either y%16 or y%4 which are both powers of two
and so it can be rearranged to use simple bitmask operations.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Ulrich Drepper <drepper@redhat.com>

libstdc++-v3/ChangeLog:

	* include/std/chrono (chrono::year::is_leap()): Optimize.
2021-06-23 18:28:08 +01:00
Martin Jambor 53330b7d68
tree-inline: Fix TREE_READONLY of parameter replacements
tree-inline leaves behind VAR_DECLs which are TREE_READONLY (because
they are copies of const parameters) but are written to because they
need to be initialized.  This patch resets the flag unconditionally so
that this does not happen.

There are other sources of variables which are incorrectly marked as
TREE_READOLY, but with this patch and a verifier catching them I can
at least compile the Ada run-time library.

gcc/ChangeLog:

2021-06-22  Richard Biener  <rguenther@suse.de>
	    Martin Jambor  <mjambor@suse.cz>

	* tree-inline.c (setup_one_parameter): Set TREE_READONLY of the
	param replacement unconditionally.  Adjust comment.
2021-06-23 18:56:41 +02:00