Commit Graph

193729 Commits

Author SHA1 Message Date
Eric Botcazou
700cd7d673 [Ada] Small performance tweak in recent change
This avoids a useless walk of the prefix chain in instances.

gcc/ada/

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Move final test on
	In_Instance to outer condition.
2022-05-18 08:40:58 +00:00
Doug Rupp
1ef3f0911c [Ada] New port arm-qnx
The QNX system specs for ARM and AARCH64 are identical. It makes more
sense to have it named for the base architecture.

gcc/ada/

	* Makefile.rtl: Rename system-qnx-aarch64.ads to
	system-qnx-arm.ads.
	(AARCH64 QNX section): Modify to handle both arm and arch64.
	* tracebak.c (__QNX__): Add new __ARMEL__ section.
	* sigtramp-arm-qnx.c: New file.
	* libgnat/system-qnx-aarch64.ads: Renamed to ...
	* libgnat/system-qnx-arm.ads: this.
2022-05-18 08:40:58 +00:00
liuhongt
9d1336d977 Enhance final_value_replacement_loop to handle bitwise induction.
This patch will enable below optimization:

 {
-  int bit;
-  long long unsigned int _1;
-  long long unsigned int _2;
-
   <bb 2> [local count: 46707768]:
-
-  <bb 3> [local count: 1027034057]:
-  # tmp_11 = PHI <tmp_8(3), tmp_6(D)(2)>
-  # bit_13 = PHI <bit_9(3), 63(2)>
-  _1 = 1 << bit_13;
-  _2 = ~_1;
-  tmp_8 = _2 & tmp_11;
-  bit_9 = bit_13 + -3;
-  if (bit_9 != -3(OVF))
-    goto <bb 3>; [95.65%]
-  else
-    goto <bb 4>; [4.35%]
-
-  <bb 4> [local count: 46707768]:
-  return tmp_8;
+  tmp_12 = tmp_6(D) & 7905747460161236406;
+  return tmp_12;

 }

gcc/ChangeLog:

	PR middle-end/103462
	* match.pd (bitwise_induction_p): New match.
	* tree-scalar-evolution.cc (gimple_bitwise_induction_p):
	Declare.
	(analyze_and_compute_bitwise_induction_effect): New function.
	(enum bit_op_kind): New enum.
	(final_value_replacement_loop): Enhanced to handle bitwise
	induction.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr103462-1.c: New test.
	* gcc.target/i386/pr103462-2.c: New test.
	* gcc.target/i386/pr103462-3.c: New test.
	* gcc.target/i386/pr103462-4.c: New test.
	* gcc.target/i386/pr103462-5.c: New test.
	* gcc.target/i386/pr103462-6.c: New test.
2022-05-18 15:46:21 +08:00
Haochen Gui
a174dc1a7f This patch adds a combine pattern for "CA minus one". The SImode "CA minus one" can be converted to DImode as CA only has two values (0 or 1).
gcc/
	PR target/95737
	* config/rs6000/rs6000.md (*subfsi3_carry_in_xx_64): New.

gcc/testsuite/
	PR target/95737
	* gcc.target/powerpc/pr95737.c: New.
2022-05-18 13:21:29 +08:00
liuhongt
102237c9f2 recognize bzhi pattern when there's zero_extendsidi.
backend has

