Gary Dismukes [Mon, 3 May 2021 05:56:38 +0000 (01:56 -0400)]
[Ada] Support for Object.Op subprogram-call notation for untagged types
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst: Add a
description of the feature of prefixed-view calls for untagged
types to the section on pragma Extensions_Allowed.
* gnat_rm.texi: Regenerate.
* einfo.ads: Update specification for
Direct_Primitive_Operations to reflect its use for untagged
types when Extensions_Allowed is True.
* gen_il-gen-gen_entities.adb: Allow Direct_Primitive_Operations
as a field of untagged classes of types by removing the "Pre"
test of "Is_Tagged_Type (N)", and making that field generally
available for all types and subtypes by defining it for
Type_Kind and removing its specification for individual classes
of types.
* sem_ch3.adb (Analyze_Full_Type_Declaration): Initialize the
Direct_Primitive_Operations list when not already set for the
new (sub)type and its base type (except when Ekind of the type
is E_Void, which can happen due to errors in cases where
Derived_Type_Declaration is called and perhaps in other
situations).
(Analyze_Subtype_Declaration): Inherit
Direct_Primitive_Operations list from the base type, for record
and private cases.
(Build_Derived_Record_Type): Initialize the
Direct_Primitive_Operations list for derived record and private
types.
(Build_Derived_Type): Initialize the Direct_Primitive_Operations
list for derived types (and also for their associated base types
when needed).
(Process_Full_View): For full types that are untagged record and
private types, copy the primitive operations of the partial view
to the primitives list of the full view.
* sem_ch4.adb (Analyze_Selected_Component): Allow prefixed
notation for subprogram calls in the case of untagged
types (when Extensions_Allowed is True). In the case where
Is_Private_Type (Prefix_Type) is True, call Try_Object_Operation
when a discriminant selector wasn't found. Also call
Try_Object_Operation in other type kind cases (when
Extensions_Allowed is True).
(Try_Object_Operation.Try_One_Prefixed_Interpretation): Prevent
early return in the untagged case (when Extensions_Allowed is
True). Condition main call to Try_Primitive_Operation on the
type having primitives, and after that, if Prim_Result is False,
test for case where the prefix type is a named access type with
primitive operations and in that case call
Try_Primitive_Operation after temporarily resetting Obj_Type to
denote the access type (and restore it to the designated type
after the call)
(Try_Object_Operation.Valid_First_Argument_Of): Do matching type
comparison by testing Base_Type (Obj_Type) against
Base_Type (Typ), rather than against just Typ, to properly
handle cases where the object prefix has a constrained
subtype. (Fixes a bug discovered while working on this
feature.)
* sem_ch6.adb
(New_Overloaded_Entity.Check_For_Primitive_Subprogram): Add a
primitive of an untagged type to the type's list of primitive
operations, for both explicit and implicit (derived, so
Comes_From_Source is False) subprogram declarations. In the case
where the new primitive overrides an inherited subprogram,
locate the primitives Elist that references the overridden
subprogram, and replace that element of the list with the new
subprogram (done by calling the new procedure
Add_Or_Replace_Untagged_Primitive on the result type and each
formal atype).
(Check_For_Primitive_Subprogram.Add_Or_Replace_Untagged_Primitive):
New nested procedure to either add or replace an untagged
primitive subprogram in a given type's list of primitive
operations (replacement happens in case where the new subprogram
overrides a primitive of the type).
* sem_ch7.adb (New_Private_Type): When Extensions_Allowed is
True, initialize the Direct_Primitive_Operations list of a
private type to New_Elmt_List in the case of untagged types.
* sem_ch8.adb (Find_Selected_Component): In the case where the
prefix is an entity name, relax condition that tests
Has_Components so that Analyze_Selected_Component will also be
called when Extensions_Allowed is True and the prefix type is
any type.
Ed Schonberg [Sat, 1 May 2021 23:55:36 +0000 (19:55 -0400)]
[Ada] Spurious conformance error on expression function
gcc/ada/
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not perform
conformance check when the subprogram body has been created for
an expression function that is not a completion of a previous
specification, because the profile of the constructed body is
copied from the expression function itself.
Steve Baird [Thu, 29 Apr 2021 22:29:16 +0000 (15:29 -0700)]
[Ada] Add GNAT RM text regarding Ada 2022 default Put_Image implementation
gcc/ada/
* doc/gnat_rm/implementation_of_specific_ada_features.rst: Add a
warning indicating that the details of the default (i.e.,
selected by the compiler) implementation of T'Put_Image for a
nonscalar type T are subject to change.
* gnat_rm.texi: Regenerate.
Iain Sandoe [Sat, 3 Jul 2021 18:47:48 +0000 (19:47 +0100)]
X86: Provide a CTOR for stringop_algs [PR100246].
Several older compilers fail to build modern GCC because of missing
or incomplete C++11 support.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR bootstrap/100246 - [11/12 Regression] GCC will not bootstrap with clang 3.4/3.5 [xcode 5/6, Darwin 12/13]
PR bootstrap/100246
gcc/ChangeLog:
* config/i386/i386.h (struct stringop_algs): Define a CTOR for
this type.
Richard Biener [Mon, 5 Jul 2021 13:51:49 +0000 (15:51 +0200)]
Add FMADDSUB and FMSUBADD SLP vectorization patterns and optabs
This adds named expanders for vec_fmaddsub<mode>4 and
vec_fmsubadd<mode>4 which map to x86 vfmaddsubXXXp{ds} and
vfmsubaddXXXp{ds} instructions. This complements the previous
addition of ADDSUB support.
x86 lacks SUBADD and the negate variants of FMA with mixed
plus minus so I did not add optabs or patterns for those but
it would not be difficult if there's a target that has them.
2021-07-05 Richard Biener <rguenther@suse.de>
* doc/md.texi (vec_fmaddsub<mode>4): Document.
(vec_fmsubadd<mode>4): Likewise.
* optabs.def (vec_fmaddsub$a4): Add.
(vec_fmsubadd$a4): Likewise.
* internal-fn.def (IFN_VEC_FMADDSUB): Add.
(IFN_VEC_FMSUBADD): Likewise.
* tree-vect-slp-patterns.c (addsub_pattern::recognize):
Refactor to handle IFN_VEC_FMADDSUB and IFN_VEC_FMSUBADD.
(addsub_pattern::build): Likewise.
* tree-vect-slp.c (vect_optimize_slp): CFN_VEC_FMADDSUB
and CFN_VEC_FMSUBADD are not transparent for permutes.
* config/i386/sse.md (vec_fmaddsub<mode>4): New expander.
(vec_fmsubadd<mode>4): Likewise.
* gcc.target/i386/vect-fmaddsubXXXpd.c: New testcase.
* gcc.target/i386/vect-fmaddsubXXXps.c: Likewise.
* gcc.target/i386/vect-fmsubaddXXXpd.c: Likewise.
* gcc.target/i386/vect-fmsubaddXXXps.c: Likewise.
Richard Biener [Fri, 2 Jul 2021 11:48:07 +0000 (13:48 +0200)]
add -fmove-loop-stores option to control GIMPLE loop store-motion
This adds the -fmove-loop-stores option, mainly as a way to disable
the store-motion part of GIMPLE invariant motion (-ftree-loop-im)
which is enabled by default. It might be sensible to turn off
-fmove-loop-stores at -O1 since it can result in compile-time
as well as memory usage issues but this patch tries to preserve
existing behavior besides introducing the new option with the
exception of -Og where I've disabled it.
Controlling store-motion has been made easy by earlier refactoring
for the invariant motion only use after loop interchange.
2021-07-02 Richard Biener <rguenther@suse.de>
* doc/invoke.texi (fmove-loop-stores): Document.
* common.opt (fmove-loop-stores): New option.
* opts.c (default_options_table): Enable -fmove-loop-stores
at -O1 but not -Og.
* tree-ssa-loop-im.c (pass_lim::execute): Pass
flag_move_loop_stores instead of true to
loop_invariant_motion_in_fun.
Iain Sandoe [Tue, 6 Jul 2021 08:19:30 +0000 (09:19 +0100)]
Documentation : Describe --with-dsymutil configure option.
This adds documentation for the dsymutil configuration option
introduced with commit r12-2037-g3b5e8ee4f1ec.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* doc/install.texi: Document --with-dsymutil.
Andrew Pinski [Tue, 29 Jun 2021 21:30:34 +0000 (14:30 -0700)]
Fix 101256: Wrong code due to range incorrect from PHI-OPT
So the problem here is that replace_phi_edge_with_variable
will copy range information to a already (not newly) defined
ssa name. This causes wrong code later on.
This fixes the problem by require the new ssa name to
be defined in the same bb as the conditional that is
about to be deleted.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
Changes from v1:
* this is a simplification of what was trying to be done before.
gcc/ChangeLog:
PR tree-optimization/101256
* dbgcnt.def (phiopt_edge_range): New counter.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable):
Check to make sure the new name is defined in the same
bb as the conditional before duplicating range info.
Also add debug counter.
gcc/testsuite/ChangeLog:
PR tree-optimization/101256
* g++.dg/torture/pr101256.C: New test.
Thomas Koenig [Tue, 6 Jul 2021 05:04:09 +0000 (07:04 +0200)]
Do not replace variable op variable in I/O implied DO loop replacement.
This PR came about because index expressions of the form k+k in
implied DO loops in I/O statements were considered for replacement
by array slices.
Fixed by only doing the transformation if the expression is of the
type expr OP contastant.
gcc/fortran/ChangeLog:
PR fortran/100227
* frontend-passes.c (traverse_io_block): Adjust test for
when a variable is eligible for the transformation to
array slice.
gcc/testsuite/ChangeLog:
PR fortran/100227
* gfortran.dg/implied_do_io_7.f90: New test.
Kewen Lin [Tue, 6 Jul 2021 01:54:16 +0000 (20:54 -0500)]
i386: Disable param ira-consider-dup-in-all-alts [PR100328]
With Hongtao's SPEC2017 performance evaluation result here:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573986.html
this new parameter ira-consider-dup-in-all-alts has negative
effects on i386, this patch is to disable it explicitly on
i386.
Bootstrapped & regtested on x86_64-redhat-linux.
gcc/ChangeLog:
PR rtl-optimization/100328
* config/i386/i386-options.c (ix86_option_override_internal):
Set param_ira_consider_dup_in_all_alts to 0.
Kewen Lin [Tue, 6 Jul 2021 01:53:19 +0000 (20:53 -0500)]
ira: Support more matching constraint forms with param [PR100328]
This patch is to make IRA consider matching constraint heavily,
even if there is at least one other alternative with non-NO_REG
register class constraint, it will continue and check matching
constraint in all available alternatives and respect the
matching constraint with preferred register class.
One typical case is destructive FMA style instruction on rs6000.
Without this patch, for the mentioned FMA instruction, IRA won't
respect the matching constraint on VSX_REG since there are some
alternative with FLOAT_REG which doesn't have matching constraint.
It can cause extra register copies since later reload has to make
code to respect the constraint. This patch make IRA respect this
matching constraint on VSX_REG which is the preferred regclass,
but it excludes some cases where for one preferred register class
there can be two or more alternatives, one of them has the
matching constraint, while another doesn't have. It also
considers the possibility of free register copy.
With option Ofast unroll, this patch can help to improve SPEC2017
bmk 508.namd_r +2.42% and 519.lbm_r +2.43% on Power8 while
508.namd_r +3.02% and 519.lbm_r +3.85% on Power9 without any
remarkable degradations. It also improved something on SVE as
testcase changes showed and Richard's confirmation.
Bootstrapped & regtested on powerpc64le-linux-gnu P9,
x86_64-redhat-linux and aarch64-linux-gnu.
gcc/ChangeLog:
PR rtl-optimization/100328
* doc/invoke.texi (ira-consider-dup-in-all-alts): Document new
parameter.
* ira.c (ira_get_dup_out_num): Adjust as parameter
param_ira_consider_dup_in_all_alts.
* params.opt (ira-consider-dup-in-all-alts): New.
* ira-conflicts.c (process_regs_for_copy): Add one parameter
single_input_op_has_cstr_p.
(get_freq_for_shuffle_copy): New function.
(add_insn_allocno_copies): Adjust as single_input_op_has_cstr_p.
* ira-int.h (ira_get_dup_out_num): Add one bool parameter.
gcc/testsuite/ChangeLog:
PR rtl-optimization/100328
* gcc.target/aarch64/sve/acle/asm/div_f16.c: Remove one xfail.
* gcc.target/aarch64/sve/acle/asm/div_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/div_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/divr_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/divr_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/divr_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mad_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mad_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mad_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mla_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mla_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mla_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mls_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mls_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mls_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/msb_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/msb_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/msb_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mulx_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mulx_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mulx_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmad_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmad_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmad_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmla_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmla_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmla_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmls_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmls_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmls_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmsb_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmsb_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/nmsb_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/sub_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/sub_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/sub_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/subr_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/subr_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/subr_f64.c: Likewise.
Indu Bhagat [Tue, 6 Jul 2021 00:28:24 +0000 (17:28 -0700)]
CTF,BTF testsuite: Use -gdwarf-4 for restrict type qualifier [PR101283]
DWARF DIEs do not contain DW_TAG_restrict_type when DWARF version is 2. CTF/BTF
generation feeds off DWARF DIEs, and as such, CTF records of kind
CTF_K_RESTRICT cease to be generated when DWARF version is 2.
This patch fixes the failure of these testcases on Darwin by using an explicit
-gdwarf-4 in the dg-options. This keeps the CTF record generation for restrict
type qualifier tested.
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf
2021-07-05 Indu Bhagat <indu.bhagat@oracle.com>
gcc/testsuite/ChangeLog:
PR debug/101283
* gcc.dg/debug/btf/btf-cvr-quals-1.c: Use -gdwarf-4 on Darwin targets.
* gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise.
GCC Administrator [Tue, 6 Jul 2021 00:16:44 +0000 (00:16 +0000)]
Daily bump.
Jeff Law [Mon, 5 Jul 2021 21:23:43 +0000 (17:23 -0400)]
Remove redundant compare in shift loop on H8
gcc/ChangeLog
* config/h8300/shiftrotate.md (shift-by-variable patterns): Update to
generate condition code aware RTL directly.
Andrew Pinski [Sun, 13 Jun 2021 02:45:20 +0000 (19:45 -0700)]
Port most of the A CMP 0 ? A : -A to match
To improve phiopt and be able to remove abs_replacement, this ports
most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to
match.pd. There is a few extra changes that are needed to remove
the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison:
* Need to handle (A - B) case
* Need to handle UN* comparisons.
I will handle those in a different patch.
Note phi-opt-15.c test needed to be updated as we get ABSU now
instead of not getting ABS. When ABSU was added phiopt was not
updated even to use ABSU instead of not creating ABS.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
PR tree-optimization/101039
* match.pd (A CMP 0 ? A : -A): New patterns.
* tree-ssa-phiopt.c (abs_replacement): Delete function.
(tree_ssa_phiopt_worker): Don't call abs_replacement.
Update comment about abs_replacement.
gcc/testsuite/ChangeLog:
PR tree-optimization/101039
* gcc.dg/tree-ssa/phi-opt-15.c: Update test to expect
ABSU and still not expect ABS_EXPR.
* gcc.dg/tree-ssa/phi-opt-23.c: New test.
* gcc.dg/tree-ssa/phi-opt-24.c: New test.
Andrew Pinski [Sun, 13 Jun 2021 02:14:46 +0000 (19:14 -0700)]
Try inverted comparison for match_simplify in phiopt
Since match and simplify does not have all of the inverted
comparison patterns, it make sense to just have
phi-opt try to do the inversion and try match and simplify again.
OK? Bootstrapped and tested on x86_64-linux-gnu.
Thanks,
Andrew Pinski
gcc/ChangeLog:
* tree-ssa-phiopt.c (gimple_simplify_phiopt):
If "A ? B : C" fails to simplify, try "(!A) ? C : B".
Andrew Pinski [Fri, 11 Jun 2021 20:21:34 +0000 (13:21 -0700)]
Allow match-and-simplified phiopt to run in early phiopt
To move a few things more to match-and-simplify from phiopt,
we need to allow match_simplify_replacement to run in early
phiopt. To do this we add a replacement for gimple_simplify
that is explictly for phiopt.
OK? Bootstrapped and tested on x86_64-linux-gnu with no
regressions.
gcc/ChangeLog:
* tree-ssa-phiopt.c (match_simplify_replacement):
Add early_p argument. Call gimple_simplify_phiopt
instead of gimple_simplify.
(tree_ssa_phiopt_worker): Update call to
match_simplify_replacement and allow unconditionally.
(phiopt_early_allow): New function.
(gimple_simplify_phiopt): New function.
Andrew Pinski [Tue, 29 Jun 2021 03:48:44 +0000 (20:48 -0700)]
Fix PR 101237: Remove element_type call when used with the functions from real
HONOR_SIGNED_ZEROS, HONOR_SIGN_DEPENDENT_ROUNDING, and HONOR_SNANS all
have an overload for taking a tree type now, so we should do that instead.
OK? Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
PR middle-end/101237
* fold-const.c (negate_expr_p): Remove call to element_mode
and TREE_MODE/TREE_TYPE when calling HONOR_SIGNED_ZEROS,
HONOR_SIGN_DEPENDENT_ROUNDING, and HONOR_SNANS.
(fold_negate_expr_1): Likewise.
(const_unop): Likewise.
(fold_cond_expr_with_comparison): Likewise.
(fold_binary_loc): Likewise.
(fold_ternary_loc): Likewise.
(tree_call_nonnegative_warnv_p): Likewise.
* match.pd (-(A + B) -> (-B) - A): Likewise.
Iain Sandoe [Sun, 13 Dec 2020 17:21:16 +0000 (17:21 +0000)]
Darwin, configury : Allow for specification and detection of dsymutil.
In order to enable DWARF versions > 2 we need a sufficiently modern
version of dsymutil (in addition to the assembler / linker). This
allows the user to configure a different path from the installed one.
In addition, there are several sources of dsymutil so we differentiate
these in order to be get accurate version information.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* configure.ac: Handle --with-dsymutil in the same way as we
do for the assembler and linker. (DEFAULT_DSYMUTIL): New.
Extract the type and version for the dsymutil configured or
found by the default searches.
* config.in: Regenerated.
* configure: Regenerated.
* collect2.c (do_dsymutil): Handle locating dsymutil in the
same way as for the assembler and linker.
* config/darwin.h (DSYMUTIL): Delete.
* gcc.c: Report a configured dsymutil correctly.
* exec-tool.in: Allow for dsymutil.
ChangeLog:
* Makefile.def: Add dsymutil defs.
* Makefile.in: Regenerated.
* Makefile.tpl: Add dsymutil to flags.
* configure: Regenerated.
* configure.ac: Add dsymutil to target and build recipes.
Uros Bizjak [Mon, 5 Jul 2021 19:05:10 +0000 (21:05 +0200)]
i386: Implement 4-byte vector (V4QI/V2HI) constant permutations
2021-07-05 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* config/i386/i386-expand.c (ix86_split_mmx_punpck):
Handle V4QI and V2HI modes.
(expand_vec_perm_blend): Allow 4-byte vector modes with TARGET_SSE4_1.
Handle V4QI mode. Emit mmx_pblendvb32 for 4-byte modes.
(expand_vec_perm_pshufb): Rewrite to use switch statemets.
Handle 4-byte dual operands with TARGET_XOP and single operands
with TARGET_SSSE3. Emit mmx_ppermv32 for TARGET_XOP and
mmx_pshufbv4qi3 for TARGET_SSSE3.
(expand_vec_perm_pblendv): Allow 4-byte vector modes with TARGET_SSE4_1.
(expand_vec_perm_interleave2): Allow 4-byte vector modes.
(expand_vec_perm_pshufb2): Allow 4-byte vector modes with TARGET_SSSE3.
(expand_vec_perm_even_odd_1): Handle V4QI mode.
(expand_vec_perm_broadcast_1): Handle V4QI mode.
(ix86_vectorize_vec_perm_const): Handle V4QI mode.
* config/i386/mmx.md (mmx_ppermv32): New insn pattern.
(mmx_pshufbv4qi3): Ditto.
(*mmx_pblendw32): Ditto.
(*mmx_pblendw64): Rename from *mmx_pblendw.
(mmx_punpckhbw_low): New insn_and_split pattern.
(mmx_punpcklbw_low): Ditto.
Pierre-Marie de Rodat [Wed, 23 Jun 2021 14:31:23 +0000 (14:31 +0000)]
[Ada] Regenerate *.texi files with Sphinx 4.0.2
gcc/ada/
* gnat-style.texi, gnat_rm.texi, gnat_ugn.texi: Regenerate.
Piotr Trojanek [Thu, 29 Apr 2021 22:29:33 +0000 (00:29 +0200)]
[Ada] Reject overlays in Global/Depends/Initializes contracts
gcc/ada/
* sem_prag.adb (Analyze_Depends_In_Decl_Part): Reject overlays
in Depends and Refined_Depends contracts.
(Analyze_Global_In_Decl_Part): Likewise for Global and
Refined_Global.
(Analyze_Initializes_In_Decl_Part): Likewise for Initializes
(when appearing both as a single item and as a initialization
clause).
* sem_util.ads (Ultimate_Overlaid_Entity): New routine.
* sem_util.adb (Report_Unused_Body_States): Ignore overlays.
(Ultimate_Overlaid_Entity): New routine.
Claire Dross [Fri, 30 Apr 2021 08:24:30 +0000 (10:24 +0200)]
[Ada] Add Reference and Constant_Reference functions to formal containers
gcc/ada/
* libgnat/a-cfdlli.ads, libgnat/a-cfdlli.adb
libgnat/a-cfinve.ads, libgnat/a-cfinve.adb,
libgnat/a-cofove.ads, libgnat/a-cofove.adb,
libgnat/a-coboho.ads, libgnat/a-coboho.adb (Constant_Reference):
Get a read-only access to an element of the container.
(At_End): Ghost functions used to express pledges in the
postcondition of Reference.
(Reference): Get a read-write access to an element of the
container.
* libgnat/a-cfhama.ads, libgnat/a-cfhama.adb,
libgnat/a-cforma.ads, libgnat/a-cforma.adb: The full view of the
Map type is no longer a tagged type, but a wrapper over this
tagged type. This is to avoid issues with dispatching result in
At_End functions.
(Constant_Reference): Get a read-only access to an element of
the container.
(At_End): Ghost functions used to express pledges in the
postcondition of Reference.
(Reference): Get a read-write access to an element of the
container.
* libgnat/a-cfhase.ads, libgnat/a-cfhase.adb,
libgnat/a-cforse.ads, libgnat/a-cforse.adb: The full view of the
Map type is no longer a tagged type, but a wrapper over this
tagged type.
(Constant_Reference): Get a read-only access to an element of
the container.
* libgnat/a-cofuse.ads, libgnat/a-cofuve.ads (Copy_Element):
Expression function used to cause SPARK to make sure
Element_Type is copiable.
* libgnat/a-cofuma.ads (Copy_Key): Expression function used to
cause SPARK to make sure Key_Type is copiable.
(Copy_Element): Expression function used to cause SPARK to make
sure Element_Type is copiable.
Yannick Moy [Fri, 30 Apr 2021 10:41:22 +0000 (12:41 +0200)]
[Ada] Adapt SPARK RM rule on non-effectively volatile abstract state
gcc/ada/
* sem_prag.adb (Analyze_Global_Item): Adapt to update SPARK RM
rule.
Arnaud Charlet [Fri, 30 Apr 2021 15:52:35 +0000 (11:52 -0400)]
[Ada] Use runtime from base compiler during stage1 #2
gcc/ada/
* Make-generated.in: Add -f switch to ensure cp will never fail.
Steve Baird [Thu, 29 Apr 2021 18:44:29 +0000 (11:44 -0700)]
[Ada] Fix some "current instance" bugs
gcc/ada/
* exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): When
building the assignment statement corresponding to the default
expression for a component, we make a copy of the expression.
When making that copy (and if we have seen a component that
requires late initialization), pass a Map parameter into the
call to New_Copy_Tree to redirect references to the type to
instead refer to the _Init formal parameter of the init proc.
This includes hoisting the declaration of Has_Late_Init_Comp out
one level so that it becomes available to Build_Assignment.
(Find_Current_Instance): Return True for other kinds of current
instance references, instead of just access-valued attribute
references such as T'Access.
* sem_util.adb (Is_Aliased_View): Return True for the _Init
formal parameter of an init procedure. The changes in
exp_ch3.adb can have the effect of replacing a "T'Access"
attribute reference in an init procedure with an "_Init'Access"
attribute reference. We want such an attribute reference to be
legal. However, we do not simply mark the formal parameter as
being aliased because that might impact callers.
(Is_Object_Image): Return True if Is_Current_Instance returns
True for the prefix of an Image (or related attribute) attribute
reference.
Piotr Trojanek [Fri, 30 Apr 2021 10:02:35 +0000 (12:02 +0200)]
[Ada] Simplify and reuse Is_Concurrent_Interface
gcc/ada/
* exp_ch3.adb (Stream_Operation_OK): Reuse
Is_Concurrent_Interface.
* sem_ch3.adb (Analyze_Interface_Declaration,
Build_Derived_Record_Type): Likewise.
* sem_ch6.adb (Check_Limited_Return): Likewise.
* sem_util.adb (Is_Concurrent_Interface): Don't call
Is_Interface because each of the Is_Protected_Interface,
Is_Synchronized_Interface and Is_Task_Interface calls it anyway.
Ghjuvan Lacambre [Fri, 30 Apr 2021 08:11:25 +0000 (10:11 +0200)]
[Ada] Fix missing error messages when returning limited type
gcc/ada/
* sem_ch6.adb (Check_Limited_Return): Replace Comes_From_Source
with Comes_From_Extended_Return_Statement.
Steve Baird [Thu, 29 Apr 2021 21:54:54 +0000 (14:54 -0700)]
[Ada] Remove Ada.Strings.Text_Output and child units
gcc/ada/
* libgnat/a-stobbu.adb, libgnat/a-stobbu.ads,
libgnat/a-stobfi.adb, libgnat/a-stobfi.ads,
libgnat/a-stoubu.adb, libgnat/a-stoubu.ads,
libgnat/a-stoufi.adb, libgnat/a-stoufi.ads,
libgnat/a-stoufo.adb, libgnat/a-stoufo.ads,
libgnat/a-stouut.adb, libgnat/a-stouut.ads,
libgnat/a-stteou.ads: Delete files.
* Makefile.rtl, impunit.adb: Remove references to deleted files.
Piotr Trojanek [Thu, 29 Apr 2021 09:39:24 +0000 (11:39 +0200)]
[Ada] Fix excessive check for alignment of overlaying objects
gcc/ada/
* sem_util.adb (Has_Compatible_Alignment_Internal): If the
prefix of the Address expression is an entire object with a
known alignment, then skip checks related to its size.
Doug Rupp [Wed, 28 Apr 2021 15:48:52 +0000 (08:48 -0700)]
[Ada] The Unix Epochalyse of 2038 - OS_Time comparison
gcc/ada/
* libgnat/s-os_lib.ads: Import OS_Time comparison ops as
intrinsic.
* libgnat/s-os_lib.adb: Remove OS_TIme comparison ops
implementation.
Doug Rupp [Wed, 28 Apr 2021 14:46:12 +0000 (07:46 -0700)]
[Ada] The Unix Epochalypse of 2038 (Warn about time_t in the compiler)
gcc/ada/
* libgnat/s-os_lib.ads: Add some comments about time_t.
* libgnat/s-os_lib.adb (GM_Split/To_GM_Time): Rename formal to
P_OS_Time.
(GM_Time_Of/To_OS_Time): Likewise.
Ghjuvan Lacambre [Wed, 28 Apr 2021 09:03:03 +0000 (11:03 +0200)]
[Ada] Fix missing minus sign in literal translation
gcc/ada/
* sem_res.adb (Resolve): Insert minus sign if needed.
Steve Baird [Tue, 27 Apr 2021 20:57:36 +0000 (13:57 -0700)]
[Ada] Temporarily disable Ada 2022 Image and Put_Image support for tagged types
gcc/ada/
* exp_put_image.adb:
(Enable_Put_Image, Preload_Root_Buffer_Type): Revert to querying
the -gnatd_z switch, as opposed to testing whether Ada_Version >= Ada_2022.
Justin Squirek [Mon, 29 Mar 2021 12:46:02 +0000 (08:46 -0400)]
[Ada] INOX: prototype alternative accessibility model
gcc/ada/
* checks.adb (Accessibility_Checks_Suppressed): Add check
against restriction No_Dynamic_Accessibility_Checks.
(Apply_Accessibility_Check): Add assertion to check restriction
No_Dynamic_Accessibility_Checks is not active.
* debug.adb: Add documentation for new debugging switch to
control which accessibility model gets employed under
restriction No_Dynamic_Accessibility_Checks.
* exp_attr.adb (Expand_N_Attribute_Reference): Disable dynamic
accessibility check generation when
No_Dynamic_Accessibility_Checks is active.
* exp_ch4.adb (Apply_Accessibility_Check): Skip check generation
when restriction No_Dynamic_Accessibility_Checks is active.
(Expand_N_Allocator): Disable dynamic accessibility checks when
No_Dynamic_Accessibility_Checks is active.
(Expand_N_In): Disable dynamic accessibility checks when
No_Dynamic_Accessibility_Checks is active.
(Expand_N_Type_Conversion): Disable dynamic accessibility checks
when No_Dynamic_Accessibility_Checks is active.
* exp_ch5.adb (Expand_N_Assignment_Statement): Disable
alternative accessibility model calculations when computing a
dynamic level for a SAOAAT.
* exp_ch6.adb (Add_Call_By_Copy_Code): Disable dynamic
accessibility check generation when
No_Dynamic_Accessibility_Checks is active.
(Expand_Branch): Disable alternative accessibility model
calculations.
(Expand_Call_Helper): Disable alternative accessibility model
calculations.
* restrict.adb, restrict.ads: Add new restriction
No_Dynamic_Accessibility_Checks.
(No_Dynamic_Accessibility_Checks_Enabled): Created to test when
experimental features (which are generally incompatible with
standard Ada) can be enabled.
* sem_attr.adb (Safe_Value_Conversions): Add handling of new
accessibility model under the restriction
No_Dynamic_Accessibility_Checks.
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Disallow new restriction No_Dynamic_Accessibility_Checks from
being exclusively specified within a body or subunit without
being present in a specification.
* sem_res.adb (Check_Fully_Declared_Prefix): Minor comment
fixup.
(Valid_Conversion): Omit implicit conversion checks on anonymous
access types and perform static checking instead when
No_Dynamic_Accessibility_Checks is active.
* sem_util.adb, sem_util.ads (Accessibility_Level): Add special
handling of anonymous access objects, formal parameters,
anonymous access components, and function return objects.
(Deepest_Type_Access_Level): When
No_Dynamic_Accessibility_Checks is active employ an alternative
model. Add paramter Allow_Alt_Model to override the new behavior
in certain cases.
(Type_Access_Level): When No_Dynamic_Accessibility_Checks is
active employ an alternative model. Add parameter
Allow_Alt_Model to override the new behavior in certain cases.
(Typ_Access_Level): Created within Accessibility_Level for
convenience.
* libgnat/s-rident.ads, snames.ads-tmpl: Add handing for
No_Dynamic_Accessibility_Checks.
Doug Rupp [Mon, 26 Apr 2021 17:14:37 +0000 (10:14 -0700)]
[Ada] The Unix Epochalypse of 2038 - Use OS_Time
gcc/ada/
* adaint.h (__gnat_set_file_time_name): Use OS_Time.
* adaint.c (__gnat_set_file_time_name): Likewise.
Doug Rupp [Mon, 26 Apr 2021 04:52:09 +0000 (21:52 -0700)]
[Ada] The Unix Epochalyse of 2038 - OS_Time
gcc/ada/
* adaint.h (OS_Time): typedef as long long.
* osint.adb (Underlying_OS_Time): Declare as 64-bit signed type.
* libgnat/s-os_lib.adb ("<"): Compare OS_Time as
Long_Long_Integer.
("<="): Likewise.
(">"): Likewise.
(">="): Likewise.
* libgnat/s-os_lib.ads (OS_Time): Declare as 64-bit signed type.
Ghjuvan Lacambre [Tue, 27 Apr 2021 11:30:34 +0000 (13:30 +0200)]
[Ada] Move overriding rename error message from declaration to use
gcc/ada/
* sem_ch3.adb (Check_Abstract_Overriding): Post error message on
renaming node.
Yannick Moy [Wed, 7 Apr 2021 10:15:04 +0000 (12:15 +0200)]
[Ada] Adapt SPARK checking after change in rules regarding heap modeling
gcc/ada/
* libgnat/a-uncdea.ads: Add Depends/Post to
Ada.Unchecked_Deallocation.
* sem_ch4.adb (Analyze_Allocator): Remove checking of allocator
placement.
* sem_res.adb (Flag_Object): Same.
Ghjuvan Lacambre [Wed, 17 Mar 2021 17:33:34 +0000 (18:33 +0100)]
[Ada] Turn GNAT_Annotate into its own pragma
gcc/ada/
* aspects.ads: Add GNAT_Annotate aspect.
* gnat1drv.adb (Adjust_Global_Switches): Stop defining
Name_Gnat_Annotate as an alias of Name_Annotate.
* snames.ads-tmpl: Define Gnat_Annotate.
* par-prag.adb, sem_prag.ads: Add Pragma_Gnat_Annotate to list
of pragmas.
* lib-writ.adb, sem_ch13.adb, sem_prag.adb: Handle Gnat_Annotate
like Aspect_Annotate.
Piotr Trojanek [Mon, 26 Apr 2021 14:09:49 +0000 (16:09 +0200)]
[Ada] Fix comment about the debug flag for strict alignment
gcc/ada/
* ttypes.ads (Target_Strict_Alignment): Fix comment.
Piotr Trojanek [Mon, 26 Apr 2021 13:55:21 +0000 (15:55 +0200)]
[Ada] Cleanup checking for compatible alignment
gcc/ada/
* sem_util.adb (Has_Compatible_Alignment_Internal): Fix
indentation of ELSIF comments; remove explicit calls to
UI_To_Int; remove extra parens around the MOD operand.
Ed Schonberg [Mon, 26 Apr 2021 17:32:06 +0000 (13:32 -0400)]
[Ada] Spurious error in instantiation with aggregate and private ancestor
gcc/ada/
* sem_aggr.adb (Resolve_Record_Aggregate, Step_5): Do not check
for the need to use an extension aggregate for a given component
when within an instance and the type of the component hss a
private ancestor: the instantiation is legal if the generic
compiles, and spurious errors may be generated otherwise.
Ghjuvan Lacambre [Fri, 23 Apr 2021 14:02:19 +0000 (16:02 +0200)]
[Ada] Print JSON continuation messages as separate messages
gcc/ada/
* errout.adb (Output_JSON_Message): Recursively call
Output_JSON_Message for continuation messages instead of
appending their content to the initial message.
Steve Baird [Fri, 16 Apr 2021 23:07:31 +0000 (16:07 -0700)]
[Ada] Add Ada 2022 Image and Put_Image support for tagged types
gcc/ada/
* debug.adb: Remove comments about -gnatd_z switch.
* exp_ch3.adb (Make_Predefined_Primitive_Specs): A one-line fix
for a subtle bug that took some effort to debug. Append a new
Put_Image procedure for a type extension even if it seems to
already have one, just as is done for (for example) the
streaming-related Read procedure.
* exp_put_image.adb:
(Build_Record_Put_Image_Procedure.Make_Component_Attributes): Do
not treat _Parent component like just another component, for two
reasons. 1. If the _parent component's type has a
user-specified Put_Image procedure, then we want to generate a
call to that procedure and then generate extension aggregate
syntax. 2. Otherwise, we still don't want to see any mention of
"_parent" in the generated image text.
(Build_Record_Put_Image_Procedure.Make_Component_Name): Add
assertion that we are not generating a reference to an "_parent"
component.
(Build_Record_Put_Image_Procedure): Add special treatment for
null records. Add call to Duplicate_Subexpr for image attribute
prefix in order to help with expansion needed in the class-wide
case (where the prefix is also referenced in the call to
Wide_Wide_Expanded_Name) if evaluation of the prefix has side
effects. Add new local helper function, Put_String_Exp. Add
support for case where prefix type is class-wide.
(Enable_Put_Image, Preload_Root_Buffer_Type): Query Ada_Version
> Ada_2022 instead of (indirectly) querying -gnatd_z switch.
* freeze.adb (In_Expanded_Body): A one-line change to add
TSS_Put_Image to the list of subprograms that have
expander-created bodies.
* rtsfind.ads: Add support for accessing
Ada.Tags.Wide_Wide_Expanded_Name.
* sem_ch3.ads, sem_ch3.adb: Delete Is_Null_Extension function,
as part of moving it to Sem_Util.
* sem_ch13.adb
(Analyze_Put_Image_TSS_Definition.Has_Good_Profile): Improve
diagnostic messages in cases where the result is going to be
False and the Report parameter is True. Relax overly-restrictive
checks in order to implement mode conformance.
(Analyze_Stream_TSS_Definition.Has_Good_Profile): Add similar
relaxation of parameter subtype checking for the Stream
parameter of user-defined streaming subprograms.
* sem_disp.adb (Check_Dispatching_Operation): A one-line
change (and an accompanying comment change) to add TSS_Put_Image
to the list of compiler-generated dispatching primitive
operations.
* sem_util.ads, sem_util.adb: Add Ignore_Privacy Boolean
parameter to Is_Null_Record_Type function (typically the
parameter will be False when the function is being used in the
implementation of static semantics and True for dynamic
semantics; the parameter might make a difference in the case of,
for example, a private type that is implemented as a null record
type). Add related new routines Is_Null_Extension (formerly
declared in Sem_Ch3), Is_Null_Extension_Of, and
Is_Null_Record_Definition.
Justin Squirek [Thu, 8 Apr 2021 08:44:19 +0000 (10:44 +0200)]
[Ada] Fix crash when printing error message
gcc/ada/
* freeze.adb (Freeze_Profile): Use N's Sloc, F_type's chars.
Bob Duff [Fri, 23 Apr 2021 12:17:28 +0000 (08:17 -0400)]
[Ada] Clean up Get_Index_Bounds
gcc/ada/
* checks.adb, exp_aggr.adb, exp_ch5.adb, freeze.adb,
sem_util.adb, sem_util.ads: Change L and H to be First and Last,
to match the attributes in the RM. Change calls from procedure
to function where appropriate.
Bob Duff [Thu, 22 Apr 2021 18:07:34 +0000 (14:07 -0400)]
[Ada] Refactoring related to Returns_By_Ref
gcc/ada/
* sem_util.ads, sem_util.adb (Compute_Returns_By_Ref): New
procedure to compute Returns_By_Ref, to avoid some code
duplication. This will likely change soon, so it's good to have
the code in one place.
(CW_Or_Has_Controlled_Part): Move here from Exp_Ch7, because
it's called by Compute_Returns_By_Ref, and this is a better
place for it anyway.
(Needs_Finalization): Fix comment to be vague instead of wrong.
* exp_ch6.adb (Expand_N_Subprogram_Body, Freeze_Subprogram):
Call Compute_Returns_By_Ref.
* sem_ch6.adb (Check_Delayed_Subprogram): Call
Compute_Returns_By_Ref.
* exp_ch7.ads, exp_ch7.adb (CW_Or_Has_Controlled_Part): Move to
Sem_Util.
(Has_New_Controlled_Component): Remove unused function.
Ghjuvan Lacambre [Thu, 22 Apr 2021 15:13:19 +0000 (17:13 +0200)]
[Ada] Fix overriding subprogram being incorrectly seen as returning
gcc/ada/
* sem_ch3.adb (Check_Abstract_Overriding): Check for renamings.
Boris Yakobowski [Wed, 21 Apr 2021 12:49:15 +0000 (14:49 +0200)]
[Ada] Do not catch 'N rem -1' in CodePeer_Mode
gcc/ada/
* exp_ch4.adb (Expand_N_Op_Rem): Remove special case for rem -1
in CodePeer_Mode.
Christophe Lyon [Mon, 5 Jul 2021 11:33:45 +0000 (11:33 +0000)]
testsuite: gcc.dg/debug/btf/btf-bitfields-3.c requires -fno-short-enums PR debug/101321
arm-eabi uses -fshort-enums by default while arm-linux-gnueabi* do not,
like most (all?) other targets, but this test relies -fno-short-enums.
Fix it by forcing -fno-short-enums.
2021-07-05 Christophe Lyon <christophe.lyon@foss.st.com>
PR debug/101321
gcc/testsuite/
* gcc.dg/debug/btf/btf-bitfields-3.c: Add -fno-short-enums.
Richard Biener [Mon, 5 Jul 2021 10:00:17 +0000 (12:00 +0200)]
Do not set both LOOP_C_INFINITE and LOOP_C_FINITE on vectorized loop
The setting is likely a typo and was meant to affect the scalar version
but even there LOOP_C_INFINITE is at most an optimization to the
niter analysis. Clearly setting it on the vectorized loop which we
just versioned to be _not_ infinite is bogus so the following change
removes this.
2021-07-05 Richard Biener <rguenther@suse.de>
* tree-vect-loop-manip.c (vect_loop_versioning): Do not
set LOOP_C_INFINITE on the vectorized loop.
Richard Biener [Mon, 5 Jul 2021 09:53:07 +0000 (11:53 +0200)]
middle-end/101291 - set loop copy of versioned loop
This fixes the vectorizer loop versioning code failing to clear
niter related info on the scalar loop as it assumed get_loop_copy
would work even for the outermost loop. The patch makes that
assumption hold by adjusting the loop versioning code.
2021-07-05 Richard Biener <rguenther@suse.de>
PR middle-end/101291
* cfgloopmanip.c (loop_version): Set the loop copy of the
versioned loop to the new loop.
Richard Biener [Mon, 5 Jul 2021 06:38:29 +0000 (08:38 +0200)]
testsuite/101299 - add missing vect_double requires to bb-slp-74.c
This should fix the FAIL of gcc.dg/vect/bb-slp-74.c on arm.
2021-07-05 Richard Biener <rguenther@suse.de>
PR testsuite/101299
* gcc.dg/vect/bb-slp-74.c: Add vect_double requires.
liuhongt [Mon, 5 Jul 2021 04:55:57 +0000 (12:55 +0800)]
Remove xfail for pr92658-avx512vl.c
Typo of standard pattern name has been fixed by r12-1970, remove those
xfails.
gcc/testsuite/ChangeLog
* gcc.target/i386/pr92658-avx512vl.c: Refine testcase.
GCC Administrator [Mon, 5 Jul 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Iain Sandoe [Fri, 30 Apr 2021 15:20:42 +0000 (16:20 +0100)]
Darwin, config : Adjust X86 biarch definitions ordering [PR100269].
This reorganises the biarch definitions to cater for the
macro changes and removals at r12-36.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/100269 - [12 Regression] i686 biarch compiler fails for Darwin after r12-36.
PR target/100269
gcc/ChangeLog:
PR target/100269
* config.gcc: Ensure that Darwin biarch definitions are
added before i386.h.
* config/i386/darwin.h (TARGET_64BIT): Remove.
(PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Amend to use PR80556_WORKAROUND.
(DARWIN_SUBARCH_SPEC): New.
* config/i386/darwin32-biarch.h (TARGET_64BIT_DEFAULT,
TARGET_BI_ARCH, PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Remove.
* config/i386/darwin64-biarch.h (TARGET_64BIT_DEFAULT,
TARGET_BI_ARCH, PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Remove.
GCC Administrator [Sun, 4 Jul 2021 00:16:25 +0000 (00:16 +0000)]
Daily bump.
David Edelsohn [Thu, 1 Jul 2021 14:49:27 +0000 (10:49 -0400)]
testsuite: Disable BTF and CTF testsuite on AIX.
CTF utilizes DWARF sections, but it is a distinct debugging
format. The CTF support in GCC is not implemented as a
separate debugging format. AIX supports DWARF but not CTF
section.
The GCC testsuite test for target support of a debugging format
checks if GCC itself emits an error message, not if the
debugging output compiles correctly. Because CTF is not
a distinct debugging format, GCC does not distinguish support
for targets and does not have the ability to produce an error
message.
This patch skips the CTF and BTF debug directories, and
explicitly reports that AIX doesn't support CTF. Currently the
dejagnu code to skip multiple debugging levels for CTF does
not ensure that CTF is a supported debugging format. The patch
also shifts the CTF options logic to within the test that CTF
debug format is supported.
Bootstrapped on powerpc-ibm-aix7.2.3.0 and powerpc64le-linux.
gcc/testsuite/ChangeLog:
* gcc.dg/debug/btf/btf.exp: Skip on AIX.
* gcc.dg/debug/ctf/ctf.exp: Skip on AIX.
* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): AIX
doesn't support CTF.
(gcc-dg-debug-runtest): Move CTF support within
target support format test.
H.J. Lu [Fri, 2 Jul 2021 17:03:48 +0000 (10:03 -0700)]
Don't use vec_duplicate on vector in CTOR expansion
Since vec_duplicate only works on scalar, don't use it on vector in
store constructor expansion.
gcc/
PR middle-end/101294
* expr.c (store_constructor): Don't use vec_duplicate on vector.
gcc/testsuite/
PR middle-end/101294
* gcc.dg/pr101294.c: New test.
Iain Buclaw [Sat, 3 Jul 2021 00:42:14 +0000 (02:42 +0200)]
d: Missed RVO optimization with non-POD structs
The D front-end semantic pass sometimes declares a temporary inside a
return expression. This is now detected with the RESULT_DECL replacing
the temporary, allowing for RVO to be done.
PR d/101273
gcc/d/ChangeLog:
* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns that
use a temporary, and replace with return value.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr101273.d: New test.
GCC Administrator [Sat, 3 Jul 2021 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Fri, 2 Jul 2021 22:13:29 +0000 (00:13 +0200)]
d: RHS value lost when a target_expr modifies LHS in a cond_expr
To prevent the RHS of an assignment modifying the LHS before the
assignment proper, a target_expr is forced so that function calls that
return with slot optimization modify the temporary instead. This did
not work for conditional expressions however, to give one example. So
now the RHS is always forced to a temporary.
PR d/101282
gcc/d/ChangeLog:
* d-codegen.cc (build_assign): Force target_expr on RHS for non-POD
assignment expressions.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr101282.d: New test.
Martin Sebor [Fri, 2 Jul 2021 22:16:31 +0000 (16:16 -0600)]
Improve warning suppression for inlined functions [PR98512].
Resolves:
PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration site
PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective in conjunction with alias attribute
gcc/ChangeLog:
PR middle-end/98871
PR middle-end/98512
* diagnostic.c (get_any_inlining_info): New.
(update_effective_level_from_pragmas): Handle inlining context.
(diagnostic_enabled): Same.
(diagnostic_report_diagnostic): Same.
* diagnostic.h (struct diagnostic_info): Add ctor.
(struct diagnostic_context): Add new member.
* tree-diagnostic.c (set_inlining_locations): New.
(tree_diagnostics_defaults): Set new callback pointer.
Jakub Jelinek [Fri, 2 Jul 2021 19:59:21 +0000 (21:59 +0200)]
openmp: Initial support for OpenMP directives expressed as C++11 attributes
This is an OpenMP 5.1 feature, but I think it is something very useful for
OpenMP users, so I'm committing it now instead of waiting until all 5.0
work is done.
The support is incomplete, only attributes on statements (or block local
declarations) are supported right now, while for non-executable directives
they should be also supported at namespace scope and at class scope, and
for declarations in all places that appertain to the declarations rather
than e.g. types.
I need to also fix up handling of C++11 non-OpenMP attributes mixed with
OpenMP attributes before block local declarations (currently it throws
them away), probably reject if the directives appertain to labels etc.
In order not to complicate all the OpenMP directive parsing, it is done
by remembering the tokens from the attribute, slightly adjusting them and
feeding them through a temporary new lexer to cp_parse_pragma.
2021-07-02 Jakub Jelinek <jakub@redhat.com>
gcc/c-family/
* c-common.h (enum c_omp_directive_kind): New enum.
(struct c_omp_directive): New type.
(c_omp_categorize_directive): Declare.
* c-omp.c (omp_directives): New variable.
(c_omp_categorize_directive): New function.
gcc/cp/
* parser.h (struct cp_lexer): Add in_omp_attribute_pragma member.
(struct cp_omp_declare_simd_data): Likewise.
* cp-tree.h (enum cp_tree_index): Add CPTI_OMP_IDENTIFIER.
(omp_identifier): Define.
* parser.c (cp_parser_skip_to_pragma_eol): Handle
in_omp_attribute_pragma CPP_PRAGMA_EOL followed by CPP_EOF.
(cp_parser_require_pragma_eol): Likewise.
(struct cp_omp_attribute_data): New type.
(cp_parser_handle_statement_omp_attributes): New function.
(cp_parser_statement): Handle OpenMP directives in statement's
attribute-specifier-seq.
(cp_parser_omp_directive_args, cp_parser_omp_sequence_args): New
functions.
(cp_parser_std_attribute): Handle omp::directive and omp::sequence
attributes.
(cp_parser_omp_all_clauses): If in_omp_attribute_pragma, allow
a comma also before the first clause.
(cp_parser_omp_allocate): Likewise.
(cp_parser_omp_atomic): Likewise.
(cp_parser_omp_depobj): Likewise.
(cp_parser_omp_flush): Likewise.
(cp_parser_omp_ordered): Likewise.
(cp_parser_omp_declare_simd): Save in_omp_attribute_pragma
into struct cp_omp_declare_simd_data.
(cp_finish_omp_declare_variant): Add in_omp_attribute_pragma
argument. If set, allow a comma also before match clause.
(cp_parser_late_parsing_omp_declare_simd): If in_omp_attribute_pragma,
allow a comma also before the first clause. Adjust
cp_finish_omp_declare_variant caller.
(cp_parser_omp_declare_target): If in_omp_attribute_pragma, allow
a comma also before the first clause.
(cp_parser_omp_declare_reduction_exprs): Likewise.
(cp_parser_omp_requires): Likewise.
* decl.c (initialize_predefined_identifiers): Initialize
omp_identifier.
* decl2.c (cplus_decl_attributes): Reject omp::directive and
omp::sequence attributes.
gcc/testsuite/
* g++.dg/gomp/attrs-1.C: New test.
* g++.dg/gomp/attrs-2.C: New test.
* g++.dg/gomp/attrs-3.C: New test.
Jakub Jelinek [Fri, 2 Jul 2021 19:57:24 +0000 (21:57 +0200)]
openmp: Reject #pragma omp atomic update, [PR101297]
I've noticed that we allow a trailing comma on OpenMP atomic construct
if there is at least one clause. Commas should be only allowed to
separate the clauses (or in OpenMP 5.1 to separate directive name
from the clauses).
2021-07-02 Jakub Jelinek <jakub@redhat.com>
PR c/101297
* c-parser.c (c_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.
* parser.c (cp_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.
* c-c++-common/gomp/atomic-24.c: New test.
Patrick Palka [Fri, 2 Jul 2021 17:54:57 +0000 (13:54 -0400)]
c++: unqualified member template in constraint [PR101247]
Here any_template_parm_r is failing to mark the template parameters
implicitly used by the unqualified use of 'd' inside the constraint
because the code to do so assumes each level of a template parameter
list points to the corresponding primary template, but here the
parameter level for A in the out-of-line definition of A::B does not
(nor do the parameter levels for A and C in the definition of A::C),
which causes us to overlook the sharing.
So it seems we can't in general depend on the TREE_TYPE of a template
parameter level being non-empty here. This patch partially fixes this
by rewriting the relevant part of any_template_parm_r to not depend on
the TREE_TYPE of outer levels. We still depend on the innermost level
to point to the innermost primary template, so we still crash on the
commented out line in the below testcase.
PR c++/101247
gcc/cp/ChangeLog:
* pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Rewrite to
use common_enclosing_class and to not depend on the TREE_TYPE
of outer levels pointing to the corresponding primary template.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-memtmpl4.C: New test.
Peter Bergner [Fri, 2 Jul 2021 16:27:52 +0000 (11:27 -0500)]
rs6000: Add MMA __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
Add support for the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
to keep in sync with LLVM which added these earlier.
2021-07-02 Peter Bergner <bergner@linux.ibm.com>
gcc/
* config/rs6000/rs6000-builtin.def (BU_MMA_PAIR_LD, BU_MMA_PAIR_ST):
New macros.
(__builtin_vsx_lxvp, __builtin_vsx_stxvp): New built-ins.
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Expand
lxvp and stxvp built-ins.
(mma_init_builtins): Handle lxvp and stxvp built-ins.
(builtin_function_type): Likewise.
* doc/extend.texi (__builtin_vsx_lxvp, __builtin_mma_stxvp): Document.
gcc/testsuite/
* gcc.target/powerpc/mma-builtin-7.c: New test.
* gcc.target/powerpc/mma-builtin-8.c: New test.
Jeff Law [Fri, 2 Jul 2021 15:58:47 +0000 (11:58 -0400)]
Use shift instructions to eliminate redundant compare/test instructions on the H8
gcc/ChangeLog
* config/h8300/h8300-protos.h (compute_a_shift_cc): Accept
additional argument for the code.
* config/h8300/h8300.c (compute_a_shift_cc): Accept additional
argument for the code. Just return if the ZN bits are useful or
not rather than the old style CC_* enums.
* config/h8300/shiftrotate.md (shiftqi_noscratch): Move before
more generic shiftqi patterns.
(shifthi_noscratch, shiftsi_noscratch): Similarly.
(shiftqi_noscratch_set_flags): New pattern.
(shifthi_noscratch_set_flags, shiftsi_noscratch_set_flags): Likewise.
Andrew MacLeod [Wed, 30 Jun 2021 18:15:53 +0000 (14:15 -0400)]
Fix build_gt and build_lt for signed 1 bit values.
Signed 1 bit values have a range of [-1, 0] but neither (0 - 1) nor (-1 + 1)
can be represented. For signed values, add or subtract -1 as appropriate.
PR tree-optimization/101223
gcc/
* range-op.cc (build_lt): Add -1 for signed values.
(built_gt): Subtract -1 for signed values.
gcc/testsuite/
* gcc.dg/pr101223.c: New.
David Faust [Tue, 1 Jun 2021 16:22:59 +0000 (09:22 -0700)]
BTF: Support for BTF_KIND_FLOAT
Add BTF_KIND_FLOAT, a new BTF type kind which has recently stabilized in
the linux kernel [1]. This kind is used for encoding floating point
types, and is of particular use when generating BTF for some s390
arch-specific kernel headers.
Also update some BTF tests which previously used floating point types to
check correct behavior for types with no BTF representation.
[1]: https://github.com/torvalds/linux/commit/
b1828f0b04828aa8cccadf00a702f459caefeed9
include/ChangeLog:
* btf.h (struct btf_type): Update bit usage comment.
(BTF_INFO_KIND): Update bit mask.
(BTF_KIND_FLOAT): New define.
(BTF_KIND_MAX): Update.
gcc/ChangeLog:
* btfout.c (get_btf_kind): Support BTF_KIND_FLOAT.
(btf_asm_type): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/debug/btf/btf-float-1.c: New test.
* gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type.
* gcc.dg/debug/btf/btf-struct-2.c: Likewise.
* gcc.dg/debug/btf/btf-variables-2.c: Likewise.
Jeff Law [Fri, 2 Jul 2021 15:07:37 +0000 (11:07 -0400)]
Preparing to use shifts to eliminate redundant test/compare insns on H8
* config/h8300/h8300-protos.h (output_a_shift): Make first argument
an array of rtx rather than a pointer to rtx. Add code argument.
(compute_a_shift_length): Similarly.
* config/h8300/h8300.c (h8300_shift_costs): Adjust now that the
shift itself isn't an operand. Create dummy operand[0] to carry
a mode and pass a suitable rtx code to compute_a_shift_length.
(get_shift_alg): Adjust operand number of clobber in output templates.
(output_a_shift): Make first argument an array of rtx rather than
a pointer to rtx. Add code argument for the type of shift.
Adjust now that the shift itself is no longer an operand.
(compute_a_shift_length): Similarly.
* config/h8300/shiftrotate.md (shiftqi, shifthi, shiftsi): Use an
iterator rather than nshift_operator.
(shiftqi_noscratch, shifthi_noscratch, shiftsi_noscratch): Likewise.
(shiftqi_clobber_flags): Adjust to API changes in output_a_shift
and compute_a_shift_length.
(shiftqi_noscratch_clobber_flags): Likewise.
(shifthi_noscratch_clobber_flags): Likewise.
(shiftsi_noscratch_clobber_flags): Likewise.
Iain Sandoe [Fri, 2 Jul 2021 08:51:57 +0000 (09:51 +0100)]
Darwin, CTF, BTF: Do not run the DWARF debug link for BTF/CTF [PR101283].
Darwin uses an efficient two-stage process for debug linking.
The static linker (ld64) notes the inputs required but does not
link the debug. When required / on demand the debug is linked
into a separate package by the debug linker (dsymutil). At
present none of the Darwin tools consume or understand BTF/CTF.
The static linker silently accepts the sections (but will not
act on them as containing anything to be processed).
However, the debug linker produces a warning that it has been
presented with input with no [DWARF] debug content:
warning: no debug symbols in executable (-arch x86_64).
This causes several testsuite fails with excess errors.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf
PR debug/101283
gcc/ChangeLog:
* config/darwin.h (DSYMUTIL_SPEC): Do not try to run
dsymutil for BTF/CTF.
Iain Sandoe [Fri, 2 Jul 2021 08:44:59 +0000 (09:44 +0100)]
Darwin, BTF: Provide a suitable section name for BTF [PR101283].
In a similar manner to r12-1960-gcc8453012f75d, this provides a
placeholder section name for BTF data. This change groups BTF
and CTF debug formats in the same segment, but keeps them in
separate sections.
As per the CTF section designation, this should be agreed or
amended to an agreed form before GCC 12 ships.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf
PR debug/101283
gcc/ChangeLog:
* config/darwin.h (CTF_INFO_SECTION_NAME): Update the
segment to include BTF.
(BTF_INFO_SECTION_NAME): New.
Jeff Law [Fri, 2 Jul 2021 14:48:26 +0000 (10:48 -0400)]
Fix m32r target specific fallout from recent int->bool changes
gcc/ChangeLog
* config/m32r/m32r-protos.h (call_operand): Adjust return type.
(small_data_operand, memreg_operand, small_insn_p): Likewise.
* config/m32r/m32r.c (call_operand): Adjust return type.
(small_data_operand, memreg_operand): Likewise.
Jeff Law [Fri, 2 Jul 2021 14:37:52 +0000 (10:37 -0400)]
Fix frv target specific fallout from recent int->bool changes
gcc/ChangeLog
* config/frv/frv-protos.h (integer_register_operand): Adjust return
type.
(frv_load_operand, gpr_or_fpr_operand, gpr_no_subreg_operand): Likewise.
(fpr_or_int6_operand, gpr_or_int_operand); Likewise.
(gpr_or_int12_operand, gpr_or_int10_operand); Likewise.
(move_source_operand, move_destination_operand): Likewise.
(condexec_source_operand, condexec_dest_operand): Likewise.
(lr_operand, gpr_or_memory_operand, fpr_or_memory_operand): Likewise.
(reg_or_0_operand, fcc_operand, icc_operand, cc_operand): Likewise.
(fcr_operand, icr_operand, cr_operand, call_operand): Likewise.
(fpr_operand, even_reg_operand, odd_reg_operand): Likewise.
(even_gpr_operand, odd_gpr_operand, quad_fpr_operand): Likewise.
(even_fpr_operand, odd_fpr_operand): Likewise.
(dbl_memory_one_insn_operand, dbl_memory_two_insn_operand): Likewise.
(int12_operand, int6_operand, int5_operand, uint5_operand): Likewise.
(uint4_operand, uint1_operand, int_2word_operand): Likewise
(upper_int16_operand, uint16_operand, symbolic_operand): Likewise.
(relational_operator, float_relational_operator): Likewise.
(ccr_eqne_operator, minmax_operator): Likewise.
(condexec_si_binary_operator, condexec_si_media_operator): Likewise.
(condexec_si_divide_operator, condexec_si_unary_operator): Likewise.
(condexec_sf_conv_operator, condexec_sf_add_operator): Likewise.
(intop_compare_operator, acc_operand, even_acc_operand): Likewise.
(quad_acc_operand, accg_operand): Likewise.
Maxim Kuvyrkov [Fri, 2 Jul 2021 14:15:35 +0000 (14:15 +0000)]
Add description of how testsuite parallelization works
... for the benefit of the next poor soul who will need to debug it.
gcc/testsuite/
* lib/gcc-defs.exp: Add a comment.
Jeff Law [Fri, 2 Jul 2021 14:31:31 +0000 (10:31 -0400)]
Fix xstormy16 target specific fallout from recent int->bool changes
gcc/
* config/stormy16/stormy16-protos.h (xstormy16_below_100_symbol): Change
return type to a bool.
(nonimmediate_nonstack_operand): Likewise.
(xstormy16_splittable_below100_operand): Likewise.
* config/stormy16/stormy16.c (xstormy16_below_100_symbol): Fix
return type.
(xstormy16_splittable_below100_operand): Likewise.
Richard Biener [Fri, 2 Jul 2021 10:57:06 +0000 (12:57 +0200)]
tree-optimization/101293 - further enhance LIMs ref canonicalization
This makes sure to handle MEM[p + 4] and MEM[p].j with j at offset 4
as the same ref in store motion. For hashing we need to be
more restrictive in what we handle since there's no poly-int
handlers for inchash. For comparison we can compare poly_offsets directly.
2021-07-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/101293
* tree-ssa-loop-im.c (mem_ref_hasher::equal): Compare MEM_REF bases
with combined offsets.
(gather_mem_refs_stmt): Hash MEM_REFs as if their offset were
combined with the rest of the offset.
* gcc.dg/tree-ssa/ssa-lim-15.c: New testcase.
Jonathan Wakely [Fri, 2 Jul 2021 07:46:18 +0000 (08:46 +0100)]
libstdc++: Revert changes to std::unique_ptr<T[]>::operator[] [PR 101271]
This reverts the changes in r12-1778 which added a noexcept-specifier to
std::unique_ptr<T[]>::operator[], and the changes in r12-1844 which
tried to make it work with incomplete types (for PR 101236).
The noexcept-specifier is not required by the standard, and is causing
regressions, so just remove it.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/101271
* include/bits/unique_ptr.h (unique_ptr<T[],D>::operator[]):
Remove noexcept-specifier.
(unique_ptr<T[],D>::_S_nothrow_deref): Remove.
* testsuite/20_util/unique_ptr/lwg2762.cc: Remove checks for
operator[].
Eric Botcazou [Fri, 2 Jul 2021 08:21:11 +0000 (10:21 +0200)]
Change EH pointer encodings to PC relative on Windows
A big difference between ELF and PE-COFF is that, with the latter, you can
build position-independent executables or DLLs without generating PIC; as
a matter of fact, flag_pic has historically been forced to 0 for 32-bit:
/* Don't allow flag_pic to propagate since gas may produce invalid code
otherwise. */
\
do {
\
flag_pic = TARGET_64BIT ? 1 : 0; \
} while (0)
The reason is that the linker builds a .reloc section that collects the
absolute relocations in the generated binary, and the loader uses them to
relocate it at load time if need be (e.g. if --dynamicbase is enabled).
Up to binutils 2.35, the GNU linker didn't build the .reloc section for
executables and defaulted to --enable-auto-image-base for DLLs, which means
that DLLs had an essentially unique load address and, therefore, need not
be relocated by the loader in most cases.
With binutils 2.36 and later, the GNU linker builds a .reloc section for
executables (thus making them PIE), --enable-auto-image-base is disabled
and --dynamicbase is enabled by default, which means that essentially all
the binaries are relocated at load time.
This badly breaks the 32-bit compiler configured to use DWARF-2 EH because
the loader corrupts the .eh_frame section when processing the relocations
contained in the .reloc section.
gcc/
* config/i386/i386.c (asm_preferred_eh_data_format): Always use the
PIC encodings for PE-COFF targets.
Jakub Jelinek [Fri, 2 Jul 2021 08:06:56 +0000 (10:06 +0200)]
i386: Punt on broadcasts from TImode integers [PR101286]
ix86_expand_vector_init_duplicate doesn't handle TImode -> V2TImode
or TImode -> V4TImode broadcasts, so I think we should punt on TImode
inner mode in ix86_broadcast_from_integer_constant, otherwise we ICE
in ix86_expand_vector_move when ix86_broadcast_from_integer_constant
returns non-NULL and ix86_expand_vector_init_duplicate returns false.
In theory TImode element broadcasts could be handled by some permutations,
but I'm not sure it is worth it.
2021-07-02 Jakub Jelinek <jakub@redhat.com>
PR target/101286
* config/i386/i386-expand.c (ix86_broadcast_from_integer_constant):
Return nullptr for TImode inner mode.
* gcc.target/i386/avx2-pr101286.c: New test.
Richard Biener [Fri, 2 Jul 2021 06:51:43 +0000 (08:51 +0200)]
tree-optimization/101280 - re-revise interchange fix for PR101173
The following fixes up the revision of the original fix for PR101173
to properly guard all dependence checks with DDR_REVERSED_P or its
inverse.
2021-07-01 Richard Biener <rguenther@suse.de>
PR tree-optimization/101280
PR tree-optimization/101173
* gimple-loop-interchange.cc
(tree_loop_interchange::valid_data_dependences): Properly
guard all dependence checks with DDR_REVERSED_P or its
inverse.
Hongyu Wang [Wed, 30 Jun 2021 06:38:31 +0000 (14:38 +0800)]
Clear odata for aes(enc|dec)(wide)?kl intrinsics when ZF is set.
For Keylocker aesenc/aesdec intrinsics, current implementation
moves idata to odata unconditionally, which causes safety issue when
the instruction meets runtime error. So we add a branch to clear
odata when ZF is set after instruction exectution.
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_builtin):
Add branch to clear odata when ZF is set for asedecenc_expand
and wideaesdecenc_expand.
gcc/testsuite/ChangeLog:
* gcc.target/i386/keylocker-aesdec128kl.c: Update test.
* gcc.target/i386/keylocker-aesdec256kl.c: Likewise.
* gcc.target/i386/keylocker-aesdecwide128kl.c: Likewise.
* gcc.target/i386/keylocker-aesdecwide256kl.c: Likewise.
* gcc.target/i386/keylocker-aesenc128kl.c: Likewise.
* gcc.target/i386/keylocker-aesenc256kl.c: Likewise.
* gcc.target/i386/keylocker-aesencwide128kl.c: Likewise.
* gcc.target/i386/keylocker-aesencwide256kl.c: Likewise.
Eugene Rozenfeld [Thu, 1 Jul 2021 23:21:36 +0000 (16:21 -0700)]
Update gen_autofdo_event.py and gcc-auto-profile.
gen_autofdo_event.py was stumbling on models with stepping so
I updated the script to handle this case similar to the code in
https://github.com/andikleen/pmu-tools/blob/
c6a5f63aede19def8886d6a8b74d7a55c38ca947/event_download.py
The second change was to tolerate cases when the CPU supports PEBS but the
perf command with /p fails. This can happen in, e.g., a virtual machine.
I regenerated gcc-auto-profile using the updated script.
contrib/ChangeLog:
* gen_autofdo_event.py: handle stepping, non-working PEBS
gcc/ChangeLog:
* config/i386/gcc-auto-profile: regenerate
liuhongt [Wed, 30 Jun 2021 09:10:44 +0000 (17:10 +0800)]
Fix typo in standard pattern name of trunc<mode><pmov_dst_4>2.
gcc/ChangeLog
* config/i386/sse.md (trunc<mode><pmov_dst_4>2): Refined to ..
(trunc<mode><pmov_dst_4_lower>2): this.
GCC Administrator [Fri, 2 Jul 2021 00:16:47 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Thu, 1 Jul 2021 19:27:00 +0000 (12:27 -0700)]
soft-fp: Update soft-fp from glibc
This patch is updating soft-fp from glibc:
1. Add __extendhfxf2 to return an IEEE half converted to IEEE extended.
2. Add __truncxfhf2 to truncate IEEE extended into IEEE half.
These are needed by x86 _Float16 support.
* soft-fp/extendhfxf2.c: New file.
* soft-fp/truncxfhf2.c: Likewise.
David Malcolm [Thu, 1 Jul 2021 21:44:51 +0000 (17:44 -0400)]
input.c: move file caching globals to a new file_cache class
This moves some global state from input.c to a new file_cache class,
of which an instance is owned by global_dc. Various state is also
made private.
No functional change intended.
gcc/ChangeLog:
* diagnostic.h (diagnostic_context::m_file_cache): New field.
* input.c (class fcache): Rename to...
(class file_cache_slot): ...this, making most members private and
prefixing fields with "m_".
(file_cache_slot::get_file_path): New accessor.
(file_cache_slot::get_use_count): New accessor.
(file_cache_slot::missing_trailing_newline_p): New accessor.
(file_cache_slot::inc_use_count): New.
(fcache_buffer_size): Move to...
(file_cache_slot::buffer_size): ...here.
(fcache_line_record_size): Move to...
(file_cache_slot::line_record_size): ...here.
(fcache_tab): Delete, in favor of global_dc->m_file_cache.
(fcache_tab_size): Move to file_cache::num_file_slots.
(diagnostic_file_cache_init): Update for move of fcache_tab
to global_dc->m_file_cache.
(diagnostic_file_cache_fini): Likewise.
(lookup_file_in_cache_tab): Convert to...
(file_cache::lookup_file): ...this.
(diagnostics_file_cache_forcibly_evict_file): Update for move of
fcache_tab to global_dc->m_file_cache, moving most of
implementation to...
(file_cache::forcibly_evict_file): ...this new function and...
(file_cache_slot::evict): ...this new function.
(evicted_cache_tab_entry): Convert to...
(file_cache::evicted_cache_tab_entry): ...this.
(add_file_to_cache_tab): Convert to...
(file_cache::add_file): ...this, moving bulk of implementation
to...
(file_cache_slot::create): ..this new function.
(file_cache::file_cache): New.
(file_cache::~file_cache): New.
(lookup_or_add_file_to_cache_tab): Convert to...
(file_cache::lookup_or_add_file): ..this new function.
(fcache::fcache): Rename to...
(file_cache_slot::file_cache_slot): ...this, adding "m_" prefixes
to fields.
(fcache::~fcache): Rename to...
(file_cache_slot::~file_cache_slot): ...this, adding "m_" prefixes
to fields.
(needs_read): Convert to...
(file_cache_slot::needs_read_p): ...this.
(needs_grow): Convert to...
(file_cache_slot::needs_grow_p): ...this.
(maybe_grow): Convert to...
(file_cache_slot::maybe_grow): ...this.
(read_data): Convert to...
(file_cache_slot::read_data): ...this.
(maybe_read_data): Convert to...
(file_cache_slot::maybe_read_data): ...this.
(get_next_line): Convert to...
(file_cache_slot::get_next_line): ...this.
(goto_next_line): Convert to...
(file_cache_slot::goto_next_line): ...this.
(read_line_num): Convert to...
(file_cache_slot::read_line_num): ...this.
(location_get_source_line): Update for moving of globals to
global_dc->m_file_cache.
(location_missing_trailing_newline): Likewise.
* input.h (class file_cache_slot): New forward decl.
(class file_cache): New.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Sandra Loosemore [Thu, 1 Jul 2021 20:07:59 +0000 (13:07 -0700)]
Fortran: set version field in CFI_cdesc_t to CFI_VERSION
When converting a GFC descriptor to a CFI descriptor, it was
incorrectly copying the version number from the former to the latter.
It should be using the value of CFI_VERSION instead (currently 1).
Going the other direction, the GFC version field is initialized to
zero elsewhere, so do that here too.
2021-06-30 Tobias Burnus <tobias@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
libgfortran/
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc):
Initialize version field to 0.
(gfc_desc_to_cfi_desc): Initialize version field to CFI_VERSION.
Michael Meissner [Thu, 1 Jul 2021 18:50:34 +0000 (14:50 -0400)]
Add IEEE 128-bit fp conditional move on PowerPC.
This patch adds the support for power10 IEEE 128-bit floating point conditional
move and for automatically generating min/max.
In this patch, I simplified things compared to previous patches. Instead of
allowing any four of the modes to be used for the conditional move comparison
and the move itself could use different modes, I restricted the conditional
move to just the same mode. I.e. you can do:
_Float128 a, b, c, d, e, r;
r = (a == b) ? c : d;
But you can't do:
_Float128 c, d, r;
double a, b;
r = (a == b) ? c : d;
or:
_Float128 a, b;
double c, d, r;
r = (a == b) ? c : d;
This eliminates a lot of the complexity of the code, because you don't have to
worry about the sizes being different, and the IEEE 128-bit types being
restricted to Altivec registers, while the SF/DF modes can use any VSX
register.
I did not modify the existing support that allowed conditional moves where
SFmode operands are compared and DFmode operands are moved (and vice versa).
I modified the test cases that I added to reflect this change. I have also
fixed the test for not equal to use '!=' instead of '=='.
2021-07-01 Michael Meissner <meissner@linux.ibm.com>
gcc/
* config/rs6000/rs6000.c (rs6000_maybe_emit_fp_cmove): Add IEEE
128-bit floating point conditional move support.
(have_compare_and_set_mask): Add IEEE 128-bit floating point
types.
* config/rs6000/rs6000.md (mov<mode>cc, IEEE128 iterator): New insn.
(mov<mode>cc_p10, IEEE128 iterator): New insn.
(mov<mode>cc_invert_p10, IEEE128 iterator): New insn.
(fpmask<mode>, IEEE128 iterator): New insn.
(xxsel<mode>, IEEE128 iterator): New insn.
gcc/testsuite/
* gcc.target/powerpc/float128-cmove.c: New test.
* gcc.target/powerpc/float128-minmax-3.c: New test.
Jonathan Wakely [Wed, 30 Jun 2021 23:30:54 +0000 (00:30 +0100)]
libstdc++: Improvements to Doxygen markup
This attempst to improve the doxygen output to work around what seems to
be some bugs in doxygen (issues 8635 and 8638).
The @addtogroup command doesn't work for entities inside a nested
namespace (see 8635) so we need to close and reopen groups on entering
and elaving nested namespaces. This fixes the problem that
chrono::duration and chrono::time_point were not documented in the
"Time" documentation group. I am unable to make the path classes appear
as part of their relevant groups (File System and Filesystem TS), nor
the contents of <exception> or <system_error>. I have made some minor
improvements to the docs for those types, including starting to address
PR 97001 by adding @since to the doxygen comments.
This change also excludes the <experimental/bits/net.h> header from
Doxygen processing, so we don't get an unwanted "Networking-ts" group
in the documentation.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* doc/doxygen/doxygroups.cc: Fix docs for std::literals.
* doc/doxygen/user.cfg.in: Exclude the Networking TS header.
Add some more predefined macros.
* include/bits/fs_fwd.h: Move @addtogroup commands inside
namespaces. Add better documentation.
* include/bits/fs_path.h: Likewise.
* include/experimental/bits/fs_fwd.h: Likewise.
* include/experimental/bits/fs_path.h: Likewise.
* include/ext/throw_allocator.h: Fix typo and improve docs.
* include/std/chrono: Move @addtogroup commands.
* include/std/system_error: Move @addtogroup commands.
* libsupc++/exception: Improve documentation.
* libsupc++/exception.h: Add @since documentation.
Eric Botcazou [Thu, 1 Jul 2021 16:06:46 +0000 (18:06 +0200)]
Improve packed record layout support with -fdump-ada-spec
We cannot fully support packed record layout in -fdump-ada-spec, as packing
in C and Ada does not behave the same, so we issue a warning. But simple
cases are OK and can actually be handled without much work.
gcc/c-family/
* c-ada-spec.c (packed_layout): New global variable.
(dump_ada_declaration): Set it upon seeing a packed record type.
Do not put the "aliased" keyword if it is set.
(dump_ada_structure): Add Pack aspect if it is set and clear it.
gcc/testsuite/
* c-c++-common/dump-ada-spec-14.c: Adjust dg-warning directive.
Eric Botcazou [Thu, 1 Jul 2021 16:02:47 +0000 (18:02 +0200)]
Fix duplicate name issues in output of -fdump-ada-spec #2
This extends the type name conflict detection mechanism to variables.
gcc/c-family/
* c-ada-spec.c (check_name): Rename into...
(check_type_name_conflict): ...this. Minor tweak.
(dump_ada_function_declaration): Adjust to above renaming.
(dump_ada_array_domains): Fix oversight.
(dump_ada_declaration): Call check_type_name_conflict for variables.
Eric Botcazou [Thu, 1 Jul 2021 15:57:16 +0000 (17:57 +0200)]
Use intermediate integer type with proper signedness
This is a minor regression present on mainline and 11 branch, whereby the
value of the Enum_Rep attribute is always unsigned.
gcc/ada/
PR ada/101094
* exp_attr.adb (Get_Integer_Type): Return an integer type with the
same signedness as the input type.
Iain Sandoe [Thu, 1 Jul 2021 14:02:43 +0000 (15:02 +0100)]
Darwin: Define a suitable section name for CTF [PR101283]
This is a placeholder name ahead of any CTF implementation on
LLVM (which sets Darwin ABI). Ideally, we would get agreement
on this choice (or any replacement) before GCC12 is shipped.
PR debug/101283 - Several tests fail on Darwin with -gctf
PR debug/101283
gcc/ChangeLog:
* config/darwin.h (CTF_INFO_SECTION_NAME): New.
H.J. Lu [Mon, 7 Jun 2021 21:23:04 +0000 (14:23 -0700)]
x86: Add vec_duplicate<mode> expander
Add vec_duplicate<mode> expander for SSE2 if we can move from GPR to SSE
register directly.
* config/i386/i386-expand.c (ix86_expand_vector_init_duplicate):
Make it global.
* config/i386/i386-protos.h (ix86_expand_vector_init_duplicate):
New prototype.
* config/i386/sse.md (INT_BROADCAST_MODE): New mode iterator.
(vec_duplicate<mode>): New expander.
H.J. Lu [Wed, 2 Jun 2021 14:15:45 +0000 (07:15 -0700)]
x86: Convert CONST_WIDE_INT/CONST_VECTOR to broadcast
1. Update move expanders to convert the CONST_WIDE_INT and CONST_VECTOR
operands to vector broadcast from an integer with AVX.
2. Add ix86_gen_scratch_sse_rtx to return a scratch SSE register which
won't increase stack alignment requirement and blocks transformation by
the combine pass.
A small benchmark:
https://gitlab.com/x86-benchmarks/microbenchmark/-/tree/memset/broadcast
shows that broadcast is a little bit faster on Intel Core i7-8559U:
$ make
gcc -g -I. -O2 -c -o test.o test.c
gcc -g -c -o memory.o memory.S
gcc -g -c -o broadcast.o broadcast.S
gcc -g -c -o vec_dup_sse2.o vec_dup_sse2.S
gcc -o test test.o memory.o broadcast.o vec_dup_sse2.o
./test
memory : 147215
broadcast : 121213
vec_dup_sse2: 171366
$
broadcast is also smaller:
$ size memory.o broadcast.o
text data bss dec hex filename
132 0 0 132 84 memory.o
122 0 0 122 7a broadcast.o
$
3. Update PR 87767 tests to expect integer broadcast instead of broadcast
from memory.
4. Update avx512f_cond_move.c to expect integer broadcast.
A small benchmark:
https://gitlab.com/x86-benchmarks/microbenchmark/-/tree/vpaddd/broadcast
shows that integer broadcast is faster than embedded memory broadcast:
$ make
gcc -g -I. -O2 -march=skylake-avx512 -c -o test.o test.c
gcc -g -c -o memory.o memory.S
gcc -g -c -o broadcast.o broadcast.S
gcc -o test test.o memory.o broadcast.o
./test
memory : 425538
broadcast : 375260
$
gcc/
PR target/100865
* config/i386/i386-expand.c (ix86_expand_vector_init_duplicate):
New prototype.
(ix86_byte_broadcast): New function.
(ix86_convert_const_wide_int_to_broadcast): Likewise.
(ix86_expand_move): Convert CONST_WIDE_INT to broadcast if mode
size is 16 bytes or bigger.
(ix86_broadcast_from_integer_constant): New function.
(ix86_expand_vector_move): Convert CONST_WIDE_INT and CONST_VECTOR
to broadcast if mode size is 16 bytes or bigger.
* config/i386/i386-protos.h (ix86_gen_scratch_sse_rtx): New
prototype.
* config/i386/i386.c (ix86_gen_scratch_sse_rtx): New function.
gcc/testsuite/
PR target/100865
* gcc.target/i386/avx512f-broadcast-pr87767-1.c: Expect integer
broadcast.
* gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512f_cond_move.c: Also pass
-mprefer-vector-width=512 and expect integer broadcast.
* gcc.target/i386/pr100865-1.c: New test.
* gcc.target/i386/pr100865-2.c: Likewise.
* gcc.target/i386/pr100865-3.c: Likewise.
* gcc.target/i386/pr100865-4a.c: Likewise.
* gcc.target/i386/pr100865-4b.c: Likewise.
* gcc.target/i386/pr100865-5a.c: Likewise.
* gcc.target/i386/pr100865-5b.c: Likewise.
* gcc.target/i386/pr100865-6a.c: Likewise.
* gcc.target/i386/pr100865-6b.c: Likewise.
* gcc.target/i386/pr100865-6c.c: Likewise.
* gcc.target/i386/pr100865-7a.c: Likewise.
* gcc.target/i386/pr100865-7b.c: Likewise.
* gcc.target/i386/pr100865-7c.c: Likewise.
* gcc.target/i386/pr100865-8a.c: Likewise.
* gcc.target/i386/pr100865-8b.c: Likewise.
* gcc.target/i386/pr100865-8c.c: Likewise.
* gcc.target/i386/pr100865-9a.c: Likewise.
* gcc.target/i386/pr100865-9b.c: Likewise.
* gcc.target/i386/pr100865-9c.c: Likewise.
* gcc.target/i386/pr100865-10a.c: Likewise.
* gcc.target/i386/pr100865-10b.c: Likewise.
* gcc.target/i386/pr100865-11a.c: Likewise.
* gcc.target/i386/pr100865-11b.c: Likewise.
* gcc.target/i386/pr100865-11c.c: Likewise.
* gcc.target/i386/pr100865-12a.c: Likewise.
* gcc.target/i386/pr100865-12b.c: Likewise.
* gcc.target/i386/pr100865-12c.c: Likewise.
Uros Bizjak [Thu, 1 Jul 2021 14:57:57 +0000 (16:57 +0200)]
i386: Return true/false instead of 1/0 from predicates.
No functional changes.
2021-07-01 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* config/i386/predicates.md (ix86_endbr_immediate_operand):
Return true/false instead of 1/0.
(movq_parallel): Ditto.
Uros Bizjak [Thu, 1 Jul 2021 14:52:11 +0000 (16:52 +0200)]
Return true/false instead of 1/0 from generic predicates.
No functional changes.
2021-07-01 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* recog.c (general_operand): Return true/false instead of 1/0.
(register_operand): Ditto.
(immediate_operand): Ditto.
(const_int_operand): Ditto.
(const_scalar_int_operand): Ditto.
(const_double_operand): Ditto.
(push_operand): Ditto.
(pop_operand): Ditto.
(memory_operand): Ditto.
(indirect_operand): Ditto.