Commit graph

206997 commits

Author SHA1 Message Date
Siddhesh Poyarekar
e9f2c6d260 SECURITY.txt: Drop "exploitable" in reference to hardening issues
The "exploitable vulnerability" may lead to a misunderstanding that
missed hardening issues are considered vulnerabilities, just that
they're not exploitable.  This is not true, since while hardening bugs
may be security-relevant, the absence of hardening does not make a
program any more vulnerable to exploits than without.

Drop the "exploitable" word to make it clear that missed hardening is
not considered a vulnerability.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>

ChangeLog:

	* SECURITY.txt: Drop "exploitable" in the hardening section.
2024-01-09 10:49:01 -05:00
Tom Tromey
b7e5a29602 Pass GUILE down to subdirectories
When I enable cgen rebuilding in the binutils-gdb tree, the default is
to run cgen using 'guile'.  However, on my host, guile is guile 2.2,
which doesn't work for me -- I have to use guile3.0.

This patch arranges to pass "GUILE" down to subdirectories, so I can
use 'make GUILE=guile3.0'.

	* Makefile.in: Rebuild.
	* Makefile.tpl (BASE_EXPORTS): Add GUILE.
	(GUILE): New variable.
	* Makefile.def (flags_to_pass): Add GUILE.
2024-01-09 08:02:31 -07:00
Jakub Jelinek
c9fc7f398e c-family: copy attribute diagnostic fixes [PR113262]
The copy attributes is allowed on decls as well as types and even has
checks whether decl (set to *node) is DECL_P or TYPE_P, but for diagnostics
unconditionally uses DECL_SOURCE_LOCATION (decl), which obviously only works
if it applies to a decl.

2024-01-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/113262
	* c-attribs.cc (handle_copy_attribute): Don't use
	DECL_SOURCE_LOCATION (decl) if decl is not DECL_P, use input_location
	instead.  Formatting fixes.

	* gcc.dg/pr113262.c: New test.
2024-01-09 15:37:04 +01:00
Tamar Christina
80bb94e88f middle-end: check if target can do extract first for early breaks [PR113199]
I was generating the vector reverse mask without checking if the target
actually supported such an operation.

This patch changes it to if the bitstart is 0 then use BIT_FIELD_REF instead
to extract the first element since this is supported by all targets.

This is good for now since masks always come from whilelo.  But in the future
when masks can come from other sources we will need the old code back.

gcc/ChangeLog:

	PR tree-optimization/113199
	* tree-vect-loop.cc (vectorizable_live_operation_1): Use
	BIT_FIELD_REF.

gcc/testsuite/ChangeLog:

	PR tree-optimization/113199
	* gcc.target/gcn/pr113199.c: New test.
2024-01-09 13:38:04 +00:00
Gaius Mulley
e3632a18d1 PR modula2/112920 cc1gm2 hangs in the type resolver
This patch contains a fix to gcc/m2/gm2-compiler/M2GCCDeclare.mod.
The fix introduces a group of sets which can be compared.  The resolver
will loop until there is no change in all sets within the group.
Since symbols migrate from set to set without ever looping this
will never hang.  Previously only the number of elements in a set
were compared which resulted in a infinite spin.

gcc/m2/ChangeLog:

	PR modula2/112920
	* gm2-compiler/M2GCCDeclare.mod (Group): New declaration.
	Import MakeSubrange, MakeConstVar, MakeConstLit and DivTrunc.
	(FreeGroup): New declaration.
	(GlobalGroup): New declaration.
	(ToBeSolvedByQuads): Remove.
	(NilTypedArrays): Remove.
	(PartiallyDeclared): Remove.
	(HeldByAlignment): Remove.
	(FinishedAlignment): Remove.
	(ToDoList): Remove.
	(DebugSet): Re-format.
	(DebugNumber): Re-format.
	(DebugSetNumbers): Reference sets using GlobalGroup.
	(AddSymToWatch): Re-format.
	(WatchIncludeList): Reference sets using GlobalGroup.
	(WatchRemoveList): Reference sets using GlobalGroup.
	(NewGroup): New procedure.
	(DisposeGroup): New procedure.
	(InitGroup): New procedure.
	(KillGroup): New procedure.
	(DupGroup): New procedure.
	(EqualGroup): New procedure.
	(LookupSet): New procedure.
	(CanDeclareTypePartially): Reference sets using GlobalGroup.
	(CompletelyResolved): Reference sets using GlobalGroup.
	(IsNilTypedArrays): Reference sets using GlobalGroup.
	(IsFullyDeclared): Reference sets using GlobalGroup.
	(IsPartiallyDeclared): Reference sets using GlobalGroup.
	(IsPartiallyOrFullyDeclared): Reference sets using GlobalGroup.
	(DeclareTypeConstFully): Reference sets using GlobalGroup.
	(bodyl): Remove.
	(Body): Use bodyt and to lookup the required set.
	(ForeachTryDeclare): Remove parameter l.  Lookup set instead.
	(DeclareOutstandingTypes): Add new rules setarraynul and setfully.
	Reference sets using GlobalGroup.
	(ActivateWatch): New procedure.
	(DeclareTypesConstantsProceduresInRange): Re-written to check
	group change.
	(DeclareTypesConstantsProcedures): Re-written to check
	group change.
	(DeclareBoolean): Reference sets using GlobalGroup.
	(DeclarePackedBoolean): Ditto.
	(DeclareDefaultConstants): Ditto.
	(FreeGroup): Initialized.
	(GlobalGroup): Ditto.
	* gm2-compiler/Sets.def (EqualSet): New procedure function.
	Remove export qualified list of identifiers.
	* gm2-compiler/Sets.mod (EqualSet): New procedure function.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-01-09 13:36:44 +00:00
Tamar Christina
dac34a1814 arm: Update early-break tests to accept thumb output too.
The tests I recently added for early break fail in thumb mode
because in thumb mode `cbz/cbnz` exist and so the cmp+branch
is fused.  This updates the testcases to accept either output.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/vect-early-break-cbranch.c: Accept thumb output.
2024-01-09 13:28:08 +00:00
Eric Botcazou
bcf7ebba91 ada: Fix bogus Constraint_Error on allocator for access to array of access type
This occurs because the access element type is not its own TYPE_CANONICAL,
which creates a discrepancy between the aliasing support code, which deals
with types directly, and the middle-end which looks at TYPE_CANONICAL only.

gcc/ada/

	* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use the
	TYPE_CANONICAL of types when it comes to aliasing.
	* gcc-interface/utils.cc (relate_alias_sets): Likewise.
