]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
8 months agolibsanitizer: merge from upstream (61a6439f35b6de28)
Kito Cheng [Fri, 1 Nov 2024 07:33:03 +0000 (15:33 +0800)] 
libsanitizer: merge from upstream (61a6439f35b6de28)

8 months ago[committed] Fix minor c6x backend bug exposed by CRC patches
Jeff Law [Tue, 12 Nov 2024 13:15:50 +0000 (06:15 -0700)] 
[committed] Fix minor c6x backend bug exposed by CRC patches

This is a minor bug in the c6x port I saw when testing Mariam's CRC work.
Specifically some of the CRC tests were failing with a segfault testing if an
operand was an "a_register" from within the dest_regfile attribute.  We were
extracting what we thought should have been a register operand then looking at
the REGNO.  The underlying data was totally bogus, hence the fault in the
accessor macros.

The core issue is we were trying to extract operands from a nop insn which has
no operands.  As far as I can tell "unknown" is a reasonable answer for the
dest_regfile attribute on a nop insn, so this patch adds an explicit setting of
dest_regfile rather than letting the default processing kick in.

I'm applying the attached patch to the trunk.

There's still a backend bug affecting ~15 CRC tests.  Essentially the assembler
complains about a label (related to debugging info) not at the start of an
execution packet.  I'm not chasing this down.

gcc/

* config/c6x/c6x.md (nop, nop_count): Add explicit
"dest_regfile" attribute setting.

8 months agoada: Typo fix in comment
Marc Poulhiès [Tue, 29 Oct 2024 10:33:43 +0000 (11:33 +0100)] 
ada: Typo fix in comment

gcc/ada/ChangeLog:

* gcc-interface/Makefile.in: Remove extra 'with'.

8 months agoada: Compile time crash on limited object in extended return
squirek [Wed, 30 Oct 2024 16:33:29 +0000 (16:33 +0000)] 
ada: Compile time crash on limited object in extended return

This patch fixes an error in the compiler whereby using an extended return on
an object of limited tagged type which extends a tagged protected type may lead
to a compile-time crash.

gcc/ada/ChangeLog:

* exp_ch3.adb (Build_Assignment): Add condition to fetch corresponding
record types for concurrent tagged types.

8 months agoada: Fix spurious error on iterated component association with large index type
Eric Botcazou [Wed, 30 Oct 2024 10:22:12 +0000 (11:22 +0100)] 
ada: Fix spurious error on iterated component association with large index type

This is only for the Ada 2022 form of the iterated component association.

gcc/ada/ChangeLog:

* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use a type sized
from the index type to compute the length.  Simplify and remove
useless calls to New_Copy_Tree for this computation.

8 months agoada: Include design documentation within runtime sources
Pat Bernardi [Mon, 18 Jul 2022 05:56:28 +0000 (01:56 -0400)] 
ada: Include design documentation within runtime sources

The existing design documentation, required when generating the Software
Architecture Design Specification and Software Component Design
Specification documents for the light and light-tasking runtimes, has been
included directly within runtime sources.

gcc/ada/ChangeLog:

* libgnarl/a-dynpri.ads: Add design annotations.
* libgnarl/a-reatim.ads: Likewise.
* libgnarl/a-synbar.ads: Likewise.
* libgnarl/a-taside.ads: Likewise.
* libgnarl/s-tarest.ads: Likewise.
* libgnarl/s-tasinf.ads: Likewise.
* libgnarl/s-taspri__posix.ads: Likewise.
* libgnarl/s-tpobmu.ads: Likewise.
* libgnat/a-assert.ads: Likewise.
* libgnat/a-comlin.ads: Likewise.
* libgnat/a-nbnbig.ads: Likewise.
* libgnat/a-nubinu.ads: Likewise.
* libgnat/a-numeri.ads: Likewise.
* libgnat/a-unccon.ads: Likewise.
* libgnat/a-uncdea.ads: Likewise.
* libgnat/ada.ads: Likewise.
* libgnat/g-debuti.ads: Likewise.
* libgnat/g-sestin.ads: Likewise.
* libgnat/g-souinf.ads: Likewise.
* libgnat/gnat.ads: Likewise.
* libgnat/i-cexten.ads: Likewise.
* libgnat/i-cexten__128.ads: Likewise.
* libgnat/i-cstrin.adb: Likewise.
* libgnat/i-cstrin.ads: Likewise.
* libgnat/interfac__2020.ads: Likewise.
* libgnat/machcode.ads: Likewise.
* libgnat/s-addope.ads: Likewise.
* libgnat/s-aridou.ads: Likewise.
* libgnat/s-arit32.ads: Likewise.
* libgnat/s-arit64.ads: Likewise.
* libgnat/s-assert.ads: Likewise.
* libgnat/s-atacco.ads: Likewise.
* libgnat/s-atocou.ads: Likewise.
* libgnat/s-atocou__builtin.adb: Likewise.
* libgnat/s-atopri.ads: Likewise.
* libgnat/s-bitops.ads: Likewise.
* libgnat/s-boarop.ads: Likewise.
* libgnat/s-bytswa.ads: Likewise.
* libgnat/s-carsi8.ads: Likewise.
* libgnat/s-carun8.ads: Likewise.
* libgnat/s-casi16.ads: Likewise.
* libgnat/s-casi32.ads: Likewise.
* libgnat/s-casi64.ads: Likewise.
* libgnat/s-caun16.ads: Likewise.
* libgnat/s-caun32.ads: Likewise.
* libgnat/s-caun64.ads: Likewise.
* libgnat/s-exnint.ads: Likewise.
* libgnat/s-exnllf.ads: Likewise.
* libgnat/s-exnlli.ads: Likewise.
* libgnat/s-expint.ads: Likewise.
* libgnat/s-explli.ads: Likewise.
* libgnat/s-expllu.ads: Likewise.
* libgnat/s-expmod.ads: Likewise.
* libgnat/s-exponn.ads: Likewise.
* libgnat/s-expont.ads: Likewise.
* libgnat/s-exponu.ads: Likewise.
* libgnat/s-expuns.ads: Likewise.
* libgnat/s-fatflt.ads: Likewise.
* libgnat/s-fatgen.ads: Likewise.
* libgnat/s-fatlfl.ads: Likewise.
* libgnat/s-fatllf.ads: Likewise.
* libgnat/s-flocon.ads: Likewise.
* libgnat/s-geveop.ads: Likewise.
* libgnat/s-imageb.ads: Likewise.
* libgnat/s-imaged.ads: Likewise.
* libgnat/s-imagef.ads: Likewise.
* libgnat/s-imagei.ads: Likewise.
* libgnat/s-imagen.ads: Likewise.
* libgnat/s-imageu.ads: Likewise.
* libgnat/s-imagew.ads: Likewise.
* libgnat/s-imde128.ads: Likewise.
* libgnat/s-imde32.ads: Likewise.
* libgnat/s-imde64.ads: Likewise.
* libgnat/s-imen16.ads: Likewise.
* libgnat/s-imen32.ads: Likewise.
* libgnat/s-imenu8.ads: Likewise.
* libgnat/s-imfi32.ads: Likewise.
* libgnat/s-imfi64.ads: Likewise.
* libgnat/s-imgbiu.ads: Likewise.
* libgnat/s-imgboo.ads: Likewise.
* libgnat/s-imgcha.ads: Likewise.
* libgnat/s-imgint.ads: Likewise.
* libgnat/s-imgllb.ads: Likewise.
* libgnat/s-imglli.ads: Likewise.
* libgnat/s-imgllu.ads: Likewise.
* libgnat/s-imgllw.ads: Likewise.
* libgnat/s-imgrea.ads: Likewise.
* libgnat/s-imguns.ads: Likewise.
* libgnat/s-imguti.ads: Likewise.
* libgnat/s-imgwiu.ads: Likewise.
* libgnat/s-maccod.ads: Likewise.
* libgnat/s-multip.ads: Likewise.
* libgnat/s-pack03.ads: Likewise.
* libgnat/s-pack05.ads: Likewise.
* libgnat/s-pack06.ads: Likewise.
* libgnat/s-pack07.ads: Likewise.
* libgnat/s-pack09.ads: Likewise.
* libgnat/s-pack10.ads: Likewise.
* libgnat/s-pack100.ads: Likewise.
* libgnat/s-pack101.ads: Likewise.
* libgnat/s-pack102.ads: Likewise.
* libgnat/s-pack103.ads: Likewise.
* libgnat/s-pack104.ads: Likewise.
* libgnat/s-pack105.ads: Likewise.
* libgnat/s-pack106.ads: Likewise.
* libgnat/s-pack107.ads: Likewise.
* libgnat/s-pack108.ads: Likewise.
* libgnat/s-pack109.ads: Likewise.
* libgnat/s-pack11.ads: Likewise.
* libgnat/s-pack110.ads: Likewise.
* libgnat/s-pack111.ads: Likewise.
* libgnat/s-pack112.ads: Likewise.
* libgnat/s-pack113.ads: Likewise.
* libgnat/s-pack114.ads: Likewise.
* libgnat/s-pack115.ads: Likewise.
* libgnat/s-pack116.ads: Likewise.
* libgnat/s-pack117.ads: Likewise.
* libgnat/s-pack118.ads: Likewise.
* libgnat/s-pack119.ads: Likewise.
* libgnat/s-pack12.ads: Likewise.
* libgnat/s-pack120.ads: Likewise.
* libgnat/s-pack121.ads: Likewise.
* libgnat/s-pack122.ads: Likewise.
* libgnat/s-pack123.ads: Likewise.
* libgnat/s-pack124.ads: Likewise.
* libgnat/s-pack125.ads: Likewise.
* libgnat/s-pack126.ads: Likewise.
* libgnat/s-pack127.ads: Likewise.
* libgnat/s-pack13.ads: Likewise.
* libgnat/s-pack14.ads: Likewise.
* libgnat/s-pack15.ads: Likewise.
* libgnat/s-pack17.ads: Likewise.
* libgnat/s-pack18.ads: Likewise.
* libgnat/s-pack19.ads: Likewise.
* libgnat/s-pack20.ads: Likewise.
* libgnat/s-pack21.ads: Likewise.
* libgnat/s-pack22.ads: Likewise.
* libgnat/s-pack23.ads: Likewise.
* libgnat/s-pack24.ads: Likewise.
* libgnat/s-pack25.ads: Likewise.
* libgnat/s-pack26.ads: Likewise.
* libgnat/s-pack27.ads: Likewise.
* libgnat/s-pack28.ads: Likewise.
* libgnat/s-pack29.ads: Likewise.
* libgnat/s-pack30.ads: Likewise.
* libgnat/s-pack31.ads: Likewise.
* libgnat/s-pack33.ads: Likewise.
* libgnat/s-pack34.ads: Likewise.
* libgnat/s-pack35.ads: Likewise.
* libgnat/s-pack36.ads: Likewise.
* libgnat/s-pack37.ads: Likewise.
* libgnat/s-pack38.ads: Likewise.
* libgnat/s-pack39.ads: Likewise.
* libgnat/s-pack40.ads: Likewise.
* libgnat/s-pack41.ads: Likewise.
* libgnat/s-pack42.ads: Likewise.
* libgnat/s-pack43.ads: Likewise.
* libgnat/s-pack44.ads: Likewise.
* libgnat/s-pack45.ads: Likewise.
* libgnat/s-pack46.ads: Likewise.
* libgnat/s-pack47.ads: Likewise.
* libgnat/s-pack48.ads: Likewise.
* libgnat/s-pack49.ads: Likewise.
* libgnat/s-pack50.ads: Likewise.
* libgnat/s-pack51.ads: Likewise.
* libgnat/s-pack52.ads: Likewise.
* libgnat/s-pack53.ads: Likewise.
* libgnat/s-pack54.ads: Likewise.
* libgnat/s-pack55.ads: Likewise.
* libgnat/s-pack56.ads: Likewise.
* libgnat/s-pack57.ads: Likewise.
* libgnat/s-pack58.ads: Likewise.
* libgnat/s-pack59.ads: Likewise.
* libgnat/s-pack60.ads: Likewise.
* libgnat/s-pack61.ads: Likewise.
* libgnat/s-pack62.ads: Likewise.
* libgnat/s-pack63.ads: Likewise.
* libgnat/s-pack65.ads: Likewise.
* libgnat/s-pack66.ads: Likewise.
* libgnat/s-pack67.ads: Likewise.
* libgnat/s-pack68.ads: Likewise.
* libgnat/s-pack69.ads: Likewise.
* libgnat/s-pack70.ads: Likewise.
* libgnat/s-pack71.ads: Likewise.
* libgnat/s-pack72.ads: Likewise.
* libgnat/s-pack73.ads: Likewise.
* libgnat/s-pack74.ads: Likewise.
* libgnat/s-pack75.ads: Likewise.
* libgnat/s-pack76.ads: Likewise.
* libgnat/s-pack77.ads: Likewise.
* libgnat/s-pack78.ads: Likewise.
* libgnat/s-pack79.ads: Likewise.
* libgnat/s-pack80.ads: Likewise.
* libgnat/s-pack81.ads: Likewise.
* libgnat/s-pack82.ads: Likewise.
* libgnat/s-pack83.ads: Likewise.
* libgnat/s-pack84.ads: Likewise.
* libgnat/s-pack85.ads: Likewise.
* libgnat/s-pack86.ads: Likewise.
* libgnat/s-pack87.ads: Likewise.
* libgnat/s-pack88.ads: Likewise.
* libgnat/s-pack89.ads: Likewise.
* libgnat/s-pack90.ads: Likewise.
* libgnat/s-pack91.ads: Likewise.
* libgnat/s-pack92.ads: Likewise.
* libgnat/s-pack93.ads: Likewise.
* libgnat/s-pack94.ads: Likewise.
* libgnat/s-pack95.ads: Likewise.
* libgnat/s-pack96.ads: Likewise.
* libgnat/s-pack97.ads: Likewise.
* libgnat/s-pack98.ads: Likewise.
* libgnat/s-pack99.ads: Likewise.
* libgnat/s-parame.ads: Likewise.
* libgnat/s-rident.ads: Likewise.
* libgnat/s-spark.ads: Likewise.
* libgnat/s-spcuop.ads: Likewise.
* libgnat/s-stoele.ads: Likewise.
* libgnat/s-traent.ads: Likewise.
* libgnat/s-unstyp.ads: Likewise.
* libgnat/s-vaispe.ads: Likewise.
* libgnat/s-valspe.ads: Likewise.
* libgnat/s-vauspe.ads: Likewise.
* libgnat/s-veboop.ads: Likewise.
* libgnat/s-vector.ads: Likewise.
* libgnat/s-vs_int.ads: Likewise.
* libgnat/s-vs_lli.ads: Likewise.
* libgnat/s-vs_llu.ads: Likewise.
* libgnat/s-vs_uns.ads: Likewise.
* libgnat/s-vsllli.ads: Likewise.
* libgnat/text_io.ads: Likewise.
* libgnat/unchconv.ads: Likewise.
* libgnat/unchdeal.ads: Likewise.
* s-pack.ads.tmpl: Likewise.

8 months agoada: Make sure not to access past the end of bit-packed arrays
Eric Botcazou [Tue, 29 Oct 2024 12:14:16 +0000 (13:14 +0100)] 
ada: Make sure not to access past the end of bit-packed arrays

The code generated for the routines of the run-time library that implement
support for bit-packed arrays with non-power-of-2 component sizes turns out
to be problematic for the Address Sanitizer and the CHERI architecture, as
it may access past the end of bit-packed arrays in specific cases.

No functional changes.

gcc/ada/ChangeLog:

