From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 0BEA73857407; Wed, 18 May 2022 08:43:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BEA73857407 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-589] [Ada] Fast implementation of floating-point mathematical functions X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 54cf6609e0c52123db5c600db197647491c33395 X-Git-Newrev: 8b49556e4ee617e0920a9335685c7961971c3d0a Message-Id: <20220518084317.0BEA73857407@sourceware.org> Date: Wed, 18 May 2022 08:43:17 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2022 08:43:17 -0000 https://gcc.gnu.org/g:8b49556e4ee617e0920a9335685c7961971c3d0a commit r13-589-g8b49556e4ee617e0920a9335685c7961971c3d0a Author: Eric Botcazou Date: Mon Mar 28 09:30:16 2022 +0200 [Ada] Fast implementation of floating-point mathematical functions This adds a package renaming unit to the GNAT hierarchy so as to expose the underlying implementation of floating-point mathematical functions, thus also making it possible to use their vector implementation, if any. The change also contains a small improvement to the Hide_Public_Entities mechanism in Sem_Ch7 that makes it possible to clear the Is_Public flag within instances of generic packages that do not have a body. gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-gfmafu$(objext). (SIMD_PATH_TARGET_PAIRS): New variable. (TRASYM_DWARF_COMMON_OBJS): Minor tweak. (x86-64/Linux): Use SIMD_PATH_TARGET_PAIRS. (x32/Linux): Likewise. * doc/gnat_rm/the_gnat_library.rst (Generic_Fast_Math_Functions): New entry. * gnat_rm.texi: Regenerate. * impunit.adb (Non_Imp_File_Names_95): Add g-gfmafu. * sem_ch7.adb (Has_Referencer): Do not set In_Nested_Instance for instances of generic packages that do not have a body. * libgnat/a-nalofl__simd.ads: New SIMD-enabled version. * libgnat/a-nuaufl__simd.ads: Likewise. * libgnat/g-gfmafu.ads: New package renaming unit. Diff: --- gcc/ada/Makefile.rtl | 22 ++- gcc/ada/doc/gnat_rm/the_gnat_library.rst | 18 ++ gcc/ada/gnat_rm.texi | 284 +++++++++++++++++-------------- gcc/ada/impunit.adb | 1 + gcc/ada/libgnat/a-nalofl__simd.ads | 95 +++++++++++ gcc/ada/libgnat/a-nuaufl__simd.ads | 95 +++++++++++ gcc/ada/libgnat/g-gfmafu.ads | 35 ++++ gcc/ada/sem_ch7.adb | 38 +++-- 8 files changed, 439 insertions(+), 149 deletions(-) diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index e4ca894b14f..7acb159f7ec 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -451,6 +451,7 @@ GNATRTL_NONTASKING_OBJS= \ g-exptty$(objext) \ g-flocon$(objext) \ g-forstr$(objext) \ + g-gfmafu$(objext) \ g-graphs$(objext) \ g-heasor$(objext) \ g-hesora$(objext) \ @@ -897,7 +898,7 @@ ATOMICS_TARGET_PAIRS = \ ATOMICS_BUILTINS_TARGET_PAIRS = \ s-atocou.adb (others => 0)); @end example @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{42e}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{42f} +@anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{430}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{431} @subsection Constant aggregates with unconstrained nominal types @@ -26485,7 +26505,7 @@ Cr_Unc : constant One_Unc := (12,24,36); @end example @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{430}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{431} +@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{432}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{433} @subsection Aggregates with static bounds @@ -26513,7 +26533,7 @@ end loop; @end example @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{432}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{433} +@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{434}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{435} @subsection Aggregates with nonstatic bounds @@ -26524,7 +26544,7 @@ have to be applied to sub-arrays individually, if they do not have statically compatible subtypes. @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{434}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{435} +@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{436}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{437} @subsection Aggregates in assignment statements @@ -26566,7 +26586,7 @@ a temporary (created either by the front-end or the code generator) and then that temporary will be copied onto the target. @node The Size of Discriminated Records with Default Discriminants,Image Values For Nonscalar Types,Code Generation for Array Aggregates,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{436}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{437} +@anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{438}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{439} @section The Size of Discriminated Records with Default Discriminants @@ -26646,7 +26666,7 @@ say) must be consistent, so it is imperative that the object, once created, remain invariant. @node Image Values For Nonscalar Types,Strict Conformance to the Ada Reference Manual,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{438}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{439} +@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{43a}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{43b} @section Image Values For Nonscalar Types @@ -26666,7 +26686,7 @@ control of image text is required for some type T, then T’Put_Image should be explicitly specified. @node Strict Conformance to the Ada Reference Manual,,Image Values For Nonscalar Types,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{43a}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{43b} +@anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{43c}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{43d} @section Strict Conformance to the Ada Reference Manual @@ -26693,7 +26713,7 @@ behavior (although at the cost of a significant performance penalty), so infinite and NaN values are properly generated. @node Implementation of Ada 2012 Features,Security Hardening Features,Implementation of Specific Ada Features,Top -@anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{43c}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{43d}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14} +@anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{43e}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{43f}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14} @chapter Implementation of Ada 2012 Features @@ -28859,7 +28879,7 @@ RM References: H.04 (8/1) @end itemize @node Security Hardening Features,Obsolescent Features,Implementation of Ada 2012 Features,Top -@anchor{gnat_rm/security_hardening_features doc}@anchor{43e}@anchor{gnat_rm/security_hardening_features id1}@anchor{43f}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} +@anchor{gnat_rm/security_hardening_features doc}@anchor{440}@anchor{gnat_rm/security_hardening_features id1}@anchor{441}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} @chapter Security Hardening Features @@ -28878,7 +28898,7 @@ are provided by GNAT. @end menu @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features -@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{440} +@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{442} @section Register Scrubbing @@ -28906,7 +28926,7 @@ For usage and more details on the command-line option, and on the @c Stack Scrubbing: @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{441} +@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{443} @section Stack Scrubbing @@ -28989,7 +29009,7 @@ Bar_Callable_Ptr. @c Hardened Conditionals: @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{442} +@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{444} @section Hardened Conditionals @@ -29032,7 +29052,7 @@ different performance impact of the hardening transformations. @c Hardened Booleans: @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{443} +@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{445} @section Hardened Booleans @@ -29069,7 +29089,7 @@ Note that @code{-gnatVn} will disable even @code{hardbool} testing. @c Control Flow Redundancy: @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features -@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{444} +@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{446} @section Control Flow Redundancy @@ -29114,7 +29134,7 @@ observed in dump files generated by the command-line option @code{-fdump-tree-hardcfr}. @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top -@anchor{gnat_rm/obsolescent_features doc}@anchor{445}@anchor{gnat_rm/obsolescent_features id1}@anchor{446}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} +@anchor{gnat_rm/obsolescent_features doc}@anchor{447}@anchor{gnat_rm/obsolescent_features id1}@anchor{448}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} @chapter Obsolescent Features @@ -29133,7 +29153,7 @@ compatibility purposes. @end menu @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id2}@anchor{447}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{448} +@anchor{gnat_rm/obsolescent_features id2}@anchor{449}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{44a} @section pragma No_Run_Time @@ -29146,7 +29166,7 @@ preferred usage is to use an appropriately configured run-time that includes just those features that are to be made accessible. @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id3}@anchor{449}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{44a} +@anchor{gnat_rm/obsolescent_features id3}@anchor{44b}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{44c} @section pragma Ravenscar @@ -29155,7 +29175,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma is part of the new Ada 2005 standard. @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id4}@anchor{44b}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{44c} +@anchor{gnat_rm/obsolescent_features id4}@anchor{44d}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{44e} @section pragma Restricted_Run_Time @@ -29165,7 +29185,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for this kind of implementation dependent addition. @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id5}@anchor{44d}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{44e} +@anchor{gnat_rm/obsolescent_features id5}@anchor{44f}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{450} @section pragma Task_Info @@ -29191,7 +29211,7 @@ in the spec of package System.Task_Info in the runtime library. @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features -@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{44f}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{450} +@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{451}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{452} @section package System.Task_Info (@code{s-tasinf.ads}) @@ -29201,7 +29221,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package standard replacement for GNAT’s @code{Task_Info} functionality. @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top -@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{451}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{452} +@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{453}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{454} @chapter Compatibility and Porting Guide @@ -29223,7 +29243,7 @@ applications developed in other Ada environments. @end menu @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{453}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{454} +@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{456} @section Writing Portable Fixed-Point Declarations @@ -29345,7 +29365,7 @@ If you follow this scheme you will be guaranteed that your fixed-point types will be portable. @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{456} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{458} @section Compatibility with Ada 83 @@ -29373,7 +29393,7 @@ following subsections treat the most likely issues to be encountered. @end menu @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{458} +@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{45a} @subsection Legal Ada 83 programs that are illegal in Ada 95 @@ -29473,7 +29493,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration. @end itemize @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{45a} +@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{45c} @subsection More deterministic semantics @@ -29501,7 +29521,7 @@ which open select branches are executed. @end itemize @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{45c} +@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{45e} @subsection Changed semantics @@ -29543,7 +29563,7 @@ covers only the restricted range. @end itemize @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{45e} +@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{45f}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{460} @subsection Other language compatibility issues @@ -29576,7 +29596,7 @@ include @code{pragma Interface} and the floating point type attributes @end itemize @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{45f}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{460} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{461}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{462} @section Compatibility between Ada 95 and Ada 2005 @@ -29648,7 +29668,7 @@ can declare a function returning a value from an anonymous access type. @end itemize @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{461}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{462} +@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{463}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{464} @section Implementation-dependent characteristics @@ -29671,7 +29691,7 @@ transition from certain Ada 83 compilers. @end menu @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{463}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{464} +@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{465}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{466} @subsection Implementation-defined pragmas @@ -29693,7 +29713,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not relevant in a GNAT context and hence are not otherwise implemented. @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{465}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{466} +@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{467}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{468} @subsection Implementation-defined attributes @@ -29707,7 +29727,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and @code{Type_Class}. @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{467}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{468} +@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{469}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{46a} @subsection Libraries @@ -29736,7 +29756,7 @@ be preferable to retrofit the application using modular types. @end itemize @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{469}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{46a} +@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{46b}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{46c} @subsection Elaboration order @@ -29772,7 +29792,7 @@ pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally @end itemize @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{46b}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{46c} +@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{46d}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{46e} @subsection Target-specific aspects @@ -29785,10 +29805,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus Ada 2005 and Ada 2012) are sometimes incompatible with typical Ada 83 compiler practices regarding implicit packing, the meaning of the Size attribute, and the size of access values. -GNAT’s approach to these issues is described in @ref{46d,,Representation Clauses}. +GNAT’s approach to these issues is described in @ref{46f,,Representation Clauses}. @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{46e}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{46f} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{470}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{471} @section Compatibility with Other Ada Systems @@ -29831,7 +29851,7 @@ far beyond this minimal set, as described in the next section. @end itemize @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{470}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{46d} +@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{472}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{46f} @section Representation Clauses @@ -29924,7 +29944,7 @@ with thin pointers. @end itemize @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{471}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{472} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{473}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{474} @section Compatibility with HP Ada 83 @@ -29954,7 +29974,7 @@ extension of package System. @end itemize @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top -@anchor{share/gnu_free_documentation_license doc}@anchor{473}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{474} +@anchor{share/gnu_free_documentation_license doc}@anchor{475}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{476} @chapter GNU Free Documentation License diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index 8776726894d..0b1b13b71cd 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -279,6 +279,7 @@ package body Impunit is ("g-exptty", F), -- GNAT.Expect.TTY ("g-flocon", F), -- GNAT.Float_Control ("g-forstr", F), -- GNAT.Formatted_String + ("g-gfmafu", F), -- GNAT.Generic_Fast_Math_Functions ("g-graphs", F), -- GNAT.Graphs ("g-heasor", F), -- GNAT.Heap_Sort ("g-hesora", F), -- GNAT.Heap_Sort_A diff --git a/gcc/ada/libgnat/a-nalofl__simd.ads b/gcc/ada/libgnat/a-nalofl__simd.ads new file mode 100644 index 00000000000..34a798b5418 --- /dev/null +++ b/gcc/ada/libgnat/a-nalofl__simd.ads @@ -0,0 +1,95 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- A D A . N U M E R I C S . A U X _ L O N G _ F L O A T -- +-- -- +-- S p e c -- +-- (Intrinsic/SIMD Version, Long Float) -- +-- -- +-- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides the basic computational interface for the +-- generic elementary functions. With the intrinsic/SIMD version, the +-- compiler can use its knowledge of the functions to select the most +-- suitable implementation, including a vector implementation. These +-- interfaces are suitable for cases in which Long Float and C's +-- double share the same representation. + +with Ada.Numerics.Aux_Linker_Options; +pragma Warnings (Off, Ada.Numerics.Aux_Linker_Options); + +package Ada.Numerics.Aux_Long_Float is + pragma Pure; + + subtype T is Long_Float; + + -- We import these functions as intrinsics. Note that we label them + -- all as pure functions, because indeed all of them are in fact pure. + + function Sin (X : T) return T with + Import, Convention => Intrinsic, External_Name => "sin"; + pragma Machine_Attribute (Sin, "simd", "notinbranch"); + + function Cos (X : T) return T with + Import, Convention => Intrinsic, External_Name => "cos"; + pragma Machine_Attribute (Cos, "simd", "notinbranch"); + + function Tan (X : T) return T with + Import, Convention => Intrinsic, External_Name => "tan"; + + function Exp (X : T) return T with + Import, Convention => Intrinsic, External_Name => "exp"; + pragma Machine_Attribute (Exp, "simd", "notinbranch"); + + function Sqrt (X : T) return T with + Import, Convention => Intrinsic, External_Name => "sqrt"; + + function Log (X : T) return T with + Import, Convention => Intrinsic, External_Name => "log"; + pragma Machine_Attribute (Log, "simd", "notinbranch"); + + function Acos (X : T) return T with + Import, Convention => Intrinsic, External_Name => "acos"; + + function Asin (X : T) return T with + Import, Convention => Intrinsic, External_Name => "asin"; + + function Atan (X : T) return T with + Import, Convention => Intrinsic, External_Name => "atan"; + + function Sinh (X : T) return T with + Import, Convention => Intrinsic, External_Name => "sinh"; + + function Cosh (X : T) return T with + Import, Convention => Intrinsic, External_Name => "cosh"; + + function Tanh (X : T) return T with + Import, Convention => Intrinsic, External_Name => "tanh"; + + function Pow (X, Y : T) return T with + Import, Convention => Intrinsic, External_Name => "pow"; + pragma Machine_Attribute (Pow, "simd", "notinbranch"); + +end Ada.Numerics.Aux_Long_Float; diff --git a/gcc/ada/libgnat/a-nuaufl__simd.ads b/gcc/ada/libgnat/a-nuaufl__simd.ads new file mode 100644 index 00000000000..0f335ac8f3d --- /dev/null +++ b/gcc/ada/libgnat/a-nuaufl__simd.ads @@ -0,0 +1,95 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- A D A . N U M E R I C S . A U X _ F L O A T -- +-- -- +-- S p e c -- +-- (Intrinsic/SIMD Version, Float) -- +-- -- +-- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package provides the basic computational interface for the +-- generic elementary functions. With the intrinsic/SIMD version, the +-- compiler can use its knowledge of the functions to select the most +-- suitable implementation, including a vector implementation. These +-- interfaces are suitable for cases in which Float and C's float +-- share the same representation. + +with Ada.Numerics.Aux_Linker_Options; +pragma Warnings (Off, Ada.Numerics.Aux_Linker_Options); + +package Ada.Numerics.Aux_Float is + pragma Pure; + + subtype T is Float; + + -- We import these functions as intrinsics. Note that we label them + -- all as pure functions, because indeed all of them are in fact pure. + + function Sin (X : T) return T with + Import, Convention => Intrinsic, External_Name => "sinf"; + pragma Machine_Attribute (Sin, "simd", "notinbranch"); + + function Cos (X : T) return T with + Import, Convention => Intrinsic, External_Name => "cosf"; + pragma Machine_Attribute (Cos, "simd", "notinbranch"); + + function Tan (X : T) return T with + Import, Convention => Intrinsic, External_Name => "tanf"; + + function Exp (X : T) return T with + Import, Convention => Intrinsic, External_Name => "expf"; + pragma Machine_Attribute (Exp, "simd", "notinbranch"); + + function Sqrt (X : T) return T with + Import, Convention => Intrinsic, External_Name => "sqrtf"; + + function Log (X : T) return T with + Import, Convention => Intrinsic, External_Name => "logf"; + pragma Machine_Attribute (Log, "simd", "notinbranch"); + + function Acos (X : T) return T with + Import, Convention => Intrinsic, External_Name => "acosf"; + + function Asin (X : T) return T with + Import, Convention => Intrinsic, External_Name => "asinf"; + + function Atan (X : T) return T with + Import, Convention => Intrinsic, External_Name => "atanf"; + + function Sinh (X : T) return T with + Import, Convention => Intrinsic, External_Name => "sinhf"; + + function Cosh (X : T) return T with + Import, Convention => Intrinsic, External_Name => "coshf"; + + function Tanh (X : T) return T with + Import, Convention => Intrinsic, External_Name => "tanhf"; + + function Pow (X, Y : T) return T with + Import, Convention => Intrinsic, External_Name => "powf"; + pragma Machine_Attribute (Pow, "simd", "notinbranch"); + +end Ada.Numerics.Aux_Float; diff --git a/gcc/ada/libgnat/g-gfmafu.ads b/gcc/ada/libgnat/g-gfmafu.ads new file mode 100644 index 00000000000..410a37cbf55 --- /dev/null +++ b/gcc/ada/libgnat/g-gfmafu.ads @@ -0,0 +1,35 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- G N A T . G E N E R I C _ F A S T _ M A T H _ F U N C T I O N S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2022, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +with Ada.Numerics.Aux_Generic_Float; + +generic package GNAT.Generic_Fast_Math_Functions + renames Ada.Numerics.Aux_Generic_Float; diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 2f09927c7ce..c43686b10ee 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -269,7 +269,8 @@ package body Sem_Ch7 is -- declaration. Examine all declarations in list Decls in reverse -- and determine whether one such referencer exists. All entities -- in the range Last (Decls) .. Referencer are hidden from external - -- visibility. + -- visibility. In_Nested_Instance is true if we are inside a package + -- instance that has a body. function Scan_Subprogram_Ref (N : Node_Id) return Traverse_Result; -- Determine whether a node denotes a reference to a subprogram @@ -282,8 +283,7 @@ package body Sem_Ch7 is -- tree traversal. procedure Scan_Subprogram_Refs (Node : Node_Id); - -- If we haven't already traversed Node, then mark it and traverse - -- it. + -- If we haven't already traversed Node, then mark and traverse it. -------------------- -- Has_Referencer -- @@ -294,16 +294,17 @@ package body Sem_Ch7 is In_Nested_Instance : Boolean; Has_Outer_Referencer_Of_Non_Subprograms : Boolean) return Boolean is - Decl : Node_Id; - Decl_Id : Entity_Id; - Spec : Node_Id; - Has_Referencer_Of_Non_Subprograms : Boolean := Has_Outer_Referencer_Of_Non_Subprograms; -- Set if an inlined subprogram body was detected as a referencer. -- In this case, we do not return True immediately but keep hiding -- subprograms from external visibility. + Decl : Node_Id; + Decl_Id : Entity_Id; + In_Instance : Boolean; + Spec : Node_Id; + begin if No (Decls) then return False; @@ -331,16 +332,22 @@ package body Sem_Ch7 is -- and hide more entities from external visibility. if not Is_Generic_Unit (Decl_Id) then + if In_Nested_Instance then + In_Instance := True; + elsif Is_Generic_Instance (Decl_Id) then + In_Instance := + Has_Completion (Decl_Id) + or else Unit_Requires_Body (Generic_Parent (Spec)); + else + In_Instance := False; + end if; + if Has_Referencer (Private_Declarations (Spec), - In_Nested_Instance - or else - Is_Generic_Instance (Decl_Id), + In_Instance, Has_Referencer_Of_Non_Subprograms) or else Has_Referencer (Visible_Declarations (Spec), - In_Nested_Instance - or else - Is_Generic_Instance (Decl_Id), + In_Instance, Has_Referencer_Of_Non_Subprograms) then return True; @@ -474,6 +481,11 @@ package body Sem_Ch7 is then Decl_Id := Defining_Entity (Decl); + -- We cannot say anything for objects declared in nested + -- instances because instantiations are not done yet so the + -- bodies are not visible and could contain references to + -- them. + if not In_Nested_Instance and then not Is_Imported (Decl_Id) and then not Is_Exported (Decl_Id)