2024-01-09 14:13:32 +01:00
Eric Botcazou
63da219a94 ada: Preliminary cleanup in aliasing support code
This declares an explicit temporary for the fields of the fat pointer type
in gnat_to_gnu_entity and removes the GNU_ prefix of the parameters of the
relate_alias_sets routine for the sake of brevity.  No functional changes.

gcc/ada/

	* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use a
	separate FLD local variable to hold the first field of the fat
	pointer type being built.
	* gcc-interface/gigi.h (relate_alias_sets): Remove GNU_ prefix on
	the first two parameters.
	* gcc-interface/utils.cc (relate_alias_sets): Likewise and adjust.
2024-01-09 14:13:32 +01:00
Viljar Indus
9b7d674fad ada: Do not count comparison of addresses as a modification
In some extended code we generate comparisons between
the Addresses of some variables. This causes those
variables to be considered modified. Whereas in this
particular scenario the variables are just referenced.

gcc/ada/

	* sem_attr.adb: avoid marking a use of the Address attribute
	as a modification of its prefix.
2024-01-09 14:13:32 +01:00
Gary Dismukes
9f6266e0ad ada: Minor change replacing "not Present" tests with "No" tests
Fixing two places flagged by gnatcheck to use "No" instead of "not Present".

gcc/ada/

	* exp_aggr.adb (Expand_Container_Aggregate): Change "not Present"
	tests to tests using "No" (in two places).
2024-01-09 14:13:32 +01:00
Bob Duff
1e2a2daa77 ada: Allow passing private types to generic formal incomplete types
It is legal to pass a private type, or a type with a component whose
type is private, as a generic actual type if the formal is a generic
formal incomplete type. This patch fixes a bug in which the compiler
would give an error in some such cases.

Also misc cleanup.

gcc/ada/

	* sem_ch12.adb (Instantiate_Type): Make the relevant error message
	conditional upon "Ekind (A_Gen_T) /= E_Incomplete_Type". Misc
	cleanup.
2024-01-09 14:13:32 +01:00
Gary Dismukes
8ca25eacaa ada: Excess elements created for indexed aggregates with iterator_specifications
In the case of an indexed aggregate of a container type with both Add_Unnamed
and New_Indexed specified in the Aggregate aspect of the type (such as for
the Vector type in Ada.Containers.Vectors), in cases where a component
association is given by an iterator_specification, the compiler could end
up generating a call to the New_Indexed operation rather than the Empty
operation. For example, in the case of a Vector type, this could result
in allocating a container of the size of the defaulted Capacity formal of
the New_Vector function (with uninitialized components), and elements added
in the aggregate would append to that preallocated Vector. The compiler is
corrected so that the Empty function is called to initialize the implicit
aggregate object, rather than the New_Indexed function.

gcc/ada/

	* exp_aggr.adb (Expand_Container_Aggregate): Add code to determine
	whether the aggregate is an indexed aggregate, setting a flag
	(Is_Indexed_Aggregate), which is tested to have proper separation
	of treatment for the Add_Unnamed
	(for positional aggregates) and New_Indexed (for indexed
	aggregates) cases. In the code generating associations for indexed
	aggregates, remove the code for Expressions cases entirely, since
	the code for indexed aggregates is governed by the presence of
	Component_Associations, and add an assertion that Expressions must
	be Empty. Also, exclude empty aggregates from entering that code.
2024-01-09 14:13:32 +01:00
Eric Botcazou
b4beadb39a ada: Remove unused runtime entity
The compiler has not generated direct attachments for a long time.

gcc/ada/

	* rtsfind.ads (RE_Id): Remove RE_Attach.
	(RE_Unit_Table): Likewise.
	* libgnat/s-finmas.ads (Attach): Delete.
	* libgnat/s-finmas.adb (Attach): Likewise.
2024-01-09 14:13:32 +01:00
Tucker Taft
1e964635b6 ada: Fix limited_with in Check_Scil; allow for <> in pp of aggregate
Check_Scil failed due to not handling a type that came from a package that was
mentioned in a limited-with clause.  Also, an aggregate with an uninitialized
component was not being pretty-printed properly.

gcc/ada/

	* pprint.adb (List_Name): Check for "Box_Present" when displaying
	a list, and emit "<>" if returns True.
	* sem_scil.adb (Check_SCIL_Node): Handle case when the type of a
	parameter is from a package that was mentioned in a limited with
	clause, and make no further checks, since this check routine does
	not have all the logic to check such a usage.
2024-01-09 14:13:31 +01:00
Eric Botcazou
fc48e3b206 ada: Fix internal error on class-wide allocator inside if-expression
The problem is that the freeze node for the class-wide subtype built for the
expression of the allocator escapes from the dependent expression instead of
being stored in its list of actions.

gcc/ada/

	* freeze.adb (Freeze_Expression.Has_Decl_In_List): Deal specifically
	with itypes that are class-wide subtypes.
2024-01-09 14:13:31 +01:00
Eric Botcazou
4784601d72 ada: Add __atomic_store_n binding to System.Atomic_Primitives
This is modeled on the existing binding for __atomic_load_n.

gcc/ada/

	* libgnat/s-atopri.ads (Atomic_Store): New generic procedure.
	(Atomic_Store_8): New instantiated procedure.
	(Atomic_Store_16): Likewise.
	(Atomic_Store_32): Likewise.
	(Atomic_Store_64): Likewise.
	* libgnat/s-atopri__32.ads (Atomic_Store): New generic procedure.
	(Atomic_Store_8): New instantiated procedure.
	(Atomic_Store_16): Likewise.
	(Atomic_Store_32): Likewise.
	* gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Implement the
	support for __atomic_store_n and __sync_bool_compare_and_swap_n.
	* gcc-interface/gigi.h (list_second): New inline function.
2024-01-09 14:13:31 +01:00
Javier Miranda
8f98721093 ada: Cannot requeue to a procedure implemented by an entry
Add missing support for RM 9.5.4(5.6/4): the target of a requeue
statement may be a procedure when its name denotes a renaming of
an entry.

gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Specification): Do not replace
	the type of the formals with its corresponding record in
	init-procs.
	* sem_ch9.adb (Analyze_Requeue): Add missing support to requeue to
	a procedure that denotes a renaming of an entry.
2024-01-09 14:13:31 +01:00
Piotr Trojanek
da75ce88bd ada: Remove side effects depending on the context of subtype declaration
In GNATprove mode the removal of side effects is only needed in certain
syntactic contexts, which include subtype declarations. Now this removal
is limited to genuine subtype declarations and not to itypes coming from
expressions where side effects are not expected.

