Skip to content
Snippets Groups Projects
  1. Nov 07, 2023
    • Christoph Müllner's avatar
      RISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.h · 74b35716
      Christoph Müllner authored
      
      stdint.h can be replaced with stdint-gcc.h to resolve some missing
      system headers in non-multilib installations.
      
      Signed-off-by: default avatarChristoph Müllner <christoph.muellner@vrull.eu>
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/xtheadmemidx-helpers.h:
      	Replace stdint.h with stdint-gcc.h.
      74b35716
    • Christoph Müllner's avatar
      RISC-V: Add ABI requirement for XTheadFMemIdx tests · 41690331
      Christoph Müllner authored
      
      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: default avatarChristoph 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.
      41690331
    • Eric Botcazou's avatar
      ada: Fix debug info for aliased packed array with unconstrained nominal subtype · b6ba22ca
      Eric Botcazou authored
      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.
      b6ba22ca
    • Eric Botcazou's avatar
      ada: Fix spurious -Wstringop-overflow with link time optimization · c210397b
      Eric Botcazou authored
      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.
      c210397b
    • Bob Duff's avatar
      ada: Compiler crash on early alignment clause · 756e05d1
      Bob Duff authored
      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.
      756e05d1
    • Julien Bortolussi's avatar
      ada: Update the logo in the gnat doc · 09e5e68c
      Julien Bortolussi authored
      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.
      09e5e68c
    • Eric Botcazou's avatar
      ada: Fix incorrect resolution of overloaded function call in instance · 003fe135
      Eric Botcazou authored
      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.
      003fe135
    • Ronan Desplanques's avatar
      ada: Fix Ada.Directories.Modification_Time on Windows · 63eaa7ee
      Ronan Desplanques authored
      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.
      63eaa7ee
    • Eric Botcazou's avatar
      ada: Elide temporary for aliased array with unconstrained nominal subtype · a2e4afc6
      Eric Botcazou authored
      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.
      a2e4afc6
    • Piotr Trojanek's avatar
      ada: Fix expansion of type aspects with handling of aspects · de4f7051
      Piotr Trojanek authored
      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.
      de4f7051
    • Yannick Moy's avatar
      ada: Rename Is_Limited_View to reflect actual query · 36fcb4b9
      Yannick Moy authored
      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.
      36fcb4b9
    • Viljar Indus's avatar
      ada: Implement Aspects as fields under nodes · 76bf4321
      Viljar Indus authored
      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.
      76bf4321
    • Eric Botcazou's avatar
      ada: Minor tweaks for comparison operators · de4588f3
      Eric Botcazou authored
      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.
      de4588f3
    • Piotr Trojanek's avatar
      ada: Cleanup "not Present" on List_Id · 598409d3
      Piotr Trojanek authored
      gcc/ada/
      
      	* exp_ch6.adb, exp_disp.adb, sem_ch13.adb, sem_ch3.adb: Fix newly
      	detected violations.
      598409d3
    • Piotr Trojanek's avatar
      ada: Cleanup more "not Present" · afb52e6e
      Piotr Trojanek authored
      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.
      afb52e6e
    • Ronan Desplanques's avatar
      ada: Fix documentation of -gnatwc · f9e0e67b
      Ronan Desplanques authored
      -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.
      f9e0e67b
    • Steve Baird's avatar
      ada: New Local_Restrictions and User_Aspect aspects. · 9daee425
      Steve Baird authored
      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.
      9daee425
    • Bob Duff's avatar
      ada: Error in prefix-notation call · 7c09fcfc
      Bob Duff authored
      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.
      7c09fcfc
    • Piotr Trojanek's avatar
      ada: Remove duplicated code for expansion of packed array assignments · fe11fa6b
      Piotr Trojanek authored
      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.
      fe11fa6b
    • Piotr Trojanek's avatar
      ada: Simplify expansion of packed array assignments · dedaaa81
      Piotr Trojanek authored
      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.
      dedaaa81
    • Piotr Trojanek's avatar
      ada: Fix extra whitespace after END keywords · 7385cd35
      Piotr Trojanek authored
      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.
      7385cd35
    • Piotr Trojanek's avatar
      ada: Avoid extra conversion in expansion of packed array assignments · aeca5b95
      Piotr Trojanek authored
      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.
      aeca5b95
    • Piotr Trojanek's avatar
      ada: Simplify handling of known values in expansion of packed arrays · 9eb5deb4
      Piotr Trojanek authored
      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.
      9eb5deb4
    • Piotr Trojanek's avatar
      ada: Change local variables to constants in expansion of packed arrays · 68040a69
      Piotr Trojanek authored
      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.
      68040a69
    • Piotr Trojanek's avatar
      ada: Fix style in declaration of routine for expansion of packed arrays · 3335c4cd
      Piotr Trojanek authored
      Style cleanup.
      
      gcc/ada/
      
      	* exp_pakd.adb (Setup_Inline_Packed_Array_Reference): Remove extra
      	whitespace from the list of parameters.
      3335c4cd
    • Piotr Trojanek's avatar
      ada: Cleanup getting of actual subtypes · 98787e9c
      Piotr Trojanek authored
      Avoid potentially unnecessary call to Etype.
      
      gcc/ada/
      
      	* sem_util.adb (Get_Actual_Subtype_If_Available): Only call Etype
      	when necessary.
      98787e9c
    • Piotr Trojanek's avatar
      ada: Fix handling of actual subtypes for expanded names · b618441a
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_util.adb
      	(Get_Actual_Subtype,Get_Actual_Subtype_If_Available): Fix handling
      	of expanded names.
      b618441a
    • Viljar Indus's avatar
      ada: Simplify code for Ignore_Style_Checks_Pragmas · a4a24e58
      Viljar Indus authored
      gcc/ada/
      
      	* sem_prag.adb: (Analyze_Pragma): Reduce the number of nested if
      	statements.
      a4a24e58
    • Viljar Indus's avatar
      ada: Fix scope of semantic style_check pragmas · 95b8d1b5
      Viljar Indus authored
      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.
      95b8d1b5
    • Eric Botcazou's avatar
      ada: Fix internal error on address of element of packed array component · 5a2d82e0
      Eric Botcazou authored
      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.
      5a2d82e0
    • Juzhe-Zhong's avatar
      RISC-V regression test: Fix FAIL bb-slp-cond-1.c for RVV · ab7ccb91
      Juzhe-Zhong authored
      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.
      ab7ccb91
    • Jiufu Guo's avatar
      rs6000,testcase: Add require-effective-target has_arch_ppc64 to pr106550_1.c · a5a76c6f
      Jiufu Guo authored
      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.
      a5a76c6f
    • Lehua Ding's avatar
      RISC-V: Fixed failed rvv combine testcases · 71b1efd9
      Lehua Ding authored
      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:
      71b1efd9
    • Juzhe-Zhong's avatar
      test: Fix FAIL of vect-sdiv-pow2-1.c for RVV test: Fix FAIL of vect-sdiv-pow2-1.c for RVV# · 86c913ec
      Juzhe-Zhong authored
      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.
      86c913ec
    • Juzhe-Zhong's avatar
      test: Fix FAIL of SAD tests for RVV · 7ba2d234
      Juzhe-Zhong authored
      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.
      7ba2d234
    • Juzhe-Zhong's avatar
      test: Fix XPASS of bb-slp-43.c for RVV · d060f8a4
      Juzhe-Zhong authored
      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.
      d060f8a4
    • Juzhe-Zhong's avatar
      RISC-V: Enhance AVL propagation for complicate reduction auto-vectorization · f1e084c6
      Juzhe-Zhong authored
      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.
      f1e084c6
    • Pan Li's avatar
      RISC-V: Support FP ceil to i/l/ll diff size autovec · fd56a9cc
      Pan Li authored
      
      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: default avatarPan Li <pan2.li@intel.com>
      fd56a9cc
    • Pan Li's avatar
      Revert "test: Fix FAIL of bb-slp-cond-1.c for RVV" · b7d05f13
      Pan Li authored
      This reverts commit ee7ba242.
      b7d05f13
    • Juzhe-Zhong's avatar
      test: Fix FAIL of bb-slp-cond-1.c for RVV · ee7ba242
      Juzhe-Zhong authored
      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.
      ee7ba242
Loading