16550(define_insn "*bmi2_bzhi_<mode>3_2"
16551  [(set (match_operand:SWI48 0 "register_operand" "=r")
16552        (and:SWI48
16553          (plus:SWI48
16554            (ashift:SWI48 (const_int 1)
16555                          (match_operand:QI 2 "register_operand" "r"))
16556            (const_int -1))
16557          (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
16558   (clobber (reg:CC FLAGS_REG))]
16559  "TARGET_BMI2"
16560  "bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}"
16561  [(set_attr "type" "bitmanip")
16562   (set_attr "prefix" "vex")
16563   (set_attr "mode" "<MODE>")])

But there's extra zero_extend in pattern match.

424Failed to match this instruction:
425(parallel [
426        (set (reg:DI 90)
427            (zero_extend:DI (and:SI (plus:SI (ashift:SI (const_int 1 [0x1])
428                            (subreg:QI (reg:SI 98) 0))
429                        (const_int -1 [0xffffffffffffffff]))
430                    (subreg:SI (reg:DI 95) 0))))
431        (clobber (reg:CC 17 flags))
432    ])

Add new define_insn for it.

gcc/ChangeLog:

	PR target/104375
	* config/i386/i386.md (*bmi2_bzhi_zero_extendsidi_4): New
	define_insn.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr104375.c: New test.
2022-05-18 10:56:35 +08:00
liuhongt
850a13d754 Expand __builtin_memcmp_eq with ptest for OImode.
gcc/ChangeLog:

	PR target/104610
	* config/i386/i386-expand.cc (ix86_expand_branch): Use ptest
	for QImode when code is EQ or NE.
	* config/i386/i386.md (cbranchoi4): New expander.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr104610.c: New test.
2022-05-18 10:47:28 +08:00
Peter Bergner
c6e36f05fb rs6000: Prefer assigning the MMA vector operands to altivec registers [PR105556]
When optimizing the DGEMM kernel in OpenBLAS to use MMA, the MMA code
uses all 8 accumulators, which overlap all vs0-vs31 vector registers.
Current trunk assigns one of the normal vector inputs to one of the MMA
instructions, which forces us to spill one of the accumulators to memory,
leading to poor performance.  The solution here is to replace the "wa"
constraints for the vector input operands in the MMA instruction patterns
with "v,?wa" so that we prefer using the altivec registers vs32-vs63
over the vs0-vs31 registers.

2022-05-17  Peter Bergner  <bergner@linux.ibm.com>
	    Segher Boessenkool  <segher@kernel.crashing.org>

gcc/
	PR target/105556
	* config/rs6000/mma.md (mma_<vv>, mma_<avv>, mma_<pv>, mma_<apv>,
	mma_<vvi4i4i8>, mma_<avvi4i4i8>, mma_<vvi4i4i2>, mma_<avvi4i4i2>,
	mma_<vvi4i4>, mma_<avvi4i4>, mma_<pvi4i2>, mma_<apvi4i2>,
	mma_<vvi4i4i4>, mma_<avvi4i4i4>): Replace "wa" constraints with "v,?wa".
	Update other operands accordingly.
2022-05-17 21:10:27 -05:00
GCC Administrator
3d9439b1bb Daily bump. 2022-05-18 00:16:36 +00:00
Ian Lance Taylor
1bfb823e2a compiler: load LHS subexpressions of op= assignment only once
Fixes golang/go#52811

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405617
2022-05-17 15:48:43 -07:00
Jason Merrill
2b0c837772 c++: constexpr ref to array of array [PR102307]
The problem here is that first check_initializer calls
build_aggr_init_full_exprs, which does overload resolution, but then in the
case of failed constexpr throws away the result and does it again in
build_functional_cast.  But in the first overload resolution,
reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
tf_error is set, so we know we're committed.  But the second pass gets
confused by the CONSTRUCTORs with non-init-list types.

Fixed by avoiding a second pass: instead, pass the call from build_aggr_init
to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
to change the object argument because it will be replaced later in
simplify_aggr_init_expr.

	PR c++/102307

gcc/cp/ChangeLog:

	* decl.cc (check_initializer): Use build_cplus_new in case of
	constexpr failure.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/constexpr-array2.C: New test.
2022-05-17 18:09:24 -04:00
Marek Polacek
2c05a2d1a8 c: use CONST_DECL for enumerators in TYPE_VALUES
The C and C++ FEs differ in TYPE_VALUES for an enum type: an entry in
the list in the C++ FE has a CONST_DECL in the TREE_VALUE, but the C FE
has only the numerical value of the CONST_DECL there.  This has caused
me some trouble in my PR105497 patch.  Using a CONST_DECL is preferable
because a CONST_DECL can track more information (e.g., attributes), and
you can always get the value simply by looking at its DECL_INITIAL.

This turned out to be a trivial change.  One place in godump.cc had to be
adjusted.  I'm not changing the CONST_DECL check in c_do_switch_warnings
because I'll be changing it soon in my next patch.  I didn't see any other
checks that this patch makes redundant.

gcc/c/ChangeLog:

	* c-decl.cc (finish_enum): Store the CONST_DECL into TREE_VALUE, not
	its value.

gcc/ChangeLog:

	* godump.cc (go_output_typedef): Use the DECL_INITIAL of the TREE_VALUE.
2022-05-17 18:03:54 -04:00
Pat Haugen
2ee68beee7 Fix register count when not splitting Complex IEEE 128-bit args.
For ABI_V4, we do not split complex args. This created a problem because
even though an arg would be passed in two VSX regs, we were only advancing the
function arg counter by one VSX register. Fixed with this patch.

	PR target/99685

gcc/
	* config/rs6000/rs6000-call.cc (rs6000_function_arg_advance_1): Bump
	register count when not splitting IEEE 128-bit Complex.
2022-05-17 15:53:24 -05:00
Tobias Burnus
47554478a1 OpenMP: Skip target-nesting warning for reverse offload
gcc/ChangeLog:

	* omp-low.cc (check_omp_nesting_restrictions): Skip warning for
	target inside target if inner is reverse offload.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/target-device-ancestor-5.c: New test.
2022-05-17 22:09:16 +02:00
Jonathan Wakely
ddb1427def libstdc++: Relax memory ordering for default memory resource object
Currently pmr::set_default_resource and pmr::get_default_resource both
use sequentially consistent memory ordering. This is overkill. The
standard only requires that a call to set_default_resource synchronizes
with subsequent calls to set_default_resource and get_default_resource.

Using acquire-release for the setter and acquire for the getter is
sufficient to meet the requirement.

Reviewed-by: Thomas Rodgers  <trodgers@redhat.com>

libstdc++-v3/ChangeLog:

	* src/c++17/memory_resource.cc (set_default_resource): Use
	memory_order_acq_rel.
	(get_default_resource): Use memory_order_acquire.
2022-05-17 20:53:40 +01:00
Jonathan Wakely
5c2d703e6d libstdc++: Add attributes to functions in <memory_resource>
Add attributes to the accessors for the global memory resource objects,
to allow the compiler to eliminate redundant calls to them. For example,
multiple calls to std::pmr::new_delete_resource() will always return the
same object, and so the compiler can replace them with a single call.

Ideally we would like adjacent calls to std::pmr::get_default_resource()
to be combined into a single call by the CSE pass. The 'pure' attribute
would permit that. However, the standard requires that calls to
std::pmr::set_default_resource() synchronize with subsequent calls to
std::pmr::get_default_resource().  With 'pure' the DCE pass might
eliminate seemingly redundant calls to std::pmr::get_default_resource().
That might be unsafe, because the caller might be relying on the
associated synchronization. We could use a hypothetical attribute that
allows CSE but not DCE, but we don't have one. So it can't be 'pure'.

Also add [[nodiscard]] to equality operators.

libstdc++-v3/ChangeLog:

	* include/std/memory_resource (new_delete_resource): Add
	nodiscard, returns_nonnull and const attributes.
	(null_memory_resource): Likewise.
	(set_default_resource, get_default_resource): Add returns_nonnull
	attribute.
	(memory_resource::is_equal): Add nodiscard attribute.
	(operator==, operator!=): Likewise.
2022-05-17 20:51:04 +01:00
Jonathan Wakely
5f1ce85135 libstdc++: Add attributes to <system_error> and related
Add the const attribute to std::future_category() and
std::iostream_category(), to match the existing attributes on
std::generic_category() and std::system_category().

Also add [[nodiscard]] to those functions and to the comparison
operators for std::error_code and std::error_condition, and to
std::make_error_code and std::make_error_condition overloads.

libstdc++-v3/ChangeLog:

	* include/bits/ios_base.h (io_category): Add const and nodiscard
	attributes.
	(make_error_code, make_error_condition): Add nodiscard.
	* include/std/future (future_category): Add const and nodiscard.
	(make_error_code, make_error_condition): Add nodiscard.
	* include/std/system_error (generic_category system_category):
	Add nodiscard. Replace _GLIBCXX_CONST with C++11 attribute.
	(error_code::value, error_code::category, error_code::operator bool)
	(error_condition::value, error_condition::category)
	(error_condition::operator bool, make_error_code)
	(make_error_condition, operator==, operator!=, operator<=>): Add
	nodiscard.
2022-05-17 20:50:31 +01:00
Tobias Burnus
c9852156dd Revert 'Use more ARRAY_SIZE.' for mkoffload
Revert commit r13-472-gca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d partially;
namely for {gcn,nvptx}/mkoffload.cc, only.

The patch changed 'sizeof(...)/sizeof(...[0])' to the 'ARRAY_SIZE' macro,
which is in principle a good idea – except that in the two mkoffload.cc,
the change happened inside a string that is used to generate plain C code.

With offlading to nvptx or gcn, the mkoffload genenates then the C file
and compilation of the latter fails with
"warning: implicit declaration of function 'ARRAY_SIZE'" followed by
"error: initializer element is not constant"

gcc/
	* config/gcn/mkoffload.cc (process_obj): Revert: Use ARRAY_SIZE.
	* config/nvptx/mkoffload.cc (process): Likewise.
2022-05-17 20:54:32 +02:00
Andrew MacLeod
b7501739f3 Add side effect infrastructure.
Replace the non-null procesing with a generic side effect implementation that
can handle arbitrary side effects.

	* Makefile.in (OBJS): Add gimple-range-side-effect.o.
	* gimple-range-cache.cc (non_null_ref::non_null_ref): Delete.
	(non_null_ref::~non_null_ref): Delete.
	(non_null_ref::set_nonnull): Delete.
	(non_null_ref::non_null_deref_p): Delete.
	(non_null_ref::process_name): Delete.
	(ranger_cache::ranger_cache): Initialize m_exit object.
	(ranger_cache::fill_block_cache): Use m_exit object intead of nonnull.
	(ranger_cache::range_from_dom): Use side_effect class and m_exit object.
	(ranger_cache::update_to_nonnull): Delete.
	(non_null_loadstore): Delete.
	(ranger_cache::block_apply_nonnull): Delete.
	(ranger_cache::apply_side_effects): New.
	* gimple-range-cache.h (class non_null_ref): Delete.
	(non_null_ref::adjust_range): Delete.
	(class ranger_cache): Adjust prototypes, add side effect manager.
	* gimple-range-path.cc (path_range_query::range_defined_in_block): Use
	side effect manager for queries.
	(path_range_query::adjust_for_non_null_uses): Ditto.
	* gimple-range-path.h (class path_range_query): Delete non_null_ref.
	* gimple-range-side-effect.cc: New.
	* gimple-range-side-effect.h: New.
	* gimple-range.cc (gimple_ranger::gimple_ranger): Update contructor.
	(gimple_ranger::range_of_expr): Check def block for override value.
	(gimple_ranger::range_on_entry): Don't scan dominators for non-null.
	(gimple_ranger::range_on_edge): Check for outgoing side-effects.
	(gimple_ranger::register_side_effects): Call apply_side_effects.
	(enable_ranger): Update contructor.
	* gimple-range.h (class gimple_ranger): Update prototype.
	(enable_ranger): Update prototype.
	* tree-vrp.cc (execute_ranger_vrp): Invoke without immediate-use flag.
2022-05-17 14:38:03 -04:00
Nathan Sidwell
451894cadc demangler: Structured Bindings
C++ Structured bindings have a mangling that has yet to be formally
documented.  However, it's been around for a while and shows up for
module support.

	include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_STRUCTURED_BINDING.
	libiberty/
	* cp-demangle.c (d_make_comp): Adjust.
	(d_unqualified_name): Add 'DC' support.
	(d_count_template_scopes): Adjust.
	(d_print_comp_inner): Add structured binding.
	* testsuite/demangle-expected: Add testcases.
2022-05-17 11:10:03 -07:00
Giuliano Belinassi
7a3f38a966 PR105169 Fix references to discarded sections
When -fpatchable-function-entry= is enabled, certain C++ codes fails to
link because of generated references to discarded sections in
__patchable_function_entry section. This commit fixes this problem by
puting those references in a COMDAT section.

2022-05-06  Giuliano Belinassi  <gbelinassi@suse.de>

gcc/ChangeLog
	PR c++/105169
	* targhooks.cc (default_print_patchable_function_entry_1): Handle COMDAT case.
	* varasm.cc (switch_to_comdat_section): New
	(handle_vtv_comdat_section): Call switch_to_comdat_section.
	* varasm.h: Declare switch_to_comdat_section.

gcc/testsuite/ChangeLog
2022-05-06  Giuliano Belinassi  <gbelinassi@suse.de>

	PR c++/105169
	* g++.dg/modules/pr105169.h: New file.
	* g++.dg/modules/pr105169_a.C: New test.
	* g++.dg/modules/pr105169_b.C: New file.
2022-05-17 14:34:21 -03:00
Richard Biener
941efd87e2 Do not clear bb->aux in duplicate_loop_body_to_header_edge
duplicate_loop_body_to_header_edge clears bb->aux which is not wanted
by a new use in loop unswitching.  The clearing was introduced with
r0-69110-g6580ee7781f903 and it seems accidentially so.

2022-05-17  Richard Biener  <rguenther@suse.de>

	* cfgloopmanip.cc (duplicate_loop_body_to_header_edge): Do
	not clear bb->aux of the copied blocks.
2022-05-17 17:53:46 +02:00
Andrew MacLeod
6101a276c3 Check for equivalence after merging relations.
When registering a relation, we need to merge with any existing relation
before checking if it was an equivalence... otherwise it was not being
handled properly.

	gcc/
	PR tree-optimization/105458
	* value-relation.cc (path_oracle::register_relation): Merge, then check
	for equivalence.

	gcc/testsuite/
	* gcc.dg/pr105458.c: New.
2022-05-17 11:43:32 -04:00
Uros Bizjak
61a6923e89 i386: Fix ICE in final_scan_insn_1 [PR105624]
Apparently const_int_operand and other const*_operand predicates
do need constraints.  Revert the offending patch that caused ICE.

2022-05-17  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	PR target/105624
	Revert:

	* config/i386/i386.md: Remove constraints when used with
	const_int_operand, const0_operand, const_1_operand, constm1_operand,
	const8_operand, const128_operand, const248_operand, const123_operand,
	const2367_operand, const1248_operand, const359_operand,
	const_4_or_8_to_11_operand, const48_operand, const_0_to_1_operand,
	const_0_to_3_operand, const_0_to_4_operand, const_0_to_5_operand,
	const_0_to_7_operand, const_0_to_15_operand, const_0_to_31_operand,
	const_0_to_63_operand, const_0_to_127_operand, const_0_to_255_operand,
	const_0_to_255_mul_8_operand, const_1_to_31_operand,
	const_1_to_63_operand, const_2_to_3_operand, const_4_to_5_operand,
	const_4_to_7_operand, const_6_to_7_operand, const_8_to_9_operand,
	const_8_to_11_operand, const_8_to_15_operand, const_10_to_11_operand,
	const_12_to_13_operand, const_12_to_15_operand, const_14_to_15_operand,
	const_16_to_19_operand, const_16_to_31_operand, const_20_to_23_operand,
	const_24_to_27_operand and const_28_to_31_operand.
	* config/i386/mmx.md: Ditto.
	* config/i386/sse.md: Ditto.
	* config/i386/subst.md: Ditto.
	* config/i386/sync.md: Ditto.

gcc/testsuite/ChangeLog:

	PR target/105624
	* gcc.target/i386/pr105624.c: New test.
2022-05-17 17:37:59 +02:00
Jakub Jelinek
741478ed3e libgomp: Clarify that omp_display_env is fully implemented
OpenMP 5.2 added
"When called from within a target region the effect is unspecified."
restriction to omp_display_env, so it is ok not to support it in
target regions (worst case we could add an empty implementation
or one with __builtin_trap in there).

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

	* libgomp.texi (OpenMP 5.1): Remove "Not inside target regions"
	comment for omp_display_env feature.
2022-05-17 16:58:26 +02:00
Thomas Schwinge
cd4a0ddc12 Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'
gcc/
	* diagnostic.cc: Don't advise to call 'abort' instead of
	'internal_error'.
	* system.h: Advise to call 'internal_error' instead of 'abort' or
	'fancy_abort'.

Suggested-by: Richard Biener <richard.guenther@gmail.com>
2022-05-17 16:27:32 +02:00
Frederik Harwath
0f00ebf0d6 graphite: Fix minor mistakes in comments
gcc/ChangeLog:

	* graphite-sese-to-poly.cc (build_poly_sr_1): Fix a typo and
	a reference to a variable which does not exist.
	* graphite-isl-ast-to-gimple.cc (gsi_insert_earliest): Fix typo
	in comment.
2022-05-17 16:02:01 +02:00
Frederik Harwath
0cca1c22b0 graphite: Rename isl_id_for_ssa_name
The SSA names for which this function gets used are always SCoP
parameters and hence "isl_id_for_parameter" is a better name.  It also
explains the prefix "P_" for those names in the ISL representation.

gcc/ChangeLog:

	* graphite-sese-to-poly.cc (isl_id_for_ssa_name): Rename to ...
	(isl_id_for_parameter): ... this new function name.
	(build_scop_context): Adjust function use.
2022-05-17 16:00:57 +02:00
Tobias Burnus
61fe7b7d46 libgomp.texi: Document OpenMP context selectors
libgomp/
	* libgomp.texi (Offload-Target Specifics): New chapter; add section
	to document OpenMP context selectors.
2022-05-17 15:54:24 +02:00
Tobias Burnus
ebe5dace8c gcn/t-omp-device: Add 'amdgcn' as 'arch' [PR105602]
Improve cross-compiler handling.

gcc/ChangeLog:

	PR target/105602
	* config/gcn/t-omp-device (arch): Add 'amdgcn' besides existing 'gcn'.
	* config/gcn/gcn.cc (gcn_omp_device_kind_arch_isa): Likewise.
2022-05-17 15:54:23 +02:00
Jakub Jelinek
2c16eb3157 openmp: Add support for inoutset depend-kind
This patch adds support for inoutset depend-kind in depend
clauses.  It is very similar to the in depend-kind in that
a task with a dependency with that depend-kind is dependent
on all previously created sibling tasks with matching address
unless they have the same depend-kind.
In the in depend-kind case everything is dependent except
for in -> in dependency, for inoutset everything is
dependent except for inoutset -> inoutset dependency.
mutexinoutset is also similar (everything is dependent except
for mutexinoutset -> mutexinoutset dependency), but there is
also the additional restriction that only one task with
mutexinoutset for each address can be scheduled at once (i.e.
mutual exclusitivty).  For now we support mutexinoutset
the same as inout/out, but the inoutset support is full.

In order not to bump the ABI for dependencies each time
(we've bumped it already once, the old ABI supports only
inout/out and in depend-kind, the new ABI supports
inout/out, mutexinoutset, in and depobj), this patch arranges
for inoutset to be at least for the time being always handled
as if it was specified through depobj even when it is not.
So it uses the new ABI for that and inoutset are represented
like depobj - pointer to a pair of pointers where the first one
will be the actual address of the object mentioned in depend
clause and second pointer will be (void *) GOMP_DEPEND_INOUTSET.

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree-core.h (enum omp_clause_depend_kind): Add
	OMP_CLAUSE_DEPEND_INOUTSET.
	* tree-pretty-print.cc (dump_omp_clause): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
	* gimplify.cc (gimplify_omp_depend): Likewise.
	* omp-low.cc (lower_depend_clauses): Likewise.
gcc/c-family/
	* c-omp.cc (c_finish_omp_depobj): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
gcc/c/
	* c-parser.cc (c_parser_omp_clause_depend): Parse
	inoutset depend-kind.
	(c_parser_omp_depobj): Likewise.
gcc/cp/
	* parser.cc (cp_parser_omp_clause_depend): Parse
	inoutset depend-kind.
	(cp_parser_omp_depobj): Likewise.
	* cxx-pretty-print.cc (cxx_pretty_printer::statement): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
gcc/testsuite/
	* c-c++-common/gomp/all-memory-1.c (boo): Add test with
	inoutset depend-kind.
	* c-c++-common/gomp/all-memory-2.c (boo): Likewise.
	* c-c++-common/gomp/depobj-1.c (f1): Likewise.
	(f2): Adjusted expected diagnostics.
	* g++.dg/gomp/depobj-1.C (f4): Adjust expected diagnostics.
include/
	* gomp-constants.h (GOMP_DEPEND_INOUTSET): Define.
libgomp/
	* libgomp.h (struct gomp_task_depend_entry): Change is_in type
	from bool to unsigned char.
	* task.c (gomp_task_handle_depend): Handle GOMP_DEPEND_INOUTSET.
	Ignore dependencies where
	task->depend[i].is_in && task->depend[i].is_in == ent->is_in
	rather than just task->depend[i].is_in && ent->is_in.  Remember
	whether GOMP_DEPEND_IN loop is needed and guard the loop with that
	conditional.
	(gomp_task_maybe_wait_for_dependencies): Handle GOMP_DEPEND_INOUTSET.
	Ignore dependencies where elem.is_in && elem.is_in == ent->is_in
	rather than just elem.is_in && ent->is_in.
	* testsuite/libgomp.c-c++-common/depend-1.c (test): Add task with
	inoutset depend-kind.
	* testsuite/libgomp.c-c++-common/depend-2.c (test): Likewise.
	* testsuite/libgomp.c-c++-common/depend-3.c (test): Likewise.
	* testsuite/libgomp.c-c++-common/depend-inoutset-1.c: New test.
2022-05-17 15:40:27 +02:00
Jonathan Wakely
1815462a6e libstdc++: Skip tests that fail for the versioned namespace
Most tests for the contents of header synopses need to be supressed for
the versioned namespace build, because redeclaring the entities in std
fails when they were originally declared in std::__8.

I added these tests recently without the suppression, so they fail.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/expected/synopsis.cc: Skip for versioned
	namespace.
	* testsuite/27_io/headers/iosfwd/synopsis.cc: Likewise.
2022-05-17 11:42:34 +01:00
Jonathan Wakely
357d6fcd41 libstdc++: Stop defining C++0x compat symbols for versioned namespace
The src/c++11/compatibility*-c++0x.cc files define symbols that need to
be exported for ancient versions of libstdc++.so.6 due to changes
between C++0x and the final C++11 standard. Those symbols are not needed
in the libstdc++.so.8 library, and we can skip building them entirely.

This also fixes the build failure I introduced last week when making the
versioned namespace config not use the _V2 namespace for compat symbols.

libstdc++-v3/ChangeLog:

	* src/Makefile.am [ENABLE_SYMVERS_GNU_NAMESPACE] (cxx11_sources):
	Do not build the compatibility*-c++0x.cc objects.
	* src/Makefile.in: Regenerate.
	* src/c++11/compatibility-c++0x.cc [_GLIBCXX_INLINE_VERSION]:
	Refuse to build for the versioned namespace.
	* src/c++11/compatibility-chrono.cc: Likewise.
	* src/c++11/compatibility-condvar.cc: Likewise.
	* src/c++11/compatibility-thread-c++0x.cc: Likewise.
	* src/c++11/chrono.cc (system_clock, steady_clock):
	Use macros to define in inline namespace _V2, matching the
	declarations in <system_error>.
	* src/c++11/system_error.cc (system_category, generic_category):
	Likewise.
2022-05-17 11:42:34 +01:00
Tobias Burnus
472aecb789 libgomp.texi: Add OpenMP 5.2 implementation status
libgomp/
	* libgomp.texi (OpenMP Implementation Status): Add 5.2 table.
2022-05-17 12:31:35 +02:00
Jakub Jelinek
254cbf7266 i386: Fix up V2DI and V1TI inequality comparisons [PR105613]
The recent r13-458 change to introduce vec_cmpeqv1tiv1ti and
add TARGET_SSE2 support to vec_cmpeqv2div2di works nicely for
equality comparisons, but as the testcase shows doesn't work
for inequality comparisons.
For EQ if we perform comparison with twice as many half-sized elemenets,
the result should be ~0 when both halves are ~0 only (both halves need
to be equal for the whole to be equal), otherwise 0, so AND is the
correct operation for it.
But for NE, the result should be ~0 when either of the halves is ~0
(if either half is not equal, the whole is not equal) and so the right
operation for NE is IOR, not AND.

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

	PR target/105613
	* config/i386/sse.md (vec_cmpeqv2div2di, vec_cmpeqv1tiv1ti): Use
	andv4si3 only for EQ, for NE use iorv4si3 instead.

	* gcc.c-torture/execute/pr105613.c: New test.
2022-05-17 12:10:30 +02:00
Tobias Burnus
4f94c38a92 OpenMP: Add omp_all_memory support to Fortran
Fortran part to the C/C++/backend implementation
r13-337-g7f78783dbedca0183d193e475262ca3c489fd365

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_namelist): Handle omp_all_memory.
	* openmp.cc (gfc_match_omp_variable_list, gfc_match_omp_depend_sink,
	gfc_match_omp_clauses, resolve_omp_clauses): Likewise.
	* trans-openmp.cc (gfc_trans_omp_clauses, gfc_trans_omp_depobj):
	Likewise.
	* resolve.cc (resolve_symbol): Reject it as symbol.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1): Set omp_all_memory to 'Y'.
	* testsuite/libgomp.fortran/depend-5.f90: New test.
	* testsuite/libgomp.fortran/depend-6.f90: New test.
	* testsuite/libgomp.fortran/depend-7.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/all-memory-1.f90: New test.
	* gfortran.dg/gomp/all-memory-2.f90: New test.
	* gfortran.dg/gomp/all-memory-3.f90: New test.
2022-05-17 11:01:04 +02:00
Richard Biener
ebce0e9bd8 tree-optimization/105618 - restore load sinking
The PR97330 fix caused some missed sinking of loads out of loops
the following patch re-instantiates.

2022-05-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105618
	* tree-ssa-sink.cc (statement_sink_location): For virtual
	PHI uses ignore those defining the used virtual operand.

	* gcc.dg/tree-ssa/ssa-sink-19.c: New testcase.
2022-05-17 10:45:45 +02:00
Piotr Trojanek
33400df641 [Ada] Restore defensive guard in checks for volatile actuals
When flagging names of volatile objects occurring in actual parameters
it is safer to guard against identifiers without entity. This is
redundant (because earlier in the resolution of actual parameters we
already guard against actuals with Any_Type), but perhaps such
identifiers will become allowed in constructs like:

   Subprogram_Call
     (Actual =>
        (declare
           X : Boolean := ...
             with Annotate (GNATprove, ...)));
                            ^^^^^^^^^

which include an identifier that does not denote any entity.

Code cleanup related to handling of volatile components; behaviour is
unaffected.

gcc/ada/

	* sem_res.adb (Flag_Effectively_Volatile_Objects): Restore
	redundant guard.
2022-05-17 08:25:50 +00:00
Gary Dismukes
de0665fc7f [Ada] Subprogram renaming fails to hide homograph
The compiler failed to detect an error where the first prefix of an
expanded name given as the renamed subprogram in a subprogram renaming
declaration denotes a unit with the same name as the name given for the
subprogram renaming. Such a unit must be hidden by the renaming itself.
An error check is added to catch this case.

gcc/ada/

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Add error check for
	the case of a renamed subprogram given by an expanded name whose
	outermost prefix names a unit that is hidden by the name of the
	renaming.
	(Ult_Expanded_Prefix): New local expression function to return
	the ultimate prefix of an expanded name.
2022-05-17 08:25:49 +00:00
Ghjuvan Lacambre
a51b6016c9 [Ada] CUDA: remove code performing kernel registration
A previous commit implemented a new kernel registration scheme, using
the binder to generate registration code rather than inserting
registration code in packages.  Now that this new approach has had time
to be thoroughly tested, it is time to remove the old approach.

gcc/ada/

	* gnat_cuda.ads: Update package-level comments.
	(Build_And_Insert_CUDA_Initialization): Remove function.
	* gnat_cuda.adb (Build_And_Insert_CUDA_Initialization): Remove
	function.
	(Expand_CUDA_Package): Remove call to
	Build_And_Insert_CUDA_Initialization.
2022-05-17 08:25:49 +00:00
Etienne Servais
5ab656c5e9 [Ada] Enhance the warning on C enum with size clause for size /= 32
Improve the warning message and silence warning when size > 32, this is
likely intentional and does not warrant a warning.

gcc/ada/

	* freeze.adb (Freeze_Enumeration_Type): Fix comment, enhance
	message and silence warning for size > 32.
2022-05-17 08:25:49 +00:00
Yannick Moy
3c802e9749 [Ada] Allow inlining for proof inside generics
For local subprograms without contracts inside generics, allow their
inlining for proof in GNATprove mode. This requires forbidding the
inlining of subprograms which contain references to object renamings,
which would be replaced in the SPARK expansion and violate assumptions
of the inlining code.

gcc/ada/

	* exp_spark.adb (Expand_SPARK_Potential_Renaming): Deal with no
	entity case.
	* inline.ads (Check_Object_Renaming_In_GNATprove_Mode): New
	procedure.
	* inline.adb (Check_Object_Renaming_In_GNATprove_Mode): New
	procedure.
	(Can_Be_Inlined_In_GNATprove_Mode): Remove case forbidding
	inlining for subprograms inside generics.
	* sem_ch12.adb (Copy_Generic_Node): Preserve global entities
	when inlining in GNATprove mode.
	* sem_ch6.adb (Analyse_Subprogram_Body_Helper): Remove body to
	inline if renaming is detected in GNATprove mode.
2022-05-17 08:25:48 +00:00
Gary Dismukes
867bf6f087 [Ada] Provide allocation subtype for allocators of a Designated_Storage_Model type
When an allocator is for an access type that has a
Designated_Storage_Model aspect, and the designated type is an
unconstrained record type with discriminants, and the subtype associated
with the allocator is constrained, a dereference of the new access value
can be passed to the designated type's initialization procedure. The
post-front-end phase of the compiler needs to be able to create a
temporary object in the host memory space to pass to the init proc,
which requires creating such an object, but the subtype needed for the
allocation isn't readily available at the point of the dereference.  To
make the subtype easily accessible, we set the Actual_Designated_Subtype
of such a dereference to the subtype of the allocated object.

gcc/ada/

	* exp_ch4.adb (Expand_N_Allocator): For an allocator with an
	unconstrained discriminated designated type, and whose
	allocation subtype is constrained, set the
	Actual_Designated_Subtype of the dereference passed to the init
	proc of the designated type to be the allocation subtype.
	* sinfo.ads: Add documentation of new setting of
	Actual_Designated_Subtype on a dereference used as an actual
	parameter of call to an init proc associated with an allocator.
	Also add missing syntax and documentation for the GNAT language
	extension that allows an expression as a default for a concrete
	generic formal function.
2022-05-17 08:25:48 +00:00
Bob Duff
f2ef7a0545 [Ada] Cleanups related to front-end SJLJ
This patch cleans up some code that is left over from the front-end SJLJ
exception handling mechanism, which has been removed.
This is in preparation for fixing a finalization-related bug.

Most importantly:

    The documentation is changed: a Handled_Sequence_Of_Statements node
    CAN contain both Exception_Handlers and an At_End_Proc.

    The assertion contradicting that is removed from
    Expand_At_End_Handler.

    The From_At_End field is removed.

gcc/ada/

	* sinfo.ads: Remove From_At_End.  Update comments.
	* gen_il-fields.ads, gen_il-gen-gen_nodes.adb, sem_ch11.adb:
	Remove From_At_End.
	* exp_ch11.adb (Expand_At_End_Handler): Remove assertion.
	* fe.h (Exception_Mechanism, Exception_Mechanism_Type, Has_DIC,
	Has_Invariants, Is_List_Member, List_Containing): Remove
	declarations that are not used in gigi.
	* opt.ads (Exception_Mechanism): This is not used in gigi.
	* exp_util.ads: Minor comment fix.
2022-05-17 08:25:48 +00:00
Dmitriy Anisimkov
26b0b2ddf4 [Ada] GNAT.Binary_Search is not internal
Put package GNAT.Binary_Search to predefined units list.

gcc/ada/

	* impunit.adb: Add "g-binsea" to Non_Imp_File_Names_95 list.
2022-05-17 08:25:47 +00:00
Yannick Moy
5c44da007b [Ada] Fix insertion of declaration inside quantified expression
When the evaluation of the subtype_indication for the
iterator_specification of a quantified_expression leads to the insertion
of a type declaration, this should be done with Insert_Action instead of
Insert_Before.

gcc/ada/

	* sem_ch5.adb (Analyze_Iterator_Specification): Use
	Insert_Action when possibly inside an expression.
2022-05-17 08:25:47 +00:00
Marc Poulhiès
5dbb65676f [Ada] Fix Forced sign flag in formatted string
Fix the Forced sign flag that is incorrectly ignored for scientific
notation and shortest representation.

gcc/ada/

	* libgnat/g-forstr.adb (Is_Number): Add scientific notation and
	shortest representation.
2022-05-17 08:25:46 +00:00
Eric Botcazou
42fe7c9a80 [Ada] Fix small glitch in Expand_N_Full_Type_Declaration
The original node is not guaranteed to also be an
N_Full_Type_Declaration, so the code needs to look into the node itself.

gcc/ada/

	* exp_ch3.adb (Expand_N_Full_Type_Declaration): Look into N.
2022-05-17 08:25:46 +00:00
Bob Duff
80d1067508 [Ada] Requires_Cleanup_Actions and N_Protected_Body
This patch disallows N_Protected_Body from being passed to
Requires_Cleanup_Actions. Protected bodies never need cleanup, and are
never passed to Requires_Cleanup_Actions, which is a good thing, because
it would blow up on Handled_Statement_Sequence, which doesn't exist for
N_Protected_Body.

gcc/ada/

	* exp_util.adb (Requires_Cleanup_Actions): Remove
	N_Protected_Body from the case statement, so that case will be
	covered by "raise Program_Error".
2022-05-17 08:25:46 +00:00
Bob Duff
b81c9e4f9f [Ada] Output.w always writes to stderr
There are several debugging procedures called Output.w, and some
output-redirection features. This patch modifies Output.w so their
output is not redirected; it always goes to standard error. Otherwise,
debugging output can get mixed in with some "real" output (perhaps to a
file), which causes confusion and in some cases failure to build.

gcc/ada/

	* output.adb (Pop_Output, Set_Output): Unconditionally flush
	output when switching from one output destination to another.
	Otherwise buffering can cause garbled output.
	(w): Push/pop the current settings, and temporarily
	Set_Standard_Error during these procedures.
2022-05-17 08:25:46 +00:00
Dmitriy Anisimkov
a2bcadcef0 [Ada] Generic binary search implementation
Allows binary search in sorted anonymous array (or array-like
container).

gcc/ada/

	* libgnat/g-binsea.ads, libgnat/g-binsea.adb
	(GNAT.Binary_Search): New package.
	* Makefile.rtl (GNATRTL_NONTASKING_OBJS): New item in list.
	* doc/gnat_rm/the_gnat_library.rst (GNAT.Binary_Search): New
	package record.
	* gnat_rm.texi: Regenerate.
2022-05-17 08:25:45 +00:00