Richard Biener [Wed, 23 Jun 2021 13:17:07 +0000 (15:17 +0200)]
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.
Richard Biener [Wed, 23 Jun 2021 10:43:03 +0000 (12:43 +0200)]
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.
liuhongt [Tue, 26 Jan 2021 08:29:32 +0000 (16:29 +0800)]
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.
GCC Administrator [Thu, 24 Jun 2021 00:16:30 +0000 (00:16 +0000)]
Daily bump.
Patrick Palka [Wed, 23 Jun 2021 21:23:39 +0000 (17:23 -0400)]
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.
Dimitar Dimitrov [Sun, 20 Jun 2021 15:39:41 +0000 (18:39 +0300)]
doc/lto.texi: List slim object format as the default
Slim LTO object files have been the default for quite a while, since:
commit
e9f67e625c2a4225a7169d7220dcb85b6fdd7ca9
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>
Tobias Burnus [Wed, 23 Jun 2021 20:10:43 +0000 (22:10 +0200)]
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.
Aaron Sawdey [Tue, 22 Jun 2021 21:02:15 +0000 (16:02 -0500)]
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.
Xi Ruoyao [Wed, 23 Jun 2021 18:45:06 +0000 (14:45 -0400)]
testsuite: add -fwrapv for 950704-1.c
gcc/testsuite
* gcc.c-torture/execute/950704-1.c: Add -fwrapv to avoid
undefined behavior.
Jonathan Wakely [Wed, 23 Jun 2021 17:50:03 +0000 (18:50 +0100)]
libstdc++: Fix comment in chrono::year::is_leap()
libstdc++-v3/ChangeLog:
* include/std/chrono (chrono::year::is_leap()): Fix incorrect
logic in comment.
Matthias Kretz [Wed, 23 Jun 2021 15:36:08 +0000 (16:36 +0100)]
libstdc++: Document simd testsuite
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* testsuite/experimental/simd/README.md: New file.
Matthias Kretz [Wed, 23 Jun 2021 15:34:30 +0000 (16:34 +0100)]
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.
Matthias Kretz [Wed, 23 Jun 2021 15:29:30 +0000 (16:29 +0100)]
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.
Cassio Neri [Wed, 23 Jun 2021 14:32:16 +0000 (15:32 +0100)]
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.
Martin Jambor [Wed, 23 Jun 2021 16:46:04 +0000 (18:46 +0200)]
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.
Andrew MacLeod [Tue, 22 Jun 2021 15:41:30 +0000 (11:41 -0400)]
Split gimple-range into gimple-range-fold and gimple-range.
Split the fold_using_range functions from gimple-range into gimple-range-fold.
Also move the gimple_range_calc* routines into gimple-range-gori.
* Makefile.in (OBJS): Add gimple-range-fold.o
* gimple-range-fold.cc: New.
* gimple-range-fold.h: New.
* gimple-range-gori.cc (gimple_range_calc_op1): Move to here.
(gimple_range_calc_op2): Ditto.
* gimple-range-gori.h: Move prototypes to here.
* gimple-range.cc: Adjust include files.
(fur_source:fur_source): Relocate to gimple-range-fold.cc.
(fur_source::get_operand): Ditto.
(fur_source::get_phi_operand): Ditto.
(fur_source::query_relation): Ditto.
(fur_source::register_relation): Ditto.
(class fur_edge): Ditto.
(fur_edge::fur_edge): Ditto.
(fur_edge::get_operand): Ditto.
(fur_edge::get_phi_operand): Ditto.
(fur_stmt::fur_stmt): Ditto.
(fur_stmt::get_operand): Ditto.
(fur_stmt::get_phi_operand): Ditto.
(fur_stmt::query_relation): Ditto.
(class fur_depend): Relocate to gimple-range-fold.h.
(fur_depend::fur_depend): Relocate to gimple-range-fold.cc.
(fur_depend::register_relation): Ditto.
(fur_depend::register_relation): Ditto.
(class fur_list): Ditto.
(fur_list::fur_list): Ditto.
(fur_list::get_operand): Ditto.
(fur_list::get_phi_operand): Ditto.
(fold_range): Ditto.
(adjust_pointer_diff_expr): Ditto.
(gimple_range_adjustment): Ditto.
(gimple_range_base_of_assignment): Ditto.
(gimple_range_operand1): Ditto.
(gimple_range_operand2): Ditto.
(gimple_range_calc_op1): Relocate to gimple-range-gori.cc.
(gimple_range_calc_op2): Ditto.
(fold_using_range::fold_stmt): Relocate to gimple-range-fold.cc.
(fold_using_range::range_of_range_op): Ditto.
(fold_using_range::range_of_address): Ditto.
(fold_using_range::range_of_phi): Ditto.
(fold_using_range::range_of_call): Ditto.
(fold_using_range::range_of_builtin_ubsan_call): Ditto.
(fold_using_range::range_of_builtin_call): Ditto.
(fold_using_range::range_of_cond_expr): Ditto.
(fold_using_range::range_of_ssa_name_with_loop_info): Ditto.
(fold_using_range::relation_fold_and_or): Ditto.
(fold_using_range::postfold_gcond_edges): Ditto.
* gimple-range.h: Add gimple-range-fold.h to include files. Change
GIMPLE_RANGE_STMT_H to GIMPLE_RANGE_H.
(gimple_range_handler): Relocate to gimple-range-fold.h.
(gimple_range_ssa_p): Ditto.
(range_compatible_p): Ditto.
(class fur_source): Ditto.
(class fur_stmt): Ditto.
(class fold_using_range): Ditto.
(gimple_range_calc_op1): Relocate to gimple-range-gori.h
(gimple_range_calc_op2): Ditto.
Andrew MacLeod [Tue, 22 Jun 2021 21:46:05 +0000 (17:46 -0400)]
Do not continue propagating values which cannot be set properly.
If the on-entry cache cannot properly represent a range, do not continue
trying to propagate it.
PR tree-optimization/101148
PR tree-optimization/101014
* gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust.
(ranger_cache::~ranger_cache): Adjust.
(ranger_cache::block_range): Check if propagation disallowed.
(ranger_cache::propagate_cache): Disallow propagation if new value
can't be stored properly.
* gimple-range-cache.h (ranger_cache::m_propfail): New member.
Andrew MacLeod [Tue, 22 Jun 2021 21:21:32 +0000 (17:21 -0400)]
Adjust on_entry cache to indicate if the value was set properly.
* gimple-range-cache.cc (class ssa_block_ranges): Adjust prototype.
(sbr_vector::set_bb_range): Return true.
(class sbr_sparse_bitmap): Adjust.
(sbr_sparse_bitmap::set_bb_range): Return value.
(block_range_cache::set_bb_range): Return value.
(ranger_cache::propagate_cache): Use return value to print msg.
* gimple-range-cache.h (class block_range_cache): Adjust.
Andrew MacLeod [Tue, 22 Jun 2021 13:20:47 +0000 (09:20 -0400)]
Dump should be read only. Do not trigger new lookups.
* gimple-range.cc (dump_bb): Use range_on_edge from the cache.
Jeff Law [Tue, 22 Jun 2021 19:25:11 +0000 (15:25 -0400)]
Use more logicals to eliminate useless test/compare instructions
gcc/
* config/h8300/logical.md (<code><mode>3<ccnz>): Use <cczn>
so this pattern can be used for test/compare removal. Pass
current insn to compute_logical_op_length and output_logical_op.
* config/h8300/h8300.c (compute_logical_op_cc): Remove.
(h8300_and_costs): Add argument to compute_logical_op_length.
(output_logical_op): Add new argument. Use it to determine if the
condition codes are used and adjust the output accordingly.
(compute_logical_op_length): Add new argument and update length
computations when condition codes are used.
* config/h8300/h8300-protos.h (compute_logical_op_length): Update
prototype.
(output_logical_op): Likewise.
Uros Bizjak [Wed, 23 Jun 2021 14:14:31 +0000 (16:14 +0200)]
i386: Add PPERM two-operand 64bit vector permutation [PR89021]
Add emulation of V8QI PPERM permutations for TARGET_XOP target. Similar
to PSHUFB, the permutation is performed with V16QI PPERM instruction,
where selector is defined in V16QI mode with inactive elements set to 0x80.
Specific to two operand permutations is the remapping of elements from
the second operand (e.g. e[8] -> e[16]), as we have to account for the
inactive elements from the first operand.
2021-06-23 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/89021
* config/i386/i386-expand.c (expand_vec_perm_pshufb):
Handle 64bit modes for TARGET_XOP. Use indirect gen_* functions.
* config/i386/mmx.md (mmx_ppermv64): New insn pattern.
* config/i386/i386.md (unspec): Move UNSPEC_XOP_PERMUTE from ...
* config/i386/sse.md (unspec): ... here.
Martin Liska [Wed, 23 Jun 2021 13:30:17 +0000 (15:30 +0200)]
arm: Revert partially
ebd5e86c0f41dc1d692f9b2b68a510b1f6835a3e
PR target/98636
gcc/ChangeLog:
* optc-save-gen.awk: Put back arm_fp16_format to
checked_options.
Patrick Palka [Wed, 23 Jun 2021 12:24:34 +0000 (08:24 -0400)]
c++: CTAD and deduction guide selection [PR86439]
During CTAD, we select the best viable deduction guide using
build_new_function_call, which performs overload resolution on the set
of candidate guides and then forms a call to the guide. As the PR
points out, this latter step is unnecessary and occasionally incorrect
since a call to the selected guide may be ill-formed, or forming the
call may have side effects such as prematurely deducing the type of a {}.
So this patch introduces a specialized subroutine based on
build_new_function_call that stops short of building a call to the
selected function, and makes do_class_deduction use this subroutine
instead. And since a call is no longer built, do_class_deduction
doesn't need to set tf_decltype or cp_unevaluated_operand anymore.
This change causes us to reject some container CTAD examples in the
libstdc++ testsuite due to deduction failure for {}, which AFAICT is the
correct behavior. Previously in e.g. the first removed example
std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}},
the type of the {} would get deduced to less<int> as a side effect of
forming a call to the chosen guide
template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>>
map(initializer_list<pair<_Key, _Tp>>,
_Compare = _Compare(), _Allocator = _Allocator())
-> map<_Key, _Tp, _Compare, _Allocator>;
which made later overload resolution for the constructor call
unambiguous. Now, the type of the {} remains undeduced until
constructor overload resolution, and we complain about ambiguity
for the two equally good constructor candidates
map(initializer_list<value_type>,
const _Compare& = _Compare(),
const allocator_type& = allocator_type())
map(initializer_list<value_type>, const allocator_type&).
This patch fixes these problematic container CTAD examples by giving
the {} an appropriate concrete type. Two of these adjusted CTAD
examples (one for std::set and one for std::multiset) end up triggering
an unrelated CTAD bug on trunk, PR101174, so these two adjusted examples
are commented out for now.
PR c++/86439
gcc/cp/ChangeLog:
* call.c (print_error_for_call_failure): Constify 'args' parameter.
(perform_dguide_overload_resolution): Define.
* cp-tree.h: (perform_dguide_overload_resolution): Declare.
* pt.c (do_class_deduction): Use perform_dguide_overload_resolution
instead of build_new_function_call. Don't use tf_decltype or
set cp_unevaluated_operand. Remove unnecessary NULL_TREE tests.
libstdc++-v3/ChangeLog:
* testsuite/23_containers/map/cons/deduction.cc: Replace ambiguous
CTAD examples.
* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
Mention one of the replaced examples is broken due to PR101174.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Replace
ambiguous CTAD examples.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/class-deduction88.C: New test.
* g++.dg/cpp1z/class-deduction89.C: New test.
* g++.dg/cpp1z/class-deduction90.C: New test.
Uros Bizjak [Wed, 23 Jun 2021 10:50:53 +0000 (12:50 +0200)]
i386: Prevent unwanted combine from LZCNT to BSR [PR101175]
The current RTX pattern for BSR allows combine pass to convert LZCNT insn
to BSR. Note that the LZCNT has a defined behavior to return the operand
size when operand is zero, where BSR has not.
Add a BSR specific setting of zero-flag to RTX pattern of BSR insn
in order to avoid matching unwanted combinations.
2021-06-23 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/101175
* config/i386/i386.md (bsr_rex64): Add zero-flag setting RTX.
(bsr): Ditto.
(*bsrhi): Remove.
(clz<mode>2): Update RTX pattern for additions.
gcc/testsuite/
PR target/101175
* gcc.target/i386/pr101175.c: New test.
Jonathan Wakely [Wed, 23 Jun 2021 10:05:51 +0000 (11:05 +0100)]
libstdc++: Avoid "__lockable" name defined as macro by newlib
libstdc++-v3/ChangeLog:
* include/std/mutex (__detail::__try_lock_impl): Rename
parameter to avoid clashing with newlib's __lockable macro.
(try_lock): Add 'inline' specifier.
* testsuite/17_intro/names.cc: Add check for __lockable.
* testsuite/30_threads/try_lock/5.cc: Add options for pthreads.
Andre Vehreschild [Wed, 23 Jun 2021 08:09:29 +0000 (10:09 +0200)]
fortran: Fix deref of optional in gen. code. [PR100337]
gcc/fortran/ChangeLog:
PR fortran/100337
* trans-intrinsic.c (conv_co_collective): Check stat for null ptr
before dereferrencing.
gcc/testsuite/ChangeLog:
PR fortran/100337
* gfortran.dg/coarray_collectives_17.f90: New test.
Jakub Jelinek [Wed, 23 Jun 2021 08:03:28 +0000 (10:03 +0200)]
openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs [PR101167]
The following testcase FAILs, because the UDR combiner is invoked incorrectly.
lower_omp_rec_clauses expects that when it sets
DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
for both the placeholder and the var that everything will be properly
regimplified, but as the variable in question is a PARM_DECL rather than
VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
and so it is not.
2021-06-23 Jakub Jelinek <jakub@redhat.com>
PR middle-end/101167
* omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.
* testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.
Martin Liska [Tue, 22 Jun 2021 07:19:45 +0000 (09:19 +0200)]
contrib: add git-commit-mklog wrapper
contrib/ChangeLog:
* gcc-git-customization.sh: Use the new wrapper.
* git-commit-mklog.py: New file.
* prepare-commit-msg: Support GCC_MKLOG_ARGS.
Kewen Lin [Wed, 23 Jun 2021 04:09:30 +0000 (23:09 -0500)]
rs6000: Fix typos in float128 ISA3.1 support
The recent float128 ISA3.1 support (r12-1340) has some typos,
it makes the libgcc build fail if it's with one binutils
(assembler) which doesn't support Power10 insns. The error
looks like:
Error: invalid switch -mpower10
Error: unrecognized option -mpower10
... [...libgcc/shared-object.mk:14: float128-p10.o] Error 1
What this patch does are:
- fix test target typo libgcc_cv_powerpc_3_1_float128_hw
(written wrongly as libgcc_cv_powerpc_float128_hw, so it's
going to build ISA3.1 stuffs just when detecting ISA3.0).
- fix test used for libgcc_cv_powerpc_3_1_float128_hw check.
- fix test option used for libgcc_cv_powerpc_3_1_float128_hw
check.
- remove the ISA3.1 related contents from t-float128-hw.
- add new macro FLOAT128_HW_INSNS_ISA3_1 to differentiate
ISA3.1 content from ISA3.0 part in ifunc support.
Bootstrapped/regtested on:
- powerpc64le-linux-gnu P10
- powerpc64le-linux-gnu P9 (w/i and w/o p10 supported as)
- powerpc64-linux-gnu P8 (w/i and w/o p10 supported as)
libgcc/ChangeLog:
* configure: Regenerate.
* configure.ac (test for libgcc_cv_powerpc_3_1_float128_hw): Fix
typos among the name, CFLAGS and the test.
* config/rs6000/t-float128-hw (fp128_3_1_hw_funcs, fp128_3_1_hw_src,
fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj, fp128_3_1_hw_obj):
Remove.
* config/rs6000/t-float128-p10-hw (FLOAT128_HW_INSNS): Append
macro FLOAT128_HW_INSNS_ISA3_1.
(FP128_3_1_CFLAGS_HW): Fix option typo.
* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): Guard this with
FLOAT128_HW_INSNS_ISA3_1.
(__floattikf_resolve): Likewise.
(__floatuntikf_resolve): Likewise.
(__fixkfti_resolve): Likewise.
(__fixunskfti_resolve): Likewise.
(__floattikf): Likewise.
(__floatuntikf): Likewise.
(__fixkfti): Likewise.
(__fixunskfti): Likewise.
GCC Administrator [Wed, 23 Jun 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Tue, 22 Jun 2021 12:35:19 +0000 (13:35 +0100)]
libstdc++: Simplify std::try_lock and std::lock further
The std::try_lock and std::lock algorithms can use iteration instead of
recursion when all lockables have the same type and can be held by an
array of unique_lock<L> objects.
By making this change to __detail::__try_lock_impl it also benefits
__detail::__lock_impl, which uses it. For std::lock we can just put the
iterative version directly in std::lock, to avoid making any call to
__detail::__lock_impl.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/std/mutex (lock): Replace recursion with iteration
when lockables all have the same type.
(__detail::__try_lock_impl): Likewise. Pass lockables as
parameters, instead of a tuple. Always lock the first one, and
recurse for the rest.
(__detail::__lock_impl): Adjust call to __try_lock_impl.
(__detail::__try_to_lock): Remove.
* testsuite/30_threads/lock/3.cc: Check that mutexes are locked.
* testsuite/30_threads/lock/4.cc: Also test non-heterogeneous
arguments.
* testsuite/30_threads/unique_lock/cons/60497.cc: Also check
std::try_lock.
* testsuite/30_threads/try_lock/5.cc: New test.
Jonathan Wakely [Wed, 2 Jun 2021 15:41:26 +0000 (16:41 +0100)]
libstdc++: Remove garbage collection support for C++23 [P2186R2]
This removes the non-functional garbage colection support from <memory>,
as proposed for C++23 by P2186R2.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/std/memory (declare_reachable, undeclare_reachable)
(declare_no_pointers, undeclare_no_pointers, get_pointer_safety)
(pointer_safety): Only define for C++11 to C++20 inclusive.
* testsuite/20_util/pointer_safety/1.cc: Do not run for C++23.
Jonathan Wakely [Tue, 22 Jun 2021 17:05:11 +0000 (18:05 +0100)]
libstdc++: Implement LWG 3422 for std::seed_seq
This ensures that the std::seed_seq initializer-list constructor will
not be used for list-initialization unless the initializers in the list
are integers. This allows list-initialization syntax to be used with a
pair of pointers and for that to use the appropriate constructor.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/random.h (seed_seq): Constrain initializer-list
constructor.
* include/bits/random.tcc (seed_seq): Add template parameter.
* testsuite/26_numerics/random/seed_seq/cons/default.cc: Check
for noexcept.
* testsuite/26_numerics/random/seed_seq/cons/initlist.cc: Check
constraints.
Sandra Loosemore [Tue, 22 Jun 2021 19:42:17 +0000 (12:42 -0700)]
Fortran: fix sm computation in CFI_allocate [PR93524]
This patch fixes a bug in setting the step multiplier field in the
C descriptor for array dimensions > 2.
2021-06-21 Sandra Loosemore <sandra@codesourcery.com>
Tobias Burnus <tobias@codesourcery.com>
libgfortran/
PR fortran/93524
* runtime/ISO_Fortran_binding.c (CFI_allocate): Fix
sm computation.
gcc/testsuite/
PR fortran/93524
* gfortran.dg/pr93524.c: New.
* gfortran.dg/pr93524.f90: New.
Thomas Rodgers [Tue, 22 Jun 2021 17:59:07 +0000 (10:59 -0700)]
libstdc++: Fix for deadlock in std::counting_semaphore [PR100806]
libstdc++-v3/ChangeLog:
PR libstdc++/100806
* include/bits/semaphore_base.h (__atomic_semaphore::_M_release):
Force _M_release() to wake all waiting threads.
* testsuite/30_threads/semaphore/100806.cc: New test.
David Malcolm [Tue, 22 Jun 2021 17:44:57 +0000 (13:44 -0400)]
analyzer: fix ICE on malloc/alloca param type mismatch [PR101143]
gcc/analyzer/ChangeLog:
PR analyzer/101143
* region-model.cc (compat_types_p): New function.
(region_model::create_region_for_heap_alloc): Convert assertion to
an error check.
(region_model::create_region_for_alloca): Likewise.
gcc/testsuite/ChangeLog:
PR analyzer/101143
* gcc.dg/analyzer/pr101143.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Sergei Trofimovich [Mon, 21 Jun 2021 22:39:56 +0000 (23:39 +0100)]
docs: drop unbalanced parenthesis in rtl.texi
gcc/ChangeLog:
* doc/rtl.texi: drop unbalanced parenthesis.
Richard Biener [Tue, 22 Jun 2021 10:13:44 +0000 (12:13 +0200)]
middle-end/101156 - remove not working optimization in gimplification
This removes a premature and not working optimization from the
gimplifier. When gimplification is requested not to produce a SSA
name we try to avoid generating a copy when we did so anyway but
instead replace the LHS of its definition. But that only works in
case there are no uses of the SSA name already which is something
we cannot easily check, so the following removes said optimization.
Statistics on the whole bootstrap shows we hit this optimization
only for libiberty/cp-demangle.c and overall we have
21652112
gimplifications where just 240 copies are elided. Preserving
the optimization would require scanning the original expression
and the pre and post sequences for SSA names and uses, that seems
excessive to avoid these 240 copies.
2021-06-22 Richard Biener <rguenther@suse.de>
PR middle-end/101156
* gimplify.c (gimplify_expr): Remove premature incorrect
optimization.
* gcc.dg/pr101156.c: New testcase.
Jakub Jelinek [Tue, 22 Jun 2021 13:22:51 +0000 (15:22 +0200)]
testsuite: Add testcase for recently fixed PR [PR101159]
On Tue, Jun 22, 2021 at 11:00:51AM +0200, Richard Biener wrote:
> 2021-06-22 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/101159
> * tree-vect-patterns.c (vect_recog_popcount_pattern): Add
> missing NULL vectype check.
The following patch adds the testcase for it, IMHO it can't hurt and
from my experience testcases often trigger other bugs later on (rather
than the original bugs reappearing, though even that happens),
and also fixes a couple of typos in the new function.
2021-06-22 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/101159
* tree-vect-patterns.c (vect_recog_popcount_pattern): Fix some
comment typos.
* gcc.c-torture/compile/pr101159.c: New test.
Jakub Jelinek [Tue, 22 Jun 2021 13:21:35 +0000 (15:21 +0200)]
expand: Fix up empty class return optimization [PR101160]
On Mon, Jun 14, 2021 at 11:24:22PM -0400, Jason Merrill via Gcc-patches wrote:
> The x86_64 psABI says that an empty class isn't passed or returned in memory or
> registers, so we shouldn't set %eax in this function. Is this a reasonable
> place to implement that? Another possibility would be to remove the hack to
> prevent i386.c:function_value_64 from returning NULL in this case and fix the
> callers to deal, but that seems like more work.
>
> The df-scan hunk catches the case where we look at a 0-length reg and build
> a range the length of unsigned int, which happened before I changed
> assign_parms to match expand_function_end.
The assign_params change unfortunately breaks e.g. the following testcase.
The problem is that some passes (e.g. subreg lowering but assign_parms
comments also talk about delayed slot scheduling) rely on crtl->return_rtx
not to contain pseudo registers, and the assign_parms change results
in the pseudo in there not being replaced with a hard register.
The following patch instead clears the crtl->return_rtx if a function
returns TYPE_EMPTY_P structure, that way (use (pseudo)) is not emitted
into the IL and it is treated like more like functions returning void.
I've also changed the effective target on the empty-class1.C testcase, so
that it doesn't fail on x86_64-linux with -m32 testing.
2021-06-22 Jakub Jelinek <jakub@redhat.com>
PR middle-end/101160
* function.c (assign_parms): For decl_result with TYPE_EMPTY_P type
clear crtl->return_rtx instead of keeping it referencing a pseudo.
* g++.target/i386/empty-class1.C: Require lp64 effective target
instead of x86_64-*-*.
* g++.target/i386/empty-class2.C: New test.
Jakub Jelinek [Tue, 22 Jun 2021 13:20:14 +0000 (15:20 +0200)]
fold-const: Return corresponding integral type for OFFSET_TYPE in range_check_type [PR101162]
Andrew's recent r12-1608-g2f1686ff70b25fceb04ca2ffc0a450fb682913ef change
to fail verification on various unary and binary operations with OFFSET_TYPE
revealed that e.g. switchconv happily performs multiplications and additions
in OFFSET_TYPE.
2021-06-22 Jakub Jelinek <jakub@redhat.com>
Andrew Pinski <apinski@marvell.com>
PR tree-optimization/101162
* fold-const.c (range_check_type): Handle OFFSET_TYPE like pointer
types.
* g++.dg/opt/pr101162.C: New test.
Andrew MacLeod [Thu, 17 Jun 2021 17:40:05 +0000 (13:40 -0400)]
Add relational self-tests.
* range-op.cc (range_relational_tests): New.
(range_op_tests): Call range_relational_tests.
Andrew MacLeod [Thu, 17 Jun 2021 17:39:02 +0000 (13:39 -0400)]
Add relation between LHS and op1 for casts and copies.
* range-op.cc (operator_cast::lhs_op1_relation): New.
(operator_identity::lhs_op1_relation): Mew.
Andrew MacLeod [Thu, 17 Jun 2021 17:38:03 +0000 (13:38 -0400)]
Add relation effects between operands to MINUS_EXPR.
* range-op.cc (operator_minus::op1_op2_relation_effect): New.
Andrew MacLeod [Thu, 17 Jun 2021 17:35:10 +0000 (13:35 -0400)]
Add relations between LHS and op1/op2 for PLUS_EXPR.
* range-op.cc (operator_plus::lhs_op1_relation): New.
(operator_plus::lhs_op2_relation): New.
Andrew MacLeod [Thu, 17 Jun 2021 18:09:48 +0000 (14:09 -0400)]
Add relational support to fold_using_range
Enable a relation oracle in ranger, and add full range-op relation support
to fold_using_range.
* gimple-range-cache.cc (ranger_cache::ranger_cache): Create a
relation_oracle if dominators exist.
(ranger_cache::~ranger_cache): Dispose of oracle.
(ranger_cache::dump_bb): Dump oracle.
* gimple-range.cc (fur_source::fur_source): New.
(fur_source::get_operand): Use mmeber query.
(fur_source::get_phi_operand): Use member_query.
(fur_source::query_relation): New.
(fur_source::register_dependency): Delete.
(fur_source::register_relation): New.
(fur_edge::fur_edge): Adjust.
(fur_edge::get_phi_operand): Fix comment.
(fur_edge::query): Delete.
(fur_stmt::fur_stmt): Adjust.
(fur_stmt::query): Delete.
(fur_depend::fur_depend): Adjust.
(fur_depend::register_relation): New.
(fur_depend::register_relation): New.
(fur_list::fur_list): Adjust.
(fur_list::get_operand): Use member query.
(fold_using_range::range_of_range_op): Process and query relations.
(fold_using_range::range_of_address): Adjust dependency call.
(fold_using_range::range_of_phi): Ditto.
(gimple_ranger::gimple_ranger): New. Use ranger_ache oracle.
(fold_using_range::relation_fold_and_or): New.
(fold_using_range::postfold_gcond_edges): New.
* gimple-range.h (class gimple_ranger): Adjust.
(class fur_source): Adjust members.
(class fur_stmt): Ditto.
(class fold_using_range): Ditto.
Andrew MacLeod [Thu, 17 Jun 2021 15:49:21 +0000 (11:49 -0400)]
Add relational support to range-op.
This patch integrates relations with range-op functionality so that any
known relations can be used to help reduce or resolve ranges.
Initially handle EQ_EXPR, NE_EXPR, LE_EXPR, LT_EXPR, GT_EXPR and GE_EXPR.
* range-op.cc (range_operator::wi_fold): Apply relation effect.
(range_operator::fold_range): Adjust and apply relation effect.
(*::fold_range): Add relation parameters.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
(range_operator::lhs_op1_relation): New.
(range_operator::lhs_op2_relation): New.
(range_operator::op1_op2_relation): New.
(range_operator::op1_op2_relation_effect): New.
(relop_early_resolve): New.
(operator_equal::op1_op2_relation): New.
(operator_equal::fold_range): Call relop_early_resolve.
(operator_not_equal::op1_op2_relation): New.
(operator_not_equal::fold_range): Call relop_early_resolve.
(operator_lt::op1_op2_relation): New.
(operator_lt::fold_range): Call relop_early_resolve.
(operator_le::op1_op2_relation): New.
(operator_le::fold_range): Call relop_early_resolve.
(operator_gt::op1_op2_relation): New.
(operator_gt::fold_range): Call relop_early_resolve.
(operator_ge::op1_op2_relation): New.
(operator_ge::fold_range): Call relop_early_resolve.
* range-op.h (class range_operator): Adjust parameters and methods.
Andrew MacLeod [Thu, 17 Jun 2021 14:19:31 +0000 (10:19 -0400)]
Initial value-relation code.
This code provides a both an equivalence and relation oracle which can be
accessed via a range_query object. This initial code drop includes the
oracles and access them, but does not utilize them yet.
* Makefile.in (OBJS): Add value-relation.o.
* gimple-range.h: Adjust include files.
* tree-data-ref.c: Adjust include file order.
* value-query.cc (range_query::get_value_range): Default to no oracle.
(range_query::query_relation): New.
(range_query::query_relation): New.
* value-query.h (class range_query): Adjust.
* value-relation.cc: New.
* value-relation.h: New.
Richard Biener [Tue, 22 Jun 2021 08:14:02 +0000 (10:14 +0200)]
tree-optimization/101151 - fix irreducible region check for sinking
The check whether two blocks are in the same irreducible region
and thus post-dominance checks being unreliable was incomplete
since an irreducible region can contain reducible sub-regions but
if one block is in the irreducible part and one not the check
still doesn't work as expected.
2021-06-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/101151
* tree-ssa-sink.c (statement_sink_location): Expand irreducible
region check.
* gcc.dg/torture/pr101151.c: New testcase.
Jojo R [Mon, 21 Jun 2021 12:42:43 +0000 (20:42 +0800)]
RISC-V: Add tune info for T-HEAD C906.
gcc/
* config/riscv/riscv.c (thead_c906_tune_info): New.
(riscv_tune_info_table): Use new tune.
Kito Cheng [Mon, 21 Jun 2021 13:19:38 +0000 (21:19 +0800)]
testuite: Add pthread check to dg-module-cmi for omp module testing
gcc/testsuite:
* g++.dg/modules/omp-1_a.C: Check pthread is available for
dg-module-cmi.
* g++.dg/modules/omp-2_a.C: Ditto.
Richard Biener [Tue, 22 Jun 2021 07:24:24 +0000 (09:24 +0200)]
tree-optimization/101158 - adjust SLP call matching sequence
This moves the check for same operands after verifying we're
facing compatible calls.
2021-06-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/101158
* tree-vect-slp.c (vect_build_slp_tree_1): Move same operand
checking after checking for matching operation.
* gfortran.dg/pr101158.f90: New testcase.
Richard Biener [Tue, 22 Jun 2021 07:12:42 +0000 (09:12 +0200)]
tree-optimization/101159 - fix missing NULL check in popcount pattern
This fixes a missing check for a NULL vectype in the new popcount
pattern.
2021-06-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/101159
* tree-vect-patterns.c (vect_recog_popcount_pattern): Add
missing NULL vectype check.
Richard Biener [Tue, 22 Jun 2021 07:10:56 +0000 (09:10 +0200)]
tree-optimization/101154 - fix out-of bound access in SLP
This fixes an out-of-bound access of matches.
2021-06-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/101154
* tree-vect-slp.c (vect_build_slp_tree_2): Fix out-of-bound access.
Jakub Jelinek [Tue, 22 Jun 2021 08:16:18 +0000 (10:16 +0200)]
i386: Use xor to write zero to memory with -Os even for more than 4 stores [PR11877]
> > 2021-06-20 Roger Sayle <roger@nextmovesoftware.com>
> >
> > gcc/ChangeLog
> > PR target/11877
> > * config/i386/i386.md: New define_peephole2s to shrink writing
> > 1, 2 or 4 consecutive zeros to memory when optimizing for size.
It unfortunately doesn't extend well to larger memory clearing.
Consider e.g.
void
foo (int *p)
{
p[0] = 0;
p[7] = 0;
p[23] = 0;
p[41] = 0;
p[48] = 0;
p[59] = 0;
p[69] = 0;
p[78] = 0;
p[83] = 0;
p[89] = 0;
p[98] = 0;
p[121] = 0;
p[132] = 0;
p[143] = 0;
p[154] = 0;
}
where with the patch we emit:
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
xorl %esi, %esi
xorl %r8d, %r8d
movl %eax, (%rdi)
movl %eax, 28(%rdi)
movl %eax, 92(%rdi)
movl %eax, 164(%rdi)
movl %edx, 192(%rdi)
movl %edx, 236(%rdi)
movl %edx, 276(%rdi)
movl %edx, 312(%rdi)
movl %ecx, 332(%rdi)
movl %ecx, 356(%rdi)
movl %ecx, 392(%rdi)
movl %ecx, 484(%rdi)
movl %esi, 528(%rdi)
movl %esi, 572(%rdi)
movl %r8d, 616(%rdi)
Here is an incremental patch that emits:
xorl %eax, %eax
movl %eax, (%rdi)
movl %eax, 28(%rdi)
movl %eax, 92(%rdi)
movl %eax, 164(%rdi)
movl %eax, 192(%rdi)
movl %eax, 236(%rdi)
movl %eax, 276(%rdi)
movl %eax, 312(%rdi)
movl %eax, 332(%rdi)
movl %eax, 356(%rdi)
movl %eax, 392(%rdi)
movl %eax, 484(%rdi)
movl %eax, 528(%rdi)
movl %eax, 572(%rdi)
movl %eax, 616(%rdi)
instead.
2021-06-22 Jakub Jelinek <jakub@redhat.com>
PR target/11877
* config/i386/i386-protos.h (ix86_last_zero_store_uid): Declare.
* config/i386/i386-expand.c (ix86_last_zero_store_uid): New variable.
* config/i386/i386.c (ix86_expand_prologue): Clear it.
* config/i386/i386.md (peephole2s for 1/2/4 stores of const0_rtx):
Remove "" from match_operand. Emit new insns using emit_move_insn and
set ix86_last_zero_store_uid to INSN_UID of the last store.
Add peephole2s for 1/2/4 stores of const0_rtx following previous
successful peep2s.
* gcc.target/i386/pr11877-2.c: New test.
liuhongt [Tue, 22 Jun 2021 08:09:48 +0000 (16:09 +0800)]
Remove my Write After Approval entry.
ChangeLog:
* MAINTAINERS: Remove my Write After Approval entry.
Martin Liska [Tue, 22 Jun 2021 07:50:38 +0000 (09:50 +0200)]
contrib: fix a flake8 issue
contrib/ChangeLog:
* mklog.py: Fix flake8 issue.
Martin Liska [Tue, 22 Jun 2021 06:54:34 +0000 (08:54 +0200)]
autofdo: Bump AUTO_PROFILE_VERSION.
gcc/ChangeLog:
* auto-profile.c (AUTO_PROFILE_VERSION): Bump as string format
was changed.
Martin Liska [Tue, 22 Jun 2021 06:43:41 +0000 (08:43 +0200)]
gcov: update comment about padding
gcc/ChangeLog:
* gcov-io.h: Remove padding entries.
liuhongt [Wed, 16 Jun 2021 09:34:43 +0000 (17:34 +0800)]
Add vect_recog_popcount_pattern to handle mismatch between the vectorized popcount IFN and scalar popcount builtin.
The patch remove those pro- and demotions when backend support direct
optab.
For i386: it enables vectorization for vpopcntb/vpopcntw and optimized
for vpopcntq.
gcc/ChangeLog:
PR tree-optimization/97770
* tree-vect-patterns.c (vect_recog_popcount_pattern):
New.
(vect_recog_func vect_vect_recog_func_ptrs): Add new pattern.
gcc/testsuite/ChangeLog:
PR tree-optimization/97770
* gcc.target/i386/avx512bitalg-pr97770-1.c: Remove xfail.
* gcc.target/i386/avx512vpopcntdq-pr97770-1.c: Remove xfail.
liuhongt [Thu, 29 Apr 2021 10:27:09 +0000 (18:27 +0800)]
Optimize vpexpand* to mask mov when mask have all ones in it's lower part (including 0 and -1).
gcc/ChangeLog:
PR target/100267
* config/i386/i386-builtin.def (BDESC): Adjust builtin name.
* config/i386/sse.md (<avx512>_expand<mode>_mask): Rename to ..
(expand<mode>_mask): this ..
(*expand<mode>_mask): New pre_reload splitter to transform
v{,p}expand* to vmov* when mask is zero, all ones, or has all
ones in it's lower part, otherwise still generate
v{,p}expand*.
gcc/testsuite/ChangeLog:
PR target/100267
* gcc.target/i386/avx512bw-pr100267-1.c: New test.
* gcc.target/i386/avx512bw-pr100267-b-2.c: New test.
* gcc.target/i386/avx512bw-pr100267-d-2.c: New test.
* gcc.target/i386/avx512bw-pr100267-q-2.c: New test.
* gcc.target/i386/avx512bw-pr100267-w-2.c: New test.
* gcc.target/i386/avx512f-pr100267-1.c: New test.
* gcc.target/i386/avx512f-pr100267-pd-2.c: New test.
* gcc.target/i386/avx512f-pr100267-ps-2.c: New test.
* gcc.target/i386/avx512vl-pr100267-1.c: New test.
* gcc.target/i386/avx512vl-pr100267-pd-2.c: New test.
* gcc.target/i386/avx512vl-pr100267-ps-2.c: New test.
* gcc.target/i386/avx512vlbw-pr100267-1.c: New test.
* gcc.target/i386/avx512vlbw-pr100267-b-2.c: New test.
* gcc.target/i386/avx512vlbw-pr100267-d-2.c: New test.
* gcc.target/i386/avx512vlbw-pr100267-q-2.c: New test.
* gcc.target/i386/avx512vlbw-pr100267-w-2.c: New test.
liuhongt [Wed, 28 Apr 2021 06:52:59 +0000 (14:52 +0800)]
Fix ICE for vpexpand*.
gcc/ChangeLog
PR target/100310
* config/i386/i386-expand.c
(ix86_expand_special_args_builtin): Keep constm1_operand only
if it satisfies insn's operand predicate.
gcc/testsuite/ChangeLog
PR target/100310
* gcc.target/i386/pr100310.c: New test.
GCC Administrator [Tue, 22 Jun 2021 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Mon, 21 Jun 2021 12:35:18 +0000 (13:35 +0100)]
libstdc++: Improve std::lock algorithm
The current std::lock algorithm is the one called "persistent" in Howard
Hinnant's https://howardhinnant.github.io/dining_philosophers.html post.
While it tends to perform acceptably fast, it wastes a lot of CPU cycles
by continuously locking and unlocking the uncontended mutexes.
Effectively, it's a spin lock with no back-off.
This replaces it with the one Howard calls "smart and polite". It's
smart, because when a Mi.try_lock() call fails because mutex Mi is
contended, the algorithm reorders the mutexes until Mi is first, then
calls Mi.lock(), to block until Mi is no longer contended. It's
polite because it uses std::this_thread::yield() between the failed
Mi.try_lock() call and the Mi.lock() call. (In reality it uses
__gthread_yield() directly, because using this_thread::yield() would
require shuffling code around to avoid a circular dependency.)
This version of the algorithm is inspired by some hints from Howard, so
that it has strictly bounded stack usage. As the comment in the code
says:
// This function can recurse up to N levels deep, for N = 1+sizeof...(L1).
// On each recursion the lockables are rotated left one position,
// e.g. depth 0: l0, l1, l2; depth 1: l1, l2, l0; depth 2: l2, l0, l1.
// When a call to l_i.try_lock() fails it recurses/returns to depth=i
// so that l_i is the first argument, and then blocks until l_i is locked.
The 'i' parameter is the desired permuation of the lockables, and the
'depth' parameter is the depth in the call stack of the current
instantiation of the function template. If i == depth then the function
calls l0.lock() and then l1.try_lock()... for each lockable in the
parameter pack l1. If i > depth then the function rotates the lockables
to the left one place, and calls itself again to go one level deeper.
Finally, if i < depth then the function returns to a shallower depth,
equivalent to a right rotate of the lockables. When a call to
try_lock() fails, i is set to the index of the contended lockable, so
that the next call to l0.lock() will use the contended lockable as l0.
This commit also replaces the std::try_lock implementation details. The
new code is identical in behaviour, but uses a pair of constrained
function templates. This avoids instantiating a class template, and is a
litle simpler to call where used in std::__detail::__lock_impl and
std::try_lock.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/std/mutex (__try_to_lock): Move to __detail namespace.
(struct __try_lock_impl): Replace with ...
(__detail::__try_lock_impl<Idx>(tuple<Lockables...>&)): New
function templates to implement std::try_lock.
(try_lock): Use new __try_lock_impl.
(__detail::__lock_impl(int, int&, L0&, L1&...)): New function
template to implement std::lock.
(lock): Use __lock_impl.
Jason Merrill [Sun, 13 Jun 2021 18:00:12 +0000 (14:00 -0400)]
expand: empty class return optimization [PR88529]
The x86_64 psABI says that an empty class isn't passed or returned in memory
or registers, so we shouldn't set %eax in this function.
The df-scan hunk catches the case where we look at a 0-length reg and build
a range the length of unsigned int, which happened before I changed
assign_parms to match expand_function_end.
PR target/88529
gcc/ChangeLog:
* df-scan.c (df_ref_record): Check that regno < endregno.
* function.c (assign_parms, expand_function_end): Do nothing with a
TYPE_EMPTY_P result.
gcc/testsuite/ChangeLog:
* g++.target/i386/empty-class1.C: New test.
Patrick Palka [Mon, 21 Jun 2021 13:45:31 +0000 (09:45 -0400)]
libstdc++: Sync __cpp_lib_ranges macro defined in ranges_cmp.h
r12-1606 bumped the value of __cpp_lib_ranges defined in <version>,
but this macro is also defined in <bits/range_cmp.h>, so it needs to
be updated there as well.
libstdc++-v3/ChangeLog:
* include/bits/ranges_cmp.h (__cpp_lib_ranges): Adjust value.
Tobias Burnus [Mon, 21 Jun 2021 13:17:22 +0000 (15:17 +0200)]
contrib/mklog.py: Improve PR handling
Co-authored-by: Martin Sebor <msebor@redhat.com>
contrib/ChangeLog:
* mklog.py (bugzilla_url): Fetch also component.
(pr_filename_regex): New.
(get_pr_titles): Update PR string with correct format and component.
(generate_changelog): Take additional PRs; extract PR from the
filename.
(__main__): Add -b/--pr-numbers argument.
* test_mklog.py (EXPECTED4): Update to expect a PR for the new file.
Richard Biener [Fri, 18 Jun 2021 12:07:00 +0000 (14:07 +0200)]
tree-optimization/101120 - fix compile-time issue with SLP groups
This places two hacks to avoid an old compile-time issue when
vectorizing large permuted SLP groups with gaps where we end up
emitting loads and IV adjustments for the gap as well and those
have quite a high cost until they are eventually cleaned up.
The first hack is to fold the auto-inc style IV updates early
in the vectorizer rather than in the next forwprop pass which
shortens the SSA use-def chains of the used IV.
The second hack is to remove the unused loads after we've picked
all that we possibly use.
2021-06-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/101120
* tree-vect-data-refs.c (bump_vector_ptr): Fold the
built increment.
* tree-vect-slp.c (vect_transform_slp_perm_load): Add
DR chain DCE capability.
* tree-vectorizer.h (vect_transform_slp_perm_load): Adjust.
* tree-vect-stmts.c (vectorizable_load): Remove unused
loads in the DR chain for SLP.
Patrick Palka [Mon, 21 Jun 2021 11:54:29 +0000 (07:54 -0400)]
c++: REF_PARENTHESIZED_P wrapper inhibiting NRVO [PR67302]
Here, in C++14 or later, we remember the parentheses around 'a' in the
return statement by using a REF_PARENTHESIZED_P wrapper, which ends up
inhibiting NRVO because we don't look through this wrapper before
checking the conditions for NRVO. This patch fixes this by calling
maybe_undo_parenthesized_ref sooner in check_return_expr.
PR c++/67302
gcc/cp/ChangeLog:
* typeck.c (check_return_expr): Call maybe_undo_parenthesized_ref
sooner, before the NRVO handling.
gcc/testsuite/ChangeLog:
* g++.dg/opt/nrv21.C: New test.
Patrick Palka [Mon, 21 Jun 2021 11:54:26 +0000 (07:54 -0400)]
c++: conversion to base of vbase in NSDMI [PR80431]
The delayed processing of conversions to a virtual base in an NSDMI
assumes the target base type is a (possibly indirect) virtual base of
the current class, but the target base type could also be a base of a
virtual base, as in the testcase below. Since such a base isn't a part
of CLASSTYPE_VBASECLASSES, we end up miscompiling the testcase due to
the call to build_base_path (with binfo=NULL_TREE) silently returning
error_mark_node. Fix this by using convert_to_base to build the
conversion instead.
PR c++/80431
gcc/cp/ChangeLog:
* tree.c (bot_replace): Use convert_to_base to build the
conversion to the (morally) virtual base.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/nsdmi-virtual1a.C: New test.
Jakub Jelinek [Mon, 21 Jun 2021 11:30:42 +0000 (13:30 +0200)]
inline-asm: Fix ICE with bitfields in "m" operands [PR100785]
Bitfields, while they live in memory, aren't something inline-asm can easily
operate on.
For C and "=m" or "+m", we were diagnosing bitfields in the past in the
FE, where c_mark_addressable had:
case COMPONENT_REF:
if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1)))
{
error
("cannot take address of bit-field %qD", TREE_OPERAND (x, 1));
return false;
}
but that check got moved in GCC 6 to build_unary_op instead and now we
emit an error during expansion and ICE afterwards (i.e. error-recovery).
For "m" it used to be diagnosed in c_mark_addressable too, but since
GCC 6 it is ice-on-invalid.
For C++, this was never diagnosed in the FE, but used to be diagnosed
in the gimplifier and/or during expansion before 4.8.
The following patch does multiple things:
1) diagnoses it in the FEs
2) stops emitting a redundant diagnostic in the gimplifier using the
usual way, if we already see error_mark_node, we assume error has
been emitted already and only diagnose if it wasn't error_mark_node;
this helps diagnosing the same bug with multiple different
errors
3) simplifies during expansion the inline asm if any errors have been
reported (similarly how e.g. vregs pass if it detects errors on
inline-asm either deletes them or simplifies to bare minimum -
just labels), so that we don't have error-recovery ICEs there
2021-06-11 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/100785
gcc/
* gimplify.c (gimplify_asm_expr): Don't diagnose errors if
output or input operands were already error_mark_node.
* cfgexpand.c (expand_asm_stmt): If errors are emitted,
remove all inputs, outputs and clobbers from the asm and
set template to "".
gcc/c/
* c-typeck.c (c_mark_addressable): Diagnose trying to make
bit-fields addressable.
gcc/cp/
* typeck.c (cxx_mark_addressable): Diagnose trying to make
bit-fields addressable.
gcc/testsuite/
* c-c++-common/pr100785.c: New test.
* gcc.dg/pr48552-1.c: Don't expect invalid lvalue errors.
* gcc.dg/pr48552-2.c: Likewise.
Gary Dismukes [Tue, 6 Apr 2021 23:07:39 +0000 (19:07 -0400)]
[Ada] Implement fixed-lower-bound consistency checks for qualified_expressions
gcc/ada/
* checks.adb (Selected_Range_Checks): In the case of a
qualified_expression where the qualifying subtype is an
unconstrained array subtype with fixed lower bounds for some of
its indexes, generate tests to check that those bounds are equal
to the corresponding lower bounds of the qualified array object.
Bob Duff [Tue, 6 Apr 2021 14:27:26 +0000 (10:27 -0400)]
[Ada] Optimization of System.Value_N
gcc/ada/
* libgnat/s-valuen.ads (Value_Enumeration,
Valid_Enumeration_Value): Inline.
(Value_Enumeration_Pos): Add Pure_Function.
Justin Squirek [Mon, 29 Mar 2021 14:06:55 +0000 (10:06 -0400)]
[Ada] INOX: prototype "when" constructs
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst: Document new
feature under pragma Extensions_Allowed.
* gnat_rm.texi: Regenerate.
* errout.adb, errout.ads (Error_Msg_GNAT_Extension): Created to
issue errors when parsing extension only constructs.
* exp_ch11.adb, exp_ch11.ads (Expand_N_Raise_When_Statement):
Created to expand raise ... when constucts.
* exp_ch5.adb, exp_ch5.ads (Expand_N_Goto_When_Statement):
Created to expand goto ... when constructs.
* exp_ch6.adb, exp_ch6.ads (Expand_N_Return_When_Statement):
Created to expand return ... when constructs.
* expander.adb (Expand): Add case entries for "when" constructs.
* gen_il-gen-gen_nodes.adb, gen_il-types.ads: Add entries for
"when" constructs.
* par-ch11.adb (P_Raise_Statement): Add processing for raise ...
when.
* par-ch5.adb (Missing_Semicolon_On_Exit): Renamed to
Missing_Semicolon_On_When and moved to par-util.adb.
* par-ch6.adb (Get_Return_Kind): Renamed from Is_Simple and
processing added for "return ... when" return kind.
(Is_Simple): Renamed to Get_Return_Kind.
(P_Return_Statement): Add case for return ... when variant of
return statement.
* par-util.adb, par.adb (Missing_Semicolon_On_When): Added to
centeralize parsing of "when" keywords in the context of "when"
constructs.
* sem.adb (Analyze): Add case for "when" constructs.
* sem_ch11.adb, sem_ch11.ads (Analyze_Raise_When_Statement):
Created to analyze raise ... when constructs.
* sem_ch5.adb, sem_ch5.ads (Analyzed_Goto_When_Statement):
Created to analyze goto ... when constructs.
* sem_ch6.adb, sem_ch6.ads (Analyze_Return_When_Statement):
Created to analyze return ... when constructs.
* sprint.adb (Sprint_Node_Actual): Add entries for new "when"
nodes.
Steve Baird [Tue, 30 Mar 2021 00:09:31 +0000 (17:09 -0700)]
[Ada] Add Ada.Strings.Text_Buffers and replace uses of Ada.Strings.Text_Output
gcc/ada/
* Make-generated.in (GEN_IL_FLAGS): Keep only GNAT flags.
(ada/stamp-gen_il): Remove dependencies on libgnat/ sources. Do not
copy libgnat/ sources locally and tidy up.
* Makefile.rtl: Include object files for new Text_Buffer units
in the GNATRTL_NONTASKING_OBJS list.
* exp_put_image.ads, exp_put_image.adb: Update Rtsfind calls to
match new specs. For example, calls to RE_Sink are replaced with
calls to RE_Root_Buffer_Type. Update comments and change
subprogram names accordingly (e.g., Preload_Sink is changed to
Preload_Root_Buffer_Type).
* impunit.adb: Add 6 new predefined units (Text_Buffers and 5
child units thereof).
* rtsfind.ads, rtsfind.adb: Add interfaces for accessing the
Ada.Strings.Text_Buffers package and declarations
therein (including the Unbounded child unit). Do not (yet)
delete interfaces for accessing the old Text_Output package.
* sem_attr.adb (Check_Put_Image_Attribute): Replace RE_Sink uses
with RE_Root_Buffer_Type and update comments accordingly.
* sem_ch10.adb (Analyze_Compilation_Unit): Update call to
reflect name change of callee (that is, the former Preload_Sink
is now Preload_Root_Buffer_Type).
* sem_ch13.adb (Has_Good_Profile): Replace RE_Sink use with
RE_Root_Buffer_Type.
(Build_Spec): Update comment describing a parameter type.
* gen_il.ads: Remove clauses for the old Text_Output package and
add them for Ada.Streams.Stream_IO.
(Sink): Declare.
(Create_File): Likewise.
(Increase_Indent): Likewise.
(Decrease_Indent): Likewise.
(Put): Likewise.
(LF): Likewise.
* gen_il.adb: Add clauses for Ada.Streams.Stream_IO.
(Create_File): New procedure.
(Increase_Indent): Likewise.
(Decrease_Indent): Likewise.
(Put): New procedures.
* gen_il-gen.adb: Add clauses for Ada.Text_IO. Replace
Sink'Class with Sink throughout. Use string concatenation and
LF marker instead of formatted strings and "\n" marker. Update
Indent/Outdent calls to use new Increase_Indent/Decrease_Indent
names.
(Put_Membership_Query_Decl): Remove.
* gen_il-internals.ads: Replace Sink'Class with Sink throughout.
(Ptypes): Remove.
(Pfields): Likewise.
* gen_il-internals.adb: Remove clauses for GNAT.OS_Lib and
Ada.Strings.Text_Buffers.Files. Replace Sink'Class with Sink
throughout. Use string concatenation and LF marker instead of
formatted strings and "\n" marker.
(Stdout): Remove.
(Ptypes): Likewise.
(Pfields): Likewise.
* libgnarl/s-putaim.ads: Modify context clause, update
declaration of subtype Sink to refer to
Text_Buffers.Root_Buffer_Type instead of the old
Text_Output.Sink type.
* libgnarl/s-putaim.adb: Modify context clause and add use
clause to refer to Text_Buffers package.
* libgnat/a-cbdlli.ads, libgnat/a-cbdlli.adb,
libgnat/a-cbhama.ads, libgnat/a-cbhama.adb,
libgnat/a-cbhase.ads, libgnat/a-cbhase.adb,
libgnat/a-cbmutr.ads, libgnat/a-cbmutr.adb,
libgnat/a-cborma.ads, libgnat/a-cborma.adb,
libgnat/a-cborse.ads, libgnat/a-cborse.adb,
libgnat/a-cdlili.ads, libgnat/a-cdlili.adb,
libgnat/a-cidlli.ads, libgnat/a-cidlli.adb,
libgnat/a-cihama.ads, libgnat/a-cihama.adb,
libgnat/a-cihase.ads, libgnat/a-cihase.adb,
libgnat/a-cimutr.ads, libgnat/a-cimutr.adb,
libgnat/a-ciorma.ads, libgnat/a-ciorma.adb,
libgnat/a-ciormu.ads, libgnat/a-ciormu.adb,
libgnat/a-ciorse.ads, libgnat/a-ciorse.adb,
libgnat/a-coboho.ads, libgnat/a-coboho.adb,
libgnat/a-cobove.ads, libgnat/a-cobove.adb,
libgnat/a-cohama.ads, libgnat/a-cohama.adb,
libgnat/a-cohase.ads, libgnat/a-cohase.adb,
libgnat/a-coinho.ads, libgnat/a-coinho.adb,
libgnat/a-coinho__shared.ads, libgnat/a-coinho__shared.adb,
libgnat/a-coinve.ads, libgnat/a-coinve.adb,
libgnat/a-comutr.ads, libgnat/a-comutr.adb,
libgnat/a-convec.ads, libgnat/a-convec.adb,
libgnat/a-coorma.ads, libgnat/a-coorma.adb,
libgnat/a-coormu.ads, libgnat/a-coormu.adb,
libgnat/a-coorse.ads, libgnat/a-coorse.adb,
libgnat/a-nbnbin.ads, libgnat/a-nbnbin.adb,
libgnat/a-nbnbin__gmp.adb, libgnat/a-nbnbre.ads,
libgnat/a-nbnbre.adb, libgnat/a-strunb.ads,
libgnat/a-strunb.adb, libgnat/a-strunb__shared.ads,
libgnat/a-strunb__shared.adb, libgnat/s-rannum.ads,
libgnat/s-rannum.adb: Modify Put_Image procedure used in
Put_Image aspect specification to conform to Ada profile
rules (in particular, the first parameter shall be of type
Ada.Strings.Text_Buffers.Root_Buffer_Type'Class).
* libgnat/a-sttebu.ads, libgnat/a-sttebu.adb,
libgnat/a-stbubo.ads, libgnat/a-stbubo.adb,
libgnat/a-stbufi.ads, libgnat/a-stbufi.adb,
libgnat/a-stbufo.ads, libgnat/a-stbufo.adb,
libgnat/a-stbuun.ads, libgnat/a-stbuun.adb,
libgnat/a-stbuut.ads, libgnat/a-stbuut.adb: A new predefined
unit, Ada.Strings.Text_Buffers, and five child units. Two of
the five are RM-defined: Bounded and Unbounded. The remaining
three are GNAT-defined: Files, Utils, and Formatting. The buffer
type corresponding to an output file, type Files.File_Buffer, is
simpler (and perhaps therefore slower) than its predecessor.
Caching similar to what was being done before could be added
later if that seems appropriate.
* libgnat/s-putima.ads: Modify context clause, update
declaration of subtype Sink to refer to
Text_Buffers.Root_Buffer_Type instead of the old
Text_Output.Sink type.
* libgnat/s-putima.adb: Modify context clause. Update
Indent/Outdent calls to use new Increase_Indent/Decrease_Indent
names; ditto for "Put_String => Put" name change.
* libgnat/a-stteou__bootstrap.ads: Delete.
Eric Botcazou [Sat, 3 Apr 2021 13:32:46 +0000 (15:32 +0200)]
[Ada] Adjust new fast bit-field copy path to big-endian platforms
gcc/ada/
* exp_ch5.adb (Expand_Assign_Array_Bitfield_Fast): If big-endian
ordering is in effect for the operands and they are small,
adjust the unchecked conversions done around them.
Richard Kenner [Thu, 1 Apr 2021 15:35:07 +0000 (11:35 -0400)]
[Ada] Add Return_Statement field
gcc/ada/
* einfo.ads (Return_Statement): Add documentation.
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Set it.
* gen_il-fields.ads: Add it.
* gen_il-gen-gen_entities.adb: Add it.
Bob Duff [Tue, 30 Mar 2021 11:15:39 +0000 (07:15 -0400)]
[Ada] Improve efficiency of small slice assignments of packed arrays
gcc/ada/
* rtsfind.ads, libgnat/s-bitfie.ads, libgnat/s-bituti.adb,
libgnat/s-bituti.ads (Fast_Copy_Bitfield): New run-time library
function to copy bit fields faster than Copy_Bitfield. Cannot be
called with zero-size bit fields. Remove obsolete ??? comments
from s-bituti.adb; we already do "avoid calling this if
Forwards_OK is False".
* exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield,
Expand_Assign_Array_Bitfield_Fast): Generate calls to
Fast_Copy_Bitfield when appropriate.
* sem_util.adb, sem_util.ads (Get_Index_Bounds): Two new
functions for getting the index bounds. These are more
convenient than the procedure of the same name, because they can
be used to initialize constants.
Ed Schonberg [Sun, 28 Mar 2021 03:28:29 +0000 (23:28 -0400)]
[Ada] Implementation of AI12-205: defaults for formal types
gcc/ada/
* gen_il-fields.ads: Add Default_Subtype_Mark to enumeration
type for fields.
* gen_il-gen-gen_nodes.adb: Add call to create new field for
Formal_Type_Declaration node.
* par-ch12.adb (P_Formal_Type_Declaration): in Ada_2022 mode,
recognize new syntax for default: "or use subtype_mark".
(P_Formal_Type_Definition): Ditto for the case of a formal
incomplete type.
* sinfo.ads: Add field Default_Subtype_Mark to
N_Formal_Type_Declaration.
* sem_ch12.adb (Validate_Formal_Type_Default): New procedure, to
apply legality rules to default subtypes in formal type
declarations. Some legality rules apply to all defaults, such as
the requirement that the default for a formal type that depends
on previous formal entities must itself be a previously declared
formal of the same unit. Other checks are kind- specific.
(Analyze_Associations): Use specified default if there is no
actual provided for a formal type in an instance.
(Analyze_Formal_Type_Declaration): Call
Validate_Formal_Type_Default when default subtype is present.
Bob Duff [Wed, 31 Mar 2021 12:00:59 +0000 (08:00 -0400)]
[Ada] Implement 'Valid_Value attribute
gcc/ada/
* libgnat/s-valuen.ads, libgnat/s-valuen.adb
(Value_Enumeration_Pos): New function to compute the 'Pos of the
enumeration literal for a given String. Return a special value
instead of raising an exception on invalid input. Called by both
Valid_Enumeration_Image and Value_Enumeration.
(Valid_Enumeration_Image): Return a Boolean indicating whether
the String is a valid Image for the given enumeration type.
(Value_Enumeration): Implement in terms of
Value_Enumeration_Pos.
* libgnat/s-vaenu8.ads, libgnat/s-vaen16.ads,
libgnat/s-vaen32.ads: Rename Valid_Enumeration_Image from the
instances.
* libgnat/s-valuti.ads: Correct documentation (it was not true
for the null string).
* libgnat/s-valuti.adb (Normalize_String): Do not raise
Constraint_Error for the null string, nor strings containing
nothing but blanks, so that Valid_Enumeration_Image can return
False in these cases, rather than raising an exception.
* rtsfind.ads (RE_Value_Enumeration_8, RE_Value_Enumeration_16,
RE_Value_Enumeration_32): New functions.
(RTE_Available): Improve comment (E doesn't have to be a
subprogram, although that's the usual case).
* sem_attr.adb (nalid_Value): Semantic analysis for new
attribute.
* exp_attr.adb: Call Expand_Valid_Value_Attribute for new
attribute.
* exp_imgv.ads, exp_imgv.adb (Expand_Valid_Value_Attribute): New
procedure to expand Valid_Value into a call to
Valid_Enumeration_Image_NN.
(Expand_Value_Attribute): Misc code cleanups. Remove two ???
mark comments. RTE_Available won't work here. For one thing,
RTE_Available (X) shouldn't be called until the compiler has
decided to make use of X (see comments on RTE_Available), and in
this case we're trying to AVOID calling something.
* snames.ads-tmpl: New attribute name.
* doc/gnat_rm/implementation_defined_attributes.rst: Document
new attribute.
* gnat_rm.texi: Regenerate.
Eric Botcazou [Tue, 30 Mar 2021 08:36:55 +0000 (10:36 +0200)]
[Ada] Export Opt.Assume_No_Invalid_Values for use in back-end
gcc/ada/
* fe.h (Assume_No_Invalid_Values): Declare.
* opt.ads (Assume_No_Invalid_Values): Add warning comment.
Bob Duff [Fri, 26 Mar 2021 19:41:31 +0000 (15:41 -0400)]
[Ada] Zero-size slices
gcc/ada/
* libgnat/s-bituti.ads (Small_Size): Do not include 0 in this
type.
* libgnat/s-bituti.adb (Copy_Bitfield): Do nothing for 0-bit
bitfields.
Ghjuvan Lacambre [Sun, 28 Mar 2021 12:10:53 +0000 (14:10 +0200)]
[Ada] Address ??? comments
gcc/ada/
* exp_ch9.adb (Build_Simple_Entry_Call): Add comment.
* libgnat/s-rannum.adb (Random): Update comment.
* libgnat/s-rannum.ads (Generator): Update comment.
Piotr Trojanek [Fri, 26 Mar 2021 22:23:01 +0000 (23:23 +0100)]
[Ada] Fix unbalanced parens in documentation of Address clauses
gcc/ada/
* doc/gnat_rm/representation_clauses_and_pragmas.rst (Address
Clauses): Fix unbalanced parens.
* gnat_rm.texi: Regenerate.
Ghjuvan Lacambre [Wed, 17 Mar 2021 18:13:17 +0000 (19:13 +0100)]
[Ada] Minor reformattings
gcc/ada/
* errout.adb (Handle_Serious_Error): Capitalize comment.
* exp_dbug.adb (Set_Entity_Name): Capitalize sentence.
* exp_dist.adb (Expand_All_Calls_Remote_Subprogram_Call): Fix
typo.
* sem_ch3.adb (Modular_Type_Declaration): Add space after comma.
Ghjuvan Lacambre [Wed, 10 Feb 2021 14:52:34 +0000 (15:52 +0100)]
[Ada] Make -gnatU and -gnatw.d the default
gcc/ada/
* debug.adb: Document -gnatd_U as taken.
* err_vars.ads (Warning_Doc_Switch): Set to True.
* errout.ads (Errout): Update documentation.
* gnat1drv.adb (Adjust_Global_Switches): React to -gnatd_U.
* hostparm.ads (Tag_Errors): Set to True.
* opt.ads (Unique_Error_Tag): Document -gnatd_U.
Eric Botcazou [Fri, 26 Mar 2021 09:53:57 +0000 (10:53 +0100)]
[Ada] Fix invalid JSON real numbers generated with -gnatRj
gcc/ada/
* urealp.ads (UR_Write_To_JSON): Declare.
* urealp.adb (Decimal_Exponent_Hi): Treat numbers in base 10
specially and rewrite handling of numbers in other bases.
(Decimal_Exponent_Lo): Likewise.
(Normalize): Minor tweak.
(UR_Write_To_JSON): New wrapper procedure around UR_Write.
* repinfo.adb (List_Type_Info): When the output is to JSON, call
UR_Write_To_JSON instead of UR_Write.
Piotr Trojanek [Fri, 26 Mar 2021 08:36:49 +0000 (09:36 +0100)]
[Ada] Disable wrong computation of offsets within multidimensional arrays
gcc/ada/
* sem_util.adb (Indexed_Component_Bit_Offset): Return an unknown
offset for components within multidimensional arrays; remove
redundant parens.
Piotr Trojanek [Fri, 26 Mar 2021 08:02:33 +0000 (09:02 +0100)]
[Ada] Skip overlay checks on protected components with expansion disabled
gcc/ada/
* sem_util.adb (Find_Overlaid_Entity): Ignore references to
components and discriminants.
Doug Rupp [Thu, 25 Mar 2021 19:44:23 +0000 (12:44 -0700)]
[Ada] Compile s-mmap on aarch64-linux
gcc/ada/
* Makefile.rtl (aarch64-linux) [LIBGNAT_TARGET_PAIRS]: Add
$(TRASYM_DWARF_UNIX_PAIRS).
[EXTRA_GNAT_RTL_NONTASKING_OBJS]: Add $(TRASYM_DWARF_UNIX_OBJS)
Gary Dismukes [Thu, 25 Mar 2021 17:37:58 +0000 (13:37 -0400)]
[Ada] Compiler crash on sliding of fixed-lower-bound object in Loop_Invariant
gcc/ada/
* exp_util.adb (Expand_Sliding_Conversion): Only perform
expansion when Expander_Active is True. Add a comment about this
and refine existing comment regarding string literals.
Piotr Trojanek [Thu, 25 Mar 2021 12:17:40 +0000 (13:17 +0100)]
[Ada] Simplify detection of statically overlapping slices
gcc/ada/
* sem_util.adb (Denotes_Same_Object): Simplify handling of
slices.
Piotr Trojanek [Thu, 25 Mar 2021 12:15:30 +0000 (13:15 +0100)]
[Ada] Fix detection of overlapping actuals with renamings
gcc/ada/
* sem_util.adb (Is_Object_Renaming): Rename from Is_Renaming;
simplify; adapt callers.
Frederic Konrad [Fri, 6 Nov 2020 19:08:28 +0000 (20:08 +0100)]
[Ada] powerpc64-wrs-vxworks7r2: build shared libgnat
gcc/ada/
* Makefile.rtl: Compiles both static and dynamic libgnat for
powerpc64-wrs-vxworks7r2.
prathamesh.kulkarni [Mon, 21 Jun 2021 09:22:54 +0000 (14:52 +0530)]
arm/66791: Replace builtins in vceq_* (a, b) with a == b.
gcc/ChangeLog:
* config/arm/arm_neon.h (vceq_s8): Replace builtin with __a == __b.
(vceq_s16): Likewise.
(vceq_s32): Likewise.
(vceq_u8): Likewise.
(vceq_u16): Likewise.
(vceq_u32): Likewise.
(vceq_p8): Likewise.
(vceqq_s8): Likewise.
(vceqq_s16): Likewise.
(vceqq_s32): Likewise.
(vceqq_u8): Likewise.
(vceqq_u16): Likewise.
(vceqq_u32): Likewise.
(vceqq_p8): Likewise.
(vceq_f32): Gate __a == __b on __FAST_MATH__.
(vceqq_f32): Likewise.
(vceq_f16): Likewise.
(vceqq_f16): Likewise.
prathamesh.kulkarni [Mon, 21 Jun 2021 09:08:32 +0000 (14:38 +0530)]
arm/97906: Adjust neon_vca patterns to use GLTE instead of GTGE iterator.
gcc/ChangeLog:
PR target/97906
* config/arm/iterators.md (NEON_VACMP): Remove.
* config/arm/neon.md (neon_vca<cmp_op><mode>): Use GLTE instead of GTGE
iterator.
(neon_vca<cmp_op><mode>_insn): Likewise.
(neon_vca<cmp_op_unsp><mode>_insn_unspec): Use NEON_VAGLTE instead of
NEON_VACMP.
gcc/testsuite/ChangeLog:
PR target/97906
* gcc.target/arm/simd/pr97906.c: New test.
Richard Biener [Mon, 21 Jun 2021 07:30:41 +0000 (09:30 +0200)]
tree-optimization/101121 - avoid infinite SLP build
The following plugs another hole where we cache a failed SLP build
attempt with an all-success 'matches'. It also adds checking that
we don't do that.
2021-06-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/101121
* tree-vect-slp.c (vect_build_slp_tree_2): To not fail fatally
when we just lack a stmt with the desired op when doing permutation.
(vect_build_slp_tree): When caching a failed SLP build attempt
assert that at least one lane is marked as not matching.
* gfortran.dg/pr101121.f: New testcase.
liuhongt [Tue, 15 Jun 2021 08:25:16 +0000 (16:25 +0800)]
Disparage slightly the mask register alternative for bitwise operations.
The avx512 supports bitwise operations with mask registers, but the
throughput of those instructions is much lower than that of the
corresponding gpr version, so we would additionally disparages
slightly the mask register alternative for bitwise operations in the
LRA.
Also when allocano cost of GENERAL_REGS is same as MASK_REGS, allocate
MASK_REGS first since it has already been disparaged.
gcc/ChangeLog:
PR target/101142
* config/i386/i386.md: (*anddi_1): Disparage slightly the mask
register alternative.
(*and<mode>_1): Ditto.
(*andqi_1): Ditto.
(*andn<mode>_1): Ditto.
(*<code><mode>_1): Ditto.
(*<code>qi_1): Ditto.
(*one_cmpl<mode>2_1): Ditto.
(*one_cmplsi2_1_zext): Ditto.
(*one_cmplqi2_1): Ditto.
* config/i386/i386.c (x86_order_regs_for_local_alloc): Change
the order of mask registers to be before general registers.
gcc/testsuite/ChangeLog:
PR target/101142
* gcc.target/i386/spill_to_mask-1.c: Adjust testcase.
* gcc.target/i386/spill_to_mask-2.c: Adjust testcase.
* gcc.target/i386/spill_to_mask-3.c: Adjust testcase.
* gcc.target/i386/spill_to_mask-4.c: Adjust testcase.
Roger Sayle [Mon, 21 Jun 2021 07:54:50 +0000 (08:54 +0100)]
PR target/11877: Use xor to write zero to memory with -Os
The following patch attempts to resolve PR target/11877 (without
triggering PR/23102). On x86_64, writing an SImode or DImode zero
to memory uses an instruction encoding that is larger than first
clearing a register (using xor) then writing that to memory. Hence,
after reload, the peephole2 pass can determine if there's a suitable
free register, and if so, use that to shrink the code size with -Os.
To improve code size, and avoid inserting a large number of xor
instructions (PR target/23102), this patch makes use of peephole2's
efficient pattern matching to use a single temporary for a run of
consecutive writes. In theory, one could do better still with a
new target-specific pass, gated on -Os, to shrink these instructions
(like stv), but that's probably overkill for the little remaining
space savings.
Evaluating this patch on the CSiBE benchmark (v2.1.1) results in a
0.26% code size improvement (3715273 bytes down to 3705477) on x86_64
with -Os [saving 1 byte every 400]. 549 of 894 tests improve, two
tests grow larger. Analysis of these 2 pathological cases reveals
that although peephole2's match_scratch prefers to use a call-clobbered
register (to avoid requiring a new stack frame), very rarely this
interacts with GCC's shrink wrapping optimization, which may previously
have avoided saving/restoring a call clobbered register, such as %eax,
in the calling function.
2021-06-21 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR target/11877
* config/i386/i386.md: New define_peephole2s to shrink writing
1, 2 or 4 consecutive zeros to memory when optimizing for size.
gcc/testsuite/ChangeLog
PR target/11877
* gcc.target/i386/pr11877.c: New test case.
liuhongt [Mon, 21 Jun 2021 02:39:38 +0000 (10:39 +0800)]
MAINTAINERS: Add myself as maintainer of the i386 vector extensions.
ChangeLog:
* MAINTAINERS: Add myself as maintainer of the i386 vector
extensions.