Commit Graph

177573 Commits

Author SHA1 Message Date
Gary Dismukes
bbab2db3a6 [Ada] Implement static expression functions for Ada 202x (AI12-0075)
2020-06-17  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

	* aspects.ads (type Aspect_Id): Add Aspect_Static as a Boolean
	aspect, and update the Is_Representation_Aspect, Aspect_Names,
	and Aspect_Delay arrays.
	* exp_ch6.adb (Expand_Simple_Function_Return): In the case of a
	return for a static expression function, capture a copy of the
	expression of the return statement before it's expanded and
	reset its Analyzed flags. Then, just before leaving this
	procedure, if the expression was rewritten, set the
	Original_Node of the rewritten expression to the new copy and
	also set the Expression of the associated static expression
	function to designate that copy. This ensures that later copies
	of the expression made via New_Copy_Tree will fully copy all
	nodes of the expression tree.
	* inline.ads (Inline_Static_Expression_Function_Call): New
	procedure to evaluate and produce the result of a static call to
	a static expression function.
	* inline.adb: Add with and use for Sem_Res.
	(Establish_Actual_Mapping_For_Inlined_Call): New procedure
	extracted from code in Expand_Inlined_Call that traverses the
	actuals and formals of an inlined call and in some cases creates
	temporaries for holding the actuals, plus establishes an
	association between formals and actuals (via the Renamed_Object
	fields of the formals).
	(Formal_Is_Used_Once): Function removed from Expand_Inlined_Call
	and now nested in the above procedure.
	(Expand_Inlined_Call): Code for doing the formal/actual
	traversal is moved to Create_Actual_Temporaries and replaced
	with a call to that new procedure.
	(Inline_Static_Expression_Function_Call): New procedure to
	evaluate a static call to a static expression function,
	substituting actuals for their corresponding formals and
	producing a fully folded and static result expression. The
	function has subsidiary functions Replace_Formal and Reset_Sloc
	that take care of doing the mapping of formals to actuals and
	resetting the Slocs of subnodes of the mapped expression to that
	of the call so errors will be flagged on the call rather than
	function.
	* sem_ch6.adb (Analyze_Expression_Function): In the case of a
	static expression function, perform an additional preanalysis of
	the function's expression to ensure that it's a potentially
	static expression (according to the requirements of
	6.8(3.2/5-3.4/5)), and issue an error if it's not. The global
	flag Checking_Potentially_Static_Expression is set and unset
	around this checking.
	* sem_ch13.adb (Analyze_Aspect_Static): New procedure to enforce
	selected requirements of the new aspect Static on expression
	functions, including checking that the language version is
	Ada_2020 and that the entity to which it applies is an
	expression function whose formal parameters are of a static
	subtype and have mode 'in', its result subtype is a static
	subtype, and it has no pre- or postcondition aspects. A ???
	comment is added to indicate the need for adding checking that
	type invariants don't apply to the result type if the function
	is a boundary entity.
	(Analyze_One_Aspect): Call Analyze_Aspect_Static for aspect
	Static.
	* sem_elab.adb (Build_Call_Marker): Return without creating a
	call marker when the subprogram is a static expression function,
	since no ABE checking is needed for such functions.
	* sem_eval.ads (Checking_Potentially_Static_Expression): New
	function to return whether the checking for potentially static
	expressions is enabled.
	(Set_Checking_Potentially_Static_Expression): New procedure to
	enable or disable checking of potentially static expressions.
	* sem_eval.adb (Checking_For_Potentially_Static_Expression): New
	global flag for determining whether preanalysis of potentially
	static expression is being done, which affects the behavior of
	certain static evaluation routines.
	(Checking_Potentially_Static_Expression): New function to return
	whether the checking for potentially static expressions is
	enabled.
	(Eval_Call): When evaluating a call within a static expression
	function with checking of potentially static expression
	functions enabled, substitutes a static value in place of the
	call to allow folding of the expression.
	(Eval_Entity_Name): When evaluating a formal parameter of a
	static expression function with checking of potentially static
	expression functions enabled, substitutes a static value in
	place of the reference to the formal to allow folding of the
	expression.
	(Set_Checking_Potentially_Static_Expression): New procedure to
	enable or disable checking of potentially static expressions.
	* sem_res.adb (Resolve_Call): Test for a recursive call
	occurring within a static expression function and issue an error
	for such a call. Prevent the establishment of a transient scope
	in the case this is a call to a (string-returning) static
	expression function. When calling a static expression function,
	if no error has been posted on the function, call
	Inline_Static_Expression_Function_Call to convert the call into
	its equivalent static value.
	* sem_util.ads (Is_Static_Expression_Function): New function
	returning whether the subprogram entity passed to it is a static
	expression function.
	(Is_Static_Expression_Function_Call): New function to determine
	whether the call node passed to it is a static call to a static
	expression function.
	* sem_util.adb (Compile_Time_Constraint_Error): Suppress
	compile-time Constraint_Error reporting when checking for a
	potentially static expression.
	(Is_Static_Expression_Function): New function returning whether
	the subprogram entity passed to it is a static expression
	function by testing for the presence of aspect Static.
	(Has_All_Static_Actuals): New function in
	Is_Static_Expression_Function_Call that traverses the actual
	parameters of a function call and returns True only when all of
	the actuals are given by static expressions. In the case of a
	string-returning function, we call Resolve on each actual to
	ensure that their Is_Static_Expression flag properly reflects
	whether they're static, to allow suppressing creation of a
	transient scope within Resolve_Call. A prominent ??? comment is
	added to explain this rather unconventional call to Resolve.
	(Is_Static_Expression_Function_Call): New function that
	determines whether a node passed to it is a call to a static
	expression function all of whose actual parameters are given by
	static expressions.
