aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-11-04diagnostics: update leading comment for class diagnostic_contextDavid Malcolm1-2/+33
No functional change intended. gcc/ChangeLog: * diagnostic.h (class diagnostic_context): Update leading comment. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-04diagnostics: cleanups to opts-diagnostic.ccDavid Malcolm1-59/+63
No functional change intended. gcc/ChangeLog: * opts-diagnostic.cc: Apply renamings throughout for clarity: from "name" and "format_name" to "scheme_name", from "m_format" to "m_scheme_name", and from "handler" to "scheme_handler". (output_factory::scheme_handler::get_handler): Pass name by const reference. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-04libgccjit: Add gcc_jit_global_set_readonlyAntoni Boucher12-11/+187
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_29): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_global_set_readonly. * jit-playback.cc (global_new_decl, new_global, new_global_initialized): New parameter readonly. * jit-playback.h (global_new_decl, new_global, new_global_initialized): New parameter readonly. * jit-recording.cc (recording::global::replay_into): Use m_readonly. (recording::global::write_reproducer): Dump reproducer for gcc_jit_global_set_readonly. * jit-recording.h (get_readonly, set_readonly): New methods. (m_readonly): New attribute. * libgccjit.cc (gcc_jit_global_set_readonly): New function. (gcc_jit_block_add_assignment): Check that we don't assign to a readonly variable. * libgccjit.h (gcc_jit_global_set_readonly): New function. (LIBGCCJIT_HAVE_gcc_jit_global_set_readonly): New define. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Mention test-readonly.c. * jit.dg/test-error-assign-readonly.c: New test. * jit.dg/test-readonly.c: New test.
2024-11-04testsuite: arm: Force hard ABI for pr51534.c testTorbjörn SVENSSON1-1/+2
The test case is written in a way that it should be using hard float ABI, but the use of -mfloat-abi=hard could be overriden by dg-add-options arm_neon. Ensure that -mfloat-abi=hard is always after. gcc/testsuite/ChangeLog: * gcc.target/arm/pr51534.c: Ensure -mfloat-abi=hard is used. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-11-04testsuite: arm: Use effective-target for data-intrinsics-assembly testTorbjörn SVENSSON1-2/+2
The expected assembler in the test case assumes -marm, so explicily require it. gcc/testsuite/ChangeLog: * gcc.target/arm/acle/data-intrinsics-assembly.c: Use effective-target arm_arch_v6_arm. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-11-04testsuite: arm: Relax cbranch tests to accept inverted branchesTorbjörn SVENSSON1-6/+6
Similar to PR113502, but for non-aarch64 test. The test started to fail after r14-7243-gafac1bd3365. gcc/testsuite/ChangeLog: * gcc.target/arm/vect-early-break-cbranch.c: Ignore exact branch. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-11-04testsuite: arm: Update expected asm in armv8_2-fp16-neon-2.cTorbjörn SVENSSON1-1/+2
With the changes in r15-1579-g792f97b44ff, the test_vmul_n_16x8 function does not contain any vdup.16 q* r* instruction with -mfloat-abi=softfp. The differnce between r15-1578-g5185274c76c and r15-1579-g792f97b44ff with -mfloat-abi=softfp for the function is: .global test_vmul_n_16x8 .syntax unified .arm .type test_vmul_n_16x8, %function test_vmul_n_16x8: @ args = 4, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. vmov d16, r0, r1 @ v8hf vmov d17, r2, r3 - ldrh r3, [sp] @ __fp16 - vdup.16 q9, r3 + vld1.16 {d18[], d19[]}, [sp] vmul.f16 q8, q9, q8 vmov r0, r1, d16 @ v8hf vmov r2, r3, d17 bx lr .size test_vmul_n_16x8, .-test_vmul_n_16x8 gcc/testsuite/ChangeLog: * gcc.target/arm/armv8_2-fp16-neon-2.c: Expect 3 vdup.16 q* r* when in arm_hf_eabi else 2. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-11-04libgccjit: Add count zeroes builtins to ensure_optimization_builtins_existAntoni Boucher1-0/+6
gcc/jit/ChangeLog: * jit-builtins.cc (ensure_optimization_builtins_exist): Add missing builtins.
2024-11-04ada: Move special case for null string literal from frontend to backendPiotr Trojanek1-2/+12
Previously the lower bound of string literals indexed by non-static integer types was artificially set to 1 in the frontend. This was to avoid an overflow in calculation of a null string size by the GCC backend, which was causing an excessively large binary object file. However, setting the lower bound to 1 was problematic for GNATprove, which could not easily retrieve the lower bound of string literals. This patch avoids the overflow in GCC by recognizing null string literal subtypes in Gigi. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Recognize null string literal subtypes and set their bounds to 1 .. 0.
2024-11-04ada: Remove special case for the size of a string literal subtypePiotr Trojanek1-6/+2
Apparently we no longer need to ignore string literal subtypes case when validating size of a type entity. Code cleanup; behavior appears to be unaffected. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Remove special case for string literal subtypes.
2024-11-04ada: Fix ancient typo in process_declsEric Botcazou1-6/+2
It has gone unnoticed for decades because it changes nothing in practice. gcc/ada/ChangeLog: * gcc-interface/trans.cc (process_decls): Remove tests on Nkind that contain a typo and would be redundant if written correctly.
2024-11-04ada: Split Library_Unit using multiple wrappersBob Duff29-295/+542
The Library_Unit field was used for all sorts of different purposes, which led to confusing code. This patch splits Library_Unit into much more specific wrapper subprograms that should be called instead of [Set_]Library_Unit. Predicates and pragmas Assert are used to catch misuses of these. We document the semantics, especially "surprising" cases (e.g. internally-generated with clauses can refer to package bodies). This change does not fix gigi, codepeer, spark, or llvm to use the new wrappers; so far, they are used only in the GNAT front end. gcc/ada/ChangeLog: * sinfo.ads (Library_Unit): Rewrite documentation. Note that the "??? not (always) true..." comment was not true; the Subunit_Parent never points to the spec. (N_Compilation_Unit): Improve documentation. The Aux_ node was not created to solve the mentioned problems; it was created because the size of nodes was limited. Misc doc improvements. * sinfo-utils.ads: Add new wrappers for Library_Unit field. Use subtypes with predicates for the parameters. (First_Real_Statement): Still used in codepeer. * sinfo-utils.adb: Add new wrappers for Library_Unit field, with suitable assertions. * sem_prag.adb: Use new field wrapper names. (Matching_Name): New name for Same_Name to avoid potential confusion with the other function with the same name (Sem_Util.Same_Name), which is also called in this same file. (Matching_Convention): Change Same_Convention to match Matching_Name. * sem_util.ads (Same_Name): Improve comments; the old comment implied that it works for all names, which was not true. * sem_util.adb: Use new field wrapper names. * gen_il-gen.adb: Rename N_Unit_Body to be N_Lib_Unit_Body. Plain "unit" is ambiguous in Ada (library unit, compilation unit, program unit, etc). Add new union types N_Lib_Unit_Declaration and N_Lib_Unit_Renaming_Declaration. * gen_il-gen-gen_nodes.adb (Compute_Ranges): Raise exception earlier (it is already raised later, in Verify_Type_Table). Add a comment explaining why it might be raised. * gen_il-types.ads: Rename N_Unit_Body to be N_Lib_Unit_Body, and add new N_Lib_Unit_Declaration and N_Lib_Unit_Renaming_Declaration. * einfo.ads: Fix obsolete comment (was left over from before the "variable-sized nodes"). * exp_ch7.adb: Use new field wrapper names. * exp_disp.adb: Use new field wrapper names. * exp_unst.adb: Use new field wrapper names. * exp_util.adb: Use new field wrapper names. * fe.h: Add new field wrapper names. These are currently not used in gigi, but this change prepares for using them in gigi. * inline.adb: Use new field wrapper names. * lib.adb: Use new field wrapper names. Comment improvements. * lib-load.adb: Use new field wrapper names. Minor cleanup. * lib-writ.adb: Use new field wrapper names. * live.adb: Use new field wrapper names. * par-load.adb: Use new field wrapper names. Comment improvements. Minor cleanup. * rtsfind.adb: Use new field wrapper names. * sem.adb: Use new field wrapper names. * sem_ch10.adb: Use new field wrapper names. Comment improvements. Minor cleanup. * sem_ch12.adb: Use new field wrapper names. * sem_ch7.adb: Use new field wrapper names. * sem_ch8.adb: Use new field wrapper names. * sem_elab.adb: Use new field wrapper names. Comment improvements. * errout.adb (Output_Source_Line): Fix blowup in some obscure cases, where List_Pragmas is not fully set up.
2024-11-04ada: Improve Unbounded_Wide_String performanceNicolas Roche2-46/+127
Improve performance of iteration using Element function. Improve performance of Append. gcc/ada/ChangeLog: * libgnat/a-stwiun__shared.adb: Restructure code to inline only the most common cases. Remove whenever possible runtime checks. * libgnat/a-stwiun__shared.ads: Add Inline => True to Append variants and Element.
2024-11-04ada: Improve performance of Unbounded_Wide_Wide_StringNicolas Roche2-47/+130
Improve performance of iteration using Element function. Improve performance of Append. gcc/ada/ChangeLog: * libgnat/a-stzunb__shared.adb: Restructure code to inline only the most common cases. Remove whenever possible runtime checks. * libgnat/a-stzunb__shared.ads: Add Inline => True to Append variants and Element.
2024-11-04ada: Improve Unbounded_String performanceNicolas Roche2-49/+134
Improve performance of iteration using Element function. Improve performance of Append. gcc/ada/ChangeLog: * libgnat/a-strunb__shared.adb: Restructure code to inline only the most common cases. Remove whenever possible runtime checks. * libgnat/a-strunb__shared.ads: Add Inline => True to Append variants and Element.
2024-11-04ada: Initial implementation of Extended_Access aspect (FE portion only)Steve Baird10-5/+204
The Extended_Access aspect can be specified to be True for certain access-to-unconstrained-array-subtype types. Such extended access types can designate objects that a normal general access type (with the same designated subtype) cannot, such as a slice of an aliased array object or an object that is represented without contiguous bounds information. gcc/ada/ChangeLog: * aspects.ads: Add Aspect_Extended_Access to Aspect_Id enumeration. * par-prag.adb: Add Pragma_Extended_Access to list of pragmas that get no interesting processing in the parser. * sem_attr.adb: Relax legality checks on Access/Unchecked_Access attribute references if access type is Extended_Access. * sem_ch12.adb (Validate_Access_Type_Instance): For an instance of a generic with a formal access type, check that formal and actual agree with with respect to Extended_Access aspect. * sem_prag.adb (Analyze_Pragma): Add analysis code for pragma Extended_Access. Set Pragma_Extended_Access element in Sig_Flags aggregate. * sem_prag.ads: Set Pragma_Extended_Access element in Aspect_Specifying_Pragma aggregate. * sem_res.adb (Valid_Conversion): Disallow extended-to-not-extended access conversion. * sem_util.adb (Is_Extended_Access_Access_Type): Implement new function. (Is_Aliased_View): If (and only if) the new Boolean For_Extended parameter is True, then a slice of an aliased non-bitpacked array is aliased, a constrained nominal subtype does not force a result of False, and a dereference of an extended access value is aliased. The last point is somewhat subtle. This is how we prevent covert fat-to-nonfat type conversions via things like "Not_Extended_Type'(Extended_Ptr.all'Access)" or passing Extended_Ptr.all as an actual parameter corresponding to an explicitly aliased formal parameter. * sem_util.ads (Is_Extended_Access_Type): Declare new function. (Is_Aliased_View): Add new defaults-False parameter For_Extended. * snames.ads-tmpl: Declare Name_Extended_Access Name_Id constant and Pragma_Extended_Access Pragma_Id enumeration literal.
2024-11-04ada: Avoid unused with warning with Extend_SystemViljar Indus1-4/+7
When the Extend_System pragma is used then we are supposed to check the extended system for referenced entities. Otherwise we would get an incorrect unused with warning. This was previously done on body files but it should also be done specs as well. gcc/ada/ChangeLog: * sem_warn.adb (Check_One_Unit): When a system extension is present always check entities from that unit before marking the unit unreferenced.
2024-11-04ada: Fix crash on default value with nested iterated component associationsEric Botcazou1-8/+15
The problem is that the freeze node for the type of the element ends up in the component list of the record type declared with the default value. gcc/ada/ChangeLog: PR ada/113036 * freeze.adb (Freeze_Expression): Deal with freezing actions coming from within nested internal loops present in spec expressions.
2024-11-04ada: Propagate resolution status from Resolve_Iterated_Component_AssociationEric Botcazou1-10/+13
The resolution status of Resolve_Aggr_Expr is lost when the routine is invoked indirectly from Resolve_Iterated_Component_Association. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Iterated_Component_Association): Change to function returning Boolean and return the result of the call made to Resolve_Aggr_Expr. (Resolve_Array_Aggregate): Return failure status if the call to Resolve_Iterated_Component_Association returns false.
2024-11-04ada: Remove dead code in Resolve_Iterated_Component_AssociationEric Botcazou1-13/+3
It dates back to when analysis was performed on a copy of the expression. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Iterated_Component_Association): Move up declaration of Expr and remove dead code from older processing.
2024-11-04ada: Update documentation for -gnatVxx switchesViljar Indus1-2/+4
Imporve the wording to explicitly state which options are turned on by -gnatVa and that -gnatVd is enabled by default. It can be somewhat hard to decifer that information from the old wording. Especially when compared to -gnatWxx switches where there is an elaborate scheme for describing those properties. gcc/ada/ChangeLog: * usage.adb: Update the wording for -gnatVa and -gnatVd.
2024-11-04ada: Tweak description of new predicateEric Botcazou1-1/+2
The existing comment is a bit too vague. gcc/ada/ChangeLog: * exp_aggr.ads (Is_Two_Pass_Aggregate): Beef up comment.
2024-11-04ada: Display message on reproducer generation failureRonan Desplanques1-1/+2
Before this patch, nothing was reported to the user when an exception was raised during generation of a minimal reproducer. This patch fixes this. gcc/ada/ChangeLog: * comperr.adb (Compiler_Abort): Display message in exception handler.
2024-11-04ada: Missing runtime check in interpolated stringJavier Miranda1-3/+69
When the type imposed by the context for an interpolated string is constrained, the compiler silently omits adding a runtime check. gcc/ada/ChangeLog: * exp_ch2.adb (Expand_N_Interpolated_String_Literal): Use the base type of the type imposed by the context for building the interpolated string image; required to allow the expander adding the missing runtime check when the target type is constrained. (Apply_Static_Length_Check): New subprogram.
2024-11-04ada: Add CHERI variant of full secondary stack allocatorDaniel King2-1/+1087
gcc/ada/ChangeLog: * Makefile.rtl: Use s-secsta__cheri.adb on Morello CheriBSD. * libgnat/s-secsta__cheri.adb: New file.
2024-11-04ada: CheriBSD: add SIGPROT handlerDaniel King1-1/+1
gcc/ada/ChangeLog: * libgnarl/s-intman__cheribsd.adb: Add SIGPROT to interrupt list.
2024-11-04ada: Add Invocation node to the SARIF reportViljar Indus1-1/+80
Add an invocation node to the SARIF report that contains the command line use to activate gnat and whether the execution was successful or not. gcc/ada/ChangeLog: * diagnostics-sarif_emitter.adb (Print_Runs): Add printing for the invocation node that consists of a single invocations that is composed of the commandLine and executionSuccessful attributes.
2024-11-04ada: Add Schema to the SARIF reportViljar Indus1-1/+13
gcc/ada/ChangeLog: * diagnostics-sarif_emitter.adb (Print_SARIF_Report): Add a Schema field to the SARIF report.
2024-11-04ada: Tweak CPU affinity handlingRonan Desplanques7-23/+63
The primary motivation for this change is making the taskset command line tool work as expected for tasking programs that don't use features from section D.16 of the Ada reference manual. A couple of components are added to the ATCB record to make it possible to tell values that come from explicit aspects and subprogram calls from values that are inherited from activating tasks. gcc/ada/ChangeLog: * libgnarl/s-mudido__affinity.adb (Unchecked_Set_Affinity): Set new ATCB component. * libgnarl/s-taprop__linux.adb (Create_Task): Only set CPU affinity when required. (Requires_Affinity_Change): New subprogram. (Set_Task_Affinity): Likewise. * libgnarl/s-tarest.adb (Create_Restricted_Task): Adapt to Initialize_ATCB change. * libgnarl/s-taskin.adb (Initialize_ATCB): Update parameter list. Record whether aspects were explicitly specified. * libgnarl/s-taskin.ads (Common_ATCB): Add component. * libgnarl/s-tassta.adb (Create_Task): Update call to Initialize_ATCB. * libgnarl/s-tporft.adb (Register_Foreign_Thread): Likewise.
2024-11-04ada: Fix error message for pragma First_Controlling_ParameterRaphaël AMIARD1-1/+1
gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pragma): Fix format for second line of warning (should be a continuation line)
2024-11-04ada: Build and runtime support for CheriBSDDaniel King3-3/+1030
SIGPROT is a new signal on CheriBSD that signals a CHERI protection violation. The full runtime converts these to the appropriate Ada exception declared in Interfaces.CHERI.Exceptions. gcc/ada/ChangeLog: * Makefile.rtl: Build support for Morello CheriBSD. * libgnarl/s-intman__cheribsd.adb: New file for CheriBSD. * libgnarl/s-osinte__cheribsd.ads: New file for CheriBSD.
2024-11-04ada: Refactor exception declarations from Interfaces.CHERI to separate packageDaniel King2-16/+50
Exception declarations require elaboration on the full run-time to register the exceptions. The package Interfaces.CHERI, however, is used on bare-metal targets during early initialization, before elaboration and is therefore marked No_Elaboration_Code_All. Refactoring the exception declarations to a separate package allows the common CHERI bindings to be used in such contexts. gcc/ada/ChangeLog: * libgnat/i-cheri.ads: Remove exception declarations. * libgnat/i-cheri-exceptions.ads: New file.
2024-11-04ada: Fix alignment of pthread_mutex_tDaniel King1-1/+6
On most targets the alignment of unsigned long is the same as pointer alignment, but on CHERI targets pointers have larger alignment (16 bytes compared to 8 bytes). pthread_mutex_t needs the same alignment as System.Address to account for CHERI targets. gcc/ada/ChangeLog: * libgnat/s-oslock__posix.ads: Fix alignment of pthread_mutex_t for CHERI targets.
2024-11-04ada: Move formal hash tables from gnat repository to the SPARK libraryClaire Dross6-927/+0
The formal containers have been part of the SPARK library for some time now. However, some units used only by these containers are still part of the gnat repository. Move them to the SPARK library. gcc/ada/ChangeLog: * Makefile.rtl: Remove references to moved units. * libgnat/a-chtgfk.adb: Removed. * libgnat/a-chtgfk.ads: Removed. * libgnat/a-chtgfo.adb: Removed. * libgnat/a-chtgfo.ads: Removed. * libgnat/a-cohata.ads (Generic_Formal_Hash_Table_Types): Removed.
2024-11-04ada: Add doc for deep delta aggregatesRaphaël AMIARD3-65/+412
gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Adjust documentation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-11-04ada: Fix internal error on alignment clause for type declared in generic unitEric Botcazou1-2/+4
The front-end raises Program_Error on an alignment clause for a type in a generic unit that references the alignment of another type in the unit. gcc/ada/ChangeLog: PR ada/117051 * freeze.adb (Freeze_Entity): Call the layout procedure on subtypes declared in a generic unit when they are static.
2024-11-04ada: Minor tweaks in commentsEric Botcazou3-6/+6
They are related to the special support for text encoding on Windows. gcc/ada/ChangeLog: * adaint.c: Replace initialize.c with rtinit.c in comment. * sysdep.c (__gnat_set_mode): Fix reference in comment. * libgnat/i-cstrea.ads (Content_Encoding): Adjust comment.
2024-11-04ada: Correction to disable self-referential with_clausesBob Duff1-2/+23
Follow-on to previous change "Disable self-referential with_clauses", which caused some regressions. Remove useless use clauses referring to useless self-referential with'ed packages. This is necessary because in some cases, such use clauses cause the compiler to crash or give spurious errors. In addition, enable the warning on self-referential with_clauses. gcc/ada/ChangeLog: * sem_ch10.adb (Analyze_With_Clause): In the case of a self-referential with clause, if there is a subsequent use clause for the same package (which is necessarily useless), remove it from the context clause. Reenable the warning.
2024-11-04ada: Missing precondition runtime check in inherited primitiveJavier Miranda9-56/+115
When a derived tagged type implements interface types in addition to deriving from its parent type, and a primitive inherited from its parent type corresponds to an inherited primitive that has class-wide preconditions, then the generated code fails to check the class-wide preconditions inherited from the interface primitive. gcc/ada/ChangeLog: * einfo.ads (Is_Dispatch_Table_Wrapper): Complete documentation. * exp_ch6.adb (Install_Class_Preconditions_Check): Dispatch table wrappers do not require installing the check since it is performed by the caller. (Class_Preconditions_Subprogram): Use new predicate Is_LSP_Wrapper. * freeze.adb (Check_Inherited_Conditions): Rename Postcond_Wrappers to Condition_Wrappers to handle implicitly inherited subprograms that implement pre-/postconditions inherited from interface primitives. Use new predicate Is_LSP_Wrapper. * sem_disp.adb (Check_Dispatching_Operation): Complete assertion to handle functions returning class-wide types. * exp_util.ads (Is_LSP_Wrapper): New subprogram. * exp_util.adb (Is_LSP_Wrapper): New subprogram. * contracts.adb (Process_Spec_Postconditions): Use Is_LSP_Wrapper. (Process_Inherited_Conditions): Use Is_LSP_Wrapper. * sem_ch6.adb (New_Overloaded_Entity): Use Is_LSP_Wrapper. * sem_util.adb (Nearest_Class_Condition_Subprogram): Use Is_LSP_Wrapper.
2024-11-04ada: Fix visibility of Taft amendment typesPiotr Trojanek1-0/+3
When uninstalling private package declarations we must mark Taft amendment types hidden, just like we mark other types. Looking at previous revisions of this code, it is quite clear that this bug comes from a code evolution and marking types should happen in all ELSE branches of the enclosing IF statement. gcc/ada/ChangeLog: * sem_ch7.adb (Uninstall_Declarations): Mark Taft amendment types like we mark other types declared in private package declarations.
2024-11-04ada: Minor whitespace tuningPiotr Trojanek1-3/+3
Code cleanup. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Op_Multiply): Remove extra whitespace.
2024-11-04ada: Avoid run-time conversion of 0 from Int to UintPiotr Trojanek1-1/+1
Code cleanup and tiny performance improvement; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Op_Subtract): Replace numeric literal with universal integer constant, just like it is done in expansion of addition operator.
2024-11-04ada: Assignment local variable only when it is usedPiotr Trojanek1-8/+8
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_res.adb (In_Decl): Rename and move local variable where it is used.
2024-11-04ada: Add null exclusion to avoid run-time checksPiotr Trojanek1-2/+2
By declaring access parameter with non-null qualifier, the compiler should avoid generating run-time checks in debug builds, resulting in a tiny performance improvement. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_res.adb (Type_In_P): Add non-null qualifier.
2024-11-04ada: Resolve intrinsic operators without homonymsPiotr Trojanek1-10/+37
Intrinsic operators are resolved by rewriting into a corresponding operator from the Standard package. Traversing homonyms just to find the corresponding operator was not particularly efficient; also, for the binary "-" it was finding the unary "-". There appears to be no difference in compiler behavior, but the new code should be more efficient and finding the correct operator seems to make more sense. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Intrinsic_Operator) (Resolve_Intrinsic_Unary_Operator): Replace traversals of homonyms with a direct lookup.
2024-11-04ada: Fix asymmetry in resolution of unary intrinsic operatorsPiotr Trojanek1-0/+7
Resolution of binary and unary intrinsic operators differed when expansion was inactive. In particular, this affected GNATprove handling of Ada.Real_Time."abs" operator. This patch makes unary resolution behave like binary resolution. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Intrinsic_Unary_Operator): Disable when expansion is inactive.
2024-11-04PR 117048: simplify-rtx: Simplify (X << C1) [+,^] (X >> C2) into ROTATEKyrylo Tkachov1-48/+156
This is, in effect, a reapplication of de2bc6a7367aca2eecc925ebb64cfb86998d89f3 fixing the compile-time hog in var-tracking due to calling simplify_rtx on the two arms of the rotation before detecting the ROTATE. That is not necessary. simplify-rtx can transform (X << C1) | (X >> C2) into ROTATE (X, C1) when C1 + C2 == mode-width. But the transformation is also valid for PLUS and XOR. Indeed GIMPLE can also do the fold. Let's teach RTL to do it too. The motivating testcase for this is in AArch64 intrinsics: uint64x2_t G2(uint64x2_t a, uint64x2_t b) { uint64x2_t c = veorq_u64(a, b); return veorq_u64(vaddq_u64(c, c), vshrq_n_u64(c, 63)); } which I was hoping to fold to a single XAR (a ROTATE+XOR instruction) but GCC was failing to detect the rotate operation for two reasons: 1) The combination of the two arms of the expression is done under XOR rather than IOR that simplify-rtx currently supports. 2) The ASHIFT operation is actually a (PLUS X X) operation and thus is not detected as the LHS of the two arms we require. The patch fixes both issues. The analysis of the two arms of the rotation expression is factored out into a common helper simplify_rotate_op which is then used in the PLUS, XOR, IOR cases in simplify_binary_operation_1. The check-assembly testcase for this is added in the following patch because it needs some extra AArch64 backend work, but I've added self-tests in this patch to validate the transformation. Bootstrapped and tested on aarch64-none-linux-gnu Signed-off-by: Kyrylo Tkachov <ktachov@nvidia.com> PR target/117048 * simplify-rtx.cc (extract_ashift_operands_p): Define. (simplify_rotate_op): Likewise. (simplify_context::simplify_binary_operation_1): Use the above in the PLUS, IOR, XOR cases. (test_vector_rotate): Define. (test_vector_ops): Use the above.
2024-11-04target: Fix asm codegen for vfpclasss* and vcvtph2* instructionsAntoni Boucher2-2/+48
This only happens when using -masm=intel. gcc/ChangeLog: PR target/116725 * config/i386/sse.md: Fix asm generation. gcc/testsuite/ChangeLog: PR target/116725 * gcc.target/i386/pr116725.c: Add test using those AVX builtins.
2024-11-04Don't call invert on VARYING.Andrew MacLeod2-2/+25
When all cases go to one label and resul in a VARYING value, we can't invert that value to remove all values from the default case. Simply check for this case and set the default to UNDEFINED. PR tree-optimization/117398 gcc/ * gimple-range-edge.cc (gimple_outgoing_range::calc_switch_ranges): Check for VARYING and don't call invert () on it. gcc/testsuite/ * gcc.dg/pr117398.c: New.
2024-11-04Revert "PR 117048: simplify-rtx: Simplify (X << C1) [+,^] (X >> C2) into ROTATE"Kyrylo Tkachov1-156/+48
This reverts commit de2bc6a7367aca2eecc925ebb64cfb86998d89f3.