gcc/ada/

	* exp_util.adb (Possible_Side_Effect_In_SPARK): Refine handling of
	itype declarations.
2024-01-09 14:13:31 +01:00
Piotr Trojanek
9afbf898ce ada: More aggressive inlining of subprogram calls in GNATprove mode
Previously if a subprogram call could not be inlined in GNATprove mode,
then all subsequent calls to the same subprogram were not inlined
either (because a failed attempt to inline clears flag Is_Inlined_Always
and we tested this flag when attempting to inline subsequent calls).

Now a failure in inlining of a particular call does not prevent inlining
of subsequent calls to the same subprogram, except when inlining failed
because the subprogram was detected to be recursive (which clears the
Is_Inlined flag that we now examine).

This change allows more checks to be proved and reduces interactions
between inlining and SPARK legality checks.

gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Specification): Set Is_Inlined
	flag by default in GNATprove mode.
	* sem_res.adb (Resolve_Call): Only look at flag which is cleared
	when inlined subprogram is detected to be recursive.
2024-01-09 14:13:31 +01:00
Piotr Trojanek
00a97303c2 ada: Remove dead detection of recursive inlined subprograms
Inlining of subprogram calls happens in routine Expand_Inlined_Call
which calls Establish_Actual_Mapping_For_Inlined_Call. Both routines
had detection of recursive calls. The detection in the second routine
was dead code.

gcc/ada/

	* inline.adb (Establish_Actual_Mapping_For_Inlined_Call):
	Remove detection of recursive calls.
2024-01-09 14:13:31 +01:00
Piotr Trojanek
31f905391f ada: Remove dead code for GNATprove inlining
Removed code was dead because it could only be executed when
Back_End_Inlining is True and that flag is always false in
GNATprove_Mode.

gcc/ada/

	* inline.adb (Cannot_Inline): Cleanup use of 'Length; remove
	dead code.
2024-01-09 14:13:30 +01:00
Piotr Trojanek
7ebae03696 ada: Fix uses of not Present
Fix style violation reported by GNATcheck.

gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): Use "No".
	* sem_ch8.adb (Find_Direct_Name): Likewise.
2024-01-09 14:13:30 +01:00
Steve Baird
7d4c4a4d21 ada: Fix bug in Sem_Util.Enclosing_Declaration
Fix Sem_Util.Enclosing_Declaration to not return an N_Subprogram_Specification
node. Remove code in various places that was formerly needed to cope with this
misbehavior.

gcc/ada/

	* sem_util.adb (Enclosing_Declaration): Instead of returning a
	subprogram specification node, return its parent (which is
	presumably a subprogram declaration).
	* contracts.adb (Insert_Stable_Property_Check): Remove code
	formerly needed to compensate for incorrect behavior of
	Sem_Util.Enclosing_Declaration.
	* exp_attr.adb (In_Available_Context): Remove code formerly needed
	to compensate for incorrect behavior of
	Sem_Util.Enclosing_Declaration.
	* sem_ch8.adb (Is_Actual_Subp_Of_Inst): Remove code formerly
	needed to compensate for incorrect behavior of
	Sem_Util.Enclosing_Declaration.
2024-01-09 14:13:30 +01:00
Steve Baird
85f0ae3c54 ada: Error compiling Ada 2022 object renaming with no subtype mark
In some cases the compiler would crash or generate spurious errors
compiling a legal object renaming declaration that lacks a subtype mark.
In addition to fixing the immediate problem, change Atree.Copy_Slots
so that attempts to modify either the Empty or the Error nodes
(e.g., by passing one of them as the target in a call to Rewrite)
are ineffective. Cope with the consequences of this.

gcc/ada/

	* sem_ch8.adb (Check_Constrained_Object): Before updating the
	subtype mark of an object renaming declaration by calling Rewrite,
	first check whether the destination of the Rewrite call exists.
	* atree.adb (Copy_Slots): Return without performing any updates if
	Destination equals Empty or Error, or if Source equals Empty. Any
	of those conditions indicates an error case.
	* sem_ch12.adb (Analyze_Formal_Derived_Type): Avoid cascading
	errors.
	* sem_ch3.adb (Analyze_Number_Declaration): In an error case, do
	not pass Error as destination in a call to Rewrite.
	(Find_Type_Of_Subtype_Indic): In an error case, do not pass Error
	or Empty as destination in a call to Rewrite.
2024-01-09 14:13:30 +01:00
Joffrey Huguet
c1ebec3478 ada: Fix precondition in Interfaces.C.Strings
The precondition of both Update procedures in Interfaces.C.Strings were
incorrect. This patch fixes this.

gcc/ada/

	* libgnat/i-cstrin.ads (Update): Fix precondition.
2024-01-09 14:13:30 +01:00
Eric Botcazou
e3da93d988 ada: Remove unreachable code in Resolve_Extension_Aggregate
The only functions using the BIP protocol are now those returning a limited
type: Is_Build_In_Place_Result_Type => Is_Inherently_Limited_Type.

gcc/ada/

	* sem_aggr.adb (Resolve_Extension_Aggregate): Remove the unreachable
	call to Transform_BIP_Assignment as well as the procedure.
2024-01-09 14:13:30 +01:00
Bob Duff
3b9d4258ea ada: Avoid xref on out params of TSS
For an actual passed as an 'in out' parameter of a type support
subprogram such as deep finalize, do not count it as a read
reference of the actual. Clearly these should not count.
Furthermore, counting them causes different warnings in -gnatc
mode compared to normal mode, because the calls only exist in
normal mode, which would disable the warnings. Such warnings now
occur in both modes, instead of just with -gnatc.

gcc/ada/

	* lib-xref.adb (Generate_Reference): Do not count it as a read
	reference if we're calling a TSS.
2024-01-09 14:13:29 +01:00
Piotr Trojanek
bfacdd11d9 ada: Document new SPARK aspect and pragma Always_Terminates
Add description of a recently added SPARK contract.

gcc/ada/

	* doc/gnat_rm/implementation_defined_aspects.rst,
	doc/gnat_rm/implementation_defined_pragmas.rst: Add sections for
	Always_Terminates.
	* gnat-style.texi: Regenerate.
	* gnat_rm.texi: Regenerate.
	* gnat_ugn.texi: Regenerate.
2024-01-09 14:13:29 +01:00
Jakub Jelinek
33b1173361 aarch64: Fix up GC of aarch64_simd_types [PR113270]
The r14-6524 changes created aarch64-builtins.h header and moved
struct aarch64_simd_type_info definition in there.
Unfortunately, the new header wasn't added to target_gtfiles, so the
trees and const char * pointer elements in the aarch64_simd_types
array aren't marked as GC roots anymore.  That breaks e.g. PCH, when
the array elements then can refer to ggc_freed memory instead of the expected
types, but also any other GC collection could free them and further uses would
not work correctly.