2020-06-17 04:14:06 -04:00
Eric Botcazou
22b5aff279 [Ada] Deal with second specific superflat case in Optimize_Length_Comparison
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Optimize_Length_Comparison): New local variable to
	record whether this may be a dynamic superflat case.
	(Is_Optimizable): Accept 0 as lower bound and set it in this case,
	but return false if the operand is not a length too.
	(Rewrite_For_Equal_Lengths): New procedure.
	Optimize the comparison of two lengths in the superflat case when
	the arrays have the same bounds.
2020-06-17 04:14:05 -04:00
Eric Botcazou
741826eff5 [Ada] Adjust documentation of 'Bit and 'Descriptor_Size attributes
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* doc/gnat_rm/implementation_defined_attributes.rst (Bit): Sharpen
	the comparison with System.Storage_Unit.
	(Descriptor_Size): Clear confusion about alignment and padding.
	* gnat_rm.texi: Regenerate.
2020-06-17 04:14:04 -04:00
Eric Botcazou
d27ec3f60a [Ada] Work around problematic interaction with public symbol generation
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_First>:
	Do not replace the bound for an array type if it is public.
2020-06-17 04:14:03 -04:00
Eric Botcazou
940eb45810 [Ada] Fix small oversight in change to Optimize_Length_Comparison
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Optimize_Length_Comparison): Make sure the base
	types are the same when comparing Y'Last and X'Last directly.
2020-06-17 04:14:02 -04:00
Eric Botcazou
ac8806c4c5 [Ada] Optimize length checks generated for slice assignments
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_First>:
	Replace it with a direct reference to an entity which is not a
	discriminant for constrained array types.  Add same condition
	for scalar types.
	<Attribute_Last>: Merge with above implementation.
	* exp_ch4.adb (Optimize_Length_Comparison): Be prepared for a
	second entity whose length is compared.  Rename Prepare_64 to
	Convert_To_Long_Long_Integer.  If the second entity is present,
	compute the difference of the 'First attributes and compare the
	sum of 'Last of the second entity with this difference against
	'Last of the first entity.  Add a special case when the 'First
	attributes are equal.  Suppress overflow checks in all cases.
2020-06-17 04:14:02 -04:00
Piotr Trojanek
137adce390 [Ada] Fix casing from GNATProve to GNATprove
2020-06-17  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* doc/gnat_rm/implementation_defined_pragmas.rst, lib-writ.ads,
	par-prag.adb, sem_ch12.adb, sem_ch8.adb, sem_prag.adb: Fix
	casing of GNATprove.
	* gnat_rm.texi: Regenerate.
2020-06-17 04:14:01 -04:00
Piotr Trojanek
4ffefb704a [Ada] Remove unnecessary special-casing of GNATprove expansion
2020-06-17  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* checks.adb (Generate_Range_Check): Simplify redundant
	condition.
	* sem_ch3.adb (Check_Initialization, Process_Discriminants):
	Likewise.
	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Likewise.
2020-06-17 04:14:00 -04:00
Eric Botcazou
e9c85394fb [Ada] Fix small fallout of change for 'Pos and 'Val attributes
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_fixd.adb (Build_Conversion): Also preserve the
	Conversion_OK flag of an inner conversion.
2020-06-17 04:13:59 -04:00
Piotr Trojanek
6be763897b [Ada] Fix expansion of "for X of Y loop" in GNATprove
2020-06-17  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_ch5.adb (Analyze_Iterator_Specification): Enable expansion
	that creates a renaming that removes side effects from the
	iterated object in the GNATprove mode; then analyze reference to
	this renaming (it is required for GNATprove and harmless for
	GNAT).
