aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-06-13ada: Skip elaboration checks for abstract subprograms on derived typesPiotr Trojanek1-1/+4
Elaboration checks skip abstract subprogram declarations, which have no body that could be examined. Now these checks also skip abstract subprograms of a derived type, which have no body either. gcc/ada/ * sem_elab.adb (Check_Overriding_Primitive): Prevent Corresponding_Body to be called with entity of an abstract subprogram.
2023-06-13ada: Fix another case of missing Has_Private_View flagEric Botcazou1-1/+1
It occurs for the case of a function call first parsed as an identifier. gcc/ada/ * sem_ch12.adb (Save_References_In_Identifier): In the case where the identifier has been turned into a function call by analysis, call Set_Global_Type on the entity if it is global.
2023-06-13ada: Fix iterated component initializationMarc Poulhiès1-3/+8
The call to Resolve_Aggr_Expr may leave references to temporary entities used to check for the construct legality and meant to be removed. Using Preanalyze_And_Resolve correctly guarantees that there is no visible occurrence of such entities. gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Call Preanalyze_And_Resolve instead of Resolve_Aggr_Expr except for aggregate. Co-authored-by: Ed Schonberg <schonberg@adacore.com>
2023-06-13ada: Fix exception raised on invalid contract in generic packageEric Botcazou1-10/+21
This lets the compiler give a proper error message instead. gcc/ada/ * contracts.adb (Contract_Error): New exception. (Add_Contract_Item): Raise Contract_Error instead of Program_Error. (Add_Generic_Contract_Pragma): Deal with Contract_Error.
2023-06-13ada: Fix spurious error on call to function returning private in genericEric Botcazou2-58/+63
The spurious error is given on a call to a parameterless function returning a private type, present in the body of a generic construct both declared and instantiated in the presence of the full view of the type, because this full view is not properly restored for the instantiation. This is supposed to be handled by the Has_Private_View mechanism, but it is bypassed here because the call to the parameterless function is first parsed as a simple identifier before being later analyzed as a function call. Fixing this first issue uncovered another one, whereby the Has_Private_View flag was not properly set on an operator returning a private type that ends up being later resolved as a function call. Finally a small loophole in Eval_Attribute exposed by the change also needs to be plugged. gcc/ada/ * sem_attr.adb (Eval_Attribute): Add more exceptions to the early return for a prefix which is a nonfrozen generic actual type. * sem_ch12.adb (Copy_Generic_Node): Also check private views in the case of an entity name or operator analyzed as a function call. (Set_Global_Type): Make it a child of Save_Global_References. (Save_References_In_Operator): In the case where the operator has been turned into a function call, call Set_Global_Type on the entity if it is global.
2023-06-13ada: Fix internal error on imported function with post-conditionEric Botcazou1-0/+16
The problem, which is also present for an expression function, is that the function is invoked in the initializing expression of a variable declared in the same declarative part as the function, which causes the freezing of its artificial body before the post-condition is analyzed on its spec. gcc/ada/ * contracts.adb (Analyze_Entry_Or_Subprogram_Body_Contract): For a subprogram body that has no contracts and does not come from source, make sure that contracts on its corresponding spec are analyzed, if any, before expanding them.
2023-06-13ada: Streamline expansion of controlled actions for aggregatesEric Botcazou9-750/+142
This changes the strategy used to expand controlled actions for array and record aggregates so as to make it simpler and more robust. The current strategy is to set the No_Ctrl_Actions flag on the assignments generated during the expansion of aggregate, as done during the expansion of initialization procedures, and to generate the adjustments of the LHS manually in the same list of actions, before sending the entire list for analysis and expansion. The problem is that, when the RHS also requires controlled actions, the No_Ctrl_Actions flag prevents transient scopes from being created around the assignments, with the end result that the actions are "naturally" generated between the assignments and adjustments of the LHS, causing premature finalization of the RHS. In order to counter that, the controlled actions of the RHS must also be generated manually during the expansion of the aggregates, after blocking normal processing e.g. by means of the No_Side_Effect_Removal flag. This means that, for a more complex RHS, this strategy generates a wrong order of controlled actions by default, until specifically adjusted. The new strategy is to reuse the standard machinery as much as possible, disabling only the part that is not needed for the assignments generated during the expansion of aggregates, namely the finalization of the LHS; in other words, the adjustment of the LHS is left entirely to the standard machinery and the creation of transient scopes is no longer blocked, which gives a correct order of controlled actions by default. It is implemented by means of a No_Finalize_Actions flag present on the assignments generated during the expansion. It is mostly straightforward, modulo the following hitch: the assignments are now analyzed and expanded by the common expander, which in the case of controlled assignments analyzes the final rewriting with all checks off, which in particular disables elaboration checks for the calls to the Adjust primitives; now these checks are necessary in the case where an aggregate is the initialization expression of an object declared before the body of the Adjust primitive is seen. Hence the use of an existing trick, namely Suppress/Unsuppress blocks, around the assignments. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Add No_Finalize_Actions and remove No_Side_Effect_Removal. * gen_il-gen-gen_nodes.adb (N_Function_Call): Remove semantic flag No_Side_Effect_Removal (N_Assignment_Statement): Add semantic flag No_Finalize_Actions. * sinfo.ads (No_Ctrl_Actions): Adjust comment. (No_Finalize_Actions): New flag on assignment statements. (No_Side_Effect_Removal): Delete. * exp_aggr.adb (Build_Record_Aggr_Code): Remove obsolete comment and Ancestor_Is_Expression variable. In the case of an extension, do not generate a call to Adjust manually, call Set_No_Finalize_Actions instead. Do not set the tags, replace call to Make_Unsuppress_Block by Make_Suppress_Block and remove useless assertions. In the general case, call Initialize_Component. (Initialize_Controlled_Component): Delete. (Initialize_Simple_Component): Delete. (Initialize_Component): Do the low-level processing, but do not generate a call to Adjust manually, call Set_No_Finalize_Actions. (Process_Transient_Component): Delete. (Process_Transient_Component_Completion): Likewise. * exp_ch5.adb (Expand_Assign_Array): Deal with No_Finalize_Actions. (Expand_Assign_Array_Loop): Likewise. (Expand_N_Assignment_Statement): Likewise. (Make_Tag_Ctrl_Assignment): Likewise. * exp_util.adb (Remove_Side_Effects): Do not test the No_Side_Effect_Removal flag. * sem_prag.adb (Process_Suppress_Unsuppress): Give the warning in SPARK mode only for pragma Suppress. * tbuild.ads (Make_Suppress_Block): New declaration. (Make_Unsuppress_Block): Adjust comment. * tbuild.adb (Make_Suppress_Block): New procedure. (Make_Unsuppress_Block): Unsuppress instead of suppressing.
2023-06-13ada: Remove obsolete code in Analyze_AssignmentEric Botcazou1-155/+1
This code was dealing with build-in-place calls for nonlimited types, but they no longer exist since Is_Build_In_Place_Result_Type => Is_Limited_View. gcc/ada/ * sem_ch5.adb (Analyze_Assignment): Turn Rhs into a constant and remove calls to the following subprograms. (Transform_BIP_Assignment): Delete. (Should_Transform_BIP_Assignment): Likewise.
2023-06-13ada: Remove unreferenced routine Is_Inherited_Operation_For_TypePiotr Trojanek2-21/+0
Remove routine that is no referenced after deconstructing of restriction SPARK_05. gcc/ada/ * sem_util.ads (Is_Inherited_Operation_For_Type): Remove spec. * sem_util.adb (Is_Inherited_Operation_For_Type): Remove body.
2023-06-13ada: Small housekeeping work in expansion of extension aggregatesEric Botcazou1-21/+15
This avoids repeatedly calling Unqualify on the same node, removes a dead call to Generate_Finalization_Actions, a redundant setting of Assignment_OK and reuses a local variable more consistently. No functional changes. gcc/ada/ * exp_aggr.adb (Build_Record_Aggr_Code): Add new variable Ancestor_Q to store the result of Unqualify on Ancestor. Remove the dead call to Generate_Finalization_Actions in the case of another aggregate as ancestor part. Remove the redundant setting of Assignment_OK. Use Init_Typ in lieu of Etype (Ancestor) more consistently.
2023-06-13ada: Fix wrong expansion of limited extension aggregateEric Botcazou1-2/+0
This happens when the ancestor part is itself an aggregate: in this case, the tag of the extension aggregate is wrongly set to that of the ancestor. gcc/ada/ * exp_aggr.adb (Build_Record_Aggr_Code): In the case of an extension aggregate of a limited type whose ancestor part is an aggregate, do not skip the final code assigning the tag of the extension.
2023-06-13ada: Mark attribute Initialized as ghost codeYannick Moy3-1/+25
Implement the SPARK RM change that defines attribute Initialized as being ghost, i.e. only allowed where a ghost entity would be allowed. gcc/ada/ * ghost.adb (Check_Ghost_Context): Allow absence of Ghost_Id for attribute. Update error message to mention Ghost_Predicate. (Is_Ghost_Attribute_Reference): New query. * ghost.ads (Is_Ghost_Attribute_Reference): New query. * sem_attr.adb (Resolve_Attribute): Check ghost context for ghost attributes.
2023-06-13ada: Add No_Elaboration_Code_All pragma to System.Storage_ElementsDaniel King1-0/+3
Allows System.Storage_Elements to be used in units that have the No_Elaboration_Code_All restriction. gcc/ada/ * libgnat/s-stoele.ads: Add No_Elaboration_Code_All pragma.
2023-06-13ada: Factor out tag assignments from type in expanderEric Botcazou5-124/+57
They are performed in a few different places during expansion. gcc/ada/ * exp_util.ads (Make_Tag_Assignment_From_Type): Declare. * exp_util.adb (Make_Tag_Assignment_From_Type): New function. * exp_aggr.adb (Build_Record_Aggr_Code): Call the above function. (Initialize_Simple_Component): Likewise. * exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Likewise. (Build_Record_Init_Proc.Build_Init_Procedure ): Likewise. (Make_Tag_Assignment): Likewise. Rename local variable and call Unqualify to go through qualified expressions. * exp_ch4.adb (Expand_Allocator_Expression): Likewise.
2023-06-13ada: Use ghost predicate in standard libraryYannick Moy2-2/+6
In preparation for attribute Initialized to become ghost, use aspect Ghost_Predicate instead of Predicate in unit Ada.Strings.Superbounded of the standard library. gcc/ada/ * libgnat/a-strsup.ads: Change predicate aspect. * sem_ch13.adb (Add_Predicate): Fix for first predicate.
2023-06-13ada: Fix expansion of aggregates with controlled componentsEric Botcazou1-3/+99
The expansion is incorrect in the case where the initialization expression of a component is a conditional expression that has a function call as one of its dependent expressions, leading to a wrong order of initialization, adjustment and finalization. gcc/ada/ * exp_aggr.adb (Initialize_Component): Perform immediate expansion of the initialization expression if it is a conditional expression and the component type is controlled.
2023-06-13ada: Factor common processing in expansion of aggregatesEric Botcazou1-640/+360
The final processing at the component level of array aggregates and record aggregates is very similar, so this factors out the common processing into three new library-level subprograms. There should be no functional changes, but the expanded code may be changed in the case of controlled components of array aggregates not covered by a multiple choice: the previous expansion used to place new declarations prior to the aggregate in this case and that is no longer the case, i.e. they are always placed right before the initialization of the component (as was done for all controlled components of record aggregates and controlled components of array aggregates covered by a multiple choice). gcc/ada/ * exp_aggr.adb (Initialize_Component): New procedure factored out from the processing of array and record aggregates. (Initialize_Controlled_Component): Likewise. (Initialize_Simple_Component): Likewise. (Build_Array_Aggr_Code.Gen_Assign): Remove In_Loop parameter. Call Initialize_Component to initialize the component. (Initialize_Array_Component): Delete. (Initialize_Ctrl_Array_Component): Likewise. (Build_Array_Aggr_Code): Adjust calls to Gen_Assign. (Build_Record_Aggr_Code): Call Initialize_Simple_Component or Initialize_Component to initialize the component. (Initialize_Ctrl_Record_Component): Delete. (Initialize_Record_Component): Likewise.
2023-06-13ada: Remove wrong comment about expansion of exceptions for GNATprovePiotr Trojanek1-5/+3
Code cleanup related to handling exceptions in GNATprove. gcc/ada/ * exp_ch11.adb (Expand_N_Raise_Statement): Expansion of raise statements never happens in GNATprove mode.
2023-06-13ada: Cleanup finding of locally handled exception handlersPiotr Trojanek1-35/+33
Code cleanup related to handling exceptions in GNATprove; semantics is unaffected. gcc/ada/ * exp_ch11.adb (Find_Local_Handler): Replace guard against other constructs appearing in the list of exception handlers with iteration using First_Non_Pragma/Next_Non_Pragma.
2023-06-13ada: Cleanup expansion of locally handled exception handlersPiotr Trojanek2-71/+55
Code cleanup related to handling exceptions in GNATprove; semantics is unaffected. gcc/ada/ * exp_ch11.ads (Find_Local_Handler): Fix typo in comment. * exp_ch11.adb (Find_Local_Handler): Remove redundant check for the Exception_Handler list being present; use membership test to eliminate local object LCN; fold nested IF statements. Remove useless ELSIF condition.
2023-06-13ada: Tune style in detection of writable function actualsPiotr Trojanek1-4/+6
Cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Check_Function_Writable_Actuals): Tune style; use subtype name to detect membership test nodes.
2023-06-13ada: Simplify appending to a newly created listPiotr Trojanek1-3/+3
Code cleanup; semantics is unaffected. gcc/ada/ * exp_disp.adb (Make_Disp_Asynchronous_Select_Spec): Use a single call to New_List.
2023-06-13ada: Support new GNAT-specific aspect Ghost_PredicateYannick Moy23-634/+772
New aspect Ghost_Predicate allows the use of ghost entities in the predicate expression, even if the type is not ghost itself. As a result, subtypes with a ghost predicate cannot be used in membership tests. Subtypes with ghost predicates are subject to the same additional restrictions as subtypes with aspect Dynamic_Predicate. They are governed for compilation by assertion policy Ghost. Checking of the predicate itself is governed by the usual assertion policy (Static_Predicate/Dynamic_Predicate/Predicate) independently of the ghost predicate. gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst: Document new aspect. * doc/gnat_rm/implementation_defined_pragmas.rst: Whitespace. * aspects.adb (Init_Canonical_Aspect): Set it to Predicate. * aspects.ads: Set global constants for new aspect. * einfo.ads: Describe new flag related to new aspect. * exp_ch6.adb (Can_Fold_Predicate_Call): Do not fold new aspect. * exp_util.adb (Make_Predicate_Check): Add comment. * gen_il-fields.ads: Add new flag. * gen_il-gen-gen_entities.adb: Add new flag. * ghost.adb (Is_OK_Ghost_Context): Ghost predicate is an OK ghost context. (Mark_Ghost_Pragma): Add overloading with ghost mode parameter. * ghost.ads (Mark_Ghost_Pragma): Add overloading with ghpst mode parameter. (Name_To_Ghost_Mode): Make function public. * sem_aggr.adb: Issue error for violation of valid use. * sem_case.adb: Issue error for violation of valid use. * sem_ch13.adb: Adapt for new aspect. * sem_ch3.adb (Analyze_Full_Type_Declaration): Remove dead code which was trying to propagate Has_Predicates flag in the wrong direction (from derived to parent type). (Analyze_Number_Declaration): Issue error for violation of valid use. (Build_Derived_Type): Cleanup inheritance of predicate flags from parent to derived type. (Build_Predicate_Function): Only add a predicate check when it is not ignored as Ghost code. * sem_ch4.adb (Analyze_Membership_Op): Issue an error for use of a subtype with a ghost predicate as name in a membership test. * sem_ch5.adb (Check_Predicate_Use): Issue error for violation of valid use. * sem_eval.adb: Adapt code for Dynamic_Predicate to account for Ghost_Predicate too. * sem_prag.adb (Analyze_Pragma): Make pragma ghost or not. * sem_util.adb (Bad_Predicated_Subtype_Use): Adapt to new aspect. (Inherit_Predicate_Flags): Add inheritance of flag. Add parameter to apply to derived types. * sem_util.ads (Inherit_Predicate_Flags): Change signature. * snames.ads-tmpl: Add new aspect name. * gnat_rm.texi: Regenerate.
2023-06-13ada: Remove explicit decoration of wrapper created in freezingPiotr Trojanek1-2/+0
We create wrapper functions associated with inherited functions with controlling results which are not overridden during freezing. We partly decorated them explicitly, even though they would be fully decorated later anyway. This early decoration didn't work as expected, because flag In_Private_Part that is read by Override_Dispatching_Operation it not set reliably while freezing (as explained in the comment of Is_Private_Declaration). In effect, we were getting a circularity between Alias and Overridden_Operation, which was causing GNATprove to loop infinitely. Apparently the cleanest fix is to not decorate the wrapper with an early call to Override_Dispatching_Operation. gcc/ada/ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Remove early decoration.
2023-06-13RISC-V: Fix one typo in full-vec-movel testPan Li1-1/+1
This patch would like to fix one typo when checking assembly of full-vec-movel. Signed-off-by: Pan Li <pan2.li@intel.com> gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c: Adjust dg-do to comiple for asm checking.
2023-06-13AArch64: [PR96339] Optimise svlast[ab]Tejas Belagod16-24/+823
This PR optimizes an SVE intrinsics sequence where svlasta (svptrue_pat_b8 (SV_VL1), x) a scalar is selected based on a constant predicate and a variable vector. This sequence is optimized to return the correspoding element of a NEON vector. For eg. svlasta (svptrue_pat_b8 (SV_VL1), x) returns umov w0, v0.b[1] Likewise, svlastb (svptrue_pat_b8 (SV_VL1), x) returns umov w0, v0.b[0] This optimization only works provided the constant predicate maps to a range that is within the bounds of a 128-bit NEON register. gcc/ChangeLog: PR target/96339 * config/aarch64/aarch64-sve-builtins-base.cc (svlast_impl::fold): Fold sve calls that have a constant input predicate vector. (svlast_impl::is_lasta): Query to check if intrinsic is svlasta. (svlast_impl::is_lastb): Query to check if intrinsic is svlastb. (svlast_impl::vect_all_same): Check if all vector elements are equal. gcc/testsuite/ChangeLog: PR target/96339 * gcc.target/aarch64/sve/acle/general-c/svlast.c: New. * gcc.target/aarch64/sve/acle/general-c/svlast128_run.c: New. * gcc.target/aarch64/sve/acle/general-c/svlast256_run.c: New. * gcc.target/aarch64/sve/pcs/return_4.c (caller_bf16): Fix asm to expect optimized code for function body. * gcc.target/aarch64/sve/pcs/return_4_128.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_4_256.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_4_512.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_4_1024.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_4_2048.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_5.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_5_128.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_5_256.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_5_512.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_5_1024.c (caller_bf16): Likewise. * gcc.target/aarch64/sve/pcs/return_5_2048.c (caller_bf16): Likewise.
2023-06-12Update perf auto profile scriptAndi Kleen1-1/+8
- Fix gen_autofdo_event: The download URL for the Intel Perfmon Event list has changed, as well as the JSON format. Also it now uses pattern matching to match CPUs. Update the script to support all of this. - Regenerate gcc-auto-profile with the latest published Intel model numbers, so it works with recent systems. - So far it's still broken on hybrid systems contrib/ChangeLog: * gen_autofdo_event.py: Update for download server changes gcc/ChangeLog * config/i386/gcc-auto-profile: Regenerate.
2023-06-13RISC-V: Fix V_WHOLE && V_FRACT iterator requirementJuzhe-Zhong2-7/+33
This patch fixes the requirement of V_WHOLE and V_FRACT. E.g. VNx8QI in V_WHOLE has no requirement which is incorrect. Actually, VNx8QI should be whole(full) mode when TARGET_MIN_VLEN < 128 since when TARGET_MIN_VLEN == 128, VNx8QI is e8mf2 which is fractional vector. Co-Authored by: Robin Dapp <rdapp@ventanamicro.com> gcc/ChangeLog: * config/riscv/vector-iterators.md: Fix requirement. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c: New test.
2023-06-13RISC-V: Enhance RVV VLA SLP auto-vectorization with decompress operationJuzhe-Zhong5-0/+232
According to RVV ISA: https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc We can enhance VLA SLP auto-vectorization with (16.5.1. Synthesizing vdecompress) Decompress operation. Case 1 (nunits = POLY_INT_CST [16, 16]): _48 = VEC_PERM_EXPR <_37, _35, { 0, POLY_INT_CST [16, 16], 1, POLY_INT_CST [17, 16], 2, POLY_INT_CST [18, 16], ... }>; We can optimize such VLA SLP permuation pattern into: _48 = vdecompress (_37, _35, mask = { 0, 1, 0, 1, ... }; Case 2 (nunits = POLY_INT_CST [16, 16]): _23 = VEC_PERM_EXPR <_46, _44, { POLY_INT_CST [1, 1], POLY_INT_CST [3, 3], POLY_INT_CST [2, 1], POLY_INT_CST [4, 3], POLY_INT_CST [3, 1], POLY_INT_CST [5, 3], ... }>; We can optimize such VLA SLP permuation pattern into: _48 = vdecompress (slidedown(_46, 1/2 nunits), slidedown(_44, 1/2 nunits), mask = { 0, 1, 0, 1, ... }; For example: void __attribute__ ((noinline, noclone)) vec_slp (uint64_t *restrict a, uint64_t b, uint64_t c, int n) { for (int i = 0; i < n; ++i) { a[i * 2] += b; a[i * 2 + 1] += c; } } ASM: ... vid.v v0 vand.vi v0,v0,1 vmseq.vi v0,v0,1 ===> mask = { 0, 1, 0, 1, ... } vdecompress: viota.m v3,v0 vrgather.vv v2,v1,v3,v0.t Loop: vsetvli zero,a5,e64,m1,ta,ma vle64.v v1,0(a0) vsetvli a6,zero,e64,m1,ta,ma vadd.vv v1,v2,v1 vsetvli zero,a5,e64,m1,ta,ma mv a5,a3 vse64.v v1,0(a0) add a3,a3,a1 add a0,a0,a2 bgtu a5,a4,.L4 gcc/ChangeLog: * config/riscv/riscv-v.cc (emit_vlmax_decompress_insn): New function. (shuffle_decompress_patterns): New function. (expand_vec_perm_const_1): Add decompress optimization. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/partial/slp-8.c: New test. * gcc.target/riscv/rvv/autovec/partial/slp-9.c: New test. * gcc.target/riscv/rvv/autovec/partial/slp_run-8.c: New test. * gcc.target/riscv/rvv/autovec/partial/slp_run-9.c: New test.
2023-06-13Daily bump.GCC Administrator6-1/+473
2023-06-13PR modula2/110189 Using an unknown TYPE as argument to VAL gives ICEGaius Mulley3-117/+85
This patch tidies P3Build.bnf and fixes error format specs in M2Quads.mod when encountering unknown symbols. gcc/m2/ChangeLog: PR modula2/110189 * gm2-compiler/M2Quads.mod (BuildAbsFunction): Replace abort format specifier. (BuildValFunction): Replace abort format specifier. (BuildCastFunction): Replace abort format specifier. (BuildMinFunction): Replace abort format specifier. (BuildMaxFunction): Replace abort format specifier. (BuildTruncFunction): Replace abort format specifier. * gm2-compiler/P3Build.bnf (Pass1): Remove. (Pass2): Remove. (Pass3): Remove. (Expect): Add Pass1. (AsmStatement): Remove Pass3. (AsmOperands): Remove Pass3. (AsmOperandSpec): Remove Pass3. (AsmInputElement): Remove Pass3. (AsmOutputElement): Remove Pass3. (AsmTrashList): Remove Pass3. gcc/testsuite/ChangeLog: PR modula2/110189 * gm2/pim/fail/foovaltype.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-06-12[committed] [PR rtl-optimization/101188] Fix reload_cse_move2add ignoring ↵Jeff Law2-69/+142
clobbers So as Georg-Johann discusses in the BZ, reload_cse_move2add can generate incorrect code when optimizing code with clobbers. Specifically in the case where we try to optimize a sequence of 4 operations down to 3 operations we can reset INSN to the next instruction and continue the loop. That skips the code to invalidate objects based on things like REG_INC nodes, stack pushes and most importantly clobbers attached to the current insn. This patch factors all of the invalidation code used by reload_cse_move2add into a new function and calls it at the appropriate time. Georg-Johann has confirmed this patch fixes his avr bug and I've had it in my tester over the weekend. It's bootstrapped and regression tested on aarch64, m68k, sh4, alpha and hppa. It's also regression tested successfully on a wide variety of other targets. gcc/ PR rtl-optimization/101188 * postreload.cc (reload_cse_move2add_invalidate): New function, extracted from... (reload_cse_move2add): Call reload_cse_move2add_invalidate. gcc/testsuite PR rtl-optimization/101188 * gcc.c-torture/execute/pr101188.c: New test
2023-06-12[aarch64] Improve code-gen for vector initialization with single constant ↵Prathamesh Kulkarni4-8/+176
element. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_expand_vector_init): Tweak condition if (n_var == n_elts && n_elts <= 16) to allow a single constant, and if maxv == 1, use constant element for duplicating into register. gcc/testsuite/ChangeLog: * gcc.target/aarch64/vec-init-single-const.c: New test. * gcc.target/aarch64/vec-init-single-const-be.c: Likewise. * gcc.target/aarch64/vec-init-single-const-2.c: Likewise.
2023-06-12OpenMP: Cleanups related to the 'present' modifierTobias Burnus12-50/+69
Reduce number of enum values passed to libgomp as GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC} have the same semantic as GOMP_MAP_FORCE_PRESENT (i.e. abort if not present, otherwise ignore); that's different to GOMP_MAP_ALWAYS_PRESENT_{TO,TOFROM,FROM} which also abort if not present but copy data when present. This is is a follow-up to the commit r14-1579-g4ede915d5dde93 done 6 days ago. Additionally, the commit improves a libgomp run-time and a C/C++ compile-time error wording and extends testcases a tiny bit. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_clause_map): Reword error message for clearness especially with 'omp target (enter/exit) data.' gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_clause_map): Reword error message for clearness especially with 'omp target (enter/exit) data.' * semantics.cc (handle_omp_array_sections): Handle GOMP_MAP_{ALWAYS_,}PRESENT_{TO,TOFROM,FROM,ALLOC} enum values. gcc/ChangeLog: * gimplify.cc (gimplify_adjust_omp_clauses_1): Use GOMP_MAP_FORCE_PRESENT for 'present alloc' implicit mapping. (gimplify_adjust_omp_clauses): Change GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC} to the equivalent GOMP_MAP_FORCE_PRESENT. * omp-low.cc (lower_omp_target): Remove handling of no-longer valid GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC}; update map kinds used for to/from clauses with present modifier. include/ChangeLog: * gomp-constants.h (enum gomp_map_kind): Change the enum values GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC} to be compiler only. (GOMP_MAP_PRESENT_P): Update to include also GOMP_MAP_FORCE_PRESENT. libgomp/ChangeLog: * target.c (gomp_to_device_kind_p, gomp_map_vars_internal): Replace GOMP_MAP_PRESENT_{FROM,TO,TOFROM,ACLLOC} by GOMP_MAP_FORCE_PRESENT. (gomp_map_vars_internal, gomp_update): Likewise; unify and improve error message. * testsuite/libgomp.c-c++-common/target-present-2.c: Update for changed error message. * testsuite/libgomp.fortran/target-present-1.f90: Likewise. * testsuite/libgomp.fortran/target-present-2.f90: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.c-c++-common/target-present-1.c: Likewise and extend testcase to check that data is copied when needed. * testsuite/libgomp.c-c++-common/target-present-3.c: Likewise. * testsuite/libgomp.fortran/target-present-3.f90: Likewise. gcc/testsuite/ChangeLog: * c-c++-common/gomp/defaultmap-4.c: Update scan-tree-dump. * c-c++-common/gomp/map-9.c: Likewise. * gfortran.dg/gomp/defaultmap-8.f90: Likewise. * gfortran.dg/gomp/map-11.f90: Likewise. * gfortran.dg/gomp/target-update-1.f90: Likewise. * gfortran.dg/gomp/map-12.f90: Likewise; also check original dump. * c-c++-common/gomp/map-6.c: Update dg-error and also check clause error with 'target (enter/exit) data'.
2023-06-12Add some overrides.Andrew MacLeod4-6/+27
PR tree-optimization/110205 * range-op-float.cc (range_operator::fold_range): Add default FII fold routine. * range-op-mixed.h (class operator_gt): Add missing final overrides. * range-op.cc (range_op_handler::fold_range): Add RO_FII case. (operator_lshift ::update_bitmask): Add final override. (operator_rshift ::update_bitmask): Add final override. * range-op.h (range_operator::fold_range): Add FII prototype.
2023-06-12Provide interface for non-standard operators.Andrew MacLeod3-19/+29
THis removes the hack introduced for WIDEN_MULT which exported a pointer to the operator and the gimple-range-op.cc set the operator to this pointer whenn it was appropriate. Instead, we simple change the range-op table to be unsigned indexed, and add new opcodes to the end of the table, allowing them to be indexed directly via range_op_handler::range_op. * gimple-range-op.cc (gimple_range_op_handler::maybe_non_standard): Use range_op_handler directly. * range-op.cc (range_op_handler::range_op_handler): Unsigned param instead of tree-code. (ptr_op_widen_plus_signed): Delete. (ptr_op_widen_plus_unsigned): Delete. (ptr_op_widen_mult_signed): Delete. (ptr_op_widen_mult_unsigned): Delete. (range_op_table::initialize_integral_ops): Add new opcodes. * range-op.h (range_op_handler): Use unsigned. (OP_WIDEN_MULT_SIGNED): New. (OP_WIDEN_MULT_UNSIGNED): New. (OP_WIDEN_PLUS_SIGNED): New. (OP_WIDEN_PLUS_UNSIGNED): New. (RANGE_OP_TABLE_SIZE): New. (range_op_table::operator []): Use unsigned. (range_op_table::set): Use unsigned. (m_range_tree): Make unsigned. (ptr_op_widen_mult_signed): Remove. (ptr_op_widen_mult_unsigned): Remove. (ptr_op_widen_plus_signed): Remove. (ptr_op_widen_plus_unsigned): Remove.
2023-06-12Provide a default range_operator via range_op_handler.Andrew MacLeod3-18/+45
range_op_handler now provides a default range_operator for any opcode, so there is no longer a need to check for a valid operator. * gimple-range-op.cc (gimple_range_op_handler): Set m_operator manually as there is no access to the default operator. (cfn_copysign::fold_range): Don't check for validity. (cfn_ubsan::fold_range): Ditto. (gimple_range_op_handler::maybe_builtin_call): Don't set to NULL. * range-op.cc (default_operator): New. (range_op_handler::range_op_handler): Use default_operator instead of NULL. (range_op_handler::operator bool): Move from header, compare against default operator. (range_op_handler::range_op): New. * range-op.h (range_op_handler::operator bool): Move.
2023-06-12Switch from unified table to range_op_table. There can be only one.Andrew MacLeod2-31/+16
Now that there is only a single range_op_table, make the base table the only table. * range-op.cc (unified_table): Delete. (range_op_table operator_table): Instantiate. (range_op_table::range_op_table): Rename from unified_table. (range_op_handler::range_op_handler): Use range_op_table. * range-op.h (range_op_table::operator []): Inline. (range_op_table::set): Inline.
2023-06-12Remove type from range_op_handler table selectionAndrew MacLeod12-87/+43
With the unified table complete, we no loonger need to specify a type to choose a table when setting a range_op_handler. * gimple-range-gori.cc (gori_compute::condexpr_adjust): Do not pass type. * gimple-range-op.cc (get_code): Rename from get_code_and_type and simplify. (gimple_range_op_handler::supported_p): No need for type. (gimple_range_op_handler::gimple_range_op_handler): Ditto. (cfn_copysign::fold_range): Ditto. (cfn_ubsan::fold_range): Ditto. * ipa-cp.cc (ipa_vr_operation_and_type_effects): Ditto. * ipa-fnsummary.cc (evaluate_conditions_for_known_args): Ditto. * range-op-float.cc (operator_plus::op1_range): Ditto. (operator_mult::op1_range): Ditto. (range_op_float_tests): Ditto. * range-op.cc (get_op_handler): Remove. (range_op_handler::set_op_handler): Remove. (operator_plus::op1_range): No need for type. (operator_minus::op1_range): Ditto. (operator_mult::op1_range): Ditto. (operator_exact_divide::op1_range): Ditto. (operator_cast::op1_range): Ditto. (perator_bitwise_not::fold_range): Ditto. (operator_negate::fold_range): Ditto. * range-op.h (range_op_handler::range_op_handler): Remove type param. (range_cast): No need for type. (range_op_table::operator[]): Check for enum_code >= 0. * tree-data-ref.cc (compute_distributive_range): No need for type. * tree-ssa-loop-unswitch.cc (unswitch_predicate): Ditto. * value-query.cc (range_query::get_tree_range): Ditto. * value-relation.cc (relation_oracle::validate_relation): Ditto. * vr-values.cc (range_of_var_in_loop): Ditto. (simplify_using_ranges::fold_cond_with_ops): Ditto.
2023-06-12Add a hybrid MAX_EXPR operator for integer and pointer.Andrew MacLeod4-30/+25
This adds an operator to the unified table for MAX_EXPR which will select either the pointer or integer version based on the type passed to the method. This is for use until we have a seperate PRANGE class. THIs also removes the pointer table which is no longer needed. * range-op-mixed.h (operator_max): Remove final. * range-op-ptr.cc (pointer_table::pointer_table): Remove MAX_EXPR. (pointer_table::pointer_table): Remove. (class hybrid_max_operator): New. (range_op_table::initialize_pointer_ops): Add hybrid_max_operator. * range-op.cc (pointer_tree_table): Remove. (unified_table::unified_table): Comment out MAX_EXPR. (get_op_handler): Remove check of pointer table. * range-op.h (class pointer_table): Remove.
2023-06-12Add a hybrid MIN_EXPR operator for integer and pointer.Andrew MacLeod3-5/+31
This adds an operator to the unified table for MIN_EXPR which will select either the pointer or integer version based on the type passed to the method. This is for use until we have a seperate PRANGE class. * range-op-mixed.h (operator_min): Remove final. * range-op-ptr.cc (pointer_table::pointer_table): Remove MIN_EXPR. (class hybrid_min_operator): New. (range_op_table::initialize_pointer_ops): Add hybrid_min_operator. * range-op.cc (unified_table::unified_table): Comment out MIN_EXPR.
2023-06-12Add a hybrid BIT_IOR_EXPR operator for integer and pointer.Andrew MacLeod3-9/+57
This adds an operator to the unified table for BIT_IOR_EXPR which will select either the pointer or integer version based on the type passed to the method. This is for use until we have a seperate PRANGE class. * range-op-mixed.h (operator_bitwise_or): Remove final. * range-op-ptr.cc (pointer_table::pointer_table): Remove BIT_IOR_EXPR. (class hybrid_or_operator): New. (range_op_table::initialize_pointer_ops): Add hybrid_or_operator. * range-op.cc (unified_table::unified_table): Comment out BIT_IOR_EXPR.
2023-06-12Add a hybrid BIT_AND_EXPR operator for integer and pointer.Andrew MacLeod3-10/+73
This adds an operator to the unified table for BIT_AND_EXPR which will select either the pointer or integer version based on the type passed to the method. This is for use until we have a seperate PRANGE class. * range-op-mixed.h (operator_bitwise_and): Remove final. * range-op-ptr.cc (pointer_table::pointer_table): Remove BIT_AND_EXPR. (class hybrid_and_operator): New. (range_op_table::initialize_pointer_ops): Add hybrid_and_operator. * range-op.cc (unified_table::unified_table): Comment out BIT_AND_EXPR.
2023-06-12Split pointer ibased range operators to range-op-ptr.ccAndrew MacLeod4-256/+314
MOve the pointer table and all pointer specific operators into a new file for pointers. * Makefile.in (OBJS): Add range-op-ptr.o. * range-op-mixed.h (update_known_bitmask): Move prototype here. (minus_op1_op2_relation_effect): Move prototype here. (wi_includes_zero_p): Move function to here. (wi_zero_p): Ditto. * range-op.cc (update_known_bitmask): Remove static. (wi_includes_zero_p): Move to header. (wi_zero_p): Move to header. (minus_op1_op2_relation_effect): Remove static. (operator_pointer_diff): Move class and routines to range-op-ptr.cc. (pointer_plus_operator): Ditto. (pointer_min_max_operator): Ditto. (pointer_and_operator): Ditto. (pointer_or_operator): Ditto. (pointer_table): Ditto. (range_op_table::initialize_pointer_ops): Ditto. * range-op-ptr.cc: New.
2023-06-12Move operator_max to the unified range-op table.Andrew MacLeod3-35/+18
Also remove the integral table. * range-op-mixed.h (class operator_max): Move from... * range-op.cc (unified_table::unified_table): Add MAX_EXPR. (get_op_handler): Remove the integral table. (class operator_max): Move from here. (integral_table::integral_table): Delete. * range-op.h (class integral_table): Delete.
2023-06-12Move operator_min to the unified range-op table.Andrew MacLeod2-11/+18
* range-op-mixed.h (class operator_min): Move from... * range-op.cc (unified_table::unified_table): Add MIN_EXPR. (class operator_min): Move from here. (integral_table::integral_table): Remove MIN_EXPR.
2023-06-12Move operator_bitwise_or to the unified range-op table.Andrew MacLeod2-21/+26
* range-op-mixed.h (class operator_bitwise_or): Move from... * range-op.cc (unified_table::unified_table): Add BIT_IOR_EXPR. (class operator_bitwise_or): Move from here. (integral_table::integral_table): Remove BIT_IOR_EXPR.
2023-06-12Move operator_bitwise_and to the unified range-op table.Andrew MacLeod2-34/+42
At this point, the remaining 4 integral operation have different impllementations than pointers, so we now check for a pointer table entry first, then if there is nothing, look at the Unified table. * range-op-mixed.h (class operator_bitwise_and): Move from... * range-op.cc (unified_table::unified_table): Add BIT_AND_EXPR. (get_op_handler): Check for a pointer table entry first. (class operator_bitwise_and): Move from here. (integral_table::integral_table): Remove BIT_AND_EXPR.
2023-06-12Move operator_bitwise_xor to the unified range-op table.Andrew MacLeod2-29/+30
* range-op-mixed.h (class operator_bitwise_xor): Move from... * range-op.cc (unified_table::unified_table): Add BIT_XOR_EXPR. (class operator_bitwise_xor): Move from here. (integral_table::integral_table): Remove BIT_XOR_EXPR. (pointer_table::pointer_table): Remove BIT_XOR_EXPR.
2023-06-12Move operator_bitwise_not to the unified range-op table.Andrew MacLeod2-18/+16
* range-op-mixed.h (class operator_bitwise_not): Move from... * range-op.cc (unified_table::unified_table): Add BIT_NOT_EXPR. (class operator_bitwise_not): Move from here. (integral_table::integral_table): Remove BIT_NOT_EXPR. (pointer_table::pointer_table): Remove BIT_NOT_EXPR.