Unfortunately, just adding the new header to target_gtfiles doesn't fix this,
because non-static variable definitions marked with GTY(()) aren't considered
by gengtype, it looks in those cases for an extern GTY(()) declaration, and
there was none - the aarch64-builtins.h header contains an extern declaration
without GTY(()).  Adding GTY(()) to that extern declaration doesn't work, because
then gengtype attempts to emit the aarch64_simd_types GC roots in gtype-desc.cc
but the corresponding header isn't included there.

So, the patch instead adds another extern declaration in aarch64-builtins.cc
right before the actual definition, which makes sure the GC roots are registered
correctly in gt-aarch64-builtins.h (where we want them).

2024-01-09  Jakub Jelinek  <jakub@redhat.com>

	PR target/113270
	* config.gcc (aarch64*-*-*): Add aarch64-builtins.h to target_gtfiles.
	* config/aarch64/aarch64-builtins.cc (aarch64_simd_types): Add extern
	GTY(()) declaration before the definition, drop GTY(()) drom the
	definition.
2024-01-09 13:57:23 +01:00
Richard Biener
c22cf7a7a7 tree-optimization/113026 - fix vector epilogue maximum iter bound
The late amendment with a limit based on VF was redundant and wrong
for peeled early exits.  The following moves the adjustment done
when we don't have a skip edge down to the place where the already
existing VF based max iter check is done and removes the amendment.

	PR tree-optimization/113026
	* tree-vect-loop-manip.cc (vect_do_peeling): Remove
	redundant and wrong niter bound setting.  Move niter
	bound adjustment down.
2024-01-09 13:31:20 +01:00
Eric Botcazou
aaa9467618 Fix outdated comment
gcc/ada/
	PR ada/78207
	* libgnat/g-regexp.ads: Fix outdated comment.
2024-01-09 12:54:39 +01:00
Tamar Christina
109f231672 frontend: don't ice with pragma NOVECTOR if loop has no condition [PR113267]
In C you can have loops without a condition, the original version of the patch
was rejecting the use of #pragma GCC novector, however during review it was
changed to not due this with the reason that we didn't want to give a compile
error with such cases.

However because annotations seem to be only be allowed on conditions (unless
I'm mistaken?) the attached example ICEs because there's no condition.

This will have it ignore the pragma instead of ICEing.  I don't know if this is
the best solution,  but as far as I can tell we can't attach the annotation to
anything else.

gcc/c/ChangeLog:

	PR c/113267
	* c-parser.cc (c_parser_for_statement): Skip the pragma is no cond.

gcc/testsuite/ChangeLog:

	PR c/113267
	* gcc.dg/pr113267.c: New test.
2024-01-09 11:19:24 +00:00
Tamar Christina
cbf569486b middle-end: rejects loops with nonlinear inductions and early breaks [PR113163]
We can't support nonlinear inductions other than neg when vectorizing
early breaks and iteration count is known.

For early break we currently require a peeled epilog but in these cases
we can't compute the remaining values.

gcc/ChangeLog:

	PR middle-end/113163
	* tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p):
	Reject non-linear inductions that aren't supported.

gcc/testsuite/ChangeLog:

	PR middle-end/113163
	* gcc.target/gcn/pr113163.c: New test.
2024-01-09 11:16:16 +00:00
Roger Sayle
468cec5363 ARC: Table-driven ashlsi implementation for better code/rtx_costs.
One of the cool features of the H8 backend is its use of tables to select
optimal shift implementations for different CPU variants.  This patch
borrows (plagiarizes) that idiom for SImode left shifts in the ARC backend
(for CPUs without a barrel-shifter).  This provides a convenient mechanism
for both selecting the best implementation strategy (for speed vs. size),
and providing accurate rtx_costs [without duplicating a lot of logic].
Left shift RTX costs are especially important for use in synth_mult.

An example improvement is:

int foo(int x) { return 32768*x; }

which is now generated with -O2 -mcpu=em -mswap as:

foo:	bmsk_s  r0,r0,16
        swap    r0,r0
        j_s.d   [blink]
        ror     r0,r0

where previously the ARC backend would generate a loop:

foo:	mov     lp_count,15
        lp      2f
        add     r0,r0,r0
        nop
2:      # end single insn loop
        j_s     [blink]

2024-01-09  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	* config/arc/arc.cc (arc_shift_alg): New enumerated type for
	left shift implementation strategies.
	(arc_shift_info): Type for each entry of the shift strategy table.
	(arc_shift_context_idx): Return a integer value for each code
	generation context, used as an index
	(arc_ashl_alg): Table indexed by context and shifted bit count.
	(arc_split_ashl): Use the arc_ashl_alg table to select SImode
	left shift implementation.
	(arc_rtx_costs) <case ASHIFT>: Use the arc_ashl_alg table to
	provide accurate costs, when optimizing for speed or size.
2024-01-09 10:23:50 +00:00
Juzhe-Zhong
db584633e6 RISC-V: Fix loop invariant check
As Robin suggested, remove gimple_uid check which is sufficient for our need.

Tested on both RV32/RV64 no regression, ok for trunk ?

gcc/ChangeLog:

	* config/riscv/riscv-vector-costs.cc (loop_invariant_op_p): Fix loop invariant check.
2024-01-09 18:22:14 +08:00
Julian Brown
1413af02d6 OpenMP: lvalue parsing for map/to/from clauses (C++)
This patch supports "lvalue" parsing (or "locator list item type" parsing)
for several OpenMP clause types for C++, as required for OpenMP 5.0
and above.

This version has been rebased -- some things have changed around
template handling recently, e.g. removal of build_non_dependent_expr and
tsubst_copy.  A new potential corner-case issue has shown up regarding
implicit mapping of references to pointer to pointers -- an interaction
with the post-review fixes/rework for the patch here:

  https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638602.html

Which fixed the (new) tests baseptrs-[6789].C.  I've noted that for now in
the patch, and adjusted the baseptrs-[46].C tests slightly to accommodate.

2024-01-08  Julian Brown  <julian@codesourcery.com>

gcc/c-family/
	* c-common.h (c_omp_address_inspector): Remove static from get_origin
	and maybe_unconvert_ref methods.
	* c-omp.cc (c_omp_split_clauses): Support OMP_ARRAY_SECTION.
	(c_omp_address_inspector::map_supported_p): Handle OMP_ARRAY_SECTION.
	(c_omp_address_inspector::get_origin): Avoid dereferencing possibly
	NULL type when processing template decls.
	(c_omp_address_inspector::maybe_unconvert_ref): Likewise.