2020-06-17 04:13:58 -04:00
liuhongt
c7199fb6e6 Optimize V16QI/V32QI/V64QI shift by constant.
gcc/ChangeLog:
	PR target/95524
	* config/i386/i386-expand.c
	(ix86_expand_vec_shift_qihi_constant): New function.
	* config/i386/i386-protos.h
	(ix86_expand_vec_shift_qihi_constant): Declare.
	* config/i386/sse.md (<shift_insn><mode>3): Optimize shift
	V*QImode by constant.

gcc/testsuite/ChangeLog:
	* gcc.target/i386/avx2-shiftqihi-constant-1.c: New test.
	* gcc.target/i386/avx2-shiftqihi-constant-2.c: Ditto.
	* gcc.target/i386/avx512bw-shiftqihi-constant-1.c: Ditto.
	* gcc.target/i386/avx512bw-shiftqihi-constant-2.c: Ditto.
	* gcc.target/i386/sse2-shiftqihi-constant-1.c: Ditto.
	* gcc.target/i386/sse2-shiftqihi-constant-2.c: Ditto.
2020-06-17 16:03:26 +08:00
Martin Liska
5fc312a98e
gcov: fix gcov-tool merge for TOPN counters
libgcc/ChangeLog:

	* libgcov-util.c (read_gcda_finalize): Remove const operator.
	(merge_wrapper): Add both counts and use them properly.
	(topn_to_memory_representation): New function.
	(gcov_merge): Covert on disk representation to in memory
	representation.
	* libgcov.h: Remove const operator.
2020-06-17 08:32:27 +02:00
GCC Administrator
56638b9b18 Daily bump. 2020-06-17 00:16:36 +00:00
Jonathan Wakely
d4b0f996fc middle-end: Add another testcase for PR 95493
This was reported on the gcc-help mailing list. The regression started
with r10-589 and was fixed by r11-963.

gcc/testsuite/ChangeLog:

	* g++.dg/torture/pr95493-1.C: New test.
2020-06-16 23:14:54 +01:00
Iain Buclaw
3a0ddf7930 d: Remove names of unused function parameters.
gcc/d/ChangeLog:

	* d-attribs.cc (handle_noreturn_attribute): Remove names of unused
	function parameters.
	(handle_leaf_attribute): Likewise.
	(handle_const_attribute): Likewise.
	(handle_malloc_attribute): Likewise.
	(handle_pure_attribute): Likewise.
	(handle_novops_attribute): Likewise.
	(handle_nonnull_attribute): Likewise.
	(handle_nothrow_attribute): Likewise.
	(handle_type_generic_attribute): Likewise.
	(handle_transaction_pure_attribute): Likewise.
	(handle_returns_twice_attribute): Likewise.
	(handle_fnspec_attribute): Likewise.
	(handle_always_inline_attribute): Likewise.
	(d_handle_noinline_attribute): Likewise.
	(d_handle_forceinline_attribute): Likewise.
	(d_handle_flatten_attribute): Likewise.
	(d_handle_noclone_attribute): Likewise.
	(d_handle_section_attribute): Likewise.
	(d_handle_alias_attribute): Likewise.
	(d_handle_weak_attribute): Likewise.
2020-06-16 23:39:47 +02:00
Iain Buclaw
af3c19f0a5 d: Update code formatting in a consistent style.
gcc/d/ChangeLog:

	* d-attribs.cc: Update code formatting in a consistant style.
	* d-builtins.cc: Likewise.
	* d-codegen.cc: Likewise.
	* d-compiler.cc: Likewise.
	* d-convert.cc: Likewise.
	* d-diagnostic.cc: Likewise.
	* d-frontend.cc: Likewise.
	* d-lang.cc: Likewise.
	* d-longdouble.cc: Likewise.
	* d-port.cc: Likewise.
	* d-spec.cc: Likewise.
	* d-tree.h: Likewise.
	* decl.cc: Likewise.
	* expr.cc: Likewise.
	* longdouble.h: Likewise.
	* modules.cc: Likewise.
	* toir.cc: Likewise.
	* typeinfo.cc: Likewise.
2020-06-16 23:39:23 +02:00
Iain Buclaw
cdbf48bed4 d: Consistently format quotations in comments.
gcc/d/ChangeLog:

	* d-builtins.cc: Update quotation formatting of comments.
	* d-codegen.cc: Likewise.
	* d-lang.cc: Likewise.
	* decl.cc: Likewise.
	* expr.cc: Likewise.
	* imports.cc: Likewise.
	* runtime.cc: Likewise.
	* toir.cc: Likewise.
	* typeinfo.cc: Likewise.
	* types.cc: Likewise.