* s-pack.adb.tmpl: Add '7' suffix to all existing constructs and
add variants with suffixes ranging from '0' to '6'.
(Get_@@): Dereference the address as a record object whose accessed
component is always the last.
(GetU_@@): Likewise.
(Set_@@): Likewise.
(SetU_@@): Likewise.
* libgnat/s-pack03.adb: Regenerate.
* libgnat/s-pack05.adb: Likewise.
* libgnat/s-pack06.adb: Likewise.
* libgnat/s-pack07.adb: Likewise.
* libgnat/s-pack09.adb: Likewise.
* libgnat/s-pack10.adb: Likewise.
* libgnat/s-pack100.adb: Likewise.
* libgnat/s-pack101.adb: Likewise.
* libgnat/s-pack102.adb: Likewise.
* libgnat/s-pack103.adb: Likewise.
* libgnat/s-pack104.adb: Likewise.
* libgnat/s-pack105.adb: Likewise.
* libgnat/s-pack106.adb: Likewise.
* libgnat/s-pack107.adb: Likewise.
* libgnat/s-pack108.adb: Likewise.
* libgnat/s-pack109.adb: Likewise.
* libgnat/s-pack11.adb: Likewise.
* libgnat/s-pack110.adb: Likewise.
* libgnat/s-pack111.adb: Likewise.
* libgnat/s-pack112.adb: Likewise.
* libgnat/s-pack113.adb: Likewise.
* libgnat/s-pack114.adb: Likewise.
* libgnat/s-pack115.adb: Likewise.
* libgnat/s-pack116.adb: Likewise.
* libgnat/s-pack117.adb: Likewise.
* libgnat/s-pack118.adb: Likewise.
* libgnat/s-pack119.adb: Likewise.
* libgnat/s-pack12.adb: Likewise.
* libgnat/s-pack120.adb: Likewise.
* libgnat/s-pack121.adb: Likewise.
* libgnat/s-pack122.adb: Likewise.
* libgnat/s-pack123.adb: Likewise.
* libgnat/s-pack124.adb: Likewise.
* libgnat/s-pack125.adb: Likewise.
* libgnat/s-pack126.adb: Likewise.
* libgnat/s-pack127.adb: Likewise.
* libgnat/s-pack13.adb: Likewise.
* libgnat/s-pack14.adb: Likewise.
* libgnat/s-pack15.adb: Likewise.
* libgnat/s-pack17.adb: Likewise.
* libgnat/s-pack18.adb: Likewise.
* libgnat/s-pack19.adb: Likewise.
* libgnat/s-pack20.adb: Likewise.
* libgnat/s-pack21.adb: Likewise.
* libgnat/s-pack22.adb: Likewise.
* libgnat/s-pack23.adb: Likewise.
* libgnat/s-pack24.adb: Likewise.
* libgnat/s-pack25.adb: Likewise.
* libgnat/s-pack26.adb: Likewise.
* libgnat/s-pack27.adb: Likewise.
* libgnat/s-pack28.adb: Likewise.
* libgnat/s-pack29.adb: Likewise.
* libgnat/s-pack30.adb: Likewise.
* libgnat/s-pack31.adb: Likewise.
* libgnat/s-pack33.adb: Likewise.
* libgnat/s-pack34.adb: Likewise.
* libgnat/s-pack35.adb: Likewise.
* libgnat/s-pack36.adb: Likewise.
* libgnat/s-pack37.adb: Likewise.
* libgnat/s-pack38.adb: Likewise.
* libgnat/s-pack39.adb: Likewise.
* libgnat/s-pack40.adb: Likewise.
* libgnat/s-pack41.adb: Likewise.
* libgnat/s-pack42.adb: Likewise.
* libgnat/s-pack43.adb: Likewise.
* libgnat/s-pack44.adb: Likewise.
* libgnat/s-pack45.adb: Likewise.
* libgnat/s-pack46.adb: Likewise.
* libgnat/s-pack47.adb: Likewise.
* libgnat/s-pack48.adb: Likewise.
* libgnat/s-pack49.adb: Likewise.
* libgnat/s-pack50.adb: Likewise.
* libgnat/s-pack51.adb: Likewise.
* libgnat/s-pack52.adb: Likewise.
* libgnat/s-pack53.adb: Likewise.
* libgnat/s-pack54.adb: Likewise.
* libgnat/s-pack55.adb: Likewise.
* libgnat/s-pack56.adb: Likewise.
* libgnat/s-pack57.adb: Likewise.
* libgnat/s-pack58.adb: Likewise.
* libgnat/s-pack59.adb: Likewise.
* libgnat/s-pack60.adb: Likewise.
* libgnat/s-pack61.adb: Likewise.
* libgnat/s-pack62.adb: Likewise.
* libgnat/s-pack63.adb: Likewise.
* libgnat/s-pack65.adb: Likewise.
* libgnat/s-pack66.adb: Likewise.
* libgnat/s-pack67.adb: Likewise.
* libgnat/s-pack68.adb: Likewise.
* libgnat/s-pack69.adb: Likewise.
* libgnat/s-pack70.adb: Likewise.
* libgnat/s-pack71.adb: Likewise.
* libgnat/s-pack72.adb: Likewise.
* libgnat/s-pack73.adb: Likewise.
* libgnat/s-pack74.adb: Likewise.
* libgnat/s-pack75.adb: Likewise.
* libgnat/s-pack76.adb: Likewise.
* libgnat/s-pack77.adb: Likewise.
* libgnat/s-pack78.adb: Likewise.
* libgnat/s-pack79.adb: Likewise.
* libgnat/s-pack80.adb: Likewise.
* libgnat/s-pack81.adb: Likewise.
* libgnat/s-pack82.adb: Likewise.
* libgnat/s-pack83.adb: Likewise.
* libgnat/s-pack84.adb: Likewise.
* libgnat/s-pack85.adb: Likewise.
* libgnat/s-pack86.adb: Likewise.
* libgnat/s-pack87.adb: Likewise.
* libgnat/s-pack88.adb: Likewise.
* libgnat/s-pack89.adb: Likewise.
* libgnat/s-pack90.adb: Likewise.
* libgnat/s-pack91.adb: Likewise.
* libgnat/s-pack92.adb: Likewise.
* libgnat/s-pack93.adb: Likewise.
* libgnat/s-pack94.adb: Likewise.
* libgnat/s-pack95.adb: Likewise.
* libgnat/s-pack96.adb: Likewise.
* libgnat/s-pack97.adb: Likewise.
* libgnat/s-pack98.adb: Likewise.
* libgnat/s-pack99.adb: Likewise.

8 months agoada: Fix assertion failure on null aggregate in generic with pragma Ada_2022
Eric Botcazou [Mon, 28 Oct 2024 08:56:44 +0000 (09:56 +0100)] 
ada: Fix assertion failure on null aggregate in generic with pragma Ada_2022

This happens when the unit is instantiated in a non-Ada 2022 unit.

gcc/ada/ChangeLog:

PR ada/114127
* sem_aggr.adb (Is_Null_Aggregate): Replace test on Ada_Version
with test on Nkind.

8 months agoada: Get rid of N_Unchecked_Expression node
Eric Botcazou [Fri, 25 Oct 2024 19:16:14 +0000 (21:16 +0200)] 
ada: Get rid of N_Unchecked_Expression node

This node is used in a single place in the front-end: it wraps the newly
built N_Indexed_Component nodes on the left-hand side of assignments
generated to elaborate array aggregates, and its effect is to disable
range checks for the expressions of these nodes.

Most of the code in the front-end does not expect to encounter it at all,
which leads to weird effects when this actually happens after changes are
made to the processing of array aggregates.

This change replaces the node by the Kill_Range_Check flag already present
on N_Unchecked_Type_Conversion, but with a slightly adjusted semantics.

gcc/ada/ChangeLog:

* exp_aggr.adb (Build_Array_Aggr_Code.Gen_Assign): Do not call
Checks_Off on the newly built N_Indexed_Component node but instead
set Kill_Range_Check on it.
* exp_ch4.ads (Expand_N_Unchecked_Expression): Delete.
* exp_ch4.adb (Expand_N_Indexed_Component): Remove handling of
N_Unchecked_Expression.
(Expand_N_Unchecked_Expression): Delete.
(Expand_N_Unchecked_Type_Conversion): Propagate the Assignment_OK
flag and rewrite the node manually.
* exp_util.adb (Insert_Actions): Remove handling of
N_Unchecked_Expression.
(Side_Effect_Free): Likewise.
* expander.adb (Expand): Likewise.
* gen_il-gen-gen_nodes.adb (N_Indexed_Component): Add flag
Kill_Range_Check for the purpose of semantics.
(N_Unchecked_Expression): Delete.
* gen_il-internals.ads (Type_Frequency): Remove entry for
N_Unchecked_Expression.
* gen_il-types.ads (Opt_Type_Enum): Remove N_Unchecked_Expression.
* pprint.adb (Expression_Image): Remove handling of
N_Unchecked_Expression.
* sem.adb (Analyze): Likewise.
* sem_ch4.ads (Analyze_Unchecked_Expression): Delete.
* sem_ch4.adb (Analyze_Unchecked_Expression): Likewise.
* sem_res.adb (Resolve_Unchecked_Expression): Likewise.
(Resolve): Remove handling of N_Unchecked_Expression.
(Resolve_Indexed_Component): Do not call Apply_Scalar_Range_Check
on the expressions if Kill_Range_Check is set on the node.
* sem_util.adb (Is_Non_Preelaborable_Construct): Remove handling of
N_Unchecked_Expression.
* sinfo.ads (Kill_Range_Check): Document it for N_Indexed_Component.
(Unchecked Expression): Delete specification.
* sprint.adb (Sprint_Node_Actual): Remove handling of
N_Unchecked_Expression.
* tbuild.ads (Checks_Off): Delete.
* tbuild.adb (Checks_Off): Likewise.

8 months agoada: Fix internal error on invalid prefix with assertions enabled
Eric Botcazou [Mon, 28 Oct 2024 10:44:47 +0000 (11:44 +0100)] 
ada: Fix internal error on invalid prefix with assertions enabled

This happens for example with:

package Q3 is
  type Types is (One, Two);
end Q3;

with Q3;

package P3 is
  Kind : Q3.Types := Q3.Types.One;
end P3;

and prevents the error from being given.

gcc/ada/ChangeLog:

PR ada/112979
* sem_ch8.adb (Find_Selected_Component): Try to recognize the
object operation notation only if the selector is a subprogram.

8 months agoada: Fix assertion failure on illegal use of aspect Type_Invariant
Eric Botcazou [Mon, 28 Oct 2024 10:58:55 +0000 (11:58 +0100)] 
ada: Fix assertion failure on illegal use of aspect Type_Invariant

The illegal use is on a type derived from a formal private type, e.g.:

generic

  type T is private;

package G is

  type D is new T with Type_Invariant => True;

end G;

gcc/ada/ChangeLog:

PR ada/113037
* sem_prag.adb (Analyze_Pragma) <Pragma_Invariant>: Reject types
that are derived from formal private types.

8 months agoada: Fix unexpected Program_Error raised in the parser on mismatched []
Eric Botcazou [Mon, 28 Oct 2024 10:28:53 +0000 (11:28 +0100)] 
ada: Fix unexpected Program_Error raised in the parser on mismatched []