gcc/cp/
	* constexpr.cc (potential_consant_expression_1): Handle
	OMP_ARRAY_SECTION.
	* cp-tree.h (grok_omp_array_section, build_omp_array_section): Add
	prototypes.
	* decl2.cc (grok_omp_array_section): New function.
	* error.cc (dump_expr): Handle OMP_ARRAY_SECTION.
	* parser.cc (cp_parser_new): Initialize parser->omp_array_section_p.
	(cp_parser_statement_expr): Disallow array sections.
	(cp_parser_postfix_open_square_expression): Support OMP_ARRAY_SECTION
	parsing.
	(cp_parser_parenthesized_expression_list, cp_parser_lambda_expression,
	cp_parser_braced_list): Disallow array sections.
	(cp_parser_omp_var_list_no_open): Remove ALLOW_DEREF parameter, add
	MAP_LVALUE in its place.  Support generalised lvalue parsing for
	OpenMP map, to and from clauses.  Use OMP_ARRAY_SECTION
	code instead of TREE_LIST to represent OpenMP array sections.
	(cp_parser_omp_var_list): Remove ALLOW_DEREF parameter, add MAP_LVALUE.
	Pass to cp_parser_omp_var_list_no_open.
	(cp_parser_oacc_data_clause): Update call to cp_parser_omp_var_list.
	(cp_parser_omp_clause_map): Add sk_omp scope around
	cp_parser_omp_var_list_no_open call.
	* parser.h (cp_parser): Add omp_array_section_p field.
	* pt.cc (tsubst, tsubst_copy, tsubst_omp_clause_decl,
	tsubst_copy_and_build): Add OMP_ARRAY_SECTION support.
	* semantics.cc (handle_omp_array_sections_1, handle_omp_array_sections,
	cp_oacc_check_attachments, finish_omp_clauses): Use OMP_ARRAY_SECTION
	instead of TREE_LIST where appropriate.  Handle more types of map
	expression.
	* typeck.cc (build_omp_array_section): New function.

gcc/
	* gimplify.cc (gimplify_expr): Ensure OMP_ARRAY_SECTION has been
	processed out before gimplification.
	* tree-pretty-print.cc (dump_generic_node): Support OMP_ARRAY_SECTION.
	* tree.def (OMP_ARRAY_SECTION): New tree code.

gcc/testsuite/
	* c-c++-common/gomp/map-6.c: Update expected output.
	* c-c++-common/gomp/target-enter-data-1.c: Update scan test.
	* g++.dg/gomp/array-section-1.C: New test.
	* g++.dg/gomp/array-section-2.C: New test.
	* g++.dg/gomp/bad-array-section-1.C: New test.
	* g++.dg/gomp/bad-array-section-2.C: New test.
	* g++.dg/gomp/bad-array-section-3.C: New test.
	* g++.dg/gomp/bad-array-section-4.C: New test.
	* g++.dg/gomp/bad-array-section-5.C: New test.
	* g++.dg/gomp/bad-array-section-6.C: New test.
	* g++.dg/gomp/bad-array-section-7.C: New test.
	* g++.dg/gomp/bad-array-section-8.C: New test.
	* g++.dg/gomp/bad-array-section-9.C: New test.
	* g++.dg/gomp/bad-array-section-10.C: New test.
	* g++.dg/gomp/bad-array-section-11.C: New test.
	* g++.dg/gomp/has_device_addr-non-lvalue-1.C: New test.
	* g++.dg/gomp/pr67522.C: Update expected output.
	* g++.dg/gomp/ind-base-3.C: New test.
	* g++.dg/gomp/map-assignment-1.C: New test.
	* g++.dg/gomp/map-inc-1.C: New test.
	* g++.dg/gomp/map-lvalue-ref-1.C: New test.
	* g++.dg/gomp/map-ptrmem-1.C: New test.
	* g++.dg/gomp/map-ptrmem-2.C: New test.
	* g++.dg/gomp/map-static-cast-lvalue-1.C: New test.
	* g++.dg/gomp/map-ternary-1.C: New test.
	* g++.dg/gomp/member-array-2.C: New test.

libgomp/
	* testsuite/libgomp.c++/baseptrs-4.C: Remove commented-out cases that
	now work.
	* testsuite/libgomp.c++/baseptrs-6.C: New test.
	* testsuite/libgomp.c++/ind-base-1.C: New test.
	* testsuite/libgomp.c++/ind-base-2.C: New test.
	* testsuite/libgomp.c++/lvalue-tofrom-1.C: New test.
	* testsuite/libgomp.c++/lvalue-tofrom-2.C: New test.
	* testsuite/libgomp.c++/map-comma-1.C: New test.
	* testsuite/libgomp.c++/map-rvalue-ref-1.C: New test.
	* testsuite/libgomp.c++/struct-ref-1.C: New test.
	* testsuite/libgomp.c-c++-common/array-field-1.c: New test.
	* testsuite/libgomp.c-c++-common/array-of-struct-1.c: New test.
	* testsuite/libgomp.c-c++-common/array-of-struct-2.c: New test.
2024-01-09 10:08:18 +00:00
Eric Botcazou
8f80b9f090 Fix internal error on function call returning extension of limited interface
The problem occurs when this function call is the expression of a return in
a function returning the limited interface; in this peculiar case, there is
a mismatch between the callee, which has BIP formals but is not a BIP call,
and the caller, which is a BIP function, that is spotted by an assertion.

This is fixed by restoring the semantics of Is_Build_In_Place_Function_Call,
which returns again true only for calls to BIP functions, introducing the
Is_Function_Call_With_BIP_Formals predicate, which also returns true for
calls to functions with BIP formals that are not BIP functions, and moving
down the assertion in Expand_Simple_Function_Return.

gcc/ada/
	PR ada/112781
	* exp_ch6.ads (Is_Build_In_Place_Function): Adjust description.
	* exp_ch6.adb (Is_True_Build_In_Place_Function_Call): Delete.
	(Is_Function_Call_With_BIP_Formals): New predicate.
	(Is_Build_In_Place_Function_Call): Restore original semantics.
	(Expand_Call_Helper): Adjust conditions guarding the calls to
	Add_Dummy_Build_In_Place_Actuals to above renaming.
	(Expand_N_Extended_Return_Statement): Adjust to above renaming.
	(Expand_Simple_Function_Return): Likewise.  Move the assertion
	to after the transformation into an extended return statement.
	(Make_Build_In_Place_Call_In_Allocator): Remove unreachable code.
	(Make_Build_In_Place_Call_In_Assignment): Likewise.