2020-06-16 23:37:55 +02:00
Iain Buclaw
a23b6d61bc d: Remove dependency on front-end OutBuffer for diagnostic and deps file generation.
gcc/d/ChangeLog:

	* d-diagnostic.cc (expand_d_format): Replace OutBuffer with obstack.
	(d_diagnostic_report_diagnostic): Don't free xformat.
	* d-lang.cc (struct d_option_data): Change deps_target type from
	OutBuffer to vec <const char *>.
	(deps_add_target): Update to push each target to deps_target.
	(deps_write_string): New function.
	(deps_write): Change buffer type to obstack* and remove colmax.
	(d_init_options): Update initialization of deps_target.
	(d_parse_file): Replace OutBuffer with obstack.
2020-06-16 23:37:33 +02:00
Iain Buclaw
0a98123c7a d: Remove dependency on front-end File type for json and deps file generation.
gcc/d/ChangeLog:

	* d-lang.cc (d_parse_file): Replace uses of File with FILE.
2020-06-16 23:36:29 +02:00
Iain Buclaw
f267a31098 d: Move generation of array bounds error to own function.
gcc/d/ChangeLog:

	* d-codegen.cc (build_array_bounds_call): New function.
	(build_bounds_condition): Use build_array_bounds_call.
	* d-lang.cc (d_init_options): Explicitly set default check action to
	CHECKACTION_D.
	(d_post_options): Set check action to CHECKACTION_C if the flag
	-fno-druntime was seen.
	* d-tree.h (build_array_bounds_call): Declare.
	* expr.cc (ExprVisitor::visit (AssertExp *)): Use
	build_array_bounds_call.
2020-06-16 23:35:34 +02:00
Jonathan Wakely
e40b11a91c libstdc++: Strip cv-qualifiers in std::atomic<FP> (PR 95282)
This improves the previous fix for PR 95282, and extends it to also
apply to the exchange function (which has a similar problem and would
become ill-formed with my proposed fix for PR 95378).

	PR libstdc++/95282
	* include/bits/atomic_base.h (__atomic_impl::load): Use the _Val
	alias instead of deducing _Tp as an unqualified type.
	(__atomic_impl::exchange): Use the _Val alias to remove volatile
	from the reinterpret_cast result type.
2020-06-16 22:34:55 +01:00
Jonathan Wakely
cc799df98f libstdc++: Enforce copyable/movable checks in std::atomic
C++20 adds some new preconditions to std::atomic, which weren't
previously checked by our implementation.

	* include/std/atomic (atomic): Add static assertions.
	* testsuite/29_atomics/atomic/requirements/types_neg.cc: New test.
2020-06-16 22:34:55 +01:00
Iain Buclaw
15cf136abe d: Use toStringExp instead of explicit cast
gcc/d/ChangeLog:

	* d-attribs.cc (build_attributes): Use toStringExp instead of cast.
	* toir.cc (IRVisitor::visit): Likewise.
2020-06-16 23:34:20 +02:00
Iain Buclaw
d873350a9c d: Use new isXxxxExp helpers where possible
gcc/d/ChangeLog:

	* d-attribs.cc (build_attributes): Use isXxxxExp helpers instead of
	explicit casts.
	* d-codegen.cc (d_build_call): Likewise.
	* d-compiler.cc (Compiler::paintAsType): Likewise.
	* decl.cc (ExprVisitor::visit): Likewise.
	(layout_class_initializer): Likewise.
	* expr.cc (ExprVisitor::lvalue_p): Likewise
	(ExprVisitor::visit): Likewise.
	* types.cc (layout_aggregate_members): Likewise.
2020-06-16 23:33:58 +02:00
Iain Buclaw
6c4db916e2 d: Use toTypeFunction instead of explicit cast
gcc/d/ChangeLog:

	* d-frontend.cc (eval_builtin): Use toTypeFunction instead of cast.
	* decl.cc (DeclVisitor::visit): Likewise.
	* toir.cc (IRVisitor::visit): Likewise.
	* typeinfo.cc (TypeInfoVisitor::visit): Likewise.
2020-06-16 23:33:26 +02:00
Iain Buclaw
89fdaf5ad8 d: Use new isTypeXxxx helpers where possible.
gcc/d/ChangeLog:

	* d-builtins.cc (d_eval_constant_expression): Use isTypeXxxx helpers
	instead of explicit casts.
	(d_build_builtins_module): Likewise.
	* d-codegen.cc (get_array_length): Likewise.
	(identity_compare_p): Likewise.
	(lower_struct_comparison): Likewise.
	(build_array_from_val): Likewise.
	(array_bounds_check): Likewise.
	(get_function_type): Likewise.
	(d_build_call): Likewise.
	* d-compiler.cc (Compiler::paintAsType): Likewise.
	* d-convert.cc (convert_expr): Likewise.
	(convert_for_assignment): Likewise.
	* d-lang.cc (d_classify_record): Likewise.
	(d_build_eh_runtime_type): Likewise.
	* decl.cc (DeclVisitor::visit): Likewise.
	* expr.cc (ExprVisitor::needs_postblit): Likewise.
	(ExprVisitor::needs_dtor): Likewise.
	(ExprVisitor::visit): Likewise.
	* imports.cc (ImportVisitor::visit): Likewise.
	* typeinfo.cc (get_typeinfo_kind): Likewise.
	(TypeInfoVisitor::visit): Likewise.
	(TypeDeclInfoVisitor::visit): Likewise.
	* types.cc (merge_aggregate_types): Likewise.
	(TypeVisitor::visit): Likewise.