This happens for example with:

  A : constant array (Natural range <>) of String := [ "xor" [;

The problem is that the left bracket token is incorrectly classified as
a name extension, but there is no handler in the Scan_Name_Extension_OK
part of P_Name in Par.Ch4.

gcc/ada/ChangeLog:

PR ada/112821
* scans.ads (Token_Type): Remove Tok_Left_Bracket from Namext.

8 months agoada: Fix internal error on instantiation of package with a nested ghost package
Eric Botcazou [Mon, 28 Oct 2024 08:13:33 +0000 (09:13 +0100)] 
ada: Fix internal error on instantiation of package with a nested ghost package

The instantiation triggers an internal error in Gigi because of a dangling
ghost entity created by the finalization machinery.

gcc/ada/ChangeLog:

PR ada/114300
* exp_ch7.adb (Attach_Object_To_Master_Node): Propagate the
Is_Ignored_Ghost_Entity flag from the finalization procedure.
(Build_Finalizer.Process_Declarations): Move up the test on
Is_Ignored_Ghost_Entity.
* exp_util.adb (Requires_Cleanup_Actions): Likewise.

8 months agoada: Fix premature finalization of anonymous access result from library function
Eric Botcazou [Mon, 28 Oct 2024 07:33:49 +0000 (08:33 +0100)] 
ada: Fix premature finalization of anonymous access result from library function

In GNAT's implementation, the finalization of controlled objects created
through anonymous access types occurs when the enclosing library unit goes
out of scope if this is safe, and never occurs otherwise.

The case of a function that is a library unit with an anonymous access
result type falls in the second category for the anonymous access result
type itself and, therefore, finalization cannot take place for it.

gcc/ada/ChangeLog:

PR ada/55725
* exp_ch6.adb (Add_Collection_Actual_To_Build_In_Place_Call): Be
prepared for no collection if the access type is anonymous.
* exp_ch7.adb (Build_Anonymous_Collection): Return early for the
anonymous access result type of a library function.

8 months agoada: Accept SPARK.Big_Integers.Big_Integer where Big_Integer is accepted
Piotr Trojanek [Mon, 28 Oct 2024 12:17:03 +0000 (13:17 +0100)] 
ada: Accept SPARK.Big_Integers.Big_Integer where Big_Integer is accepted

For certification of a light SPARK runtime libraries we now accept
expressions of type SPARK.Big_Integers.Big_Integer in subprogram and
loop variants.

gcc/ada/ChangeLog:

* exp_util.adb (Make_Variant_Comparison): Accept new types in
expansion.
* rtsfind.adb (Get_Unit_Name): Support SPARK.Big_Integers.
* rtsfind.ads (RTU_Id, RE_Id, RE_Unit_Table): Support new type
and its enclosing unit.
* sem_prag.adb (Analyze_Pragma): Support new type in pragma
Loop_Variant.
(Analyze_Subprogram_Variant_In_Decl_Part): Support new type in
aspect Subprogram_Variant.

8 months agoada: Make Interrupt and Attach Handlers Obsolescent in VXWorks
Viljar Indus [Wed, 18 Sep 2024 07:14:09 +0000 (10:14 +0300)] 
ada: Make Interrupt and Attach Handlers Obsolescent in VXWorks

In order to trigger an obsolescent feature warning in
VXWorks if either the pragma or aspect of Interrupt_Handler
or Attach_Handler is used, the spec of the Register_Interrupt_Handler
method needs to be marked as obsolescent in a VXWorks specific
version of the file.

gcc/ada/ChangeLog:

* libgnarl/s-interr__vxworks.ads (new): A VXWorks specific
version of the file where Register_Interrupt_Handler is marked
with the Obsolescent pragma.
* libgnarl/s-interr__vxworks.adb: Remove pragma Obsoloescent
that had no effect.
* Makefile.rtl: Add entries for using the
libgnarl/s-interr__vxworks.ads file.

8 months agoada: Fix bogus error for delta aggregate as expression function
Eric Botcazou [Mon, 28 Oct 2024 08:30:07 +0000 (09:30 +0100)] 
ada: Fix bogus error for delta aggregate as expression function

The compiler correctly accepts the other forms of aggregates.

gcc/ada/ChangeLog:

PR ada/113868
* par-ch6.adb (P_Subprogram) <Scan_Body_Or_Expression_Function>:
Add delta aggregate alongside the other forms of aggregates.

8 months agoada: Remove couple of irregular calls to Resolve_Aggr_Expr
Eric Botcazou [Mon, 28 Oct 2024 06:42:54 +0000 (07:42 +0100)] 
ada: Remove couple of irregular calls to Resolve_Aggr_Expr

The function is supposed to be passed an expression, but it is passed the
enclosing N_Component_Association node in a couple of cases, only to give
an error that can as well be given in the caller, at the cost of bypasses
to disable most of its processing.

gcc/ada/ChangeLog:

* sem_aggr.adb (Resolve_Array_Aggregate): In the case of an others
choice with a box, do not call Resolve_Aggr_Exp and give the error
for a multidimensional array directly.
(Resolve_Aggr_Expr): Remove bypasses for above case.

8 months agoada: Allow file mapping for System's spec
Ronan Desplanques [Thu, 24 Oct 2024 12:56:15 +0000 (14:56 +0200)] 
ada: Allow file mapping for System's spec

Before this patch, it was never allowed to use pragma Source_File_Name
for the spec of System, allegedly because Targparm.Get_Target_Parameters
is called before configuration pragmas are processed. Using a mapping
file was allowed but did not work correctly.

This patch makes mapping files loading happen before the call to
Get_Target_Parameters so mapping file can set the file name of System.
Also, pragma Source_File_Name is allowed if it confirms a mapping that
was previously given in a mapping file, to accommodate GPRbuild that
uses both pragmas and mapping files.

gcc/ada/ChangeLog:

* frontend.adb (Frontend): Move call to Fmap.Initialize ...
* gnat1drv.adb (Gnat1drv): ... here. Look up Fmap when loading System.
* par-prag.adb (Prag): Allow pragma Source_File_Name for System when
it confirms an existing mapping.

8 months agoada: Fix markup typos
Richard Kenner [Fri, 25 Oct 2024 12:02:14 +0000 (08:02 -0400)] 
ada: Fix markup typos

gcc/ada/ChangeLog:

* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix minor
markup errors.
* doc/gnat_ugn/gnat_utility_programs.rst: Likewise.
* gnat_ugn.texi: Regenerate.

8 months agoada: Remove use of overlays in implementation of System.Pack_N units
Eric Botcazou [Fri, 20 Sep 2024 18:24:55 +0000 (20:24 +0200)] 
ada: Remove use of overlays in implementation of System.Pack_N units

The implementation uses an overlay between an address and an access value,
which is convoluted. This changes it to use a direct conversion instead.

No functional changes (and no changes to generated code at -O2).

gcc/ada/ChangeLog:

* s-pack.adb.tmpl: Add "with System.Address_To_Access_Conversions".
(Cluster_Ref): Delete.
(AAC): New instance of System.Address_To_Access_Conversions.
(Rev_Cluster_Ref): Delete.
(Rev_ACC): New instance of System.Address_To_Access_Conversions.
(ClusterU_Ref): Delete.
(AACU): New instance of System.Address_To_Access_Conversions.
(Rev_ClusterU_Ref): Delete.
(Rev_ACCU): New instance of System.Address_To_Access_Conversions.
(Get_@@): Use a direct address-to-access conversion.
(GetU_@@): Likewise.
(Set_@@): Likewise.
(SetU_@@): Likewise.
* libgnat/s-pack03.adb: Regenerate.
* libgnat/s-pack05.adb: Likewise.
* libgnat/s-pack06.adb: Likewise.
* libgnat/s-pack07.adb: Likewise.
* libgnat/s-pack09.adb: Likewise.
* libgnat/s-pack10.adb: Likewise.
* libgnat/s-pack100.adb: Likewise.
* libgnat/s-pack101.adb: Likewise.
* libgnat/s-pack102.adb: Likewise.
* libgnat/s-pack103.adb: Likewise.
* libgnat/s-pack104.adb: Likewise.
* libgnat/s-pack105.adb: Likewise.
* libgnat/s-pack106.adb: Likewise.
* libgnat/s-pack107.adb: Likewise.
* libgnat/s-pack108.adb: Likewise.
* libgnat/s-pack109.adb: Likewise.
* libgnat/s-pack11.adb: Likewise.
* libgnat/s-pack110.adb: Likewise.
* libgnat/s-pack111.adb: Likewise.
* libgnat/s-pack112.adb: Likewise.
* libgnat/s-pack113.adb: Likewise.
* libgnat/s-pack114.adb: Likewise.
* libgnat/s-pack115.adb: Likewise.
* libgnat/s-pack116.adb: Likewise.
* libgnat/s-pack117.adb: Likewise.
* libgnat/s-pack118.adb: Likewise.
* libgnat/s-pack119.adb: Likewise.
* libgnat/s-pack12.adb: Likewise.
* libgnat/s-pack120.adb: Likewise.
* libgnat/s-pack121.adb: Likewise.
* libgnat/s-pack122.adb: Likewise.
* libgnat/s-pack123.adb: Likewise.
* libgnat/s-pack124.adb: Likewise.
* libgnat/s-pack125.adb: Likewise.
* libgnat/s-pack126.adb: Likewise.
* libgnat/s-pack127.adb: Likewise.
* libgnat/s-pack13.adb: Likewise.
* libgnat/s-pack14.adb: Likewise.
* libgnat/s-pack15.adb: Likewise.
* libgnat/s-pack17.adb: Likewise.
* libgnat/s-pack18.adb: Likewise.
* libgnat/s-pack19.adb: Likewise.
* libgnat/s-pack20.adb: Likewise.
* libgnat/s-pack21.adb: Likewise.
* libgnat/s-pack22.adb: Likewise.
* libgnat/s-pack23.adb: Likewise.
* libgnat/s-pack24.adb: Likewise.
* libgnat/s-pack25.adb: Likewise.
* libgnat/s-pack26.adb: Likewise.
* libgnat/s-pack27.adb: Likewise.
* libgnat/s-pack28.adb: Likewise.
* libgnat/s-pack29.adb: Likewise.
* libgnat/s-pack30.adb: Likewise.
* libgnat/s-pack31.adb: Likewise.
* libgnat/s-pack33.adb: Likewise.
* libgnat/s-pack34.adb: Likewise.
* libgnat/s-pack35.adb: Likewise.
* libgnat/s-pack36.adb: Likewise.
* libgnat/s-pack37.adb: Likewise.
* libgnat/s-pack38.adb: Likewise.
* libgnat/s-pack39.adb: Likewise.
* libgnat/s-pack40.adb: Likewise.
* libgnat/s-pack41.adb: Likewise.
* libgnat/s-pack42.adb: Likewise.
* libgnat/s-pack43.adb: Likewise.
* libgnat/s-pack44.adb: Likewise.
* libgnat/s-pack45.adb: Likewise.
* libgnat/s-pack46.adb: Likewise.
* libgnat/s-pack47.adb: Likewise.
* libgnat/s-pack48.adb: Likewise.
* libgnat/s-pack49.adb: Likewise.
* libgnat/s-pack50.adb: Likewise.
* libgnat/s-pack51.adb: Likewise.
* libgnat/s-pack52.adb: Likewise.
* libgnat/s-pack53.adb: Likewise.
* libgnat/s-pack54.adb: Likewise.
* libgnat/s-pack55.adb: Likewise.
* libgnat/s-pack56.adb: Likewise.
* libgnat/s-pack57.adb: Likewise.
* libgnat/s-pack58.adb: Likewise.
* libgnat/s-pack59.adb: Likewise.
* libgnat/s-pack60.adb: Likewise.
* libgnat/s-pack61.adb: Likewise.
* libgnat/s-pack62.adb: Likewise.
* libgnat/s-pack63.adb: Likewise.
* libgnat/s-pack65.adb: Likewise.
* libgnat/s-pack66.adb: Likewise.
* libgnat/s-pack67.adb: Likewise.
* libgnat/s-pack68.adb: Likewise.
* libgnat/s-pack69.adb: Likewise.
* libgnat/s-pack70.adb: Likewise.
* libgnat/s-pack71.adb: Likewise.
* libgnat/s-pack72.adb: Likewise.
* libgnat/s-pack73.adb: Likewise.
* libgnat/s-pack74.adb: Likewise.
* libgnat/s-pack75.adb: Likewise.
* libgnat/s-pack76.adb: Likewise.
* libgnat/s-pack77.adb: Likewise.
* libgnat/s-pack78.adb: Likewise.
* libgnat/s-pack79.adb: Likewise.
* libgnat/s-pack80.adb: Likewise.
* libgnat/s-pack81.adb: Likewise.
* libgnat/s-pack82.adb: Likewise.
* libgnat/s-pack83.adb: Likewise.
* libgnat/s-pack84.adb: Likewise.
* libgnat/s-pack85.adb: Likewise.
* libgnat/s-pack86.adb: Likewise.
* libgnat/s-pack87.adb: Likewise.
* libgnat/s-pack88.adb: Likewise.
* libgnat/s-pack89.adb: Likewise.
* libgnat/s-pack90.adb: Likewise.
* libgnat/s-pack91.adb: Likewise.
* libgnat/s-pack92.adb: Likewise.
* libgnat/s-pack93.adb: Likewise.
* libgnat/s-pack94.adb: Likewise.
* libgnat/s-pack95.adb: Likewise.
* libgnat/s-pack96.adb: Likewise.
* libgnat/s-pack97.adb: Likewise.
* libgnat/s-pack98.adb: Likewise.
* libgnat/s-pack99.adb: Likewise.

8 months agoada: Remove obsolete ??? comment about Assignment_OK flag
Eric Botcazou [Fri, 25 Oct 2024 06:37:30 +0000 (08:37 +0200)] 
ada: Remove obsolete ??? comment about Assignment_OK flag

The flagged use has apparently disappeared for long.

gcc/ada/ChangeLog:

* sinfo.ads (Assignment_OK): Remove obsolete ??? comment.

8 months agoada: Get rid of Kill_Range_Checks flag on entities
Eric Botcazou [Thu, 24 Oct 2024 17:20:30 +0000 (19:20 +0200)] 
ada: Get rid of Kill_Range_Checks flag on entities

This flag is set in a single context, namely semantic analysis of record
type definitions, to avoid generating spurious range checks from it, and
a large testing campaign showed that, in practice, it makes a difference
in a single case, namely an access-to-constrained-array component with a
default expression, for example:

  type Acc_String is access all String (1 .. 100);

  type Rec (D : Positive) is record
    A : Acc_String := new String (1 .. D);
  end record;

Now there is another mechanism implemented in Process_Range_Expr_In_Decl to
avoid generating spurious range checks, which does not work in this specific
case but can be made to work with a small tweak to Denotes_Discriminant.

gcc/ada/ChangeLog:

* checks.adb (Range_Checks_Suppressed): Remove test on the
Kill_Range_Checks flag.
* einfo.ads (Kill_Range_Checks): Delete.
* gen_il-fields.ads (Opt_Field_Enum): Remove Kill_Range_Checks.
* gen_il-gen-gen_entities.adb (Entity_Kind): Likewise.
* sem_ch3.adb (Record_Type_Declaration): Do not set the
Kill_Range_Checks flag.
* sem_util.adb (Denotes_Discriminant): In a default expression,
also return True for a discriminal.

8 months agoada: Improve message for misused implicitly-defined preprocessor symbol.
Steve Baird [Tue, 22 Oct 2024 23:20:27 +0000 (16:20 -0700)] 
ada: Improve message for misused implicitly-defined preprocessor symbol.

If the -u option is specified, then otherwise-undefined preprocessor
symbols are implicitly defined to be False. If such an implicitly-defined
symbol is then incorrectly used in a context that requires an integer value,
the resulting error message should not incorrectly state that the symbol is
undefined.

gcc/ada/ChangeLog:

* prep.adb (Expression): Improve error message text when an
implicitly-defined Boolean-valued symbol is used in a context that
requires an integer value.

8 months agoada: Flatten Is_Build_In_Place_Aggregate_Return predicate
Eric Botcazou [Thu, 24 Oct 2024 05:44:13 +0000 (07:44 +0200)] 
ada: Flatten Is_Build_In_Place_Aggregate_Return predicate

The predicate is passed an aggregate node and goes up its parent chain,
but that's unnecessary because Convert_To_Assignments has already done
so in the case of a record aggregate and Expand_Array_Aggregate does not
fully support intermediate conditional expressions yet.

gcc/ada/ChangeLog:

* exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): Directly test
the node and remove dead code for extended return statements.

8 months agoada: Set correct minimum stack size for aarch64-linux
Johannes Kliemann [Wed, 23 Oct 2024 14:07:07 +0000 (14:07 +0000)] 
ada: Set correct minimum stack size for aarch64-linux

The minimum stack size defined by PTHREAD_STACK_MIN defined on
AArch64 Linux is 131072 bytes. Add a separate version for this
target to reflect that value. Previously the x86-64 value of 16384
bytes was used.

gcc/ada/ChangeLog:

* Makefile.rtl: Use libgnat/s-parame__aarch64-linux.adb for
s-parame.adb on aarch64-linux.
* libgnat/s-parame__aarch64-linux.adb: Add file.

8 months agoada: Detect sharing of external file in inconsistent read-write modes
Piotr Trojanek [Thu, 24 Oct 2024 08:47:09 +0000 (10:47 +0200)] 
ada: Detect sharing of external file in inconsistent read-write modes

When opening files with "shared=yes", as described in GNAT RM 11.10,
Sharing Files, we now prevent sharing a single file in inconsistent
read-write modes.

gcc/ada/ChangeLog:

* doc/gnat_rm/the_implementation_of_standard_i_o.rst
(Shared Files): Add trailing period.
* libgnat/s-ficobl.ads (AFCB): Reflect new behavior in comment.
* libgnat/s-fileio.adb (Open): Detect inconsistent sharing,
just like we do in System.File_IO.Reset.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

8 months agoada: Spurious error on abstract primitive with access formals
squirek [Tue, 13 Aug 2024 12:06:52 +0000 (12:06 +0000)] 
ada: Spurious error on abstract primitive with access formals

This patch fixes an issue in the compiler whereby using anonymous access
types as abstract overridden subprogram formals for a derived abtract type
may lead to compile-time errors.

gcc/ada/ChangeLog:

* accessibility.adb (Type_Access_Level): Add handling for
subprogram aliases.

8 months agoada: Missing runtime tag check on mutably tagged objects
squirek [Tue, 13 Aug 2024 11:35:06 +0000 (11:35 +0000)] 
ada: Missing runtime tag check on mutably tagged objects

This patch fixes an issue in the compiler whereby assigning to a non-existant
mutably tagged object component failed to result in the expected run-time
exception.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Type_Conversion): Add special runtime check
generation for mutably tagged objects.

8 months agoada: GNAT Calendar Support for 64-bit Unix Time
Douglas B Rupp [Wed, 9 Oct 2024 19:44:16 +0000 (12:44 -0700)] 
ada: GNAT Calendar Support for 64-bit Unix Time

The Epochalypse of 2038 will require the use of 64-bit time_t and
tv_sec (aka time in seconds from the Unix Epoch). The subprograms
in Ada calendar are self contained but nevertheless will malfunction
if a 64-bit integer type and calculations aren't used.  Add 64-bit
versions and mark the old ones with pragma Obsolescent.

gcc/ada/ChangeLog:

* libgnat/a-calcon.adb (To_Ada_Time) (To_Duration)
(To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent.
(To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64)
(To_Unix_Time_64): New.
* libgnat/a-calcon.ads (To_Ada_Time) (To_Duration)
(To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent.
(To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64)
(To_Unix_Time_64): New.
* libgnat/a-calend.adb (To_Ada_Time) (To_Duration)
(To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent.
(To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64)
(To_Unix_Time_64): New.
* libgnat/a-calend.ads (To_Ada_Time) (To_Duration)
(To_Struct_Timespec) (To_Unix_Time): Mark as obsolescent.
(To_Ada_Time_64) (To_Duration_64) (To_Struct_Timespec_64)
(To_Unix_Time_64): New.

8 months agoada: Fix internal error on nested iterated component associations
Eric Botcazou [Wed, 23 Oct 2024 07:42:25 +0000 (09:42 +0200)] 
ada: Fix internal error on nested iterated component associations

The problem is that Insert_Actions gets confused as to where it should
insert actions coming from within an N_Iterated_Component_Association,
because some actions may be generated during semantic analysis and some
others during expansion.

Instead of another ad-hoc fix, this change extends the processing done
for N_Component_Association, that is to say waiting for the Loop_Actions
field to be set during expansion before inserting actions in there.

This in turn requires semantic analysis to stop generating actions for
N_Iterated_Component_Association nodes.  The current processing is a
little unstable:
  - for container aggregates, Resolve_Iterated_Association preanalyzes
    a copy of the expression,
  - for delta aggregates, Resolve_Delta_Array_Aggregate fully analyzes
    a copy of the expression,
  - for array aggregate, Resolve_Aggr_Expr entirely skips the analysis.

The change implements a preanalysis of a copy of the expression using
Copy_Separate_Tree, which should be sufficient since the expression is
supposed to be unanalyzed at this point, recursively in the context of
N_Iterated_Component_Association nodes.

gcc/ada/ChangeLog:

PR ada/117018
* exp_aggr.adb (Build_Array_Aggr_Code): Do not expect the
Loop_Actions field to be already present on association nodes.
* exp_util.adb (Insert_Actions): For association nodes, insert
into the Loop_Actions field only if it is already present.
* sem_aggr.adb (Resolve_Array_Aggregate): Add Iterated parameter.
(Resolve_Aggregate): Adjust calls to Resolve_Array_Aggregate.
(Resolve_Aggr_Expr): Add Iterated_Elmt defaulted parameter and
a default for Single_Elmt.  Adjust call to Resolve_Array_Aggregate.
Preanalyze a copy of the expression in an iteration context.
(Resolve_Iterated_Component_Association): Pass Iterated_Elmt as
True to Resolve_Aggr_Expr and remove processing of Loop_Actions.
Do not check incorrect use of dynamically tagged expression in
an iteration context.
(Resolve_Iterated_Association): Use Copy_Separate_Tree instead of
New_Copy_Tree and set the Parent field of the result.
(Resolve_Delta_Array_Aggregate): Likewise.  Only preanalyze the
copy instead of analyzing it.

8 months agoada: Add documentation about GNAT LLVM to GNAT User's Guide
Richard Kenner [Mon, 14 Oct 2024 20:55:27 +0000 (16:55 -0400)] 
ada: Add documentation about GNAT LLVM to GNAT User's Guide

Also be consistent on spelling of "back end".

gcc/ada/ChangeLog:

* doc/gnat_ugn/about_this_guide.rst: Add information about GNAT LLVM.
Be consistent about spelling of "back end".
* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Likewise.
* doc/gnat_ugn/gnat_and_program_execution.rst: Be consistent about
spelling of "back end".
* doc/gnat_ugn/the_gnat_compilation_model.rst: Likewise.
* gnat_ugn.texi: Regenerate.

8 months agoada: Fix compilation failure due to style warning
Eric Botcazou [Tue, 22 Oct 2024 20:28:10 +0000 (22:28 +0200)] 
ada: Fix compilation failure due to style warning

gcc/ada/ChangeLog:

* mdll.adb (Build_Dynamic_Library): Fix indentation.

8 months agoada: Rework GNATdll shared library relocation support.
Pascal Obry [Sat, 19 Oct 2024 14:24:04 +0000 (16:24 +0200)] 
ada: Rework GNATdll shared library relocation support.

The code has been simplified to use a single way to create a DLL.
The relocation support is based on whether the base address for the
DLL is passed to the final linker step or not.

gcc/ada/ChangeLog:

* mdll.adb: Use the same procedure to create relocatable or non
relocatable DLL. The only difference is wether the base address is
passed to the final linker. If no base-address is given the DLL is
relocatable.

8 months agoada: The Library_Unit field was used for all sorts of different purposes, which led...
squirek [Mon, 21 Oct 2024 18:21:13 +0000 (18:21 +0000)] 
ada: The Library_Unit field was used for all sorts of different purposes, which led to confusing code.

This patch further refines the previous work to fix several cases.

gcc/ada/ChangeLog:

* inline.adb (In_Main_Unit_Or_Subunit): Use Other_Comp_Unit instead of
Spec_Or_Body_Lib_Unit.
(Must_Inline): Use Other_Comp_Unit instead of Spec_Or_Body_Lib_Unit.

8 months agoada: Elide the copy in aggregate returns for nonlimited types
Eric Botcazou [Mon, 21 Oct 2024 08:55:28 +0000 (10:55 +0200)] 
ada: Elide the copy in aggregate returns for nonlimited types

This implements elision of the copy operation for aggregate returns, i.e.
simple return statements whose expression is an aggregate, in the case of
nonlimited by-reference types (the copy operation is already elided for
limited types), which comprise controlled and tagged types.  This is the
copy operation in the called function, that is to say the copy from the
anonymous object built for the aggregate to the anonymous return object.

The implementation simply extends that of limited types, which rewrites
the simple return statement as an extended return statement internally
and then leverages the built-in-place implementation of return objects
for these statements.

gcc/ada/ChangeLog:

* exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): Also return
True for functions returning on the secondary stack or returning
a by-reference type if the back end exposes its return slot.
(Expand_Array_Aggregate): Call Is_Build_In_Place_Aggregate_Return
to spot aggregates to be built in place.
* exp_ch3.adb (Make_Allocator_For_Return): Add missing condition
in assertion pragma deduced from Expand_Subtype_From_Expr.
* exp_ch6.adb (Expand_Simple_Function_Return): Rewrite the statement
as an extended return statement if the expression is an aggregate
whose expansion is delayed.  Properly relocate the expression in
this case.
* sem_ch6.adb: Add clauses for Exp_Aggr.
(Analyze_Function_Return): Do not apply the predicate check to an
aggregate whose expansion is delayed.  Extended the processing of
case expressions to all conditional expressions.

8 months agoada: Add Ada coverage instrumentation support
Ronan Desplanques [Wed, 16 Oct 2024 13:49:57 +0000 (15:49 +0200)] 
ada: Add Ada coverage instrumentation support

gcc/ada/ChangeLog:

* gnat2.gpr: New file.

8 months agoada: Implement built-in-place expansion of container aggregates
Eric Botcazou [Fri, 18 Oct 2024 10:06:23 +0000 (12:06 +0200)] 
ada: Implement built-in-place expansion of container aggregates

It is implemented for container aggregates that are used to initialize an
object, as specified by RM 7.6(17.2/3-17.3/3) for immutably limited types
and types that need finalization, but for all types like other aggregates.

gcc/ada/ChangeLog:

* exp_aggr.adb (Expand_Delta_Array_Aggregate): Move declaration.
(Expand_Delta_Record_Aggregate): Likewise.
(Expand_Container_Aggregate): Likewise.  Move implementation to
Build_Container_Aggr_Code.  Implement built-in-place expansion
for object declarations and allocators.
(Build_Container_Aggr_Code): New function containing most of the
code of the original Expand_Container_Aggregate.  Do not build a
temporary for the size calculation.  Minor formatting tweaks.
(Expand_N_Aggregate): Add comment.
* exp_ch4.adb (Expand_Allocator_Expression): Detect the case of
a container aggregate as qualified expression.  Do not apply the
predicate check on entry in this case and rewrite the allocator.
* exp_ch7.adb (Build_Finalizer.Process_Object_Declaration): Deal
with Last_Aggregate_Assignment first to compute the attachment
point (as already done in Attach_Object_To_Master_Node).

8 months agoada: Remove obsolete workaround for back-end limitation
Eric Botcazou [Fri, 18 Oct 2024 15:06:25 +0000 (17:06 +0200)] 
ada: Remove obsolete workaround for back-end limitation

This avoids a strange discrepancy in the handling of constants vs variables.

gcc/ada/ChangeLog:

* sem_aux.ads (Has_Unconstrained_Elements): Delete.
* sem_aux.adb (Has_Unconstrained_Elements): Likewise.
* sem_ch3.adb (Analyze_Object_Declaration): Remove obsolete code.

8 months agoada: sem.adb.process_bodies_in_context: check if spec has lib body before use
Ghjuvan Lacambre [Fri, 18 Oct 2024 14:15:04 +0000 (16:15 +0200)] 
ada: sem.adb.process_bodies_in_context: check if spec has lib body before use

Inspector testing shows that calling Body_Lib_Unit on Spec can sometimes
fail due to the following assertion failing:

            pragma Assert
              (Unit (N) in N_Lib_Unit_Declaration_Id
                | N_Lib_Unit_Renaming_Declaration_Id);

Indeed, Unit (N) may sometimes be an N_Subprogram_Body instead of an
N_Lib_Unit_Declaration_Id.

gcc/ada/ChangeLog:

* sem.adb (Process_Bodies_In_Context): check that Spec's unit is
an N_Lib_Unit_Declaration_Id.

8 months agoada: Fix weird error in Ada.Numerics.Discrete_Random with Component_Alignment
Eric Botcazou [Fri, 18 Oct 2024 07:28:17 +0000 (09:28 +0200)] 
ada: Fix weird error in Ada.Numerics.Discrete_Random with Component_Alignment

The problem arises when an instance of Ada.Numerics.Discrete_Random is
covered by a pragma Component_Alignment with a non-default alignment.

gcc/ada/ChangeLog:

* exp_ch5.adb (Expand_Assign_Array): Make Act_Rhs a constant and
do not recompute it, as well as R_Type, when there is a change of
representation.  Move comment about the RHS from here to...
(Expand_N_Assignment_Statement): ...here.

8 months agoada: add xspack.py and corresponding templates.
Marc Poulhiès [Fri, 8 Nov 2024 10:32:56 +0000 (11:32 +0100)] 
ada: add xspack.py and corresponding templates.

xspack.py is used to generate libgnat/s-pack* files.

gcc/ada/ChangeLog:

* xspack.py: New
* s-pack.ads.tmpl: New.
* s-pack.adb.tmpl: New.

8 months agotree-optimization/117417 - ICE with complex load optimization
Richard Biener [Tue, 12 Nov 2024 10:15:15 +0000 (11:15 +0100)] 
tree-optimization/117417 - ICE with complex load optimization

When we decompose a complex load only used as real and imaginary
parts we fail to honor IL constraints which are that a BIT_FIELD_REF
of register type should be outermost in a ref.  The following
simply avoids the transform when the complex load has such a
BIT_FIELD_REF.

PR tree-optimization/117417
* tree-ssa-forwprop.cc (pass_forwprop::execute): Avoid
decomposing BIT_FIELD_REF complex load.

* gcc.dg/torture/pr117417.c: New testcase.

8 months agortl: Validate subreg info when optimizing vec_select.
Tejas Belagod [Mon, 2 Sep 2024 15:23:42 +0000 (20:53 +0530)] 
rtl: Validate subreg info when optimizing vec_select.

When optimizing for NOPs in case of overlapping regs in VEC_SELECT expressions,
validate subreg data before using simplify_subreg_regno.  There is no real
SUBREG rtx here, but a pseudo subreg call to check if subregs are possible.

gcc/ChangeLog:

* rtlanal.cc (set_noop_p): Validate subreg constraints before checking
for overlapping regs using simplify_subreg_regno.

8 months agoAdd X86_TUNE_AVX512_TWO_EPILOGUES, enable for Zen4 and Zen5
Richard Biener [Fri, 8 Nov 2024 10:17:22 +0000 (11:17 +0100)] 
Add X86_TUNE_AVX512_TWO_EPILOGUES, enable for Zen4 and Zen5

The following adds X86_TUNE_AVX512_TWO_EPILOGUES tuning and directs the
vectorizer to produce both a vector AVX2 and SSE epilogue for AVX512
vectorized loops when set.  The tuning is enabled by default for Zen4
and Zen5 where I benchmarked it to be overall positive on SPEC CPU 2017 both
in performance and overall code size.  In particular it speeds up
525.x264_r which with only an AVX2 epilogue ends up in unvectorized code
at the moment.

* config/i386/i386.cc (ix86_vector_costs::finish_cost): Set
m_suggested_epilogue_mode according to X86_TUNE_AVX512_TWO_EPILOGUES.
* config/i386/x86-tune.def (X86_TUNE_AVX512_TWO_EPILOGUES): Add.
Enable for znver4 and znver5.

8 months agoAdd suggested_epilogue_mode to vector costs
Richard Biener [Fri, 8 Nov 2024 10:12:06 +0000 (11:12 +0100)] 
Add suggested_epilogue_mode to vector costs

The following enables targets to suggest the vector mode to be used
preferably for the epilogue of a vectorized loop.  The patch also
enables more than one vectorized epilogue in case the target suggests
a vector mode for the epilogue of a vector epilogue.

* tree-vectorizer.h (vector_costs::suggested_epilogue_mode): New.
(vector_costs::m_suggested_epilogue_mode): Likewise.
(vector_costs::vector_costs): Initialize m_suggested_epilogue_mode.
* tree-vect-loop.cc (vect_analyze_loop): Honor the target
suggested prefered epilogue mode and support vector epilogues
of vector epilogues if requested.

8 months agotree-optimization/117484 - issue with SLP discovery of permuted .MASK_LOAD
Richard Biener [Fri, 8 Nov 2024 08:43:26 +0000 (09:43 +0100)] 
tree-optimization/117484 - issue with SLP discovery of permuted .MASK_LOAD

When we do SLP discovery of a .MASK_LOAD for a dataref group with gaps
the discovery for the mask will have gaps as well and this was
unexpected in a few places.  The following re-organizes things
slightly to accomodate for this.

PR tree-optimization/117484
* tree-vect-slp.cc (vect_build_slp_tree_2): Handle gaps in
mask discovery.  Fix condition to release the load permutation.
(vect_lower_load_permutations): Assert we get no load
permutation for the unpermuted node.
* tree-vect-slp-patterns.cc (linear_loads_p): Properly identify
loads (without permutation).
(compatible_complex_nodes_p): Likewise.

* gcc.dg/vect/pr117484-1.c: New testcase.
* gcc.dg/vect/pr117484-2.c: Likewise.

8 months agotree-optimization/117502 - VMAT_STRIDED_SLP vs VMAT_ELEMENTWISE when considering...
Richard Biener [Fri, 8 Nov 2024 12:06:07 +0000 (13:06 +0100)] 
tree-optimization/117502 - VMAT_STRIDED_SLP vs VMAT_ELEMENTWISE when considering gather

The following treats both the same when considering to use gather or
scatter for single-element interleaving accesses.

This will cause

FAIL: gcc.target/aarch64/sve/sve_iters_low_2.c scan-tree-dump-not vect "LOOP VECTORIZED"

where we now vectorize the loop with VNx4QI, I'll leave it to ARM folks
to investigate whether that's OK and to adjust the testcase or to see
where to adjust things to make the testcase not vectorized again.  The
original fix for which the testcase was introduced is still efffective.

PR tree-optimization/117502
* tree-vect-stmts.cc (get_group_load_store_type): Also consider
VMAT_STRIDED_SLP when checking to use gather/scatter for
single-element interleaving access.
* tree-vect-loop.cc (update_epilogue_loop_vinfo): STMT_VINFO_STRIDED_P
can be classified as VMAT_GATHER_SCATTER, so update DR_REF for
those as well.

8 months agoMatch: Optimize log (x) CMP CST and exp (x) CMP CST operations
Soumya AR [Tue, 12 Nov 2024 03:56:24 +0000 (09:26 +0530)] 
Match: Optimize log (x) CMP CST and exp (x) CMP CST operations

This patch implements transformations for the following optimizations.

logN(x) CMP CST -> x CMP expN(CST)
expN(x) CMP CST -> x CMP logN(CST)

Where CMP expands to ge and le operations.

For example:

int
foo (float x)
{
  return __builtin_logf (x) <= 0.0f;
}

can just be:

int
foo (float x)
{
  return x <= 1.0f;
}

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Soumya AR <soumyaa@nvidia.com>
gcc/ChangeLog:

* match.pd: Fold logN(x) CMP CST -> x CMP expN(CST)
and expN(x) CMP CST -> x CMP logN(CST)

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/log_exp.c: New test.

8 months agoc++: regenerate opt urls
Jason Merrill [Tue, 12 Nov 2024 00:36:20 +0000 (19:36 -0500)] 
c++: regenerate opt urls

Forgot this in the -fmodules patch (r15-5112).

gcc/c-family/ChangeLog:

* c.opt.urls: Regenerate.

8 months agoDaily bump.
GCC Administrator [Tue, 12 Nov 2024 00:19:15 +0000 (00:19 +0000)] 
Daily bump.

8 months agoc++: include libcody in TAGS
Jason Merrill [Mon, 11 Nov 2024 01:38:40 +0000 (20:38 -0500)] 
c++: include libcody in TAGS

The C++ front-end uses symbols from these directories, so they should also
be in TAGS.

gcc/cp/ChangeLog:

* Make-lang.in: Also collect tags from libcody and c++tools.

8 months agoc++: rename -fmodules-ts to -fmodules
Jason Merrill [Mon, 14 Oct 2024 20:22:34 +0000 (16:22 -0400)] 
c++: rename -fmodules-ts to -fmodules

The C++ modules support is not targeting the Modules TS, so it doesn't make
much sense to refer to the TS in the option name.  But keep the old spelling
as an undocumented alias for now.

gcc/ChangeLog:

* doc/invoke.texi: Rename -fmodules-ts to -fmodules.

gcc/c-family/ChangeLog:

* c.opt: Add -fmodules with same effect as -fmodules-ts.

gcc/cp/ChangeLog:

* lang-specs.h: Check fmodules* instead of fmodules-ts.

8 months agoopts: fix narrowing warning
Jason Merrill [Mon, 11 Nov 2024 02:42:48 +0000 (21:42 -0500)] 
opts: fix narrowing warning

The init-list initialization of cl_deferred_option p had a couple of
narrowing warnings: first of opt_index from int to size_t and then of value
from HOST_WIDE_INT to int.  Fixed by making the types more consistent.

gcc/ChangeLog:

* opts.h (cl_deferred_option::value): Change to HOST_WIDE_INT.
(set_option): Change opt_index parm to size_t.
* opts-common.cc (set_option): Likewise.

9 months agoc++: Fix another crash with invalid new operators [PR117463]
Simon Martin [Mon, 11 Nov 2024 19:22:32 +0000 (20:22 +0100)] 
c++: Fix another crash with invalid new operators [PR117463]

Even though this PR is very close to PR117101, it's not addressed by the
fix I made through r15-4958-g5821f5c8c89a05 because cxx_placement_new_fn
has the very same issue as std_placement_new_fn_p used to have.

As suggested by Jason, this patch changes both functions so that
cxx_placement_new_fn leverages std_placement_new_fn_p which reduces code
duplication and fixes the PR.

PR c++/117463

gcc/cp/ChangeLog:

* constexpr.cc (cxx_placement_new_fn): Implement in terms of
std_placement_new_fn_p.
* cp-tree.h (std_placement_new_fn_p): Declare.
* init.cc (std_placement_new_fn_p): Add missing checks to ensure
that fndecl is a non-replaceable ::operator new.

gcc/testsuite/ChangeLog:

* g++.dg/init/new54.C: New test.

9 months agoc++: Add __builtin_operator_{new,delete} support
Jakub Jelinek [Mon, 11 Nov 2024 18:54:32 +0000 (19:54 +0100)] 
c++: Add __builtin_operator_{new,delete} support

clang++ adds __builtin_operator_{new,delete} builtins which as documented
work similarly to ::operator {new,delete}, except that it is an error
if the called ::operator {new,delete} is not a replaceable global operator
and allow optimizations which C++ normally allows just when those are used
from new/delete expressions https://eel.is/c++draft/expr.new#14
When using these builtins, the same optimizations can be done even when
using those builtins.

For GCC we note that in the CALL_FROM_NEW_OR_DELETE_P flag on CALL_EXPRs.
The following patch implements it as a C++ FE keyword (because passing
references through ... changes the argument and so BUILT_IN_FRONTEND
builtin can't be used), just attempts to call the ::operator {new,delete}
and if it isn't replaceable, diagnoses it.

libstdc++ already uses the builtin in some cases.

2024-11-11  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
* c-common.h (enum rid): Add RID_BUILTIN_OPERATOR_NEW
and RID_BUILTIN_OPERATOR_DELETE.
(names_builtin_p): Change return type from bool to int.
* c-common.cc (c_common_reswords): Add __builtin_operator_new
and __builtin_operator_delete.
gcc/c/
* c-decl.cc (names_builtin_p): Change return type from
bool to int, adjust return statments.
gcc/cp/
* parser.cc (cp_parser_postfix_expression): Handle
RID_BUILTIN_OPERATOR_NEW and RID_BUILTIN_OPERATOR_DELETE.
* cp-objcp-common.cc (names_builtin_p): Change return type from
bool to int, adjust return statments.  Handle
RID_BUILTIN_OPERATOR_NEW and RID_BUILTIN_OPERATOR_DELETE.
* pt.cc (tsubst_expr) <case CALL_EXPR>: Handle
CALL_FROM_NEW_OR_DELETE_P.
gcc/
* doc/extend.texi (New/Delete Builtins): Document
__builtin_operator_new and __builtin_operator_delete.
gcc/testsuite/
* g++.dg/ext/builtin-operator-new-1.C: New test.
* g++.dg/ext/builtin-operator-new-2.C: New test.
* g++.dg/ext/builtin-operator-new-3.C: New test.

9 months agolibstdc++: Improve exception messages in conversion classes
Jonathan Wakely [Fri, 8 Nov 2024 11:09:47 +0000 (11:09 +0000)] 
libstdc++: Improve exception messages in conversion classes

The std::logic_error exceptions thrown from misuses of
std::wbuffer_convert and std::wstring_convert should use names qualified
with "std::".

libstdc++-v3/ChangeLog:

* include/bits/locale_conv.h (wstring_convert, wbuffer_convert):
Adjust strings passed to exception constructors.

9 months agolibstdc++: Fix typos in iterator increment for std::text_encoding [PR117520]
Jonathan Wakely [Mon, 11 Nov 2024 11:54:00 +0000 (11:54 +0000)] 
libstdc++: Fix typos in iterator increment for std::text_encoding [PR117520]

The intended behaviour for std::text_encoding::aliases_view's iterator
is that it incrementing or decrementing too far sets it to a
value-initialized state, or fails an assertion when those are enabled.
There were typos that used == instead of = which meant that instead of
becoming singular or aborting, an out-of-range increment just did
nothing. This meant erroneous operations were well-defined and didn't
produce any undefined behaviour, but were not diagnosed with assertions
enabled, as had been intended.

This change fixes the bugs and adds more tests to verify the intended
behaviour.

libstdc++-v3/ChangeLog:

PR libstdc++/117520
* include/std/text_encoding (aliases_view:_Iterator::operator+=):
Fix typos that caused == to be used instead of =.
(aliases_view::_Iterator): Fix friend declaration.
* testsuite/std/text_encoding/members.cc: Adjust expected
behaviour of invalid subscript. Add tests for other erroneous
operations on iterators.

9 months agolibstdc++: Add parentheses around operand of |
Jonathan Wakely [Mon, 11 Nov 2024 11:23:08 +0000 (11:23 +0000)] 
libstdc++: Add parentheses around operand of |

libstdc++-v3/ChangeLog:

* include/bits/unicode.h (_Utf_iterator::_M_read_utf16): Add
parentheses.

9 months agotestsuite: Require atomic operations for c2y-if-decls-*
Dimitar Dimitrov [Sun, 27 Oct 2024 07:49:49 +0000 (09:49 +0200)] 
testsuite: Require atomic operations for c2y-if-decls-*

Since some of the c2y-if-decls tests use _Atomic, add a
requirement for target to support atomic operations on
int and long types.

This fixes spurious test link failures on pru-unknown-elf,
which lacks atomic ops.  The tests still pass on x86_64-linux-gnu.

gcc/testsuite/ChangeLog:

* gcc.dg/c2y-if-decls-1.c: Require target that supports atomic
operations on int and long types.
* gcc.dg/c2y-if-decls-11.c: Ditto.
* gcc.dg/c2y-if-decls-4.c: Ditto.
* gcc.dg/c2y-if-decls-8.c: Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
9 months agotestsuite: arm: fast-math-complex-add-half-float.c test should not xfail
Torbjörn SVENSSON [Sun, 10 Nov 2024 13:46:51 +0000 (14:46 +0100)] 
testsuite: arm: fast-math-complex-add-half-float.c test should not xfail

With the change in 15-3128-gde1923f9f4d, this test case no longer xfail.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/complex/fast-math-complex-add-half-float.c: Remove
xfail from test.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
9 months agoaarch64: return scalar fp8 values in fp registers
Claudio Bantaloukas [Mon, 11 Nov 2024 18:08:28 +0000 (18:08 +0000)] 
aarch64: return scalar fp8 values in fp registers

According to the aapcs64: If the argument is an 8-bit (...) precision
Floating-point or short vector type and the NSRN is less than 8, then the
argument is allocated to the least significant bits of register v[NSRN].

gcc/
* config/aarch64/aarch64.cc
(aarch64_vfp_is_call_or_return_candidate): use fp registers to
return svmfloat8_t parameters.

gcc/testsuite/
* gcc.target/aarch64/fp8_scalar_1.c:

9 months agoc++: reduce unnecessary tree_common
Jason Merrill [Tue, 5 Nov 2024 15:27:39 +0000 (10:27 -0500)] 
c++: reduce unnecessary tree_common

Lewis' r15-5067 fixing the marking of TRAIT_EXPR led me to compare some
other front-end type definitions to their marking in cp_common_init_ts; it
seems we can change tree_common to something smaller in several cases, to
match how they are marked.

gcc/cp/ChangeLog:

* cp-tree.h (struct ptrmem_cst): Change tree_common to tree_typed.
(struct tree_trait_expr): Likewise.
(struct tree_static_assert): Change tree_common to tree_base.
(struct tree_argument_pack_select): Likewise.

9 months agolibgomp.c-c++-common/pr109062.c: Fix expected spin count for hybrid x86
Tobias Burnus [Mon, 11 Nov 2024 16:22:20 +0000 (17:22 +0100)] 
libgomp.c-c++-common/pr109062.c: Fix expected spin count for hybrid x86

On my system with E and P cores (hybrid) x86, the spincount is by default 1
and not 300000, cf. PR109812 and r14-4571-ge1e127de18dbee.

Hence, this commit updates the expected value of the testcase to also
accept omp_display_env showing "GOMP_SPINCOUNT = '1'" - but only for
x86-64, which might be hybrid.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/pr109062.c: Update dg-output
to also accept GOMP_SPINCOUNT = 1 for x86-64.

9 months agoAdd missing SLP discovery for CFN[_MASK][_LEN]_SCATTER_STORE
Richard Biener [Fri, 8 Nov 2024 12:59:05 +0000 (13:59 +0100)] 
Add missing SLP discovery for CFN[_MASK][_LEN]_SCATTER_STORE

This was responsible for a bunch of SVE FAILs with --param vect-force-slp=1

* tree-vect-slp.cc (arg1_arg3_map): New.
(arg1_arg3_arg4_map): Likewise.
(vect_get_operand_map): Handle IFN_SCATTER_STORE,
IFN_MASK_SCATTER_STORE and IFN_MASK_LEN_SCATTER_STORE.
(vect_build_slp_tree_1): Likewise.
* tree-vect-stmts.cc (vectorizable_store): For SLP masked
gather/scatter record the mask with proper number of copies.
* tree-vect-loop.cc (vectorizable_recurr): Avoid costing
the initial value construction in the prologue twice with SLP.

9 months agoaarch64: Conditionally define __ARM_FEATURE_SVE2p1
Richard Sandiford [Mon, 11 Nov 2024 12:32:21 +0000 (12:32 +0000)] 
aarch64: Conditionally define __ARM_FEATURE_SVE2p1

Previous patches are supposed to add full support for SVE2.1,
so this patch advertises that through __ARM_FEATURE_SVE2p1.

pragma_cpp_predefs_3.c had one fewer pop than push.  The final
test is triple-nested:

- armv8-a (to start with a clean slate, untainted by command-line flags)
- the maximal SVE set
- general-regs-only

gcc/
* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Handle
__ARM_FEATURE_SVE2p1.

gcc/testsuite/
* gcc.target/aarch64/pragma_cpp_predefs_3.c: Add SVE2p1 tests.

9 months agoaarch64: Add remaining SVE2p1 support
Richard Sandiford [Mon, 11 Nov 2024 12:32:21 +0000 (12:32 +0000)] 
aarch64: Add remaining SVE2p1 support

This patch adds the instructions that are new to FEAT_SVE2p1.
It mostly contains simple additions, so it didn't seem worth
splitting up further.

It's likely that we'll find more autovec uses for some of these
instructions, but for now this patch just deals with one obvious case:
using the new hybrid-VLA permutations to handle "stepped" versions of
some Advanced SIMD permutations.  See aarch64_evpc_hvla for details.

The patch also continues the existing practice of lowering ACLE
permutation intrinsics to VEC_PERM_EXPR.  That's admittedly a bit
inconsistent with the approach I've been advocating for when it comes
to arithmetic, but I think the difference is that (a) these are pure
data movement, and so there's limited scope for things like gimple
canonicalisations to mess with the instruction selection or operation
mix; and (b) there are no added UB rules to worry about.

Another new thing in the patch is the concept of "memory-only"
SVE vector modes.  These are used to represent the memory operands
of the new LD1[DW] (to .Q), LD[234]Q, ST1[DW] (from .Q), and ST[234]Q
instructions.  We continue to use .B, .H, .S, and .D modes for the
registers, since there's no predicated contiguous LD1Q instruction,
and since there's no arithmetic that can be done on TI.  (The new
instructions are instead intended for hybrid VLA, i.e. for vectors
of vectors.)

For now, all of the new instructions are non-streaming-only.
Some of them are streaming-compatible with SME2p1, but that's
a later patch.

gcc/
* config/aarch64/aarch64-modes.def (VNx1SI, VNx1DI): New modes.
* config/aarch64/aarch64-sve-builtins-base.cc
(svdup_lane_impl::expand): Update generation of TBL instruction.
(svtbl_impl): Delete.
(svtbl): Use unspec_based_uncond_function instead.
* config/aarch64/aarch64-sve-builtins-functions.h
(permute::fold_permute): Handle trailing immediate arguments.
* config/aarch64/aarch64-sve-builtins-shapes.h (extq): Declare.
(load_gather64_sv_index, load_gather64_sv_offset): Likewise.
(load_gather64_vs_index, load_gather64_vs_offset): Likewise.
(pmov_from_vector, pmov_from_vector_lane, pmov_to_vector_lane)
(reduction_neonq, store_scatter64_index, store_scatter64_offset)
(unary_lane): Likewise.
* config/aarch64/aarch64-sve-builtins-shapes.cc
(load_gather64_sv_base, store_scatter64_base): New classes.
(extq_def, ext): New shape.
(load_gather64_sv_index_def, load_gather64_sv_index): Likewise.
(load_gather64_sv_offset_def, load_gather64_sv_offset): Likewise.
(load_gather64_vs_index_def, load_gather64_vs_index): Likewise.
(load_gather64_vs_offset_def, load_gather64_vs_offset): Likewise.
(pmov_from_vector_def, pmov_from_vector): Likewise.
(pmov_from_vector_lane_def, pmov_from_vector_lane): Likewise.
(pmov_to_vector_lane_def, pmov_to_vector_lane): Likewise.
(reduction_neonq_def, reduction_neonq): Likewise.
(store_scatter64_index_def, store_scatter64_index): Likewise.
(store_scatter64_offset_def, store_scatter64_offset): Likewise.
(unary_lane_def, unary_lane): Likewise.
* config/aarch64/aarch64-sve-builtins-sve2.h (svaddqv, svandqv)
(svdup_laneq, sveorqv, svextq, svld1q_gather, svld1udq, svld1uwq)
(svld2q, svld3q, svld4q, svmaxnmqv, svmaxqv, svminnmqv, svminqv)
(svorqv, svpmov, svpmov_lane, svst1qd, svst1q_scatter, svst1wq)
(svst2q, svst3q, svst4q, svtblq, svtbx, svtbxq, svuzpq1, svuzpq2)
(svzipq1, svzipq2): Declare.
* config/aarch64/aarch64-sve-builtins-sve2.cc (ld1uxq_st1xq_base)
(ld234q_st234q_base, svdup_laneq_impl, svextq_impl): New classes.
(svld1q_gather_impl, svld1uxq_impl, svld234q_impl): Likewise.
(svpmov_impl, svpmov_lane_impl, svst1q_scatter_impl): Likewise.
(svst1xq_impl, svst234q_impl, svuzpq_impl, svzipq_impl): Likewise.
(svaddqv, svandqv, svdup_laneq, sveorqv, svextq, svld1q_gather)
(svld1udq, svld1uwq, svld2q, svld3q, svld4q, svmaxnmqv, svmaxqv)
(svminnmqv, svminqv, svorqv, svpmov, svpmov_lane, svst1qd)
(svst1q_scatter, svst1wq, svst2q, svst3q, svst4q, svtblq, svtbx)
(svtbxq, svuzpq1, svuzpq2, svzipq1, svzipq2): New function entries.
* config/aarch64/aarch64-sve-builtins-sve2.def (svaddqv, svandqv)
(svdup_laneq, sveorqv, svextq, svld2q, svld3q, svld4q, svmaxnmqv)
(svmaxqv, svminnmqv, svminqv, svorqv, svpmov, svpmov_lanes, vst2q)
(svst3q, svst4q, svtblq, svtbxq, svuzpq1, svuzpq2, svzipq1, svzipq2)
(svld1q_gather, svld1udq, svld1uwq, svst1dq, svst1q_scatter)
(svst1wq): New function definitions.
* config/aarch64/aarch64-sve-builtins.cc (TYPES_hsd_data)
(hsd_data, s_data): New type lists.
(function_resolver::infer_pointer_type): Give a specific error about
passing a pointer to 8-bit elements to an _index function.
(function_resolver::resolve_sv_displacement): Check whether the
function allows 32-bit bases.
* config/aarch64/iterators.md (UNSPEC_TBLQ, UNSPEC_TBXQ): New unspecs.
(UNSPEC_ADDQV, UNSPEC_ANDQV, UNSPEC_DUPQ, UNSPEC_EORQV, UNSPEC_EXTQ)
(UNSPEC_FADDQV, UNSPEC_FMAXQV, UNSPEC_FMAXNMQV, UNSPEC_FMINQV)
(UNSPEC_FMINNMQV, UNSPEC_LD1_EXTENDQ, UNSPEC_LD1Q_GATHER): Likewise.
(UNSPEC_LDNQ, UNSPEC_ORQV, UNSPEC_PMOV_PACK, UNSPEC_PMOV_PACK_LANE)
(UNSPEC_PMOV_UNPACK, UNSPEC_PMOV_UNPACK_LANE, UNSPEC_SMAXQV): Likewise.
(UNSPEC_SMINQV, UNSPEC_ST1_TRUNCQ, UNSPEC_ST1Q_SCATTER, UNSPEC_STNQ)
(UNSPEC_UMAXQV, UNSPEC_UMINQV, UNSPEC_UZPQ1, UNSPEC_UZPQ2): Likewise.
(UNSPEC_ZIPQ1, UNSPEC_ZIPQ2): Likewise.
(Vtype): Handle single-vector SVE modes.
(Vendreg): Handle SVE structure modes.
(VNxTI, LD1_EXTENDQ_MEM): New mode attributes.
(SVE_PERMUTE, SVE_TBL, SVE_TBX): New int iterators.
(SVE_INT_REDUCTION_128, SVE_FP_REDUCTION_128): Likewise.
(optab): Handle the new SVE2.1 reductions.
(perm_insn): Handle the new SVE2.1 permutations.
* config/aarch64/aarch64-sve.md
(@aarch64_sve_tbl<mode>): Generalize to...
(@aarch64_sve_<SVE_TBL:perm_insn><mode>): ...this.
(@aarch64_sve_<PERMUTE:perm_insn><mode>): Generalize to...
(@aarch64_sve_<SVE_PERMUTE:perm_insn><mode>): ...this.
* config/aarch64/aarch64-sve2.md (@aarch64_pmov_to_<mode>)
(@aarch64_pmov_lane_to_<mode>, @aarch64_pmov_from_<mode>)
(@aarch64_pmov_lane_from_<mode>, @aarch64_sve_ld1_extendq<mode>)
(@aarch64_sve_ldnq<mode>, aarch64_gather_ld1q): New patterns.
(@aarch64_sve_st1_truncq<mode>, @aarch64_sve_stnq<mode>): Likewise.
(aarch64_scatter_st1q, @aarch64_pred_reduc_<optab>_<mode>): Likewise.
(@aarch64_sve_dupq<mode>, @aarch64_sve_extq<mode>): Likewise.
(@aarch64_sve2_tbx<mode>): Generalize to...
(@aarch64_sve_<SVE_TBX:perm_insn><mode>): ...this.
* config/aarch64/aarch64.cc
(aarch64_classify_vector_memory_mode): New function.
(aarch64_regmode_natural_size): Use it.
(aarch64_classify_index): Likewise.
(aarch64_classify_address): Likewise.
(aarch64_print_address_internal): Likewise.
(aarch64_evpc_hvla): New function.
(aarch64_expand_vec_perm_const_1): Use it.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_index_1.c,
* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_1.c,
* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_2.c,
* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_3.c,
* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_4.c,
* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_5.c:
Adjust the "did you mean" suggestion.
* gcc.target/aarch64/sve/acle/general-c/ld1sh_gather_1.c: Removed.
* gcc.target/aarch64/sve/acle/general-c/extq_1.c: New test.
* gcc.target/aarch64/sve/acle/general-c/load_gather64_sv_index_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/load_gather64_sv_offset_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/pmov_from_vector_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/pmov_from_vector_lane_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/pmov_to_vector_lane_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/pmov_to_vector_lane_2.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_scatter64_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_scatter64_index_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_scatter64_offset_1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/unary_lane_1.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/addqv_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/andqv_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dup_laneq_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/eorqv_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/extq_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1q_gather_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1udq_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1udq_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1udq_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1uwq_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1uwq_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1uwq_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld2q_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld3q_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld4q_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxnmqv_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxnmqv_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxnmqv_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/maxqv_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minnmqv_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minnmqv_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minnmqv_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/minqv_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/orqv_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pmov_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1dq_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1dq_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1dq_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1q_scatter_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1wq_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1wq_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1wq_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st2q_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st3q_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st4q_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tblq_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/tbxq_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq1_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/uzpq2_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq1_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/zipq2_u8.c: Likewise.
* gcc.target/aarch64/sve2/dupq_1.c: Likewise.
* gcc.target/aarch64/sve2/extq_1.c: Likewise.
* gcc.target/aarch64/sve2/uzpq_1.c: Likewise.
* gcc.target/aarch64/sve2/zipq_1.c: Likewise.

9 months agoaarch64: Add common subset of SVE2p1 and SME2
Richard Sandiford [Mon, 11 Nov 2024 12:32:20 +0000 (12:32 +0000)] 
aarch64: Add common subset of SVE2p1 and SME2

This patch handles the SVE2p1 instructions that are shared
with SME2.  This includes the consecutive-register forms of
the 2-register and 4-register loads and stores, but not the
strided-register forms.

gcc/
* config/aarch64/aarch64.h (TARGET_SVE2p1_OR_SME2): New macro.
* config/aarch64/aarch64-early-ra.cc
(is_stride_candidate): Require TARGET_STREAMING_SME2
(early_ra::maybe_convert_to_strided_access): Likewise.
* config/aarch64/aarch64-sve-builtins-sve2.def: Mark instructions
that are common to both SVE2p1 and SME2.
* config/aarch64/aarch64-sve.md
(@aarch64_<sur>dot_prod_lane<SVE_FULL_SDI:mode><SVE_FULL_BHI:mode>):
Test TARGET_SVE2p1_OR_SME2 instead of TARGET_STREAMING_SME2.
(@aarch64_sve_<sve_fp_op>vnx4sf): Move TARGET_SVE_BF16 condition
into SVE_BFLOAT_TERNARY_LONG.
(@aarch64_sve_<sve_fp_op>_lanevnx4sf): Likewise
SVE_BFLOAT_TERNARY_LONG_LANE.
* config/aarch64/aarch64-sve2.md
(@aarch64_<LD1_COUNT:optab><mode>): Require TARGET_SVE2p1_OR_SME2
instead of TARGET_STREAMING_SME2.
(@aarch64_<ST1_COUNT:optab><mode>): Likewise.
(@aarch64_sve_ptrue_c<BHSD_BITS>): Likewise.
(@aarch64_sve_pext<BHSD_BITS>): Likewise.
(@aarch64_sve_pext<BHSD_BITS>x2): Likewise.
(@aarch64_sve_cntp_c<BHSD_BITS>): Likewise.
(@aarch64_sve_fclamp<mode>): Likewise.
(*aarch64_sve_fclamp<mode>_x): Likewise.
(<sur>dot_prodvnx4sivnx8hi): Likewise.
(aarch64_sve_fdotvnx4sfvnx8hf): Likewise.
(aarch64_fdot_prod_lanevnx4sfvnx8hf): Likewise.
(@aarch64_sve_while<while_optab_cmp>_b<BHSD_BITS>_x2): Likewise.
(@aarch64_sve_while<while_optab_cmp>_c<BHSD_BITS>): Likewise.
(@aarch64_sve_<optab><VNx8HI_ONLY:mode><VNx8SI_ONLY:mode>): Move
TARGET_STREAMING_SME2 condition into SVE_QCVTxN.
(@aarch64_sve_<sve_int_op><mode>): Likewise
SVE2_INT_SHIFT_IMM_NARROWxN, but also require TARGET_STREAMING_SME2
for the 4-register forms.
* config/aarch64/iterators.md (SVE_BFLOAT_TERNARY_LONG): Require
TARGET_SVE2p1_OR_SME2 rather than TARGET_STREAMING_SME2 for
UNSPEC_BFMLSLB and UNSPEC_BFMLSLT.  Require TARGET_SVE_BF16
for the others.
(SVE_BFLOAT_TERNARY_LONG_LANE): Likewise.
(SVE2_INT_SHIFT_IMM_NARROWxN): Require TARGET_SVE2p1_OR_SME2 for
the interleaving forms and TARGET_STREAMING_SME2 for the rest.
(SVE_QCVTxN): Likewise.

gcc/testsuite/
* gcc.target/aarch64/sve/clamp_3.c: New test.
* gcc.target/aarch64/sve/clamp_4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/bfmlslb_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/bfmlslb_lane_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/bfmlslt_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/bfmlslt_lane_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/cntp_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/cntp_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/cntp_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/cntp_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dot_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dot_lane_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dot_lane_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dot_lane_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dot_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/dot_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_bf16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_bf16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_f16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_f16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_f32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_f32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_f64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_f64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_s8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ld1_u8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_bf16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_bf16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_f16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_f16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_f32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_f32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_f64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_f64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_s8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1_u8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/pext_lane_c8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ptrue_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ptrue_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ptrue_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ptrue_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/qcvtn_s16_s32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/qcvtn_u16_s32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/qcvtn_u16_u32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/qrshrn_s16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/qrshrn_u16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/qrshrun_u16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_bf16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_bf16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_f16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_f16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_f32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_f32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_f64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_f64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_s8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/st1_u8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_bf16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_bf16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_f16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_f16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_f32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_f32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_f64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_f64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_s8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u16_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u32_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u64_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1_u8_x4.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_b16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_b32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_b64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_b8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilege_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_b16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_b32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_b64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_b8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilegt_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_b16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_b32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_b64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_b8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilele_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_b16_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_b32_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_b64_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_b8_x2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/whilelt_c8.c: Likewise.

9 months agoaarch64: Add common subset of SVE2p1 and SME
Richard Sandiford [Mon, 11 Nov 2024 12:32:20 +0000 (12:32 +0000)] 
aarch64: Add common subset of SVE2p1 and SME

Some instructions that were previously restricted to streaming mode
can also be used in non-streaming mode with SVE2.1.  This patch adds
support for those, as well as the usual new-extension boilerplate.
A later patch will add the feature macro.

gcc/
* config/aarch64/aarch64-option-extensions.def (sve2p1): New extension.
* doc/invoke.texi (sve2p1): Document it.
* config/aarch64/aarch64-sve-builtins-sve2.def: Mark instructions
that are common to both SVE2p1 and SME.
* config/aarch64/aarch64.h (TARGET_SVE2p1): New macro.
(TARGET_SVE2p1_OR_SME): Likewise.
* config/aarch64/aarch64-sve2.md
(@aarch64_sve_psel<BHSD_BITS>): Require TARGET_SVE2p1_OR_SME
instead of TARGET_STREAMING.
(*aarch64_sve_psel<BHSD_BITS>_plus): Likewise.
(@aarch64_sve_<su>clamp<mode>): Likewise.
(*aarch64_sve_<su>clamp<mode>_x): Likewise.
(@aarch64_pred_<optab><mode>): Likewise.
(@cond_<optab><mode>): Likewise.

gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_aarch64_asm_sve2p1_ok): New procedure.
* gcc.target/aarch64/sve/clamp_1.c: New test.
* gcc.target/aarch64/sve/clamp_2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/clamp_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_b16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_b32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_b64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_b8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_c16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_c32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_c64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/psel_lane_c8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/revd_u8.c: Likewise.

9 months agoaarch64: Define arm_neon.h types in arm_sve.h too
Richard Sandiford [Mon, 11 Nov 2024 12:32:19 +0000 (12:32 +0000)] 
aarch64: Define arm_neon.h types in arm_sve.h too

This patch moves the scalar and single-vector Advanced SIMD types
from arm_neon.h into a private header, so that they can be defined
by arm_sve.h as well.  This is needed for the upcoming SVE2.1
hybrid-VLA reductions, which return 128-bit Advanced SIMD vectors.

The approach follows Claudio's patch for FP8.

gcc/
* config.gcc (extra_headers): Add arm_private_neon_types.h.
* config/aarch64/arm_private_neon_types.h: New file, split out
from...
* config/aarch64/arm_neon.h: ...here.
* config/aarch64/arm_sve.h: Include arm_private_neon_types.h

9 months agoaarch64: Add svboolx4_t
Richard Sandiford [Mon, 11 Nov 2024 12:32:18 +0000 (12:32 +0000)] 
aarch64: Add svboolx4_t

This patch adds an svboolx4_t type, to go alongside the existing
svboolx2_t type.  It doesn't require any special ISA support beyond
SVE itself and it currently has no associated instructions.

gcc/
* config/aarch64/aarch64-modes.def (VNx64BI): New mode.
* config/aarch64/aarch64-protos.h
(aarch64_split_double_move): Generalize to...
(aarch64_split_move): ...this.
* config/aarch64/aarch64-sve-builtins-base.def (svcreate4, svget4)
(svset4, svundef4): Add bool variants.
* config/aarch64/aarch64-sve-builtins.cc (handle_arm_sve_h): Add
svboolx4_t.
* config/aarch64/iterators.md (SVE_STRUCT_BI): New mode iterator.
* config/aarch64/aarch64-sve.md (movvnx32bi): Generalize to...
(mov<SVE_STRUCT_BI:mode>): ...this.
* config/aarch64/aarch64.cc
(pure_scalable_type_info::piece::get_rtx): Allow num_prs to be 4.
(aarch64_classify_vector_mode): Handle VNx64BI.
(aarch64_hard_regno_nregs): Likewise.
(aarch64_class_max_nregs): Likewise.
(aarch64_array_mode): Use VNx64BI for arrays of 4 svbool_ts.
(aarch64_split_double_move): Generalize to...
(aarch64_split_move): ...this.
(aarch64_split_128bit_move): Update call accordingly.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general-c/create_5.c: Expect svcreate4
to succeed for svbool_ts.
* gcc.target/aarch64/sve/acle/asm/test_sve_acle.h
(TEST_UNDEF_B): New macro.
* gcc.target/aarch64/sve/acle/asm/create4_1.c: Test _b form.
* gcc.target/aarch64/sve/acle/asm/undef2_1.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/undef4_1.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/get4_b.c: New test.
* gcc.target/aarch64/sve/acle/asm/set4_b.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/svboolx4_1.c: Likewise.

9 months agoaarch64: Sort some SVE2 lists alphabetically
Richard Sandiford [Mon, 11 Nov 2024 12:32:18 +0000 (12:32 +0000)] 
aarch64: Sort some SVE2 lists alphabetically

gcc/
* config/aarch64/aarch64-sve-builtins-sve2.def: Sort entries
alphabetically.
* config/aarch64/aarch64-sve-builtins-sve2.h: Likewise.
* config/aarch64/aarch64-sve-builtins-sve2.cc: Likewise.

9 months agoaarch64: Factor out part of the SVE ext_def class
Richard Sandiford [Mon, 11 Nov 2024 12:32:17 +0000 (12:32 +0000)] 
aarch64: Factor out part of the SVE ext_def class

This patch factors out some of ext_def into a base class,
so that it can be reused for the SVE2.1 svextq intrinsic.

gcc/
* config/aarch64/aarch64-sve-builtins-shapes.cc (ext_base): New base
class, extracted from...
(ext_def): ...here.

9 months agoaarch64: Parameterise SVE pointer type inference
Richard Sandiford [Mon, 11 Nov 2024 12:32:17 +0000 (12:32 +0000)] 
aarch64: Parameterise SVE pointer type inference

All extending gather load intrinsics encode the source type in
their name (e.g. svld1sb for an extending load from signed bytes).
The type of the extension result has to be specified using an
explicit type suffix; it isn't something that can be inferred
from the arguments, since there are multiple valid choices for
the same arguments.

This meant that type inference for gather loads was only needed for
non-extending loads, in which case the pointer target had to be a
32-bit or 64-bit element type.  The gather_scatter_p argument to
function_resolver::infer_pointer_type therefore controlled two things:
how we should react to vector base addresses, and whether we should
require a minimum element size of 32.

The element size restriction doesn't apply to the upcomding SVE2.1
svld1q intrinsic, so this patch adds a separate argument for the minimum
element size requirement.

gcc/
* config/aarch64/aarch64-sve-builtins.h
(function_resolver::target_type_restrictions): New enum.
(function_resolver::infer_pointer_type): Add an extra argument
that specifies what the target type can be.
* config/aarch64/aarch64-sve-builtins.cc
(function_resolver::infer_pointer_type): Likewise.
* config/aarch64/aarch64-sve-builtins-shapes.cc
(load_gather_sv_base::get_target_type_restrictions): New virtual
member function.
(load_gather_sv_base::resolve): Use it.  Update call to
infer_pointer_type.

9 months agoaarch64: Add an abstraction for scatter store type inference
Richard Sandiford [Mon, 11 Nov 2024 12:32:16 +0000 (12:32 +0000)] 
aarch64: Add an abstraction for scatter store type inference

Until now, all data arguments to a scatter store needed to have
32-bit or 64-bit elements.  This isn't true for the upcoming SVE2.1
svst1q scatter intrinsic, so this patch adds an abstraction around the
restriction.

gcc/
* config/aarch64/aarch64-sve-builtins-shapes.cc
(store_scatter_base::infer_vector_type): New virtual member function.
(store_scatter_base::resolve): Use it.

9 months agoaarch64: Add an abstraction for vector base addresses
Richard Sandiford [Mon, 11 Nov 2024 12:32:16 +0000 (12:32 +0000)] 
aarch64: Add an abstraction for vector base addresses

In the upcoming SVE2.1 svld1q and svst1q intrinsics, the relationship
between the base vector and the data vector differs from existing
gather/scatter intrinsics.  This patch adds a new abstraction to
handle the difference.

gcc/
* config/aarch64/aarch64-sve-builtins.h
(function_shape::vector_base_type): New member function.
* config/aarch64/aarch64-sve-builtins.cc
(function_shape::vector_base_type): Likewise.
(function_resolver::resolve_sv_displacement): Use it.
(function_resolver::resolve_gather_address): Likewise.

9 months agoaarch64: Use braces in SVE TBL instructions
Richard Sandiford [Mon, 11 Nov 2024 12:32:15 +0000 (12:32 +0000)] 
aarch64: Use braces in SVE TBL instructions

GCC previously used the older assembly syntax for SVE TBL, with no
braces around the second operand.  This patch switches to the newer,
official syntax, with braces around the operand.

The initial SVE binutils submission supported both syntaxes, so there
should be no issues with backwards compatibility.

gcc/
* config/aarch64/aarch64-sve.md (@aarch64_sve_tbl<mode>): Wrap
the second operand in braces.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/asm/dup_lane_bf16.c: Wrap the second
TBL operand in braces
* gcc.target/aarch64/sve/acle/asm/dup_lane_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_s16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_s32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_s64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_s8.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_u16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_u32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_u64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_lane_u8.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_bf16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_f16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_f32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_f64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_s16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_s32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_s64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_s8.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_u16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_u32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_u64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/tbl_u8.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_6.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_7.c: Likewise.
* gcc.target/aarch64/sve/vec_perm_1.c: Likewise.
* gcc.target/aarch64/sve/vec_perm_const_1.c: Likewise.
* gcc.target/aarch64/sve/vec_perm_const_1_overrun.c: Likewise.
* gcc.target/aarch64/sve/vec_perm_const_single_1.c: Likewise.
* gcc.target/aarch64/sve/vec_perm_single_1.c: Likewise.
* gcc.target/aarch64/sve/uzp1_1.c: Shorten the scan-assembler-nots
to just "\ttbl\".
* gcc.target/aarch64/sve/uzp2_1.c: Likewise.

9 months agoaarch64: Tweak definition of all_data & co
Richard Sandiford [Mon, 11 Nov 2024 12:32:15 +0000 (12:32 +0000)] 
aarch64: Tweak definition of all_data & co

Past extensions to SVE have required new subsets of all_data; the
SVE2.1 patches will add another.  This patch tries to make this more
scalable by defining the multi-size *_data macros to be unions of
single-size *_data macros.

gcc/
* config/aarch64/aarch64-sve-builtins.cc (TYPES_all_data): Redefine
in terms of single-size *_data definitions.
(TYPES_bhs_data, TYPES_hs_data, TYPES_sd_data): Likewise.
(TYPES_b_data, TYPES_h_data, TYPES_s_data): New macros.

9 months agoaarch64: Test TARGET_STREAMING instead of TARGET_STREAMING_SME
Richard Sandiford [Mon, 11 Nov 2024 12:32:14 +0000 (12:32 +0000)] 
aarch64: Test TARGET_STREAMING instead of TARGET_STREAMING_SME

g:ede97598e2c recorded separate ISA requirements for streaming
and non-streaming mode.  The premise there was that AARCH64_FL_SME
should not be included in the streaming mode requirements, since:

(a) an __arm_streaming_compatible function wouldn't be in streaming
    mode if SME wasn't available.

(b) __arm_streaming_compatible functions only allow things that are
    possible in non-streaming mode, so the non-streaming architecture
    is enough to assemble the code, even if +sme isn't enabled.

(c) we reject __arm_streaming if +sme isn't enabled, so don't need
    to test it for individual intrinsics as well.

Later patches lean into this further.

This patch applies the same reasoning to the .md constructs for
base streaming-only SME instructions, guarding them with
TARGET_STREAMING rather than TARGET_STREAMING_SME.

gcc/
* config/aarch64/aarch64.h (TARGET_SME): Expand comment.
(TARGET_STREAMING_SME): Delete.
* config/aarch64/aarch64-sme.md: Use TARGET_STREAMING instead of
TARGET_STREAMING_SME.
* config/aarch64/aarch64-sve2.md: Likewise.

9 months agoaarch64: Make more use of TARGET_STREAMING_SME2
Richard Sandiford [Mon, 11 Nov 2024 12:32:14 +0000 (12:32 +0000)] 
aarch64: Make more use of TARGET_STREAMING_SME2

Some code was checking TARGET_STREAMING and TARGET_SME2 separately,
but we now have a macro to test both at once.

gcc/
* config/aarch64/aarch64-sme.md: Use TARGET_STREAMING_SME2
instead of separate TARGET_STREAMING and TARGET_SME2 tests.
* config/aarch64/aarch64-sve2.md: Likewise.
* config/aarch64/iterators.md: Likewise.

9 months agoAdd push/pop_function_decl
Richard Sandiford [Mon, 11 Nov 2024 12:32:13 +0000 (12:32 +0000)] 
Add push/pop_function_decl

For the aarch64 simd clones patches, it would be useful to be able to
push a function declaration onto the cfun stack, even though it has no
function body associated with it.  That is, we want cfun to be null,
current_function_decl to be the decl itself, and the target and
optimisation flags to reflect the declaration.

This patch adds a push/pop_function_decl pair to do that.

I think the more direct way of doing what I want to do under the
existing interface would have been:

  push_cfun (nullptr);
  invoke_set_current_function_hook (fndecl);
  pop_cfun ();

where invoke_set_current_function_hook would need to become public.
But it seemed safer to use the higher-level routines, since it makes
sure that the target/optimisation changes are synchronised with the
function changes.  In particular, if cfun was null before the
sequence above, the pop_cfun would leave the flags unchanged,
rather than restore them to the state before the push_cfun.

gcc/
* function.h (push_function_decl, pop_function_decl): Declare.
* function.cc (set_function_decl): New function, extracted from...
(set_cfun): ...here.
(push_function_decl): New function, extracted from...
(push_cfun): ...here.
(pop_cfun_1): New function, extracted from...
(pop_cfun): ...here.
(pop_function_decl): New function.

9 months agoFortran: Fix elemental array refs in SELECT TYPE [PR109345]
Paul Thomas [Mon, 11 Nov 2024 12:21:57 +0000 (12:21 +0000)] 
Fortran: Fix elemental array refs in SELECT TYPE [PR109345]

2024-11-10  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/109345
* trans-array.cc (gfc_get_array_span): Unlimited polymorphic
expressions are now treated separately since the span need not
be the same as the element size.

gcc/testsuite/
PR fortran/109345
* gfortran.dg/character_workout_1.f90: Cut trailing whitespace.
* gfortran.dg/pr109345.f90: New test.

9 months agotree-optimization/117510 - fix guard hoisting validity check
Richard Biener [Mon, 11 Nov 2024 08:40:20 +0000 (09:40 +0100)] 
tree-optimization/117510 - fix guard hoisting validity check

For the loop in the testcase we currently fail to hoist the guard
check of the inner loop (m > 0) out of the outer loop because
find_loop_guard checks all blocks of the outer loop for side-effects,
including those that are skipped by the guard.  This usually
is harmless as the guard does not skip any blocks in the outer loop
but in this case store-motion was applied to the inner loop and thus
there's now a skipped store in the outer loop.

The following properly skips blocks that are dominated by the
entry to the skipped region.

PR tree-optimization/117510
* tree-ssa-loop-unswitch.cc (find_loop_guard): Only check
not skipped blocks for side-effects.

* gcc.dg/vect/vect-outer-pr117510.c: New testcase.

9 months agomodula2: Reimplement parameter declaration and checking.
Gaius Mulley [Mon, 11 Nov 2024 11:43:06 +0000 (11:43 +0000)] 
modula2: Reimplement parameter declaration and checking.

This patch improves the parameter declaration by saving all parameter
kinds: proper procedure, definition module procedure and forward
procedures.  This allows error messages to reference any parameter
in the three kinds of procedures.  Variables and their declaration
are also stored.  The expression, assignment and parameter checking
has been improved to highlight any variable or parameter and
its declaration causing a conflict.

gcc/m2/ChangeLog:

* gm2-compiler/M2Base.def (MixTypes): Rename parameters.
(MixTypesDecl): New procedure function.
* gm2-compiler/M2Base.mod (BuildOrdFunctions): Add
DefProcedure parameter to PutFunction.
(BuildTruncFunctions): Ditto.
(BuildFloatFunctions): Ditto.
(BuildIntFunctions): Ditto.
(InitBaseFunctions): Ditto.
(MixTypesDecl): New procedure function.
(MixTypes): Reimplement.
* gm2-compiler/M2Check.mod (checkProcType): Replace
NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(checkProcedureProcType): Ditto.
* gm2-compiler/M2Error.def: Remove unnecessary export qualified list.
* gm2-compiler/M2GCCDeclare.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(DeclareProcedureToGccWholeProgram): Rename son to
Variable.
(DeclareProcedureToGccSeparateProgram): Ditto.
(PrintKind): New procedure.
(PrintProcedureParameters): Ditto.
(PrintProcedureReturnType): Ditto.
(PrintProcedure): Reimplement.
(PrintProcTypeParameters): New procedure.
(PrintProcType): Ditto.
(DeclareProcType): Rename Son to Parameter.
* gm2-compiler/M2GenGCC.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(ErrorMessageDecl): New procedure.
(checkIncorrectMeta): Replace call to MetaErrorT2 with
ErrorMessageDecl.
(ComparisonMixTypes): Add varleft and varright parameters.
Adjust all callers of ComparisonMixTypes.
* gm2-compiler/M2MetaError.def (MetaErrorDecl): New procedure.
* gm2-compiler/M2MetaError.mod (MetaErrorDecl): New procedure.
* gm2-compiler/M2Options.def (SetXCode): Add -fd flag description
to comment.
* gm2-compiler/M2Options.mod (SetXCode): Add -fd flag description
to comment.
* gm2-compiler/M2Quads.mod (CheckBreak): New procedure.
Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(FailParameter): Reimplement using GetVarDeclFullTok.
Generate message for formal parameter, actual parameter and
declaration of actual parameter.
(WarnParameter): Ditto.
(CheckBuildFunction): Reimplement error message using MetaErrorT1.
* gm2-compiler/M2Range.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
* gm2-compiler/M2Scaffold.mod (DeclareScaffoldFunctions): Call
PutProcedureDefined after every procedure declaration.
(DeclareArgEnvParams): Add ProperProcedure parameter to PutParam.
* gm2-compiler/M2Size.mod (MakeSize): Add DefProcedure parameter
to PutFunction.
* gm2-compiler/M2Swig.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
* gm2-compiler/M2SymInit.mod: Ditto.
* gm2-compiler/M2System.mod (InitSystem): Add DefProcedure
parameter to PutFunction.
* gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Reimplement.
(EndBuildProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2Build.bnf (BuildProcedureDefinedByForward):
Remove.
(BuildProcedureDefinedByProper): Ditto.
(ForwardDeclaration): Remove BuildProcedureDefinedByForward.
(BuildNoReturnAttribute): Remove parameter.
* gm2-compiler/P2SymBuild.def (BuildNoReturnAttribute): Remove
parameter.
(BuildProcedureDefinedByForward): Remove.
(BuildProcedureDefinedByProper): Ditto.
* gm2-compiler/P2SymBuild.mod (Import): Remove
AreParametersDefinedInDefinition,
AreParametersDefinedInImplementation,
AreProcedureParametersDefined,
ParametersDefinedInDefinition,
ParametersDefinedInImplementation,
GetProcedureDeclaredDefinition,
GetProcedureDeclaredForward,
GetProcedureDeclaredProper,
GetParametersDefinedByForward,
GetParametersDefinedByProper and
PutProcedureNoReturn.
Add PutProcedureParametersDefined,
GetProcedureParametersDefined,
GetProcedureKindDesc,
GetProcedureDeclaredTok,
GetProcedureKind,
GetReturnTypeTok,
SetReturnOptional,
IsReturnOptional,
PutProcedureNoReturn and
PutProcedureDefined.
(Debug): New procedure.
(P2StartBuildDefModule): Space formatting.
(BuildVariable): Reimplement to record full declaration.
(StartBuildProcedure): Reimplement using token to determine
the kind of procedure.
(BuildProcedureHeading): Ditto.
(BuildFPSection): Ditto.
(BuildVarArgs): Ditto.
(BuildOptArg): Ditto.
(BuildProcedureDefinedByForward): Remove.
(BuildProcedureDefinedByProper): Ditto.
(BuildFormalParameterSection): Reimplement so that the
quad stack is unchanged.
(CheckFormalParameterSection): Ditto.
(RemoveFPParameters): New procedure.
(ParameterError): Reimplement.
(StartBuildFormalParameters): Add annotation.
(ParameterMismatch): Reimplement.
(EndBuildFormalParameters): Reimplement to check against
all procedure kinds.
(GetSourceDesc): Remove.
(GetCurSrcDesc): Ditto.
(GetDeclared): Ditto.
(ReturnTypeMismatch): Reimplement.
(BuildFunction): Ditto.
(BuildOptFunction): Ditto.
(CheckOptFunction): New procedure.
(BuildNoReturnAttribute): Remove parameter and obtain
procedure symbol from quad stack.
(CheckProcedureReturn): New procedure.
* gm2-compiler/P3SymBuild.mod (BuildOptArgInitializer):
Preserve ProcSym tok on the quad stack.
Add Assert.
* gm2-compiler/PCSymBuild.mod (fixupProcedureType): Replace
NoOfParam with NoOfParamAny.
* gm2-compiler/SymbolTable.def (GetNthParam): Add ProcedureKind
parameter.
(PutFunction): Ditto.
(PutOptFunction): Ditto.
(IsReturnOptional): Ditto.
(PutParam): Ditto.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(PutProcedureNoReturn): Ditto.
(IsProcedureNoReturn): Ditto.
(IsVarParam): Ditto.
(IsUnboundedParam): Ditto.
(NoOfParam): Ditto.
(ForeachLocalSymDo): Ditto.
(GetProcedureKind): Ditto.
(GetProcedureDeclaredTok): Ditto.
(PutProcedureDeclaredTok): Ditto.
(GetReturnTypeTok): Ditto.
(PutReturnTypeTok): Ditto.
(PutParametersDefinedByForward): New procedure.
(PutProcedureParametersDefined): Ditto.
(PutProcedureDefined): Ditto.
(GetParametersDefinedByProper): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureDefined): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(PutOptArgInit): Ditto.
(SetReturnOptional): Ditto.
(UsesOptArgAny): Ditto.
(GetProcedureKindDesc): Ditto.
(IsReturnOptionalAny): New procedure function.
(GetNthParamAny): Ditto.
(NoOfParamAny): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(AreParametersDefinedInImplementation): Remove.
(ParametersDefinedInImplementation): Ditto.
(AreParametersDefinedInDefinition): Ditto.
(AreProcedureParametersDefined): Ditto.
(ParametersDefinedInDefinition): Ditto.
(ProcedureParametersDefined): Ditto.
(PutParametersDefinedByProper): Ditto.
(PutProcedureDeclaredForward): Ditto.
(GetParametersDefinedByForward): Ditto.
(GetProcedureParametersDefined): Ditto.
(PushOffset): Ditto.
(PopSize): Ditto.
(PushParamSize): Ditto.
(PushSumOfLocalVarSize): Ditto.
(PushSumOfParamSize): Ditto.
(PopOffset): Ditto.
(PopSumOfParamSize): Ditto.
* gm2-compiler/SymbolTable.mod (MakeProcedure): Reimplement.
(PutProcedureNoReturn): Add ProcedureKind parameter.
(GetNthParam): Ditto.
(PutFunction): Ditto.
(PutOptFunction): Ditto.
(IsReturnOptional): Ditto.
(MakeVariableForParam): Ditto.
(PutParam): Ditto.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(AddParameter): Ditto.
(IsVarParam): Ditto.
(IsVarParamAny): Ditto.
(NoOfParam): Ditto.
(HasVarParameters): Ditto.
(IsUnboundedParam): Ditto.
(PutUseVarArgs): Ditto.
(UsesVarArgs): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(UsesOptArgAny): Ditto.
(PutOptArgInit): Ditto.
(IsProcedure): Ditto.
(IsPointer): Ditto.
(IsRecord): Ditto.
(IsArray): Ditto.
(IsEnumeration): Ditto.
(IsUnbounded): Ditto.
(IsSet): Ditto.
(IsSetPacked): Ditto.
(CheckUnbounded): Ditto.
(IsOAFamily): Ditto.
(IsModuleWithinProcedure): Ditto.
(GetDeclaredDef): Ditto.
(GetDeclaredMod): Ditto.
(GetDeclaredFor): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureKind): Ditto.
(PutProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredTok): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredTok): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetReturnTypeTok): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutReturnTypeTok): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureKindDesc): Ditto.
(IsProcedureVariable): Ditto.
(IsAModula2Type): Ditto.
(GetParam): Ditto.
(ProcedureParametersDefined): Ditto.
(AreParametersDefinedInImplementation): Remove.
(AreParametersDefinedInDefinition): Ditto.
(AreProcedureParametersDefined): Ditto.
(IsSizeSolved): Ditto.
(IsOffsetSolved): Ditto.
(IsValueSolved): Ditto.
(IsSumOfParamSizeSolved): Ditto.
(PushSize): Ditto.
(PushOffset): Ditto.
(PopSize): Ditto.
(PushValue): Ditto.
(PushParamSize): Ditto.
(PushSumOfLocalVarSize): Ditto.
(PushSumOfParamSize): Ditto.
(PushVarSize): Ditto.
(PopValue): Ditto.
(PopSize): Ditto.
(PopOffset): Ditto.
(PopSumOfParamSize): Ditto.
(PutParametersDefinedByForward): New procedure.
(PutProcedureParametersDefined): Ditto.
(PutProcedureDefined): Ditto.
(GetParametersDefinedByProper): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureDefined): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(PutOptArgInit): Ditto.
(SetReturnOptional): Ditto.
(UsesOptArgAny): Ditto.
(GetProcedureKindDesc): Ditto.
(PutParametersDefinedByProper): Ditto.
(GetParametersDefinedByProper): Ditto.
(IsReturnOptionalAny): New procedure function.
(IsProcedureAnyDefaultBoolean): Ditto.
(IsProcedureAnyBoolean): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(GetNthParamAny): Ditto.
(NoOfParamAny): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(GetProcedureKind): Ditto.
(IsVarParamAny): Ditto.
(IsUnboundedParamAny): Ditto.
(ForeachParamSymDo): New comment.
* gm2-libs-coroutines/SYSTEM.mod: Reformat.

