Commit Graph

186127 Commits

Author SHA1 Message Date
Richard Biener
a2ef8395fa 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.
2021-06-22 12:09:59 +02:00
Jojo R
7822285515 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.
2021-06-22 17:14:25 +08:00
Kito Cheng
f0e40ea064 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.
2021-06-22 17:06:01 +08:00
Richard Biener
7a22d8a764 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.
2021-06-22 11:01:17 +02:00
Richard Biener
a5b773d3f8 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.
2021-06-22 11:01:17 +02:00
Richard Biener
26f05f5a82 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.
2021-06-22 11:01:17 +02:00
Jakub Jelinek
d58a66aa0f 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.
2021-06-22 10:16:18 +02:00
liuhongt
706533c339 Remove my Write After Approval entry.
ChangeLog:

	* MAINTAINERS: Remove my Write After Approval entry.
2021-06-22 16:09:56 +08:00
Martin Liska
48b312b4ba contrib: fix a flake8 issue
contrib/ChangeLog:

	* mklog.py: Fix flake8 issue.
2021-06-22 09:50:38 +02:00
Martin Liska
8819c82ce8 autofdo: Bump AUTO_PROFILE_VERSION.
gcc/ChangeLog:

	* auto-profile.c (AUTO_PROFILE_VERSION): Bump as string format
	was changed.
2021-06-22 08:54:34 +02:00
Martin Liska
6871b899b8 gcov: update comment about padding
gcc/ChangeLog:

	* gcov-io.h: Remove padding entries.
2021-06-22 08:43:41 +02:00
liuhongt
e08a125b20 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.
2021-06-22 10:40:11 +08:00
liuhongt
f51618f301 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.
2021-06-22 09:35:16 +08:00
liuhongt
b6efffa552 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.
2021-06-22 09:34:47 +08:00
GCC Administrator
2f080224cf Daily bump. 2021-06-22 00:16:29 +00:00
Jonathan Wakely
6cf0040fff 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.
2021-06-21 18:29:58 +01:00
Jason Merrill
7232f7c4c2 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.
2021-06-21 10:50:01 -04:00
Patrick Palka
12bdd39755 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.
2021-06-21 09:45:31 -04:00
Tobias Burnus
edf0c3ffb5 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.
2021-06-21 15:17:45 +02:00
Richard Biener
0ad9c7087e 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.
2021-06-21 15:01:52 +02:00
Patrick Palka
21761d2b2b 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.
2021-06-21 07:54:29 -04:00
Patrick Palka
de31f5445b 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.
2021-06-21 07:54:26 -04:00
Jakub Jelinek
644c2cc5f2 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.
2021-06-21 13:32:36 +02:00
Gary Dismukes
62a3799f34 [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.
2021-06-21 06:45:21 -04:00
Bob Duff
a61fd32dd1 [Ada] Optimization of System.Value_N
gcc/ada/

	* libgnat/s-valuen.ads (Value_Enumeration,
	Valid_Enumeration_Value): Inline.
	(Value_Enumeration_Pos): Add Pure_Function.
2021-06-21 06:45:20 -04:00
Justin Squirek
eba1160fdd [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.
2021-06-21 06:45:19 -04:00
Steve Baird
2092278297 [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.
2021-06-21 06:45:17 -04:00
Eric Botcazou
88bed4e088 [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.
2021-06-21 06:45:16 -04:00
Richard Kenner
d315f859f8 [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.
2021-06-21 06:45:15 -04:00
Bob Duff
9418d3d41f [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.
2021-06-21 06:45:14 -04:00
Ed Schonberg
c3681eba72 [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.
2021-06-21 06:45:13 -04:00
Bob Duff
336438b6d2 [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.
2021-06-21 06:45:12 -04:00
Eric Botcazou
7f34e744c0 [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.
2021-06-21 06:45:11 -04:00
Bob Duff
148be92923 [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.
2021-06-21 06:45:10 -04:00
Ghjuvan Lacambre
c1f1ef1836 [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.
2021-06-21 06:45:09 -04:00
Piotr Trojanek
e171a399ef [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.
2021-06-21 06:45:08 -04:00
Ghjuvan Lacambre
48cf9f9975 [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.
2021-06-21 06:45:07 -04:00
Ghjuvan Lacambre
805f081980 [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.
2021-06-21 06:45:06 -04:00
Eric Botcazou
08c9ef089f [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.
2021-06-21 06:45:05 -04:00
Piotr Trojanek
05447313c9 [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.
2021-06-21 06:45:04 -04:00
Piotr Trojanek
b1955e0e6d [Ada] Skip overlay checks on protected components with expansion disabled
gcc/ada/

	* sem_util.adb (Find_Overlaid_Entity): Ignore references to
	components and discriminants.
2021-06-21 06:45:03 -04:00
Doug Rupp
28741e501f [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)
2021-06-21 06:45:02 -04:00
Gary Dismukes
eb077d7047 [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.
2021-06-21 06:45:01 -04:00
Piotr Trojanek
c9fcf01172 [Ada] Simplify detection of statically overlapping slices
gcc/ada/

	* sem_util.adb (Denotes_Same_Object): Simplify handling of
	slices.
2021-06-21 06:45:00 -04:00
Piotr Trojanek
58484cdf4e [Ada] Fix detection of overlapping actuals with renamings
gcc/ada/

	* sem_util.adb (Is_Object_Renaming): Rename from Is_Renaming;
	simplify; adapt callers.
2021-06-21 06:44:59 -04:00
Frederic Konrad
3045dd3c17 [Ada] powerpc64-wrs-vxworks7r2: build shared libgnat
gcc/ada/

	* Makefile.rtl: Compiles both static and dynamic libgnat for
	powerpc64-wrs-vxworks7r2.
2021-06-21 06:44:58 -04:00
prathamesh.kulkarni
316dd79876 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.
2021-06-21 14:52:54 +05:30
prathamesh.kulkarni
29a539a675 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.
2021-06-21 14:41:12 +05:30
Richard Biener
90f78d5d86 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.
2021-06-21 11:06:27 +02:00
liuhongt
08c85f609a 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.
2021-06-21 16:05:35 +08:00