2020-06-16 23:31:24 +02:00
Aldy Hernandez
8fb4d1d583 Fix pasto in the substitute_and_fold_engine merge with evrp.
The original code only propagated into PHI arguments if the value was
a constant.  This behavior was lost in the conversion, allowing
any value (SSAs for instance) to be propagated into PHIs.

gcc/ChangeLog:

	PR tree-optimization/95649
	* tree-ssa-propagate.c (propagate_into_phi_args): Do not propagate unless
	value is a constant.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/pr95649.C: New test.
	* gcc.dg/tree-ssa/pr95649.c: New test.
2020-06-16 20:46:42 +02:00
Tobias Burnus
12df77ab6d OpenACC/Fortran: permit 'routine' inside PURE
gcc/fortran/ChangeLog

	* parse.c (decode_oacc_directive): Permit 'acc routine' also
	inside pure procedures.
	* openmp.c (gfc_match_oacc_routine): Inside pure procedures
	do not permit gang, worker or vector clauses.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-fortran/routine-10.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/goacc/pure-elemental-procedures-2.f90: New test.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
2020-06-16 20:23:58 +02:00
Tobias Burnus
244ed2adaa OpenMP/Fortran: Permit impure ELEMENTAL in omp directives
OpenMP since 4.5 permits IMPURE ELEMENTAL in directives and
the code already only checked for PURE. – Followup for
-fopenmp-simd.

gcc/fortran/ChangeLog:

	* parse.c (decode_omp_directive): Remove "or ELEMENTAL"
	from "in PURE" error message also for -fopenmp-simd.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/pr79154-simd.f90: New test.
2020-06-16 20:17:20 +02:00
Marek Polacek
04afaf4575 c++: Don't allow designated initializers with non-aggregates [PR95369]
Another part of 95369 is that we accept designated initializers with
non-aggregate types.  That seems to be wrong since they're part of
aggregate initialization.  clang/icc also reject it.

There are multiple contexts where we can use designated initializers:
function-like casts, member list initializers, NTTP, etc.  I've adjusted
add_list_candidates and implicit_conversion_error in order to to detect
this case.

gcc/cp/ChangeLog:

	PR c++/95369
	* call.c (add_list_candidates): Return if a designated initializer
	is used with a non-aggregate.
	(implicit_conversion_error): Give an error for the case above.

gcc/testsuite/ChangeLog:

	PR c++/95369
	* g++.dg/cpp2a/desig11.C: Adjust dg-error.
	* g++.dg/cpp2a/desig16.C: New test.
2020-06-16 13:19:44 -04:00
Marek Polacek
2661635323 c++: Fix ICE in check_local_shadow with enum [PR95560]
Another indication that perhaps this warning is emitted too early.  We
crash because same_type_p gets a null type: we have an enumerator
without a fixed underlying type and finish_enum_value_list hasn't yet
run.  So check if the type is null before calling same_type_p.

	PR c++/95560
	* name-lookup.c (check_local_shadow): Check if types are
	non-null before calling same_type_p.

	* g++.dg/warn/Wshadow-local-3.C: New test.
2020-06-16 13:08:57 -04:00
Jakub Jelinek
43a9b25c17 testsuite: Make sure the *san/inline* tests aren't UNRESOLVED with LTO
These tests are UNRESOLVED because -fdump-tree-optimized can't be scanned
with slim LTO.  Other *san/ tests deal with this by adding -ffat-lto-objects.

2020-06-16  Jakub Jelinek  <jakub@redhat.com>

	* c-c++-common/asan/inline.c: Add -ffat-lto-objects to dg-options.
	* c-c++-common/asan/inline-kernel.c: Likewise.
	* c-c++-common/ubsan/inline.c: Likewise.
2020-06-16 18:19:44 +02:00
Stefan Schulze Frielinghaus
929fd91ba9 S/390: Emit vector alignment hints for z13 if AS accepts them
Since 87cb9423ad vector alignment hints are emitted for target z13,
too.  This patch changes this behaviour in the sense that alignment
hints are only emitted for target z13 if the assembler accepts them.