gcc/testsuite/ChangeLog:

* gm2/iso/fail/badexpression3.mod: New test.
* gm2/iso/fail/badparam4.def: New test.
* gm2/iso/fail/badparam4.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
9 months agolibgomp/plugin/plugin-gcn.c: Show device number in ISA error message
Tobias Burnus [Mon, 11 Nov 2024 11:17:42 +0000 (12:17 +0100)] 
libgomp/plugin/plugin-gcn.c: Show device number in ISA error message

libgomp/ChangeLog:

* plugin/plugin-gcn.c (isa_matches_agent): Mention the device number
and ROCR_VISIBLE_DEVICES when reporting an ISA mismatch error.

9 months agoRISC-V: Fix one nit indent issue of ustrunc pattern [NFC]
Pan Li [Mon, 11 Nov 2024 07:39:40 +0000 (15:39 +0800)] 
RISC-V: Fix one nit indent issue of ustrunc pattern [NFC]

Just notice the indent is not that right for ustrunc pattern from
the md files.  Thus, make it correct.  It is somehow very obvious
and will commit it after next 48H if no more comments.

gcc/ChangeLog:

* config/riscv/autovec.md: Fix indent format issue.

Signed-off-by: Pan Li <pan2.li@intel.com>
9 months agoFortran: Suppress invalid finalization of artificial variable [PR116388]
Paul Thomas [Mon, 11 Nov 2024 09:01:11 +0000 (09:01 +0000)] 
Fortran: Suppress invalid finalization of artificial variable [PR116388]