gcc/testsuite/
	* gnat.dg/bip_prim_func2.adb: New test.
	* gnat.dg/bip_prim_func2_pkg.ads, gnat.dg/bip_prim_func2_pkg.adb:
	New helper package.
2024-01-09 11:06:23 +01:00
Eric Botcazou
436ce7a351 Fix internal error on function call returning extension of limited interface
This is a regression present on the mainline and 13 branch, in the form of a
series of internal errors (3) on a function call returning the extension of
a limited interface.

This is only a partial fix for the first two assertion failures; the third
one is the most problematic and will be dealt with separately.

The first issue is in Instantiate_Type, where we use Base_Type in a specific
case to compute the ancestor of a derived type, which will later trigger the
assertion on line 16960 of sem_ch3.adb since Parent_Base and Generic_Actual
are the same node.  This is changed to use Etype like in other cases around.

The second issue is an unprotected use of Designated_Type on type T in
Analyze_Explicit_Dereference, while another use in an equivalent context
is guarded by Is_Access_Type a few lines above.

gcc/ada
	PR ada/112781
	* sem_ch12.adb (Instantiate_Type): Use Etype instead of Base_Type
	consistently to retrieve the ancestor for a derived type.
	* sem_ch4.adb (Analyze_Explicit_Dereference): Test Is_Access_Type
	consistently before accessing Designated_Type.