gcc/ChangeLog:

	* config.in: Regenerate.
	* config/s390/s390.c (print_operand): Emit vector alignment hints
	for target z13, if AS accepts them.  For other targets the logic
	stays the same.
	* config/s390/s390.h (TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS): Define
	macro.
	* configure: Regenerate.
	* configure.ac: Check HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13.
2020-06-16 17:30:28 +02:00
Srinath Parvathaneni
dc39db8736 [PATCH][GCC] arm: Fix the MVE ACLE vaddq_m polymorphic variants.
Hello,

This patch fixes the MVE ACLE vaddq_m polymorphic variants by modifying the corresponding
intrinsic parameters and vaddq_m polymorphic variant's _Generic case entries in "arm_mve.h"
header file.

2020-06-04  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

gcc/
	* config/arm/arm_mve.h (__arm_vaddq_m_n_s8): Correct the intrinsic
	arguments.
	(__arm_vaddq_m_n_s32): Likewise.
	(__arm_vaddq_m_n_s16): Likewise.
	(__arm_vaddq_m_n_u8): Likewise.
	(__arm_vaddq_m_n_u32): Likewise.
	(__arm_vaddq_m_n_u16): Likewise.
	(__arm_vaddq_m): Modify polymorphic variant.

gcc/testsuite/
	* gcc.target/arm/mve/intrinsics/mve_vaddq_m.c: New test.
2020-06-16 15:59:11 +01:00
Srinath Parvathaneni
6af598703f [PATCH][GCC] arm: Fix MVE scalar shift intrinsics code-gen.
This patch modifies the MVE scalar shift RTL patterns. The current patterns
have wrong constraints and predicates due to which the values returned from
MVE scalar shift instructions are overwritten in the code-gen.

example:
$ cat x.c
int32_t  foo(int64_t acc, int shift)
{
  return sqrshrl_sat48 (acc, shift);
}

Code-gen before applying this patch:
$ arm-none-eabi-gcc -march=armv8.1-m.main+mve -mfloat-abi=hard -O2 -S
$  cat x.s
foo:
   push    {r4, r5}
   sqrshrl r0, r1, #48, r2   ----> (a)
   mov     r0, r4  ----> (b)
   pop     {r4, r5}
   bx      lr

Code-gen after applying this patch:
foo:
   sqrshrl r0, r1, #48, r2
   bx      lr

In the current compiler the return value (r0) from sqrshrl (a) is getting
overwritten by the mov statement (b).
This patch fixes above issue.

2020-06-12  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

gcc/
	* config/arm/mve.md (mve_uqrshll_sat<supf>_di): Correct the predicate
	and constraint of all the operands.
	(mve_sqrshrl_sat<supf>_di): Likewise.
	(mve_uqrshl_si): Likewise.
	(mve_sqrshr_si): Likewise.
	(mve_uqshll_di): Likewise.
	(mve_urshrl_di): Likewise.
	(mve_uqshl_si): Likewise.
	(mve_urshr_si): Likewise.
	(mve_sqshl_si): Likewise.
	(mve_srshr_si): Likewise.
	(mve_srshrl_di): Likewise.
	(mve_sqshll_di): Likewise.
	* config/arm/predicates.md (arm_low_register_operand): Define.

gcc/testsuite/
	* gcc.target/arm/mve/intrinsics/mve_scalar_shifts1.c: New test.
	* gcc.target/arm/mve/intrinsics/mve_scalar_shifts2.c: Likewise.
	* gcc.target/arm/mve/intrinsics/mve_scalar_shifts3.c: Likewise.
	* gcc.target/arm/mve/intrinsics/mve_scalar_shifts4.c: Likewise.
2020-06-16 15:56:16 +01:00
Jakub Jelinek
1160ec9a14 openmp: Initial part of OpenMP 5.0 non-rectangular loop support
OpenMP 5.0 adds support for non-rectangular loop collapses, e.g.
triangular and more complex.

This patch deals just with the diagnostics so that they aren't rejected
immediately as before.  As the spec generally requires as before that the
iteration variable initializer and bound in the comparison as invariant
vs. the outermost loop, and just add some exceptional forms that can violate
that, we need to avoid folding the expressions until we can detect them and
in order to avoid folding it later on, I chose to use a TREE_VEC in those
expressions to hold the var_outer * expr1 + expr2 triplet, the patch adds
pretty-printing of that, gimplification etc. and just sorry_at during
omp expansion for now.

The next step will be to implement the different cases of that one by one.