2024-11-11  Tomas Trnka  <trnka@scm.com>
    Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/116388
* class.cc (finalize_component): Leading underscore in the name
of 'byte_stride' to suppress invalid finalization.

gcc/testsuite/
PR fortran/116388
* gfortran.dg/finalize_58.f90: New test.

9 months agoReject UNSIGNED for Complex, some documentation fixes.
Thomas Koenig [Sat, 9 Nov 2024 18:24:43 +0000 (19:24 +0100)] 
Reject UNSIGNED for Complex, some documentation fixes.

gcc/fortran/ChangeLog:

* check.cc (gfc_check_complex): Reject UNSIGNED.
* gfortran.texi: Update example program.  Note that
CMPLX, INT and REAL also take unsigned arguments.
* intrinsic.texi (CMPLX): Document UNSIGNED.
(INT): Likewise.
(REAL): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/unsigned_41.f90: New test.

9 months agodoc: install: document UBSAN_OPTIONS
Sam James [Thu, 31 Oct 2024 21:09:32 +0000 (21:09 +0000)] 
doc: install: document UBSAN_OPTIONS

Explain that 'bootstrap-ubsan' won't abort on errors by default and how
to override that by setting UBSAN_OPTIONS.

gcc/ChangeLog:
PR other/116948

* doc/install.texi (Building a native compiler): Document UBSAN_OPTIONS.

