aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-05-07Remove obsolete Solaris 11.3 supportRainer Orth25-977/+43
Support for Solaris 11.3 had already been obsoleted in GCC 13. However, since the only Solaris system in the cfarm was running 11.3, I've kept it in tree until now when both Solaris 11.4/SPARC and x86 systems have been added. This patch actually removes the Solaris 11.3 support. Apart from several minor simplifications, there are two more widespread changes: * In Solaris 11.4, libsocket and libnsl were folded into libc, so there's no longer a need to link them explictly. * Since Solaris 11.4, Solaris includes all crts needed by gcc (like crt1.o and gcrt1.o) with the base system. All workarounds to provide fallbacks can thus go. Bootstrapped without regressions on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (as/ld, gas/ld, and gas/gld) as well as Solaris 11.3/x86 to ascertain that version is actually rejected. 2024-04-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> c++tools: * configure.ac (ax_lib_socket_nsl.m4): Don't sinclude. (AX_LIB_SOCKET_NSL): Don't call. (NETLIBS): Remove. * configure: Regenerate. * Makefile.in (NETLIBS): Remove. (g++-mapper-server$(exeext)): Remove $(NETLIBS). gcc: * config.gcc: Move *-*-solaris2.11.[0-3]* to unsupported list. <*-*-solaris2*> (default_use_cxa_atexit): Set unconditionally. * configure.ac (AX_LIB_SOCKET_NSL): Don't call. (NETLIBS): Remove. (gcc_cv_ld_aligned_shf_merge): Remove. (hidden_linkonce) <i?86-*-solaris2* | x86_64-*-solaris2*>: Remove. (gcc_cv_target_dl_iterate_phdr) <*-*-solaris2*>: Always set to yes. * Makefile.in (NETLIBS): Remove. * configure, config.in, aclocal.m4: Regenerate. * config/sol2.h: Don't check HAVE_SOLARIS_CRTS. (STARTFILE_SPEC): Remove !HAVE_SOLARIS_CRTS case. [USE_GLD] (LINK_EH_SPEC): Remove TARGET_DL_ITERATE_PHDR guard. * config/i386/i386.cc (USE_HIDDEN_LINKONCE): Remove guard. * varasm.cc (mergeable_string_section): Remove HAVE_LD_ALIGNED_SHF_MERGE handling. (mergeable_constant_section): Likewise. * doc/install.texi (Specific,i?86-*-solaris2*): Reference Solaris 11.4 only. (Specific, *-*-solaris2*): Document Solaris 11.3 removal. Remove 11.3 references and caveats. Update for 11.4. gcc/cp: * Make-lang.in (cc1plus$(exeext)): Remove $(NETLIBS). gcc/objcp: * Make-lang.in (cc1objplus$(exeext)): Remove $(NETLIBS). gcc/testsuite: * lib/target-supports.exp (check_effective_target_pie): Always enable on *-*-solaris2*. libgcc: * configure.ac <*-*-solaris2*> (libgcc_cv_solaris_crts): Remove. * config.host <*-*-solaris2*>: Remove !libgcc_cv_solaris_crts support. * configure, config.in: Regenerate. * config/sol2/gmon.c (internal_mcount) [!HAVE_SOLARIS_CRTS]: Remove. * config/i386/sol2-c1.S, config/sparc/sol2-c1.S: Remove. * config/sol2/t-sol2 (crt1.o, gcrt1.o): Remove. libstdc++-v3: * testsuite/lib/dg-options.exp (add_options_for_net_ts) <*-*-solaris2*>: Don't link with -lsocket -lnsl.
2024-05-07Revert "Revert "combine: Don't combine if I2 does not change""Richard Biener1-0/+11
This reverts commit 109f1b28fc94c93096506e3df0c25e331cef19d0.
2024-05-07ada: Fix calculation of tasks in null arraysPiotr Trojanek1-1/+2
Fix handling of null arrays when calculating the secondary stack size for the binder. gcc/ada/ * sem_util.adb (Number_Of_Elements_In_Array): Fix counting of elements in null arrays; remove redundant parenthesis; avoid run-time conversion of 1 to universal integer.
2024-05-07ada: Prevent calculation of negative stack countsPiotr Trojanek7-20/+20
Negative numbers of stack counts have no meaning. gcc/ada/ * lib.ads, lib.adb (Primary_Stack_Count, Sec_Stack_Count, Increment_Primary_Stack_Count, Increment_Sec_Stack_Count, Unit_Record): Stack counts are never negative. * ali.ads (Unit_Record): Likewise. * bindgen.adb (Num_Primary_Stacks, Num_Sec_Stacks): Likewise. * exp_ch3.adb (Count_Default_Sized_Task_Stacks): Likewise. * sem_util.ads, sem_util.adb (Number_Of_Elements_In_Array): Likewise.
2024-05-07ada: Cleanup calculation of task stacksPiotr Trojanek1-18/+13
Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch3.adb (Count_Default_Sized_Task_Stacks): Do not look for tasks inside record discriminants; remove avoid repeated call to Has_Task that happened for record components. (Expand_N_Object_Declaration): Use high-level routine to detect array types and subtypes; remove unused initial values.
2024-05-07ada: Fix grammar in commentPiotr Trojanek1-1/+1
Code cleanup. gcc/ada/ * exp_aggr.ads (Static_Array_Aggregate): Fix typo in comment.
2024-05-07ada: Remove redundant guard against empty list of declarationsPiotr Trojanek1-2/+1
Code cleanup. gcc/ada/ * inline.adb (Has_Single_Return): Remove redundant check for empty list, because First works also for empty list.
2024-05-07ada: Remove redundant guard against empty list of actionsPiotr Trojanek1-14/+11
Code cleanup. gcc/ada/ * exp_ch4.adb (Useful): Remove redundant check for empty list, because iteration with First works also for empty list; rename local variable from L to Action.
2024-05-07ada: Cleanup detection of per-object constraints in inlining for SPARKPiotr Trojanek1-14/+14
In GNATprove mode we didn't inline subprograms whose formal parameters was of a record type with constraints depending on discriminants. Now this is extended to formal parameters with per-object constraints, regardless if they come from references to discriminants or from attributes prefixed by the current type instance. gcc/ada/ * inline.adb (Has_Formal_With_Per_Object_Constrained_Component): Use flag Has_Per_Object_Constraint which is set by analysis; rename for consistency.
2024-05-07ada: Simplify detection of the enclosing scopePiotr Trojanek1-4/+1
Code cleanup; behaviour is unaffected. gcc/ada/ * sem_attr.adb (Analyze_Access_Attribute): Replace loop with Current_Scope_No_Loops.
2024-05-07ada: Reduce scope in the analysis of access attributesPiotr Trojanek1-7/+8
Code cleanup; semantics is unaffected. gcc/ada/ * sem_attr.adb (Analyze_Access_Attribute): Move code to IF branch where its result is used.
2024-05-07ada: Fix detection of components with per-object constraintsPiotr Trojanek2-80/+14
Routine Contains_POC (where POC means "per-object constraint") was failing to detect expressions of the form "Current_Type'Access", because it was comparing prefix (typically an N_Identifier) with a scope (typically an N_Definining_Entity). This was harmless, because these expressions are detected anyway in Analyze_Access_Attribute, together with uses of 'Unconstrained_Access and 'Unchecked_Access. Also, this routine was failing to detect the use of discriminants in array types with constrained subtype indication, e.g.: type T (D : Integer) is record C : array (Integer range 1 .. D); end record; It is simpler to just reuse Has_Discriminant_Dependent_Constraint and leave detection of access attributes to Analyze_Access_Attribute. gcc/ada/ * sem_attr.adb (Analyze_Access_Attribute): Prevent search from going too far. * sem_ch3.adb (Analyze_Component_Declaration): Remove Contains_POC; reuse Has_Discriminant_Dependent_Constraint.
2024-05-07ada: Fix bad interaction between homogeneous finalization master and BIP ↵Eric Botcazou11-523/+32
protocol Dynamically-allocated objects that require finalization are attached to a finalization master, which is of a (limited) controlled type declared in the System.Finalization_Masters unit. Now there are two kinds of them: homogeneous and heterogeneous; for the former, all the objects attached to the master share the same Finalize_Address primitive whereas, for the latter, they may have different Finalize_Address primitives. There is a problem in this scheme with the BIP protocol, because this protocol forwards the finalization master from callers to callees and it does so even if the result types are distinct, so it is possible for a homogeneous finalization master to end up containing objects with different Finalize_Address primitives; in that case, the object attached last wins and sets the common Finalize_Address, which is then used to finalize other objects with unpredictable outcome (and very loud valgrind report). Therefore, this change gets rid of homogeneous finalization masters and also streamlines the implementation of heterogeneous ones by storing the Finalize_Address primitive on a per object basis in the FM_Node record. gcc/ada/ * einfo.ads (Pending_Access_Types): Delete. * exp_ch3.adb (Freeze_Type.Process_Pending_Access_Types): Likewise. (Freeze_Type): Do not call Process_Pending_Access_Types. * exp_ch7.ads (Make_Set_Finalize_Address_Call): Delete. * exp_ch7.adb (Build_Finalization_Master.Add_Pending_Access_Type): Delete. (Build_Finalization_Master): Do not set Finalize_Address on the master or call Add_Pending_Access_Type. (Make_Set_Finalize_Address_Call): Delete. * gen_il-fields.ads (Opt_Field_Enum): Remove Pending_Access_Types. * gen_il-gen-gen_entities.adb (Type_Kind): Likewise. * rtsfind.ads (RE_Id): Remove RE_Set_Finalize_Address. (RE_Unit_Table): Likewise. * sem_ch3.adb (Analyze_Full_Type_Declaration): Do not deal with pending access types. * libgnat/s-finmas.ads (Attach_Unprotected): Add Finalize_Address second parameter. (Delete_Finalize_Address_Unprotected): Delete. (Finalize_Address): Likewise. (Finalize_Address_Unprotected): Likewise. (Is_Homogeneous): Likewise. (Set_Finalize_Address): Likewise. (Set_Finalize_Address_Unprotected): Likewise. (Set_Heterogeneous_Finalize_Address_Unprotected): Likewise. (Set_Is_Heterogeneous): Likewise. (FM_Node): Add Finalize_Address component. (Finalization_Master): Remove Is_Homogeneous and Finalize_Address components. * libgnat/s-finmas.adb: Remove with & use clauses for System.HTable. (Finalize_Address_Table): Delete. (Attach_Unprotected): Add Finalize_Address second parameter and save its value in the Finalize_Address field of the node. (Delete_Finalize_Address_Unprotected): Delete. (Finalize): Call Finalize_Address saved in the nodes. (Finalize_Address): Delete. (Finalize_Address_Unprotected): Likewise. (Hash): Likewise. (Is_Homogeneous): Likewise. (Print_Master): Adjust. (Set_Finalize_Address): Delete. (Set_Finalize_Address_Unprotected): Likewise. (Set_Heterogeneous_Finalize_Address_Unprotected): Likewise. (Set_Is_Heterogeneous): Likewise. * libgnat/s-stposu.adb (Finalize_Address_Table_In_Use): Likewise. (Allocate_Any_Controlled): Pass Fin_Address to Attach_Unprotected and remove obsolete processing. (Deallocate_Any_Controlled): Remove obsolete processing. (Set_Pool_Of_Subpool): Do not call Set_Is_Heterogeneous.
2024-05-07ada: Add Global contracts to Ada.Numerics.Generic_Elementary_FunctionsJoffrey Huguet1-46/+74
GNATprove raised warnings about unspecified Global contracts when using functions from an instance of Ada.Numerics.Generic_Elementary_Functions. This patch adds null Global contracts to all subprograms. gcc/ada/ * libgnat/a-ngelfu.ads (Sqrt): Add Global contracts. (Log): Likewise. (Exp): Likewise. ("**"): Likewise. (Sin): Likewise. (Cos): Likewise. (Tan): Likewise. (Cot): Likewise. (Arcsin): Likewise. (Arccos): Likewise. (Arctan): Likewise. (Arccot): Likewise. (Sinh): Likewise. (Cosh): Likewise. (Tanh): Likewise. (Coth): Likewise. (Arcsinh): Likewise. (Arccosh): Likewise. (Arctanh): Likewise. (Arccoth): Likewise.
2024-05-07ada: Remove obsolete field Postconditions_ProcEric Botcazou3-8/+0
It is now totally unused by the front-end and dependent tools. gcc/ada/ * einfo.ads (Postconditions_Proc): Delete. * gen_il-fields.ads (Opt_Field_Enum): Remove Postconditions_Proc. * gen_il-gen-gen_entities.adb (E_Function): Likewise. (E_Procedure): Likewise. (E_Entry): Likewise. (E_Entry_Family): Likewise.
2024-05-07ada: Fix typo in documentation commentRonan Desplanques1-1/+1
gcc/ada/ * sinfo.ads: Fix typo.
2024-05-07ada: Fix crash on body postconditionBob Duff3-67/+13
This patch fixes a bug where the compiler could crash on a postcondition on a subprogram body (i.e. a body that "acts as spec"), if the postcondition contains 'Old attributes that use the Ada 2022 feature that allows certain conditionals (see RM-6.1.1). The main bug fix here is in exp_attr.adb to set Ins_Node properly in the Acts_As_Spec case. Otherwise, the initialization of the 'Old temp would occur before the declaration, which gigi does not like. gcc/ada/ * exp_attr.adb (Attribute_Old): The 'Old attribute we are processing here is in a postcondition, which cannot be inside the "Wrapped_Statements" of the subprogram with that postcondition. So remove the loop labeled "Climb the parent chain looking for subprogram _Wrapped_Statements". The only way this loop could find a Subp is if we are nested inside a subprogram that also has a postcondition, and in that case we would find the wrong (outer) one. In any case, Subp is set to Empty after the loop, so all subsequent tests for Present (Subp) are necessarily False; remove them and the corresponding code. Set Ins_Node unconditionally (to the right thing). Remove obsolete comments. * sem_util.adb (Determining_Expressions): Fix assertion; Pragma_Test_Case was missing. (Eligible_For_Conditional_Evaluation): Fix assert that could fail in case of errors. * libgnat/s-valspe.ads: Remove pragma Unevaluated_Use_Of_Old; there are no uses of 'Old in this package.
2024-05-07ada: Adapt proof of runtime unitsYannick Moy4-5/+24
Restore proof of runtime units after changes in SPARK. gcc/ada/ * libgnat/a-strsea.adb (Index): Add assertions. * libgnat/a-strsup.ads ("="): Remove useless precondition. * libgnat/s-aridou.adb (Prove_Rounding_Case): Add assertions. (Lemma_Shift_Right): Add call to lemma. * libgnat/s-arit32.adb (Prove_Rounding_Case): Add assertion. (Prove_ Signs): Add assertions. (Scaled_Divide32): Add assertions.
2024-05-07Update copyright years.Marc Poulhiès2-2/+2
2024-05-07ada: Improve pragma No_Return's pre-Ada2022 handling of functionsSteve Baird1-69/+97
Ada 2022 allows pragma No_Return to apply to a function (or a generic function). For earlier Ada versions, if a No_Return pragma argument's possible resolutions include a function (or a generic function) then we want to ignore that candidate if a non-function candidate is also available and otherwise to generate an error message mentioning that this is an Ada 2022 feature. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Restructure the loop over possible resolutions of a No_Return pragma's argument so that functions (and generic functions) are not processed until after it is known whether there is a non-function candidate resolution. For a pre-2022 Ada version, terminate the iteration before processing functions if a non-function resolution is found.
2024-05-07ada: Fix LTO type mismatches in GNAT.Sockets.ThinEric Botcazou2-18/+170
The default implementation of GNAT.Sockets.Thin is mainly used on Linux and the socklen_t type used in various routines of the BSD sockets C API is a typedef for unsigned int there, so importing it as Interface.C.int will be flagged as a type mismatch during LTO compilation. gcc/ada/ * libgnat/g-socthi.ads (C_Bind): Turn into inline function. (C_Getpeername): Likewise. (C_Getsockname): Likewise. (C_Getsockopt): Likewise. (C_Setsockopt): Likewise. (Nonreentrant_Gethostbyaddr): Likewise. * libgnat/g-socthi.adb (Syscall_Accept): Adjust profile. (Syscall_Connect): Likewise. (Syscall_Recvfrom): Likewise. (Syscall_Sendto): Likewise. (C_Bind): New function. (C_Accept): Adjust to above change for profiles. (C_Connect): Likewise. (C_Getpeername): New function. (C_Getsockname): Likewise. (C_Getsockopt): Likewise. (C_Recvfrom): Adjust to above change for profiles. (C_Setsockopt): New function. (Nonreentrant_Gethostbyaddr): Likewise.
2024-05-07ada: Aspects on multiple component declarationsBob Duff10-59/+45
This patch fixes a bug where aspect specifications were ignored on all but the last of multiple component declarations. For example, in a record type with components "X, Y: T with Volatile;" only Y was marked Volatile; X was not. Both should be marked Volatile. The fix is in Par.Ch3.P_Component_Items, where P_Aspect_Specifications needs to be called each time through the loop. In addition, various minor cleanups. gcc/ada/ * par-ch3.adb (P_Component_Items): Move P_Aspect_Specifications into the loop, so aspects can be attached to multiple component declarations. (P_Type_Declaration, P_Subtype_Declaration) (P_Known_Discriminant_Part_Opt): Remove default for Semicolon in calls to P_Aspect_Specifications. * gen_il-gen-gen_nodes.adb (N_Discriminant_Specification): Add Aspect_Specifications field to N_Discriminant_Specification, which was missing. * aspects.adb (Has_Aspect_Specifications_Flag): Make it True for N_Discriminant_Specification. * par-ch13.adb: Remove default for Semicolon in calls to P_Aspect_Specifications. (Get_Aspect_Specifications): Misc cleanup. (P_Aspect_Specifications): Remove comment. It's not clear what "the flag" is referring to, but anyway the first part of the comment is obvious, and the second part is apparently obsolete. Misc cleanup. * par.adb (P_Aspect_Specifications, Get_Aspect_Specifications): Remove default for Semicolon; calls are more readable that way. Improve comments. * par-ch12.adb: Remove default for Semicolon in calls to P_Aspect_Specifications. * par-ch6.adb: Likewise. * par-ch7.adb: Likewise. * par-ch9.adb: Likewise. * par-endh.adb: Likewise.
2024-05-07ada: Bad internal naming when using pragma Compile_Time_ErrorJustin Squirek1-1/+17
This patch fixes an error in the compiler whereby the presence of a condition which tests the size of a type not known at compile time within an instance of pragma Compile_Time_Error causes incorrect internal names to be generated for said type during expansion. gcc/ada/ * sem_prag.adb (Defer_Compile_Time_Warning_Error_To_BE): Better handle itypes such that the tree copy required for the expansion of the pragma doesn't cause ordering problems with internal names.
2024-05-07ada: Fix missing flag for GNATproveYannick Moy1-0/+11
GNATprove expects the frontend to position correctly range check flags, on expressions which might lead to a range check failure. This was missing on in-out parameters of calls. Now fixed. There is no impact on compilation. gcc/ada/ * sem_res.adb (Resolve_Actuals): Add range check flag.
2024-05-07ada: Fix spurious error on generic state in SPARKYannick Moy1-0/+8
The public state of a generic package needs not be part of the state of the enclosing unit, only the state of instantiations need to be accounted for in the enclosing package. Now fixed. gcc/ada/ * sem_util.adb (Find_Placement_In_State_Space): Stop search for placement when reaching the public state of a generic package.
2024-05-07ada: Reject non-statically compatible extended return statementJavier Miranda2-2/+27
Add missing check of RM 6.5(5.3/5): when the result subtype of the function is defined by a subtype mark, the subtype defined by the subtype indication of the extended return statement shall be statically compatible with the result subtype of the function. gcc/ada/ * sem_ch3.adb (Check_Return_Subtype_Indication): Add missing check on statically compatible subtypes. * sem_eval.adb (Subtypes_Statically_Compatible): Ensure that both types are either scalar types or access types to evaluate this predicate.
2024-05-07ada: Minor comment improvementBob Duff1-1/+1
Clarify comment about selectors. gcc/ada/ * sem_ch13.adb (Resolve_Name): Clarify comment.
2024-05-07ada: Fix bug in overloaded selected_components in aspect_specificationsBob Duff1-4/+11
This patch fixes a bug where if a selected_component X.Y appears in an aspect_specification, and there are two or more overloaded Y's in X, then it can choose the wrong one, leading to subsequent type errors. It was always picking the last declaration of Y, and leaving Entity set to that. We now reset Entity (as for the already-existing code for N_Identifier just below). Note that Resolve_Aspect_Expressions is called only for aspect_specifications, and not even all aspect_specifications, so the bug didn't occur for other names. For example, Resolve_Aspect_Expressions is not called for aspect_specifications in the visible part of a library package if there is no private part. gcc/ada/ * sem_ch13.adb (Resolve_Name): This is called only for names in aspect_specifications. If the name is an overloaded selected_component, reset the Entity. Note that this was already done for N_Identifier in the code just below.
2024-05-07ada: Fix Program_Error raised during generation of data representation in JSONEric Botcazou1-0/+6
This happens for the extension of a private discriminated tagged type. gcc/ada/ * repinfo.adb (List_Record_Info.List_Structural_Record_Layout): Add another guard for private types after retrieving the parent in the extension case.
2024-05-07ada: SPARK rule changed on functions with side effectsYannick Moy1-0/+5
SPARK RM definition of function with side effects now makes them implicitly volatile functions. gcc/ada/ * sem_util.adb (Is_Volatile_Function): Return True on functions with side effects.
2024-05-07ada: Accept constants of access types as globals of side-effect functionPiotr Trojanek1-1/+3
Complete support for functions with side-effects. gcc/ada/ * sem_prag.adb (Analyze_Global_Item): Handle side-effect functions like procedures.
2024-05-07ada: Update comment about implicit inputs of Depends contractPiotr Trojanek1-2/+1
Sync comment with the updated SPARK RM rules. gcc/ada/ * sem_prag.adb (Collect_Global_Item): Update comment.
2024-05-07Mention that some options are turned on by `-Ofast` in their descriptions ↵Andrew Pinski1-19/+22
[PR97263] Like was done for -ffast-math in r0-105946-ga570fc16fa8056, we should document that -Ofast enables -fmath-errno, -funsafe-math-optimizations, -finite-math-only, -fno-trapping-math in their documentation. Note this changes the stronger "must not" to be "is not" for -fno-trapping-math since we do enable it for -Ofast already. gcc/ChangeLog: PR middle-end/97263 * doc/invoke.texi(fmath-errno): Document it is turned on with -Ofast. (funsafe-math-optimizations): Likewise. (ffinite-math-only): Likewise. (fno-trapping-math): Likewise and use less strong language. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-05-07Extend usdot_prodv*qi with vpmaddwd when AVXVNNI/AVX512VNNI is not available.liuhongt1-14/+41
gcc/ChangeLog: * config/i386/sse.md (usdot_prodv*qi): Extend to VI1_AVX512 with vpmaddwd when avxvnni/avx512vnni is not available.
2024-05-07Support dot_prod optabs for 64-bit vector.liuhongt4-0/+571
gcc/ChangeLog: PR target/113079 * config/i386/mmx.md (usdot_prodv8qi): New expander. (sdot_prodv8qi): Ditto. (udot_prodv8qi): Ditto. (usdot_prodv4hi): Ditto. (udot_prodv4hi): Ditto. (sdot_prodv4hi): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr113079.c: New test. * gcc.target/i386/pr113079-2.c: New test. * gcc.target/i386/sse4-pr113079-2.c: New test.
2024-05-07Optimize 64-bit vector permutation with punpcklqdq + 128-bit vector pshuf.liuhongt2-0/+96
gcc/ChangeLog: PR target/113090 * config/i386/i386-expand.cc (expand_vec_perm_punpckldq_pshuf): New function. (ix86_expand_vec_perm_const_1): Try expand_vec_perm_punpckldq_pshuf for sequence of 2 instructions. gcc/testsuite/ChangeLog: * gcc.target/i386/pr113090.c: New test.
2024-05-07pru: New validation pass for minrtDimitar Dimitrov10-0/+168
Add a new pru-specific pass to validate that the assumptions for the minimal C runtime are not violated by the user program. gcc/ChangeLog: * config/pru/pru-passes.cc (class pass_pru_minrt_check): New pass. (pass_pru_minrt_check::execute): New method. (make_pru_minrt_check): New function. * config/pru/pru-passes.def (INSERT_PASS_AFTER): Register the minrt check pass. * config/pru/pru-protos.h (make_pru_minrt_check): Add declaration. gcc/testsuite/ChangeLog: * g++.target/pru/minrt-1.cc: New test. * g++.target/pru/minrt-2.cc: New test. * g++.target/pru/minrt-3.cc: New test. * g++.target/pru/pru.exp: New test. * gcc.target/pru/minrt-1.c: New test. * gcc.target/pru/minrt-2.c: New test. * gcc.target/pru/minrt-3.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Refactor to use passes definition fileDimitar Dimitrov5-27/+36
Switch to using a passes definition file instead of explicitly registering the PRU-specific passes in pru.cc. This would make it cleaner to add new PRU-specific passes. There are no functional changes. gcc/ChangeLog: * config/pru/pru-passes.cc (class pass_tiabi_check): Rename to add "pru_" prefix. (class pass_pru_tiabi_check): Ditto. (pass_tiabi_check::execute): Ditto. (pass_pru_tiabi_check::execute): Ditto. (make_pru_tiabi_check): Ditto. (pru_register_abicheck_pass): Remove. * config/pru/pru-protos.h (pru_register_abicheck_pass): Remove. (make_pru_tiabi_check): Add declaration. * config/pru/pru.cc (pru_option_override): Remove explicit pass registration. * config/pru/t-pru: Register PRU passes definition file. * config/pru/pru-passes.def: New file. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Use HOST_WIDE_INT_1U macroDimitar Dimitrov1-2/+4
Use the HOST_WIDE_INT_1U macro instead of literal 1 when constructing constants for RTL. gcc/ChangeLog: * config/pru/pru.md (lshrdi3): Use HOST_WIDE_INT_1U macro. (ashldi3): Ditto. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Drop usage of ATTRIBUTE_UNUSEDDimitar Dimitrov3-17/+11
Remove usage of ATTRIBUTE_UNUSED. Instead remove the argument's name, which in C++ means that the argument would not be used. gcc/ChangeLog: * config/pru/pru-passes.cc: Drop ATTRIBUTE_UNUSED and remove argument's name. * config/pru/pru-pragma.cc (pru_pragma_ctable_entry): Ditto. * config/pru/pru.cc (pru_function_profiler): Ditto. (pru_can_eliminate): Ditto. (pru_rtx_costs): Ditto. (pru_insert_attributes): Ditto. (pru_function_value): Ditto. (pru_libcall_value): Ditto. (pru_return_in_memory): Ditto. (pru_builtin_decl): Ditto. (pru_expand_builtin): Ditto. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Skip register save if function will not returnDimitar Dimitrov3-0/+25
There is no need to store callee-saved registers in prologue if the function would never return. Size optimization is paramount for the microcontroller-class PRU. Some backends save some registers for noreturn functions. But for PRU debuggability is a less concern because GDB has not been ported yet for PRU. gcc/ChangeLog: * config/pru/pru.cc (prologue_saved_reg_p): Skip saving if function will not return. gcc/testsuite/ChangeLog: * gcc.target/pru/noreturn-prologue-1.c: New test. * gcc.target/pru/noreturn-prologue-2.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Add pattern variants for zero extending destinationDimitar Dimitrov5-9/+63
The higher bits in the result of some ALU operations are inherently always zero when all input operands are smaller than 32-bits. Add pattern variants to match when the resulting value is zero extended, so that all operations can be effectively executed in a single instruction. For PRU it simply means to use a wider register for destination. ALU operations which cannot be presented as zero-extending their destination are addition, subtraction and logical shift left. The PRU ALU performs all operations in 32-bit mode, so the carry-out and shifted-out bits would violate the assumption that ALU operation was performed in 16-bit or 8-bit mode, and result was zero-extended. gcc/ChangeLog: * config/pru/alu-zext.md (_noz0): New subst attribute. (<code>_impl): Allow zero-extending the destination. (<shift_op>): Remove unified pattern (ashl_impl): New distinct pattern. (lshr_impl): Ditto. (alu3_zext_op0_subst): New subst iterator to zero-extend the destination register. gcc/testsuite/ChangeLog: * gcc.target/pru/extzv-1.c: Update to mark the new more efficient generated code sequence. * gcc.target/pru/extzv-2.c: Ditto. * gcc.target/pru/extzv-3.c: Ditto. * gcc.target/pru/zero_extend-op0.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Optimize the extzv and insv patternsDimitar Dimitrov9-10/+194
Optimize the generated code for the bit-field extract and insert patterns: - Use bit-set and bit-clear instructions for 1-bit fields. - Expand to SImode operations instead of relying on the default expansion to word (QI) mode. gcc/ChangeLog: * config/pru/pru.md (extzv<mode>): Make it an expand pattern, handle efficiently zero-positioned bit-fields. (insv<mode>): New expand pattern. gcc/testsuite/ChangeLog: * gcc.target/pru/ashiftrt.c: Minor update due to new (but equivalent) generated code sequence. * gcc.target/pru/extzv-1.c: New test. * gcc.target/pru/extzv-2.c: New test. * gcc.target/pru/extzv-3.c: New test. * gcc.target/pru/insv-1.c: New test. * gcc.target/pru/insv-2.c: New test. * gcc.target/pru/insv-3.c: New test. * gcc.target/pru/insv-4.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Implement zero fill for 64-bit registersDimitar Dimitrov2-8/+29
Loading a constant zero in a 64-bit register now takes one instead of two instructions. gcc/ChangeLog: * config/pru/pru.md: New pattern alternative for zero-filling 64-bit registers. gcc/testsuite/ChangeLog: * gcc.target/pru/mov-0.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07pru: Implement TARGET_ADDRESS_COSTDimitar Dimitrov1-0/+25
Stop relying on the default fallback to TARGET_RTX_COST for PRU's addressing costs. Implement TARGET_ADDRESS_COST, in order to allow RTX cost refactoring in the future without affecting the addressing costs. No code generation changes are expected by this patch. No changes were detected when running embench-iot and building a few real-world firmware examples. gcc/ChangeLog: * config/pru/pru.cc (pru_address_cost): Implement address cost calculation. (TARGET_ADDRESS_COST): Define for PRU. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-07Update gennews for GCC 14.Jakub Jelinek1-0/+1
2024-05-07 Jakub Jelinek <jakub@redhat.com> * gennews (files): Add files for GCC 14.
2024-05-07tree-optimization/114921 - _Float16 -> __bf16 isn't noop fixupRichard Biener1-3/+3
The following further strengthens the check which convert expressions we allow to vectorize as simple copy by resorting to tree_nop_conversion_p on the vector components. PR tree-optimization/114921 * tree-vect-stmts.cc (vectorizable_assignment): Use tree_nop_conversion_p to identify converts we can vectorize with a simple assignment.
2024-05-07PR target/106060: Improved SSE vector constant materialization on x86.Roger Sayle12-13/+411
This patch resolves PR target/106060 by providing efficient methods for materializing/synthesizing special "vector" constants on x86. Currently there are three methods of materializing a vector constant; the most general is to load a vector from the constant pool, secondly "duplicated" constants can be synthesized by moving an integer between units and broadcasting (of shuffling it), and finally the special cases of the all-zeros vector and all-ones vectors can be loaded via a single SSE instruction. This patch handle additional cases that can be synthesized in two instructions, loading an all-ones vector followed by another SSE instruction. Following my recent patch for PR target/112992, there's conveniently a single place in i386-expand.cc where these special cases can be handled. Two examples are given in the original bugzilla PR for 106060. __m256i should_be_cmpeq_abs () { return _mm256_set1_epi8 (1); } is now generated (with -O3 -march=x86-64-v3) as: vpcmpeqd %ymm0, %ymm0, %ymm0 vpabsb %ymm0, %ymm0 ret and __m256i should_be_cmpeq_add () { return _mm256_set1_epi8 (-2); } is now generated as: vpcmpeqd %ymm0, %ymm0, %ymm0 vpaddb %ymm0, %ymm0, %ymm0 ret 2024-05-07 Roger Sayle <roger@nextmovesoftware.com> Hongtao Liu <hongtao.liu@intel.com> gcc/ChangeLog PR target/106060 * config/i386/i386-expand.cc (enum ix86_vec_bcast_alg): New. (struct ix86_vec_bcast_map_simode_t): New type for table below. (ix86_vec_bcast_map_simode): Table of SImode constants that may be efficiently synthesized by a ix86_vec_bcast_alg method. (ix86_vec_bcast_map_simode_cmp): New comparator for bsearch. (ix86_vector_duplicate_simode_const): Efficiently synthesize V4SImode and V8SImode constants that duplicate special constants. (ix86_vector_duplicate_value): Attempt to synthesize "special" vector constants using ix86_vector_duplicate_simode_const. * config/i386/i386.cc (ix86_rtx_costs) <case ABS>: ABS of a vector integer mode costs with a single SSE instruction. gcc/testsuite/ChangeLog PR target/106060 * gcc.target/i386/auto-init-8.c: Update test case. * gcc.target/i386/avx512fp16-13.c: Likewise. * gcc.target/i386/pr100865-9a.c: Likewise. * gcc.target/i386/pr101796-1.c: Likewise. * gcc.target/i386/pr106060-1.c: New test case. * gcc.target/i386/pr106060-2.c: Likewise. * gcc.target/i386/pr106060-3.c: Likewise. * gcc.target/i386/pr70314.c: Update test case. * gcc.target/i386/vect-shiftv4qi.c: Likewise. * gcc.target/i386/vect-shiftv8qi.c: Likewise.
2024-05-07c++: Allow IS_FAKE_BASE_TYPE for union types [PR114954]Nathaniel Shead2-1/+15
In some circumstances, unions can also have an __as_base type; we need to make sure that IS_FAKE_BASE_TYPE correctly recognises this. PR c++/114954 gcc/cp/ChangeLog: * cp-tree.h (IS_FAKE_BASE_TYPE): Also apply to unions. gcc/testsuite/ChangeLog: * g++.dg/modules/pr114954.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-05-07c++/modules: Fix dangling pointer with imported_temploid_friendsNathaniel Shead3-3/+21
I got notified by Linaro CI and by checking testresults that there seems to be some occasional failures in tpl-friend-4_b.C on some architectures and standards modes since r15-59-gb5f6a56940e708. I haven't been able to reproduce but looking at the backtrace I suspect the issue is that we're adding to the 'imported_temploid_friend' map a decl that is ultimately discarded, which then has its address reused by a later decl causing a failure in the assert in 'set_originating_module'. This patch fixes the problem by ensuring 'imported_temploid_friends' is correctly marked as a GTY root, and that 'duplicate_decls' properly removes entries from the map for declarations that it frees. PR c++/114275 gcc/cp/ChangeLog: * cp-tree.h (remove_defining_module): Declare. * decl.cc (duplicate_decls): Call remove_defining_module on to-be-freed newdecl. * module.cc (imported_temploid_friends): Mark as GTY root... (init_modules): ...and allocate from ggc. (trees_in::decl_value): Only track for declarations that won't be discarded. (remove_defining_module): New function. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>