2024-01-09 10:49:17 +01:00
Jakub Jelinek
b1d4e5b513 vect: Ensure both NITERSM1 and NITERS are INTEGER_CSTs or neither of them [PR113210]
On the following testcase e.g. on riscv64 or aarch64 (latter with
-O3 -march=armv8-a+sve ) we ICE, because while NITERS is INTEGER_CST,
NITERSM1 is a complex expression like
(short unsigned int) (a.0_1 + 255) + 1 > 256 ? ~(short unsigned int) (a.0_1 + 255) : 0
where a.0_1 is unsigned char.  The condition is never true, so the above
is equivalent to just 0, but only when trying to fold the above with
PLUS_EXPR 1 we manage to simplify it (first
~(short unsigned int) (a.0_1 + 255)
to
-(short unsigned int) (a.0_1 + 255)
and then
(short unsigned int) (a.0_1 + 255) + 1 > 256 ? -(short unsigned int) (a.0_1 + 255) : 1
to
(short unsigned int) (a.0_1 + 255) >= 256 ? -(short unsigned int) (a.0_1 + 255) : 1
and only at this point we fold the condition to be false.

But the vectorizer seems to assume that if NITERS is known (i.e. suitable
INTEGER_CST) then NITERSM1 also is, so the following hack ensures that if
NITERS folds into INTEGER_CST NITERSM1 will be one as well.

2024-01-09  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/113210
	* tree-vect-loop.cc (vect_get_loop_niters): If non-INTEGER_CST
	value in *number_of_iterationsm1 PLUS_EXPR 1 is folded into
	INTEGER_CST, recompute *number_of_iterationsm1 as the INTEGER_CST
	minus 1.

	* gcc.c-torture/compile/pr113210.c: New test.
2024-01-09 10:31:51 +01:00
Eric Botcazou
4d3fd59953 Fix internal error on anonymous access type equality
This is a small regression present on the mainline and 13 branch, in the
form of an internal error in gigi on anonymous access type equality.  We
now need to also accept them for anonymous access types that point to
compatible object subtypes in the language sense.

gcc/ada/
	* gcc-interface/utils2.cc (build_binary_op) <EQ_EXPR>: Relax
	assertion for regular pointer types.

gcc/testsuite/
	* gnat.dg/specs/anon4.ads: New test.
2024-01-09 10:24:57 +01:00
Eric Botcazou
f341417302 Fix segfault during delay slot scheduling pass
This is a small regression present on the mainline and 13 branch, although
the underlying problem has probably been there for ages, in the form of a
segfault during the delay slot scheduling pass, for a function that falls
through to exit without any instruction generated for the end of function.

gcc/
	PR rtl-optimization/113140
	* reorg.cc (fill_slots_from_thread): If we are to branch after the
	last instruction of the function, create an end label.

gcc/testsuite/
	* g++.dg/opt/delay-slot-2.C: New test.
2024-01-09 10:24:57 +01:00
Jakub Jelinek
f2e967e025 libgomp: Use absolute pathname to testsuite/flock [PR113192]
When flock program doesn't exist, libgomp configure attempts to
offer a fallback version using a perl script, but we weren't using
absolute filename to that, so it apparently failed to work correctly.

The following patch arranges for it to get the absolute filename.

Tested by John David in the PR.

2024-01-09  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/113192
	* configure.ac (FLOCK): Use \$(abs_top_srcdir)/testsuite/flock
	rather than $srcdir/testsuite/flock.
	* configure: Regenerated.
2024-01-09 09:54:06 +01:00
Roger Sayle
6a67fdcb3f i386: PR target/112992: Optimize mode for broadcast of constants.
The issue addressed by this patch is that when initializing vectors by
broadcasting integer constants, the compiler has the flexibility to
select the most appropriate vector mode to perform the broadcast, as
long as the resulting vector has an identical bit pattern.
For example, the following constants are all equivalent:
V4SImode {0x01010101, 0x01010101, 0x01010101, 0x01010101 }
V8HImode {0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101 }
V16QImode {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, ... 0x01 }
So instruction sequences that construct any of these can be used to
construct the others (with a suitable cast/SUBREG).

On x86_64, it turns out that broadcasts of SImode constants are preferred,
as DImode constants often require a longer movabs instruction, and
HImode and QImode broadcasts require multiple uops on some architectures.
Hence, SImode is always the equal shortest/fastest implementation.

Examples of this improvement, can be seen in the testsuite.

gcc.target/i386/pr102021.c
Before:
   0:   48 b8 0c 00 0c 00 0c    movabs $0xc000c000c000c,%rax
   7:   00 0c 00
   a:   62 f2 fd 28 7c c0       vpbroadcastq %rax,%ymm0
  10:   c3                      retq

After:
   0:   b8 0c 00 0c 00          mov    $0xc000c,%eax
   5:   62 f2 7d 28 7c c0       vpbroadcastd %eax,%ymm0
   b:   c3                      retq

and
gcc.target/i386/pr90773-17.c:
Before:
   0:   48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 7 <foo+0x7>
   7:   b8 0c 00 00 00          mov    $0xc,%eax
   c:   62 f2 7d 08 7a c0       vpbroadcastb %eax,%xmm0
  12:   62 f1 7f 08 7f 02       vmovdqu8 %xmm0,(%rdx)
  18:   c7 42 0f 0c 0c 0c 0c    movl   $0xc0c0c0c,0xf(%rdx)
  1f:   c3                      retq

After:
   0:   48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 7 <foo+0x7>
   7:   b8 0c 0c 0c 0c          mov    $0xc0c0c0c,%eax
   c:   62 f2 7d 08 7c c0       vpbroadcastd %eax,%xmm0
  12:   62 f1 7f 08 7f 02       vmovdqu8 %xmm0,(%rdx)
  18:   c7 42 0f 0c 0c 0c 0c    movl   $0xc0c0c0c,0xf(%rdx)
  1f:   c3                      retq

where according to Agner Fog's instruction tables broadcastd is slightly
faster on some microarchitectures, for example Knight's Landing.

2024-01-09  Roger Sayle  <roger@nextmovesoftware.com>
	    Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog
	PR target/112992
	* config/i386/i386-expand.cc
	(ix86_convert_const_wide_int_to_broadcast): Allow call to
	ix86_expand_vector_init_duplicate to fail, and return NULL_RTX.
	(ix86_broadcast_from_constant): Revert recent change; Return a
	suitable MEMREF independently of mode/target combinations.
	(ix86_expand_vector_move): Allow ix86_expand_vector_init_duplicate
	to decide whether expansion is possible/preferrable.  Only try
	forcing DImode constants to memory (and trying again) if calling
	ix86_expand_vector_init_duplicate fails with an DImode immediate
	constant.
	(ix86_expand_vector_init_duplicate) <case E_V2DImode>: Try using
	V4SImode for suitable immediate constants.
	<case E_V4DImode>: Try using V8SImode for suitable constants.
	<case E_V4HImode>: Fail for CONST_INT_P, i.e. use constant pool.
	<case E_V2HImode>: Likewise.
	<case E_V8HImode>: For CONST_INT_P try using V4SImode via widen.
	<case E_V16QImode>: For CONT_INT_P try using V8HImode via widen.
	<label widen>: Handle CONT_INTs via simplify_binary_operation.
	Allow recursive calls to ix86_expand_vector_init_duplicate to fail.
	<case E_V16HImode>: For CONST_INT_P try V8SImode via widen.
	<case E_V32QImode>: For CONST_INT_P try V16HImode via widen.
	(ix86_expand_vector_init): Move try using a broadcast for all_same
	with ix86_expand_vector_init_duplicate before using constant pool.

gcc/testsuite/ChangeLog
	* gcc.target/i386/auto-init-8.c: Update test case.
	* gcc.target/i386/avx512f-broadcast-pr87767-1.c: Likewise.
	* gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
	* gcc.target/i386/avx512fp16-13.c: Likewise.
	* gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
	* gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
	* gcc.target/i386/pr100865-1.c: Likewise.
	* gcc.target/i386/pr100865-10a.c: Likewise.
	* gcc.target/i386/pr100865-10b.c: Likewise.
	* gcc.target/i386/pr100865-2.c: Likewise.
	* gcc.target/i386/pr100865-3.c: Likewise.
	* gcc.target/i386/pr100865-4a.c: Likewise.
	* gcc.target/i386/pr100865-4b.c: Likewise.
	* gcc.target/i386/pr100865-5a.c: Likewise.
	* gcc.target/i386/pr100865-5b.c: Likewise.
	* gcc.target/i386/pr100865-9a.c: Likewise.
	* gcc.target/i386/pr100865-9b.c: Likewise.
	* gcc.target/i386/pr102021.c: Likewise.
	* gcc.target/i386/pr90773-17.c: Likewise.
2024-01-09 08:28:42 +00:00
Chung-Ju Wu
43c4f98211 arm: Add Arm Cortex-M52 CPU documentation.
Signed-off-by: Chung-Ju Wu <jasonwucj@gmail.com>

gcc/ChangeLog:

	* doc/invoke.texi (Arm Options): Document Cortex-M52 options.
2024-01-09 14:26:18 +08:00
Chung-Ju Wu
6e249a9ad9 arm: Add support for Arm Cortex-M52 CPU.
This patch adds the -mcpu support for the Arm Cortex-M52 CPU which is
an Armv8.1-M Mainline CPU supporting MVE and PACBTI by default.

-mcpu=cortex-m52 switch by default matches to -march=armv8.1-m.main+pacbti+mve.fp+fp.dp.

The cde feature is supported by specifying +cdecpN (e.g. -mcpu=cortex-m52+cdecp<N>),
where N is the coprocessor number 0 to 7.

Also following options are provided to disable default features.
+nomve.fp (disables MVE Floating point)
+nomve (disables MVE Integer and MVE Floating point)
+nodsp (disables dsp, MVE Integer and MVE Floating point)
+nopacbti (disables pacbti)
+nofp (disables floating point and MVE floating point)

Signed-off-by: Chung-Ju Wu <jasonwucj@gmail.com>

gcc/ChangeLog:

	* config/arm/arm-cpus.in (cortex-m52): New cpu.
	* config/arm/arm-tables.opt: Regenerate.
	* config/arm/arm-tune.md: Regenerate.
2024-01-09 14:26:18 +08:00
Haochen Jiang
ab6224dfe1 i386: Fix recent testcase fail
After commit 01f4251b87, early break
vectorization is supported. The two testcases need to be fixed.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-xorsign-1.c: Fix testcase.
	* gcc.target/i386/part-vect-absneghf.c: Ditto.
2024-01-09 13:47:51 +08:00
Jiahao Xu
34d339bbd0 LoongArch: Implement vec_init<M><N> where N is a LSX vector mode
This patch implements more vec_init optabs that can handle two LSX vectors producing a LASX
vector by concatenating them. When an lsx vector is concatenated with an LSX const_vector of
zeroes, the vec_concatz pattern can be used effectively. For example as below

typedef short v8hi __attribute__ ((vector_size (16)));
typedef short v16hi __attribute__ ((vector_size (32)));
v8hi a, b;

v16hi vec_initv16hiv8hi ()
{
 return __builtin_shufflevector (a, b, 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15);
}

Before this patch:

vec_initv16hiv8hi:
    addi.d  $r3,$r3,-64
    .cfi_def_cfa_offset 64
    xvrepli.h   $xr0,0
    la.local    $r12,.LANCHOR0
    xvst    $xr0,$r3,0
    xvst    $xr0,$r3,32
    vld $vr0,$r12,0
    vst $vr0,$r3,0
    vld $vr0,$r12,16
    vst $vr0,$r3,32
    xvld    $xr1,$r3,32
    xvld    $xr2,$r3,32
    xvld    $xr0,$r3,0
    xvilvh.h    $xr0,$xr1,$xr0
    xvld    $xr1,$r3,0
    xvilvl.h    $xr1,$xr2,$xr1
    addi.d  $r3,$r3,64
    .cfi_def_cfa_offset 0
    xvpermi.q   $xr0,$xr1,32
    jr  $r1

After this patch:

vec_initv16hiv8hi:
    la.local        $r12,.LANCHOR0
    vld     $vr0,$r12,32
    vld     $vr2,$r12,48
    xvilvh.h        $xr1,$xr2,$xr0
    xvilvl.h        $xr0,$xr2,$xr0
    xvpermi.q       $xr1,$xr0,32
    xvst    $xr1,$r4,0
    jr      $r1

gcc/ChangeLog:

	* config/loongarch/lasx.md (vec_initv32qiv16qi): Rename to ..
	(vec_init<mode><lasxhalf>): .. this, and extend to mode.
	(@vec_concatz<mode>): New insn pattern.
	* config/loongarch/loongarch.cc (loongarch_expand_vector_group_init):
	Handle VALS containing two vectors.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/lasx/lasx-vec-init-2.c: New test.
2024-01-09 12:00:32 +08:00
Juzhe-Zhong
2e4607666c RISC-V: Fix comments of segment load/store intrinsic [NFC]
We have supported segment load/store intrinsics.

Committed as it is obvious.

gcc/ChangeLog:

	* config/riscv/riscv-vector-builtins-functions.def (vleff): Move comments.
	(vundefined): Ditto.
2024-01-09 10:15:26 +08:00
Feng Wang
411b210797 RISC-V: Add crypto vector api-testing cases.
Patch v8: Resubmit after fix the rtl-checking issue. Passed all the riscv regression test.
Patch v7: Add newline at the end of file.
Patch v6: Move intrinsic tests into rvv/base.
Patch v5: Rebase
Patch v4: Add some RV32 vx constraint testcase.
Patch v3: Refine crypto vector api-testing cases.
Patch v2: Update march info according to the change of riscv-common.c

This patch add crypto vector api-testing cases based on
https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/eopc/vector-crypto/auto-generated/vector-crypto
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/zvbb-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvbb_vandn_vx_constraint.c: New test.
	* gcc.target/riscv/rvv/base/zvbc-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvbc_vx_constraint-1.c: New test.
	* gcc.target/riscv/rvv/base/zvbc_vx_constraint-2.c: New test.
	* gcc.target/riscv/rvv/base/zvkg-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvkned-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvknha-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvknhb-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvksed-intrinsic.c: New test.
	* gcc.target/riscv/rvv/base/zvksh-intrinsic.c: New test.
	* gcc.target/riscv/zvkb.c: New test.
2024-01-09 01:37:38 +00:00
Feng Wang
e50a1ed3d3 RISC-V: Add crypto vector builtin function.
This patch add the intrinsic funtions of crypto vector based on the
intrinsic doc(https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob
/eopc/vector-crypto/auto-generated/vector-crypto/intrinsic_funcs.md).

Co-Authored by: Songhe Zhu <zhusonghe@eswincomputing.com>
Co-Authored by: Ciyan Pan <panciyan@eswincomputing.com>
gcc/ChangeLog:

	* config/riscv/riscv-vector-builtins-bases.cc (class vandn):
				Add new function_base for crypto vector.
	(class bitmanip): Ditto.
	(class b_reverse):Ditto.
	(class vwsll):   Ditto.
	(class clmul):   Ditto.
	(class vg_nhab):  Ditto.
	(class crypto_vv):Ditto.
	(class crypto_vi):Ditto.
	(class vaeskf2_vsm3c):Ditto.
	(class vsm3me): Ditto.
	(BASE): Add BASE declaration for crypto vector.
	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
	* config/riscv/riscv-vector-builtins-functions.def (REQUIRED_EXTENSIONS):
				Add crypto vector intrinsic definition.
	(vbrev): Ditto.
	(vclz): Ditto.
	(vctz): Ditto.
	(vwsll): Ditto.
	(vandn): Ditto.
	(vbrev8): Ditto.
	(vrev8): Ditto.
	(vrol): Ditto.
	(vror): Ditto.
	(vclmul): Ditto.
	(vclmulh): Ditto.
	(vghsh): Ditto.
	(vgmul): Ditto.
	(vaesef): Ditto.
	(vaesem): Ditto.
	(vaesdf): Ditto.
	(vaesdm): Ditto.
	(vaesz): Ditto.
	(vaeskf1): Ditto.
	(vaeskf2): Ditto.
	(vsha2ms): Ditto.
	(vsha2ch): Ditto.
	(vsha2cl): Ditto.
	(vsm4k): Ditto.
	(vsm4r): Ditto.
	(vsm3me): Ditto.
	(vsm3c): Ditto.
	* config/riscv/riscv-vector-builtins-shapes.cc (struct crypto_vv_def):
				Add new function_shape for crypto vector.
	(struct crypto_vi_def): Ditto.
	(struct crypto_vv_no_op_type_def): Ditto.
	(SHAPE): Add SHAPE declaration of crypto vector.
	* config/riscv/riscv-vector-builtins-shapes.h: Ditto.
	* config/riscv/riscv-vector-builtins-types.def (DEF_RVV_CRYPTO_SEW32_OPS):
				Add new data type for crypto vector.
	(DEF_RVV_CRYPTO_SEW64_OPS): Ditto.
	(vuint32mf2_t): Ditto.
	(vuint32m1_t): Ditto.
	(vuint32m2_t): Ditto.
	(vuint32m4_t): Ditto.
	(vuint32m8_t): Ditto.
	(vuint64m1_t): Ditto.
	(vuint64m2_t): Ditto.
	(vuint64m4_t): Ditto.
	(vuint64m8_t): Ditto.
	* config/riscv/riscv-vector-builtins.cc (DEF_RVV_CRYPTO_SEW32_OPS):
				Add new data struct for crypto vector.
	(DEF_RVV_CRYPTO_SEW64_OPS): Ditto.
	(registered_function::overloaded_hash): Processing size_t uimm for C overloaded func.
	* config/riscv/riscv-vector-builtins.def (vi): Add vi OP_TYPE.
2024-01-09 01:03:03 +00:00