9 months agodoc: install: document bootstrap-ubsan
Sam James [Thu, 31 Oct 2024 21:06:13 +0000 (21:06 +0000)] 
doc: install: document bootstrap-ubsan

gcc/ChangeLog:
PR other/116948

* doc/install.texi (Building a native compiler): Mention bootstrap-ubsan.

9 months agoxtensa: Fix the issue in "*extzvsi-1bit_addsubx"
Takayuki 'January June' Suwa [Sun, 10 Nov 2024 06:39:22 +0000 (15:39 +0900)] 
xtensa: Fix the issue in "*extzvsi-1bit_addsubx"

The second source register of insn "*extzvsi-1bit_addsubx" cannot be the
same as the destination register, because that register will be overwritten
with an intermediate value after insn splitting.

     /* example #1 */
     int test1(int b, int a) {
       return ((a & 1024) ? 4 : 0) + b;
     }

     ;; result #1 (incorrect)
     test1:
      extui a2, a3, 10, 1 ;; overwrites A2 before used
      addx4 a2, a2, a2
      ret.n

This patch fixes that.

     ;; result #1 (correct)
     test1:
      extui a3, a3, 10, 1 ;; uses A3 and then overwrites
      addx4 a2, a3, a2
      ret.n

However, it should be noted that the first source register can be the same
as the destination without any problems.

     /* example #2 */
     int test2(int a, int b) {
       return ((a & 1024) ? 4 : 0) + b;
     }

     ;; result (correct)
     test2:
      extui a2, a2, 10, 1 ;; uses A2 and then overwrites
      addx4 a2, a2, a3
      ret.n

