aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-11-07testsuite: Change expectation for bb-slp-over-widen-n.cRobin Dapp2-2/+2
This patch makes sure we check for note: Basic block will be vectorized using SLP instead of optimized: basic block which will also match optimized: basic block part of which there are many more in an RVV dump. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-over-widen-1.c: Change test expectation. * gcc.dg/vect/bb-slp-over-widen-2.c: Ditto.
2023-11-07RISC-V: Add RISC-V into vect_cmdline_neededJuzhe-Zhong1-1/+2
Like all other targets, we add RISC-V into vect_cmdline_needed. This patch fixes following FAILs: FAIL: gcc.dg/tree-ssa/gen-vect-11b.c scan-tree-dump-times vect "vectorized 0 loops" 1 FAIL: gcc.dg/tree-ssa/gen-vect-11c.c scan-tree-dump-times vect "vectorized 0 loops" 1 FAIL: gcc.dg/tree-ssa/gen-vect-26.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1 FAIL: gcc.dg/tree-ssa/gen-vect-28.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1 gcc/testsuite/ChangeLog: * lib/target-supports.exp: Add RISC-V.
2023-11-07testsuite: check for and use -mno-strict-align where neededAlexandre Oliva36-0/+81
Various tests fail on powerpc if the toolchain is configured to enable -mstrict-align by default. This patch introduces -mno-strict-align on tests found to fail that way, when the target supports this option. I suppose !non_strict_align could be used to skip tests, instead of or in addition to this tweak, and that might be desirable if they still fail on targets that do no support -mno-strict-align, but I haven't observed such scenarios. The p9-vec-length tests expect vectorization on loop bodies and epilogues that reference arrays that are not known to be more aligned than their small element types. Though VSX vectors work best with 32- or 64-bit alignment, unaligned vector loads and stores are expected by the tests. However, with -mstrict-align by default, vector loads and stores not known to be aligned end up open coded, which doesn't match the asm output expectations coded in the tests. for gcc/ChangeLog * doc/sourcebuild.texi (opt_mstrict_align): New target. for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_opt_mstrict_align): New. * gcc.dg/strlenopt-80.c: Add -mno-strict-align if supported. * gcc.target/powerpc/prefix-ds-dq.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-1.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-2.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-3.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-4.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-5.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-6.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-1.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-2.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-3.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-4.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-5.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-6.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-7.c: Likewise. * gcc.target/powerpc/p9-vec-length-epil-run-8.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-1.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-2.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-3.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-4.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-5.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-6.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-7.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-8.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-1.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-2.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-3.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-4.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-5.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-6.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-7.c: Likewise. * gcc.target/powerpc/p9-vec-length-full-run-8.c: Likewise.
2023-11-07RISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.hChristoph Müllner1-1/+1
stdint.h can be replaced with stdint-gcc.h to resolve some missing system headers in non-multilib installations. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> gcc/testsuite/ChangeLog: * gcc.target/riscv/xtheadmemidx-helpers.h: Replace stdint.h with stdint-gcc.h.
2023-11-07RISC-V: Add ABI requirement for XTheadFMemIdx testsChristoph Müllner8-8/+8
The XTheadFMemIdx tests set the required ABI for RV32, but not for RV64, which has the effect that the tests are expected to succeed for RV64/LP64. Let's set the ABI to LP64D in these tests to clarify the requirements. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> gcc/testsuite/ChangeLog: * gcc.target/riscv/xtheadfmemidx-index-update.c: Add ABI. * gcc.target/riscv/xtheadfmemidx-index-xtheadbb-update.c: Likewise. * gcc.target/riscv/xtheadfmemidx-index-xtheadbb.c: Likewise. * gcc.target/riscv/xtheadfmemidx-index.c: Likewise. * gcc.target/riscv/xtheadfmemidx-uindex-update.c: Likewise. * gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb-update.c: Likewise. * gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb.c: Likewise. * gcc.target/riscv/xtheadfmemidx-uindex.c: Likewise.
2023-11-07ada: Fix debug info for aliased packed array with unconstrained nominal subtypeEric Botcazou1-0/+12
The front-end now rewrites it as a renaming when it is initialized with a function call and the same processing must be applied in the renaming case as in the regular case for this kind of special objects. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Apply the specific rewriting done for an aliased object with an unconstrained array nominal subtype in the renaming case too.
2023-11-07ada: Fix spurious -Wstringop-overflow with link time optimizationEric Botcazou1-24/+0
It comes from an incomplete optimization performed by LTO that is caused by an obsolete transformation done in Gigi, which is redundant with the common uniquization of constant CONSTRUCTORs now performed during gimplification. gcc/ada/ * gcc-interface/trans.cc (gnat_gimplify_expr) <CALL_EXPR>: Delete.
2023-11-07ada: Compiler crash on early alignment clauseBob Duff2-4/+1
This patch fixes a bug: if "for T'Alignment use..." is followed by "for T use (<enum rep>);" the compiler crashes. A workaround is to move the alignment clause after the enumeration rep clause. gcc/ada/ * sem_ch13.ads (Set_Enum_Esize): Do not set alignment. * sem_ch13.adb (Set_Enum_Esize): Do not set alignment. Archaeology seems to show that this line of code dates from when "Alignment = 0" meant "the Alignment is not known at compile time" and "the Alignment is not yet known at compile time" as well as "the Alignment is zero". In any case, it seems to be unnecessary, and in this case harmful, because gigi would crash. Alignment_Clause is set (because there is one), so gigi would query the Alignment, but Alignment was destroyed.
2023-11-07ada: Update the logo in the gnat docJulien Bortolussi1-3/+6
Update the logo and the background color in the top right corner of the GNAT User’s Guide for Native Platforms gcc/ada/ * doc/share/conf.py: Changed the background color and the logo.
2023-11-07ada: Fix incorrect resolution of overloaded function call in instanceEric Botcazou6-41/+87
The problem occurs when the function call is the operand of an equality operator, the type used to do the comparison is declared outside of the generic construct but visible inside it, and this generic construct also declares two functions with the same profile except for the result type, one result type being the aforementioned type, the other being derived from this type but not visible inside the generic construct. When the second operand is either a literal or also overloaded, the call may be resolved to the second function instead of the first in instances. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Add Compare_Type. * gen_il-gen-gen_nodes.adb (N_Op_Eq): Likewise. (N_Op_Ge): Likewise. (N_Op_Gt): Likewise. (N_Op_Le): Likewise. (N_Op_Lt): Likewise. (N_Op_Ne): Likewise. * sinfo.ads (Compare_Type): Document new field. * sem_ch4.adb (Analyze_Comparison_Equality_Op): If the entity is already present, set the Compare_Type on overloaded operands if it is present on the node. * sem_ch12.adb (Check_Private_View): Look into the Compare_Type instead of the Etype for comparison operators. (Copy_Generic_Node): Remove obsolete code for comparison operators. (Save_Global_References.Save_References): Do not walk into the descendants of N_Implicit_Label_Declaration nodes. (Save_Global_References.Set_Global_Type): Look into the Compare_Type instead of the Etype for comparison operators. * sem_res.adb (Resolve_Comparison_Op): Set Compare_Type. (Resolve_Equality_Op): Likewise.
2023-11-07ada: Fix Ada.Directories.Modification_Time on WindowsRonan Desplanques1-1/+10
Before this patch, Ada.Directories.Modification_Time called GetFileAttributesExA under the hood on Windows. That would sometimes fail to work with files whose names were non-ASCII. This patch replaces the call to GetFileAttributesExA with a call to GetFileAttributesEx preceded by an encoding scheme conversion, as is done in other functions of the run-time library. This fixes the issues that were observed with the previous implementations. gcc/ada/ * adaint.c (__gnat_file_time): Fix Windows version.
2023-11-07ada: Elide temporary for aliased array with unconstrained nominal subtypeEric Botcazou1-23/+24
When the array is initialized with the result of a call to a function whose result type is unconstrained, then the result is allocated with its bounds, so the array can be rewritten as a renaming of the result in this case too. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Fold initialization expression of Nominal_Subtype_Is_Constrained_Array constant into the computation of Rewrite_As_Renaming and remove the constant. Set it to True for an aliased array with unconstrained nominal subtype if the subtype of the expression is also unconstrained.
2023-11-07ada: Fix expansion of type aspects with handling of aspectsPiotr Trojanek1-2/+2
The new handling of aspects stores the aspect expression as the Expression_Copy of the aspect and not as the Entity of the aspect identified. This has been changed for most of the aspects, but not for Type_Invariant and Default_Initial_Condition, which have custom expansion. Apparently this change only affects GNATprove and not GNAT. gcc/ada/ * exp_util.adb (Add_Own_DIC, Add_Own_Invariants): Store the aspect expression in Expression_Copy.
2023-11-07ada: Rename Is_Limited_View to reflect actual queryYannick Moy17-98/+101
Function Sem_Aux.Is_Limited_View returns whether the type is "inherently limited" in a slightly different way from the "immutably limited" definition in Ada 2012. Rename for clarity. gcc/ada/ * exp_aggr.adb: Apply the renaming. * exp_ch3.adb: Same. * exp_ch4.adb: Same. * exp_ch6.adb: Same. * exp_ch7.adb: Same. * exp_util.adb: Same. * freeze.adb: Same. * sem_aggr.adb: Same. * sem_attr.adb: Same. * sem_aux.adb: Alphabetize Is_Limited_Type. Rename. * sem_aux.ads: Same. * sem_ch3.adb: Apply the renaming. * sem_ch6.adb: Same. * sem_ch8.adb: Same. * sem_prag.adb: Same. * sem_res.adb: Same. * sem_util.adb: Same.
2023-11-07ada: Implement Aspects as fields under nodesViljar Indus26-462/+266
In the previous implementation Aspect Specifications were stored in a separate table and not directly under each node. This implementation included a lot of extra code that needed to be maintained manually. The new implementation stores Aspect_Specfications as a syntactic field under each node. This removes the extra code that was needed to store, traverse and clone aspects for nodes. gcc/ada/ * aspects.adb (Exchange_Aspects): Removed. This method was typically called after a Rewrite method. Now since the Rewrite switches the aspects between the new and the old node it is no longer needed. (Has_Aspects): Converted to a utility method that performs the same before as the previous Has_Aspects field did. Meaning it shows whether a node actually has aspects or not. (Copy_Aspects): New utility method that performs a deep copy of the From nodes aspects. (Aspect_Specfications): Removed. No longer needed. Replaced by the primitive operation for the Aspect_Specification fields. (Set_Aspect_Specifications): Likewise. (Aspect_Specifications_Hash_Table): Remove the table and all the utility methods for storing the old aspects. * aspects.ads: Likewise. * atree.adb (Copy_Separate_Tree): Remove custom code for aspects. (New_Copy): Likewise. (Replace): Likewise. (Rewrite): Likewise. * exp_ch3.adb (Expand_N_Object_Declaration): Keep the aspects from the old node. * exp_ch6.adb (Validate_Subprogram_Calls): Previously aspects were ignored because they were not on the tree. Explicitly ignore them here when traversing the tree. * exp_unst.adb (Build_Tables): Likewise * gen_il-fields.ads: Remove Has_Aspects and add Aspect_Specifications fields. * gen_il-gen-gen_nodes.adb: Add Aspect_Specification fields for all nodes that can have aspects. Additionally add Expression_Copy for Aspect_Speficiations to avoid reusing the Associated_Node for generic instantiation and aspect analysis. * ghost.adb (Remove_Ignored_Ghost_Node): Remove call to Remove_Aspects. The rewritten node is a Null_Statement that cannot have aspects and there is not anything to gain from removing them from the Orignal_Node of N since it technically is not part of the active tree. * inline.adb (Process_Formals_In_Aspects): Simplify code for node traversal. * par-ch13.adb: Avoid setting the parent explicitly for the Aspect_Specifications list. This is done explicitly in the setter. * par-ch6.adb: Likewise. * par_sco.adb (Traverse_Aspects): Handle early return. * sem_ch10.adb: Simplify code for Analyze_Aspect_Specifications. * sem_ch11.adb: Likewise. * sem_ch12.adb (Analyze_Formal_Derived_Interface_Type): Keep the aspects from the orignal node after rewrite. (Analyze_Formal_Derived_Type): Likewise. (Analyze_Formal_Interface_Type): Likewise. (Analyze_Formal_Object_Declaration): Simplify code for Analyze_Aspect_Specifications. (Analyze_Formal_Package_Declaration): Likewise. (Analyze_Formal_Subprogram_Declaration): Likewise. (Analyze_Formal_Type_Declaration): Likewise. (Analyze_Generic_Package_Declaration): Remove Exchange_Aspects. The new node already has the correct aspects after the rewrite. Also simplify code for Analyze_Aspect_Specifications. (Analyze_Generic_Subprogram_Declaration): Likewise. (Analyze_Package_Instantiation): Simplify code for Analyze_Aspect_Specifications. (Build_Instance_Compilation_Unit_Nodes): Remove explicit copy of aspects that is no longer needed. (Save_References): Update the traversal code to handle Aspect_Specifications in the tree. (Copy_Generic_Node): Remove explicit copy for aspects. New_Copy took care of that already. * sem_ch13.adb (Analyze_Aspect_Specifications): Add early return to simplify code for its calls. Avoid reusing the Entity(Associated_Node) field for storing the original expression. Instead use the new Expression_Copy field since Entity(Associated_Node) is also used in generic instantiation. (Analyze_Aspects_On_Subprogram_Body_Or_Stub): Simlify call to Analyze_Aspect_Specifications. (Check_Aspect_At_End_Of_Declarations): Use Expression_Copy instead of Entity. (Check_Aspect_At_Freeze_Point): Likewise. * sem_ch3.adb: Simplify calls to Analyze_Aspect_Specifications. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Simplify call to Analyze_Aspect_Specifications. (Analyze_Expression_Function): Keep the aspects from the original node after a rewrite. (Analyze_Generic_Subprogram_Body): Remove Exchange aspects that is no longer needed. Simplify call to Analyze_Aspect_Specifications. (Analyze_Null_Procedure): Keep the aspects from the original node after a rewrite. (Analyze_Subprogram_Body_Helper): Simplify calls to Analyze_Aspect_Specifications. (Analyze_Subprogram_Declaration): Likewise. * sem_ch7.adb (Analyze_Package_Body_Helper): Remove Exchange aspects that is no longer needed. Simplify call to Analyze_Aspect_Specifications. (Analyze_Package_Declaration): Simplify call to Analyze_Aspect_Specifications. (Analyze_Private_Type_Declaration): Likewise. * sem_ch8.adb: Simplify calls to Analyze_Aspect_Specifications. * sem_ch9.adb (Analyze_Entry_Body): Simplify call to Analyze_Aspects_On_Subprogram_Body_Or_Stub. (Analyze_Entry_Declaration): Simplify call to Analyze_Aspect_Specifications. (Analyze_Protected_Body): Likewise. (Analyze_Protected_Type_Declaration): Likewise. (Analyze_Single_Protected_Declaration): Keep the aspects from the original node after a rewrite. Simplify call to Analyze_Aspect_Specifications. (Analyze_Single_Task_Declaration): Likewise. (Analyze_Task_Body): Simplify call to Analyze_Aspect_Specifications. (Analyze_Task_Type_Declaration): Simplify calls to Analyze_Aspect_Specifications. * sem_dim.adb: Remove explicitly setting the parents for the Aspect_Specification list. * sem_disp.adb: Remove the with that is no longer required since Aspect_Specifications is a node operation now. * sem_util.adb (Copy_Node_With_Replacement): Remove explicit code for aspects. * treepr.adb (Print_Field): Remove the version that was used for printing aspects. (Print_Node): Remove aspect specific code.
2023-11-07ada: Minor tweaks for comparison operatorsEric Botcazou3-14/+6
No functional changes. gcc/ada/ * gen_il-gen-gen_nodes.adb (N_Op_Boolean): Fix description. * sem_ch4.adb (Analyze_Comparison_Equality_Op): Tidy up. * sem_ch12.adb (Copy_Generic_Node): Use N_Op_Compare subtype.
2023-11-07ada: Cleanup "not Present" on List_IdPiotr Trojanek4-4/+4
gcc/ada/ * exp_ch6.adb, exp_disp.adb, sem_ch13.adb, sem_ch3.adb: Fix newly detected violations.
2023-11-07ada: Cleanup more "not Present"Piotr Trojanek3-9/+7
We had a GNATcheck rule that suggests replacing "not Present (...)" with "No (...)", but it only detected calls with a parameter of type Node_Id. Now this rules also detects parameters of type Elist_Id. gcc/ada/ * sem_ch3.adb, sem_ch4.adb, sem_eval.adb: Fix newly detected violations.
2023-11-07ada: Fix documentation of -gnatwcRonan Desplanques2-4/+4
-gnatwc has been correctly emitting warnings for expressions outside of tests for a while, but its documentation in the user's guide had never been updated to reflect that. Also, the documentation used "conditional expressions" to designate boolean expressions, but "conditional expressions" has been defined by Ada 2012 to designate if expressions and case expressions. This patch fixes those issues. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix -gnatwc documentation. * gnat_ugn.texi: Regenerate.
2023-11-07ada: New Local_Restrictions and User_Aspect aspects.Steve Baird22-643/+1843
A GNAT-defined aspect, Local_Restrictions, is defined. This provides a way of enforcing a given restriction for an individual subprogram (and its call-closure) without requiring that the entire program satisfy the restriction. A GNAT-defined aspect, User_Aspect, is defined. This (along with the new User_Aspect_Definition configuration pragma) provides a way of naming a set of aspect specifications which can then be applied to multiple declarations without textual repetition of the set. gcc/ada/ * local_restrict.ads: A new package. Declares Local_Restriction enumeration type and provides operations to check for local restriction violations. * local_restrict.adb: Corresponding package body. Replace "not Present (X)" calls with "No (X)" calls. * aspects.ads: Add a new enumeration elements, Aspect_Local_Restrictions and Aspect_User_Aspect, to the Aspect_Id enumeration type. Update Aspect_Id-indexed aggregates. Add nested package User_Aspect_Support to manage two pieces of state. One is a map from identifiers to User_Aspect_Definition pragmas (updated when such a pragma is encountered). The other is an access-to-subprogram variable that is introduced in order to keep the bulk of semantics out of the closure of package Aspects while allowing a call from aspects.adb to the sem_ch13 procedure that analyzes a User_Aspect aspect specification. * aspects.adb (Find_Aspect): Cope with a case of a block statement with an empty parent. It is not clear whether this is papering over a compiler bug. Add indirect call through the aforementioned access-to-subprogram variable when Find_Aspect enounters an unanalyzed User_Aspect aspect specification. If Find_Aspect is called looking for aspect Foo, then a User_Aspect specification might generate (during analysis) a Foo aspect specification. So the Find_Aspect call needs to trigger that analysis if it has not already taken place. Provide a body for package User_Aspect_Support. Replace "not Present (X)" call with "No (X)" call. * freeze.adb (Freeze_Subprogram): Check local restriction compatibility when a dispatching operation is overridden. * par-prag.adb: Add support for parsing a User_Aspect_Definition pragma. * restrict.ads: We'd like to have the body of package Restrict include a call to a procedure declared in package Local_Restrict. Doing that in the obvious way pulls most of semantics into the closure of package Restrict, and that turns out to cause problems. So we introduce a level of indirection and instead call through an access-to-subprogram value. In this unit, we declare the access-to-subprogram type and object. * restrict.adb (Check Restriction): When a construct is encountered that could violate a global restriction (depending on whether the given restriction is in effect), Check_Restriction is called. At this point, we also check for a violation of any corresponding local restriction that is in effect. For reasons described above, this check is performed via an indirect call. * sem_ch13.ads (Parse_Aspect_Local_Restrictions): A new function, similar to the existing Parse_Aspect_Xxx subprograms. * sem_ch13.adb: Perform semantic analysis of Local_Restrictions and User_Aspect aspect specifications. Declare and call new Validate_Aspect_Local_Restrictions and Analyze_User_Aspect_Aspect_Specification procedures (a reference to the latter is registered during package elaboration). In Analyze_Aspect_Specifications, do not set the Analyzed flag of a User_Aspect aspect specification. Replace "not Present (X)" call with "No (X)" call. Replace 'Image with 'Img in a case where the prefix of the attribute reference is an object; this is done to accomodate older compilers. * sem_ch6.adb (Check_Subtype_Conformant): Include in subtype conformance check a check for overriding-related compatibility of local restrictions. * sem_ch8.adb (Analyze_Subprogram_Renaming): In the case of an instance of a generic that takes a formal subprogram, check that formal and actual are compatible with respect to local restrictions. * sem_prag.adb: Add support for User_Aspect_Definition pragma. * sem_res.adb (Resolve_Call): Check caller/callee compatibility with respect to local restrictions. * snames.ads-tmpl: Add Name_Local_Restrictions, Name_User_Aspect, and Name_User_Aspect_Definition constants. * doc/gnat_rm/implementation_defined_aspects.rst: Document new aspects. * doc/gnat_rm/implementation_defined_pragmas.rst: Document new pragma. * doc/gnat_ugn/the_gnat_compilation_model.rst: Add User_Aspect_Definition to list of GNAT pragmas. * gcc-interface/Make-lang.in: Add local_restrict.o. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-11-07ada: Error in prefix-notation callBob Duff1-2/+8
The compiler gives a wrong error for a call of the form X.Y(...) when Y is inherited indirectly via an interface. gcc/ada/ * sem_ch4.adb (Is_Private_Overriding): Return True in the case where a primitive operation is publicly inherited but privately overridden.
2023-11-07ada: Remove duplicated code for expansion of packed array assignmentsPiotr Trojanek1-4/+0
Expansion of assignments to packed array objects has two cases and had duplicated code for both these cases. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Remove code from the ELSE branch, because it was is identical to code before the IF statements itself.
2023-11-07ada: Simplify expansion of packed array assignmentsPiotr Trojanek1-4/+4
When expanding assignment to a packed array object, e.g. a formal parameter with mode OUT that might have unconstrained type, we took the component type and component size from the constrained actual subtype. It is simpler to take these properties from the nominal type of the assigned object. Semantics is unaffected, because constraining the array doesn't change the type or size of the array components. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Change Ctyp and Csiz from variables to constants and compute them using the nominal type of the assigned array object.
2023-11-07ada: Fix extra whitespace after END keywordsPiotr Trojanek8-8/+8
Style cleanup. gcc/ada/ * exp_pakd.adb, libgnarl/s-osinte__android.ads, libgnarl/s-osinte__linux.ads, libgnarl/s-osinte__qnx.ads, libgnarl/s-osinte__rtems.ads, libgnat/s-gearop.adb, libgnat/s-poosiz.adb, sem_util.adb: Fix style.
2023-11-07ada: Avoid extra conversion in expansion of packed array assignmentsPiotr Trojanek1-1/+2
Expansion of assignments to packed array objects with string literals on the right-hand side, created an unnecessary conversion, i.e.: ... := component_type (declare temp : component_type := "string_literal"; begin temp) Now the expansion omits the outer type conversion. Cleanup; behavior is unaffected. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Simplify handling of assignments with string literals.
2023-11-07ada: Simplify handling of known values in expansion of packed arraysPiotr Trojanek1-16/+10
If an expression value is not known at compile time, it can be represented with No_Uint and doesn't require a dedicated flag. Code cleanup; behavior is unaffected. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Remove Rhs_Val_Known; represent unknown value by assigning Rhs_Val with No_Uint.
2023-11-07ada: Change local variables to constants in expansion of packed arraysPiotr Trojanek1-7/+3
Cleanup; semantics is unaffected. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Change local Decl object from variable to constant. (Setup_Inline_Packed_Array_Reference): Likewise for Csiz.
2023-11-07ada: Fix style in declaration of routine for expansion of packed arraysPiotr Trojanek1-10/+10
Style cleanup. gcc/ada/ * exp_pakd.adb (Setup_Inline_Packed_Array_Reference): Remove extra whitespace from the list of parameters.
2023-11-07ada: Cleanup getting of actual subtypesPiotr Trojanek1-3/+1
Avoid potentially unnecessary call to Etype. gcc/ada/ * sem_util.adb (Get_Actual_Subtype_If_Available): Only call Etype when necessary.
2023-11-07ada: Fix handling of actual subtypes for expanded namesPiotr Trojanek1-2/+2
gcc/ada/ * sem_util.adb (Get_Actual_Subtype,Get_Actual_Subtype_If_Available): Fix handling of expanded names.
2023-11-07ada: Simplify code for Ignore_Style_Checks_PragmasViljar Indus1-15/+11
gcc/ada/ * sem_prag.adb: (Analyze_Pragma): Reduce the number of nested if statements.
2023-11-07ada: Fix scope of semantic style_check pragmasViljar Indus1-0/+10
Restore the original state of Style_Check pragmas before analyzing each compilation unit to avoid Style_Check pragmas from unit affecting the style checks of a different unit. gcc/ada/ * sem_ch10.adb: (Analyze_Compilation_Unit): Restore the orignal state of style check pragmas at the end of the analysis.
2023-11-07ada: Fix internal error on address of element of packed array componentEric Botcazou1-3/+3
This occurs when the component is part of a discriminated type and its offset depends on a discriminant, the problem being that the front-end generates an incomplete Bit_Position attribute reference. gcc/ada/ * exp_pakd.adb (Get_Base_And_Bit_Offset): Use the full component reference instead of just the selector name for 'Bit_Position.
2023-11-07RISC-V regression test: Fix FAIL bb-slp-cond-1.c for RVVJuzhe-Zhong1-2/+2
Previously, in this patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-November/635392.html I use vect64 && vect128 to represent both RVV and AMDGCN. However, it caused additional FAIL on ARM SVE. I don't know why ARM SVE vect64 is set as true since their AdvSIMD is 128bit vector and they don't use 64bit vector. So, here we leverage current AMDGCN solution, just add RISCV like AMDGCN. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-cond-1.c: Add riscv.
2023-11-07rs6000,testcase: Add require-effective-target has_arch_ppc64 to pr106550_1.cJiufu Guo1-0/+1
With the latest trunk, case pr106550_1.c runs with failure on ppc under -m32. Previously, this case failed with ICE due to PR111971. Now, this emission is exposed. While, the case is testing 64bit constant building. So, "has_arch_ppc64" is required. PR target/112340 gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr106550_1.c: Add has_arch_ppc64 target require.
2023-11-07RISC-V: Fixed failed rvv combine testcasesLehua Ding3-25/+232
This patch fixed the fellowing failed testcases on the trunk: FAIL: gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c scan-assembler-times \\tvfwredusum\\.vs\\tv[0-9]+,v[0-9]+,v[0-9]+,v0\\.t 2 ... FAIL: gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c scan-assembler-times \\tvwredsumu\\.vs\\tv[0-9]+,v[0-9]+,v[0-9]+,v0\\.t 3 ... The reason for these failed testcases is the introduce of .VCOND_MASK_LEN in midend for other bugfix and further leads to a new vcond_mask_len rtl pattern after expand. So we need add new combine patterns handle this case. Consider this code: int16_t foo (int8_t *restrict a, int8_t *restrict pred) { int16_t sum = 0; for (int i = 0; i < 16; i += 1) if (pred[i]) sum += a[i]; return sum; } Before this patch: foo: vsetivli zero,16,e8,m1,ta,ma vle8.v v0,0(a1) vsetvli a5,zero,e8,m1,ta,ma vmsne.vi v0,v0,0 vsetvli zero,zero,e16,m2,ta,ma li a3,0 vmv.v.i v2,0 vsetivli zero,16,e16,m2,ta,ma vle8.v v6,0(a0),v0.t vmv.s.x v1,a3 vsetvli a5,zero,e16,m2,ta,ma vsext.vf2 v4,v6 vsetivli zero,16,e16,m2,tu,ma vmerge.vvm v2,v2,v4,v0 vsetvli a5,zero,e16,m2,ta,ma vredsum.vs v2,v2,v1 vmv.x.s a0,v2 slliw a0,a0,16 sraiw a0,a0,16 ret After this patch: foo: vsetivli zero,16,e16,m2,ta,ma li a5,0 vle8.v v0,0(a1) vmv.s.x v1,a5 vsetvli zero,zero,e8,m1,ta,ma vmsne.vi v0,v0,0 vle8.v v2,0(a0),v0.t vwredsum.vs v1,v2,v1,v0.t vsetvli zero,zero,e16,m1,ta,ma vmv.x.s a0,v1 slliw a0,a0,16 sraiw a0,a0,16 ret Combine the vsext.vf2, vmerge.vvm, and vredsum.vs instructions while reducing the corresponding vsetvl instructions. gcc/ChangeLog: * config/riscv/autovec-opt.md (*cond_len_<optab><v_double_trunc><mode>): New combine pattern. (*cond_len_<optab><v_quad_trunc><mode>): Ditto. (*cond_len_<optab><v_oct_trunc><mode>): Ditto. (*cond_len_extend<v_double_trunc><mode>): Ditto. (*cond_len_widen_reduc_plus_scal_<mode>): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-1.c: * gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c:
2023-11-07test: Fix FAIL of vect-sdiv-pow2-1.c for RVV test: Fix FAIL of ↵Juzhe-Zhong1-1/+1
vect-sdiv-pow2-1.c for RVV# RVV didn't explictly enable DIV_POW2 optab but we cen vectorize it. We should check pattern recognition instead of explicit pattern check. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-sdiv-pow2-1.c: Fix dump check.
2023-11-07test: Fix FAIL of SAD tests for RVVJuzhe-Zhong2-2/+2
RVV didn't explicitly enable SAD optab but we can vectorize it since loop vectorizer is able to recognize SAD pattern for RVV during analysis. Current scan check of explicit SAD pattern looks odd, it should be more reasonable to check recognition of SAD pattern during Loop vectorize analysis. Other SAD tests like slp-reduc-sad-2.c are checking pattern recognition instead of explicit pattern enable. Fix SAD dump check to fix the FAILS for RVV. gcc/testsuite/ChangeLog: * gcc.dg/vect/slp-reduc-sad.c: Fix check. * gcc.dg/vect/vect-reduc-sad.c: Ditto.
2023-11-07test: Fix XPASS of bb-slp-43.c for RVVJuzhe-Zhong1-1/+1
RVV is variable length vector but also has 256 bit VLS mode vector. This test is vectorized as: f: vsetivli zero,8,e32,m2,ta,ma vle32.v v2,0(a0) vmv.v.i v4,1 vle16.v v1,0(a1) vmseq.vv v0,v2,v4 vsetvli zero,zero,e16,m1,ta,ma vmseq.vi v1,v1,2 vsetvli zero,zero,e32,m2,ta,ma vmv.v.i v2,0 vmand.mm v0,v0,v1 vmerge.vvm v2,v2,v4,v0 vse32.v v2,0(a0) ret Use 256 bit vector, so remove XFAIL for 256 bits vector. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-43.c: Fix XPASS for RVV.
2023-11-07RISC-V: Enhance AVL propagation for complicate reduction auto-vectorizationJuzhe-Zhong4-5/+49
I notice we failed to AVL propagate for reduction with more complicate situation: double foo (double *__restrict a, double *__restrict b, double *__restrict c, int n) { double result = 0; for (int i = 0; i < n; i++) result += a[i] * b[i] * c[i]; return result; } vsetvli a5,a3,e8,mf8,ta,ma -> should be fused into e64m1,TU slli a4,a5,3 vle64.v v3,0(a0) vle64.v v1,0(a1) vsetvli a6,zero,e64,m1,ta,ma -> redundant vfmul.vv v1,v1,v3 vsetvli zero,a5,e64,m1,tu,ma -> redundant vle64.v v3,0(a2) vfmacc.vv v2,v1,v3 add a0,a0,a4 add a1,a1,a4 add a2,a2,a4 sub a3,a3,a5 bne a3,zero,.L3 The failed AVL propgation causes redundant AVL/VL togglling. The root cause as follows: vsetvl a5, zero vadd.vv def r136 vsetvl zero, a3, ... TU vsub.vv (use r136) We propagate AVL (r136) from 'vsub.vv' into 'vadd.vv' when 'vsub.vv' is TA policy. However, it's too restrict so we missed optimization here. We enhance AVL propation for TU policy for following situation: vsetvl a5, zero vadd.vv def r136 vsetvl zero, a3, ... TU vsub.vv (use r136, merge != r136) Note that we should only propagate AVL when merge != r136 for 'vsub.vv' doesn't depend on the tail elements. After this patch: vsetvli a5,a3,e64,m1,tu,ma slli a4,a5,3 vle64.v v3,0(a0) vle64.v v1,0(a1) vfmul.vv v1,v1,v3 vle64.v v3,0(a2) vfmacc.vv v2,v3,v1 add a0,a0,a4 add a1,a1,a4 add a2,a2,a4 sub a3,a3,a5 bne a3,zero,.L3 PR target/112399 gcc/ChangeLog: * config/riscv/riscv-avlprop.cc (pass_avlprop::get_vlmax_ta_preferred_avl): Enhance AVL propagation. * config/riscv/t-riscv: Add new include. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/imm_switch-2.c: Adapt test. * gcc.target/riscv/rvv/autovec/pr112399.c: New test.
2023-11-07RISC-V: Support FP ceil to i/l/ll diff size autovecPan Li14-9/+520
This patch would like to support the FP below API auto vectorization with different type size +---------+-----------+----------+ | API | RV64 | RV32 | +---------+-----------+----------+ | iceil | DF => SI | DF => SI | | iceilf | - | - | | lceil | - | DF => SI | | lceilf | SF => DI | - | | llceil | - | - | | llceilf | SF => DI | SF => DI | +---------+-----------+----------+ Given below code: void test_lceilf (long *out, float *in, unsigned count) { for (unsigned i = 0; i < count; i++) out[i] = __builtin_lceilf (in[i]); } Before this patch: .L3: flw fa0,0(s0) addi s0,s0,4 addi s1,s1,8 call ceilf fcvt.l.s a5,fa0,rtz sd a5,-8(s1) bne s2,s0,.L3 ld ra,24(sp) ld s0,16(sp) ld s1,8(sp) ld s2,0(sp) addi sp,sp,32 jr ra After this patch: fsrmi 3 // RUP mode .L3: vsetvli a5,a2,e32,mf2,ta,ma vle32.v v2,0(a1) slli a3,a5,2 slli a4,a5,3 vfwcvt.x.f.v v1,v2 sub a2,a2,a5 vse64.v v1,0(a0) add a1,a1,a3 add a0,a0,a4 bne a2,zero,.L3 Unfortunately, the HF mode is not include due to it requires additional middle-end support from internal-fun.def. gcc/ChangeLog: * config/riscv/autovec.md: Remove the size check of lceil.l * config/riscv/riscv-v.cc (expand_vec_lceil): Leverage emit_vec_rounding_to_integer for ceil. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-iceil-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-iceil-run-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lceil-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lceil-rv32-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lceilf-rv64-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lceilf-rv64-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llceilf-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llceilf-run-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-iceil-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lceil-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lceilf-rv64-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-llceilf-0.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-07Revert "test: Fix FAIL of bb-slp-cond-1.c for RVV"Pan Li1-2/+2
This reverts commit ee7ba242cf43884477f09e59d9b80af4bf91d143.
2023-11-07test: Fix FAIL of bb-slp-cond-1.c for RVVJuzhe-Zhong1-2/+2
This patch fixes: FAIL: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects scan-tree-dump-times vect "loop vectorized" 1 FAIL: gcc.dg/vect/bb-slp-cond-1.c scan-tree-dump-times vect "loop vectorized" 1 For RVV, "loop vectorized" appears 2 times instead of 1. Because: optimized: loop vectorized using 16 byte vectors optimized: loop vectorized using 8 byte vectors As long as targets have both 64bit and 128bit vectors, it will occur 2 times. 2 targets are same situation, one is AMDGCN, the other is RVV. Replace it target amdgcn with vect64 && vect128 to make test more general and easy maintain. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-cond-1.c: Fix FAIL.
2023-11-07RISC-V regression test: Fix FAIL of bb-slp-39.cJuzhe-Zhong1-2/+2
Like s390, add riscv to fix the fail. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-39.c: Add RISCV.
2023-11-07Daily bump.GCC Administrator6-1/+735
2023-11-06hppa: Fix typo in PA 2.0 trampoline templateJohn David Anglin1-1/+1
2023-11-06 John David Anglin <danglin@gcc.gnu.org> * config/pa/pa.cc (pa_asm_trampoline_template): Fix typo.
2023-11-06Enable generation of GNU stack notes on LinuxJohn David Anglin1-3/+2
2023-11-06 John David Anglin <danglin@gcc.gnu.org> * config/pa/pa-linux.h (NEED_INDICATE_EXEC_STACK): Define to 1.
2023-11-06diagnostics: split out struct diagnostic_source_printing_optionsDavid Malcolm2-94/+88
This patch removes almost all use of diagnostic_context from the source-printing code. No functional change intended. gcc/ChangeLog: * diagnostic-show-locus.cc (class colorizer): Take just a pretty_printer rather than a diagnostic_context. (layout::layout): Make context param a const reference, and pretty_printer param non-optional. (layout::m_context): Drop field. (layout::m_options): New field. (layout::m_colorize_source_p): Drop field. (layout::m_show_labels_p): Drop field. (layout::m_show_line_numbers_p): Drop field. (layout::print_gap_in_line_numbering): Use m_options. (layout::calculate_line_spans): Likewise. (layout::calculate_linenum_width): Likewise. (layout::calculate_x_offset_display): Likewise. (layout::print_source_line): Likewise. (layout::start_annotation_line): Likewise. (layout::print_annotation_line): Likewise. (layout::print_line): Likewise. (gcc_rich_location::add_location_if_nearby): Update for changes to layout ctor. (diagnostic_show_locus): Likewise. (selftest::test_offset_impl): Likewise. (selftest::test_layout_x_offset_display_utf8): Likewise. (selftest::test_layout_x_offset_display_tab): Likewise. (selftest::test_tab_expansion): Likewise. * diagnostic.h (diagnostic_context::m_source_printing): Move declaration of struct outside diagnostic_context as... (struct diagnostic_source_printing_options)... this. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-06diagnostics: introduce class diagnostic_option_classifierDavid Malcolm2-92/+163
This patch gathers the 6 fields in diagnostic_context relating to keeping track of overriding the severity of warnings, and pushing/popping those severities, moving them all into a new class diagnostic_option_classifier. No functional change intended. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::push_diagnostics): Convert to... (diagnostic_option_classifier::push): ...this. (diagnostic_context::pop_diagnostics): Convert to... (diagnostic_option_classifier::pop): ...this. (diagnostic_context::initialize): Move code to... (diagnostic_option_classifier::init): ...this new function. (diagnostic_context::finish): Move code to... (diagnostic_option_classifier::fini): ...this new function. (diagnostic_context::classify_diagnostic): Convert to... (diagnostic_option_classifier::classify_diagnostic): ...this. (diagnostic_context::update_effective_level_from_pragmas): Convert to... (diagnostic_option_classifier::update_effective_level_from_pragmas): ...this. (diagnostic_context::diagnostic_enabled): Update for refactoring. * diagnostic.h (struct diagnostic_classification_change_t): Move into... (class diagnostic_option_classifier): ...this new class. (diagnostic_context::option_unspecified_p): Update for move of fields into m_option_classifier. (diagnostic_context::classify_diagnostic): Likewise. (diagnostic_context::push_diagnostics): Likewise. (diagnostic_context::pop_diagnostics): Likewise. (diagnostic_context::update_effective_level_from_pragmas): Delete. (diagnostic_context::m_classify_diagnostic): Move into class diagnostic_option_classifier. (diagnostic_context::m_option_classifier): Likewise. (diagnostic_context::m_classification_history): Likewise. (diagnostic_context::m_n_classification_history): Likewise. (diagnostic_context::m_push_list): Likewise. (diagnostic_context::m_n_push): Likewise. (diagnostic_context::m_option_classifier): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-06diagnostics: make diagnostic_context::m_urlifier privateDavid Malcolm4-2/+13
No functional change intended. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::set_urlifier): New. * diagnostic.h (diagnostic_context::set_urlifier): New decl. (diagnostic_context::m_urlifier): Make private. * gcc.cc (driver::global_initializations): Use set_urlifier rather than directly setting field. * toplev.cc (general_init): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>