2020-06-16  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree.h (OMP_FOR_NON_RECTANGULAR): Define.
	* gimplify.c (gimplify_omp_for): Diagnose schedule, ordered
	or dist_schedule clause on non-rectangular loops.  Handle
	gimplification of non-rectangular lb/b expressions.  When changing
	iteration variable, adjust also non-rectangular lb/b expressions
	referencing that.
	* omp-general.h (struct omp_for_data_loop): Add m1, m2 and outer
	members.
	(struct omp_for_data): Add non_rect member.
	* omp-general.c (omp_extract_for_data): Handle non-rectangular
	loops.  Fill in non_rect, m1, m2 and outer.
	* omp-low.c (lower_omp_for): Handle non-rectangular lb/b expressions.
	* omp-expand.c (expand_omp_for): Emit sorry_at for unsupported
	non-rectangular loop cases and assert for cases that can't be
	non-rectangular.
	* tree-pretty-print.c (dump_mem_ref): Formatting fix.
	(dump_omp_loop_non_rect_expr): New function.
	(dump_generic_node): Handle non-rectangular OpenMP loops.
	* tree-pretty-print.h (dump_omp_loop_non_rect_expr): Declare.
	* gimple-pretty-print.c (dump_gimple_omp_for): Handle non-rectangular
	OpenMP loops.
gcc/c-family/
	* c-common.h (c_omp_check_loop_iv_exprs): Add an int argument.
	* c-omp.c (struct c_omp_check_loop_iv_data): Add maybe_nonrect and
	idx members.
	(c_omp_is_loop_iterator): New function.
	(c_omp_check_loop_iv_r): Use it.  Add support for silent scanning
	if outer loop iterator is present.  Perform duplicate checking through
	hash_set in the function rather than expecting caller to do that.
	Pass NULL instead of d->ppset to walk_tree_1.
	(c_omp_check_nonrect_loop_iv): New function.
	(c_omp_check_loop_iv): Use it.  Fill in new members, allow
	non-rectangular loop forms, diagnose multiple associated loops with
	the same iterator.  Pass NULL instead of &pset to walk_tree_1.
	(c_omp_check_loop_iv_exprs): Likewise.
gcc/c/
	* c-parser.c (c_parser_expr_no_commas): Save, clear and restore
	c_in_omp_for.
	(c_parser_omp_for_loop): Set c_in_omp_for around some calls to avoid
	premature c_fully_fold.  Defer explicit c_fully_fold calls to after
	c_finish_omp_for.
	* c-tree.h (c_in_omp_for): Declare.
	* c-typeck.c (c_in_omp_for): Define.
	(build_modify_expr): Avoid c_fully_fold if c_in_omp_for.
	(digest_init): Likewise.
	(build_binary_op): Likewise.
gcc/cp/
	* semantics.c (handle_omp_for_class_iterator): Adjust
	c_omp_check_loop_iv_exprs caller.
	(finish_omp_for): Likewise.  Don't call fold_build_cleanup_point_expr
	before calling c_finish_omp_for and c_omp_check_loop_iv, move it
	after those calls.
	* pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
gcc/testsuite/
	* c-c++-common/gomp/loop-6.c: New test.
	* gcc.dg/gomp/loop-1.c: Don't expect diagnostics on valid
	non-rectangular loops.
	* gcc.dg/gomp/loop-2.c: New test.
	* g++.dg/gomp/loop-1.C: Don't expect diagnostics on valid
	non-rectangular loops.
	* g++.dg/gomp/loop-2.C: Likewise.
	* g++.dg/gomp/loop-5.C: New test.
	* g++.dg/gomp/loop-6.C: New test.
2020-06-16 16:31:13 +02:00
Jakub Jelinek
fab46c5df7 openmp: Diagnose invalid OpenMP schedule(simd, static)
2020-06-16  Jakub Jelinek  <jakub@redhat.com>

gcc/c/
	* c-parser.c (c_parser_omp_clause_schedule): Reject modifier separated
	from kind by comma rather than colon.
gcc/cp/
	* parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
	from kind by comma rather than colon.
gcc/testsuite/
	* c-c++-common/gomp/schedule-modifiers-2.c: New test.
2020-06-16 16:30:05 +02:00
Tobias Burnus
e70fbee1a3 testsuite: Add offloading_enabled check and use it for xfail (PR95622)
gcc/testsuite/ChangeLog:

	PR middle-end/95622
	* lib/target-supports.exp (check_effective_target_offloading_enabled):
	New.
	* c-c++-common/goacc/kernels-alias-ipa-pta-2.c: Use it for xfail.
	* c-c++-common/goacc/kernels-alias-ipa-pta-4.c: Likewise.
	* c-c++-common/goacc/kernels-alias-ipa-pta.c: Likewise.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
2020-06-16 15:14:13 +02:00
Tobias Burnus
6a893783f9 OpenMP/Fortran: Permit impure ELEMENTAL in omp directives
OpenMP since 4.5 permits IMPURE ELEMENTAL in directives and
the code already only checked for PURE.

gcc/fortran/ChangeLog:

	* parse.c (decode_omp_directive): Remove "or ELEMENTAL"
	from "in PURE" error message.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/pr79154-1.f90: Update dg-*;
	add an impure elemental example.
	* gfortran.dg/gomp/pr79154-2.f90: Likewise.