gcc/ChangeLog:

* config/xtensa/xtensa.md (*extzvsi-1bit_addsubx):
Add '&' to the destination register constraint to indicate that
it is 'earlyclobber', append '0' to the first source register
constraint to indicate that it can be the same as the destination
register, and change the split condition from 1 to reload_completed
so that the insn will be split only after RA in order to obtain
allocated registers that satisfy the above constraints.

9 months agoInitial Diamond Rapids Support
Haochen Jiang [Mon, 11 Nov 2024 02:48:16 +0000 (10:48 +0800)] 
Initial Diamond Rapids Support

gcc/ChangeLog:

* common/config/i386/cpuinfo.h
(get_intel_cpu): Handle Diamond Rapids.
* common/config/i386/i386-common.cc (processor_name):
Add Diamond Rapids.
(processor_alias_table): Ditto.
* common/config/i386/i386-cpuinfo.h (enum processor_types):
Add INTEL_COREI7_DIAMONDRAPIDS.
* config.gcc: Add -march=diamondrapids.
* config/i386/driver-i386.cc (host_detect_local_cpu): Handle
diamondrapids.
* config/i386/i386-c.cc (ix86_target_macros_internal): Ditto.
* config/i386/i386-options.cc (processor_cost_table): Ditto.
(m_DIAMONDRAPIDS): New.
(m_CORE_AVX512): Add diamondrapids.
* config/i386/i386.h (enum processor_type): Ditto.
* doc/extend.texi: Ditto.
* doc/invoke.texi: Ditto.

gcc/testsuite/ChangeLog:

* g++.target/i386/mv16.C: Ditto.
* gcc.target/i386/funcspec-56.inc: Handle new march.

9 months agoi386: Add new model number for Arrow Lake
Haochen Jiang [Mon, 11 Nov 2024 02:48:14 +0000 (10:48 +0800)] 
i386: Add new model number for Arrow Lake

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_intel_cpu): Add new model
number for Arrow Lake.

9 months agoGuard truncate from vector float to vector __bf16 with !flag_rounding_math && HONOR_N...
liuhongt [Thu, 7 Nov 2024 02:15:42 +0000 (18:15 -0800)] 
Guard truncate from vector float to vector __bf16 with !flag_rounding_math && HONOR_NANS (BFmode).

hw instruction doesn't raise exceptions, turns sNAN into qNAN quietly,
and always round to nearest (even). Output denormals are always
flushed to zero and input denormals are always treated as zero. MXCSR
is not consulted nor updated.
W/o native instructions, flag_unsafe_math_optimizations is needed for
the permutation instructions.
Similar guard extend from vector __bf16 to vector float with
!HONOR_NANS (BFmode).

gcc/ChangeLog:

* config/i386/i386.md (truncsf2bf2): Add !flag_rounding_math
to the condition, require flag_unsafe_math_optimizations when
native instruction is not available.
* config/i386/mmx.md: (truncv2sfv2bf2): Ditto.
(extendv2bfv2sf2): Add !HONOR_NANS (BFmode) to the condition.
* config/i386/sse.md: (truncv4sfv4sf2): Add
!flag_rounding_math to the condition, require
flag_unsafe_math_optimizations when native instruction is not
available.
(truncv8sfv8bf2): Ditto.
(truncv16sfv16bf2): Ditto.
(extendv4bfv4sf2): Add !HONOR_NANS (BFmode) to the condition.
(extendv8bfv8sf2): Ditto.
(extendv16bfv16sf2): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512bf16-truncsfbf.c: Add -ffast-math.
* gcc.target/i386/avx512bw-extendbf2sf.c: Ditto.
* gcc.target/i386/avx512bw-truncsfbf.c: Ditto.
* gcc.target/i386/sse2-extendbf2sf.c: Ditto.
* gcc.target/i386/ssse3-truncsfbf.c: Ditto.

9 months agoDaily bump.
GCC Administrator [Mon, 11 Nov 2024 00:16:44 +0000 (00:16 +0000)] 
Daily bump.

9 months agoDo not cost the permute node that are part of SLP load-lanes
Richard Biener [Fri, 8 Nov 2024 12:25:13 +0000 (13:25 +0100)] 
Do not cost the permute node that are part of SLP load-lanes

There are some SVE testsuite fails when forcing SLP because costing
prevents VLA vectors from being used as we add permute cost for
the VEC_PERM nodes that are part of a SLP load-lanes node.  The
permutes only exist for representational reasons and pessimize SLP
vs non-SLP so the following makes sure to cost them as zero.

* tree-vect-slp.cc (vectorizable_slp_permutation_1): Return
zero for the permute nodes part of load-lanes.

9 months agoAdjust 'libgomp.c/max_vf-*.c'
Thomas Schwinge [Sat, 9 Nov 2024 12:37:53 +0000 (13:37 +0100)] 
Adjust 'libgomp.c/max_vf-*.c'

For configurations where both GCN and nvptx offloading are enabled, we get:

    PASS: libgomp.c/max_vf-1.c (test for excess errors)
    PASS: libgomp.c/max_vf-1.c scan-tree-dump-times ompexp "GOMP_MAX_VF" 2
    PASS: libgomp.c/max_vf-1.c scan-tree-dump-times ompexp "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, D\\.[0-9]*, 0\\);" 1
    PASS: libgomp.c/max_vf-1.c scan-amdgcn-amdhsa-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 64, 0\\);" 1
    FAIL: libgomp.c/max_vf-1.c scan-nvptx-none-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 64, 0\\);" 1
    FAIL: libgomp.c/max_vf-1.c scan-amdgcn-amdhsa-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 7, 0\\);" 1
    PASS: libgomp.c/max_vf-1.c scan-nvptx-none-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 7, 0\\);" 1

Avoid these FAILs via 'only_for_offload_target [...]'.  Also, for consistency
with other libgomp test cases, use effective-target specifiers of the libgomp
test suite.  Fix-up for recent commit d334f729e53867b838e867375b3f475ba793d96e
"openmp: Add testcases for omp_max_vf".

libgomp/
* testsuite/libgomp.c/max_vf-1.c: Adjust.
* testsuite/libgomp.c/max_vf-2.c: Likewise.

9 months agoc++: Fix tree_contains_struct for TRAIT_EXPR
Lewis Hyatt [Sun, 3 Nov 2024 01:59:24 +0000 (21:59 -0400)] 
c++: Fix tree_contains_struct for TRAIT_EXPR

CODE_CONTAINS_STRUCT () currently reports that a TRAIT_EXPR contains a
TS_EXP struct, but it does not actually start with a TS_EXP as an initial
sequence. In modules.cc, when we stream out a tree, we explicitly check for the
TS_EXP case and call note_location(t->exp.locus) if so. Currently, this
actually queries the tree_common::chain field of a tree_trait_expr, which
seems not to be used, returning 0, which is interpreted as UNKNOWN_LOCATION
and does no harm.

If location_t will change to be 64 bytes, as is under discussion, then on
32-bit platforms (well those, such as sparc, on which uint64_t has higher
alignment requirement than a pointer), reading t->exp.locus will end up
reading a different field (tree_trait_expr::type1) due to padding
offsets. That field is not generally 0, and the resulting bogus location_t
is sufficiently problematic to cause an ICE in the line_map code. Pretty
much any modules testcase displays the issue, such as partial-2_a.C.

Resolve by initializing tree_contains_struct with the correct value for
TRAIT_EXPR, namely TS_TYPED.

gcc/cp/ChangeLog:

* cp-objcp-common.cc (cp_common_init_ts): Change TRAIT_EXPR from
TS_EXP to TS_TYPED.

9 months agoDaily bump.
GCC Administrator [Sun, 10 Nov 2024 00:17:04 +0000 (00:17 +0000)] 
Daily bump.

9 months agoDarwin: Support '-ObjC{,++}' as shorthand for -xobjective-c{,++} [PR117478].
Iain Sandoe [Thu, 7 Nov 2024 17:17:46 +0000 (17:17 +0000)] 
Darwin: Support '-ObjC{,++}' as shorthand for -xobjective-c{,++} [PR117478].

This improves compatibility with clang, and is used by some projects.

PR target/117478

gcc/ChangeLog:

* config/darwin-driver.cc (darwin_driver_init): Handle ObjC/ObjC++
* config/darwin.opt: Add ObjC/ObjC++ as driver-only options.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>