2020-06-16 15:11:12 +02:00
Eric Botcazou
f193b29e42 [Ada] Expand 'Pos and 'Val for enumeration types with standard representation
2020-06-16  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sinfo.ads (Conversion_OK): Document use for 'Pos and 'Val.
	* exp_attr.adb (Get_Integer_Type): New function returning a
	small integer type appropriate for an enumeration type.
	(Expand_N_Attribute_Reference) <Attribute_Enum_Rep>: Call it.
	<Attribute_Pos>: For an enumeration type with a standard
	representation, expand to a conversion with Conversion_OK.
	<Attribute_Val>: Likewise.
	* exp_ch4.adb (Expand_N_Type_Conversion): Do not expand when
	the target is an enumeration type and Conversion_OK is set.
2020-06-16 09:07:18 -04:00
Eric Botcazou
dad94b3aca [Ada] Fix spurious error on derived private type with predicate
2020-06-16  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch4.adb (Common_Type): Go to Underlying_Full_View, if any.
2020-06-16 09:07:18 -04:00
Richard Kenner
eb6dc6f301 [Ada] Change how we detect internal protected subprograms
2020-06-16  Richard Kenner  <kenner@adacore.com>

gcc/ada/

	* exp_unst.adb (Subp_Index): Change way we detect internal
	protected subprograms.
2020-06-16 09:07:18 -04:00
Richard Kenner
27e64b8451 [Ada] Improve bug box customer language
2020-06-16  Richard Kenner  <kenner@adacore.com>

gcc/ada/

	* comperr.adb (Compiler_Abort): Clarify message displayed to
	customers.
2020-06-16 09:07:18 -04:00
Piotr Trojanek
e8bb6ff959 [Ada] Minor casing of " The " after a comma in docs and comments
2020-06-16  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* checks.adb, doc/gnat_ugn/the_gnat_compilation_model.rst,
	einfo.ads, exp_ch5.adb, exp_ch7.adb, lib-xref.ads,
	libgnat/g-spitbo.ads, make.adb, sem_aux.adb, sem_ch3.adb,
	sem_ch4.adb, sem_ch5.adb, urealp.adb: Fix wrong casing.
	* gnat_ugn.texi: Regenerate.
2020-06-16 09:07:17 -04:00
Piotr Trojanek
a1447c2a84 [Ada] Reuse Is_Object where possible
2020-06-16  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* einfo.adb, exp_spark.adb, exp_util.adb, sem_eval.adb: Replace
	"Ekind ... in Object_Kind" with "Is_Object (...)".
2020-06-16 09:07:17 -04:00
Piotr Trojanek
96bd3460c9 [Ada] Fix typo in comment about overlapping actuals
2020-06-16  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Fix typo in
	comment.
2020-06-16 09:07:17 -04:00
Piotr Trojanek
1a3680ffe3 [Ada] Force evaluation of qualified aggregates
2020-06-16  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* exp_util.adb (Evaluate_Name): Force evaluation of aggregates;
	recursively evaluate expression of a qualified expression; fix
	location of the comment for an attribute referenced and an
	indexed component.
2020-06-16 09:07:17 -04:00
Eric Botcazou
9d2e727e9a [Ada] Couple of formatting and stylistic fixes
2020-06-16  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* freeze.adb (Freeze_Expression): Use consistent style and
	formatting in a couple of cases.
2020-06-16 09:07:16 -04:00
Steve Baird
0951b918ca [Ada] Enable literal aspect specifications in Big_Numbers specs
2020-06-16  Steve Baird  <baird@adacore.com>

gcc/ada/

	* libgnat/a-nbnbin.ads, libgnat/a-nbnbre.ads: Uncomment the
	commented-out Integer_Literal aspect specification for type
	Big_Integer.
2020-06-16 09:07:16 -04:00
Javier Miranda
82af729163 [Ada] Crash in tagged type constructor with task components
2020-06-16  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_ch6.adb (BIP_Suffix_Kind, Check_BIP_Actuals,
	Is_Build_In_Place_Entity): New subprograms.
	(Make_Build_In_Place_Call_In_Allocator,
	Make_Build_In_Place_Call_In_Anonymous_Context,
	Make_Build_In_Place_Call_In_Assignment,
	Make_Build_In_Place_Call_In_Object_Declaration): Add assertions.
	(Needs_BIP_Task_Actuals): Add missing support for thunks.
	(Expand_Actuals): Ensure that the BIP call has available an
	activation chain and the _master variable.
	* exp_ch9.adb (Find_Enclosing_Context): Initialize the list of
	declarations of empty blocks when the _master variable must be
	declared and the list was not available.
2020-06-16 09:07:16 -04:00