Commit graph

205646 commits

Author SHA1 Message Date
Thomas Schwinge
878a860cae Fix 'gcc.dg/tree-ssa/return-value-range-1.c'
... added in recent commit 53ba8d6695
"inter-procedural value range propagation".

	gcc/testsuite/
	* gcc.dg/tree-ssa/return-value-range-1.c: Fix.
2023-11-21 13:30:34 +01:00
Sebastian Huber
41aacdea55 gcov: Fix integer types in gen_counter_update()
This change fixes issues like this:

  gcc.dg/gomp/pr27573.c: In function ‘main._omp_fn.0’:
  gcc.dg/gomp/pr27573.c:19:1: error: non-trivial conversion in ‘ssa_name’
     19 | }
        | ^
  long int
  long unsigned int
  # .MEM_19 = VDEF <.MEM_18>
  __gcov7.main._omp_fn.0[0] = PROF_time_profile_12;
  during IPA pass: profile
  gcc.dg/gomp/pr27573.c:19:1: internal compiler error: verify_gimple failed

gcc/ChangeLog:

	PR middle-end/112634

	* tree-profile.cc (gen_assign_counter_update): Cast the unsigned result type of
	__atomic_add_fetch() to the signed counter type.
	(gen_counter_update): Fix formatting.
2023-11-21 11:42:50 +01:00
Eric Botcazou
4649c07940 ada: Fix miscompilation of loop over boolean range
The optimized form generated in this case turns out to be problematic.

gcc/ada/

	* gcc-interface/trans.cc (Loop_Statement_to_gnu): Always use the
	simpler form for a loop with a boolean iteration variable.
2023-11-21 10:57:43 +01:00
Eric Botcazou
4d011701c0 ada: Fix issue with indefinite vector of overaligned unconstrained array
The problem is that the aligning machinery is not consistently triggered,
depending on whether a constrained view or the nominal unconstrained view
of the element type is used to perform the allocations and deallocations.

gcc/ada/

	* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>: Put
	the alignment directly on the type in the constrained case too.
	* gcc-interface/utils.cc (maybe_pad_type): For an array type, take
	the alignment of the element type as the original alignment.
2023-11-21 10:57:43 +01:00
Gary Dismukes
1f61f81d6c ada: Compiler crash on container aggregate with loop_parameter_specifications
The compiler crashes on a container aggregate with more than one
iterated_element_association given by a loop_parameter_specification.
In such a case, the tree contains N_Iterated_Component_Association
nodes rather than N_Iterated_Element_Association nodes, and the code
for handling those needs to obtain the bounds from the Discrete_Choices
field of each N_Iterated_Component_Association rather than assuming
that the association has a normal list of choices.

gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): In the case where Comp
	is an N_Iterated_Component_Association, pick up Discrete_Choices rather
	than Choices.
2023-11-21 10:57:43 +01:00
Eric Botcazou
5a6dbb34c5 ada: Another couple of cleanups in the finalization machinery
For package specs and bodies that need finalizers, Build_Finalizer is
invoked from the Standard scope so it needs to adjust the scope stack
before creating new objects; this changes it to do so only once.

For other kinds of scopes, it is invoked from Expand_Cleanup_Actions,
which assumes that the correct scope is already on the stack; that's
why Cleanup_Scopes adjusts the scope stack explicitly, but it should
use Pop_Scope instead of End_Scope to do it.

gcc/ada/

	* exp_ch7.adb (Build_Finalizer): For package specs and bodies, push
	and pop the specs onto the scope stack only once.
	* inline.adb (Cleanup_Scopes): Call Pop_Scope instead of End_Scope.
2023-11-21 10:57:43 +01:00
Steve Baird
87517ca34e ada: Deep delta aggregates in postconditions
Fix a bug in handling array-valued deep delta aggregates occurring in
postconditions. The bug could result in a spurious compilation failure.

gcc/ada/

	* sem_aggr.adb (Resolve_Delta_Array_Aggregate): In the case of a
	deep delta choice, the expected type for the expression will
	typically not be the component type of the array type, so a call
	to Analyze_And_Resolve that assumes otherwise would be an error.
	It turns out that such a call, while wrong, is usually harmless
	because the expression has already been marked as analyzed. This
	doesn't work if the aggregate occurs in a postcondition and, in
	any case, we don't want to rely on this. So do not perform the
	call in the deep case.
2023-11-21 10:57:42 +01:00
Eric Botcazou
3bf92fe3f2 ada: Small consistency fix for -gnatwv warning
The goal is to arrange for the warning to be issued consistently between
objects whose address is taken and objects whose address is not taken.

gcc/ada/

	* sem_warn.adb (Check_References.Type_OK_For_No_Value_Assigned):
	New predicate.
	(Check_References): For Warn_On_No_Value_Assigned, use the same test
	on the type in the address-not-taken and default cases.

gcc/testsuite/ChangeLog:

	* gnat.dg/warn25.adb: Add xfail.
2023-11-21 10:57:42 +01:00
Gary Dismukes
ea60a4cd19 ada: Compiler error reporting illegal prefix on legal loop iterator with "in"
During semantic analysis, the compiler fails to determine the cursor type
in the case of a generalized iterator loop with "in", in the case where the
iterator type has a parent type that is a controlled type (for example) and
its ancestor iterator interface type is given after as a progenitor. It also
improperly determines the ancestor interface type during expansion (within
Expand_Iterator_Loop_Over_Container), for both "in" and "of" iterator forms.
The FE was assuming that the iterator interface is simply the parent type
of the iterator type, but that type can occur later in the interface list,
or be inherited. A new function is added that properly locates a type's
iterator interface ancestor, if any, and is called for analysis and expansion.

gcc/ada/

	* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Retrieve the
	iteration type's iteration interface progenitor via
	Iterator_Interface_Ancestor, in the case of both "in" and "of"
	iterators. Narrow the scope of Pack, so it's declared and
	initialized only within the code related to "of" iterators, and
	change its name to Cont_Type_Pack. Adjust comments.
	* sem_ch5.adb (Get_Cursor_Type): In the case of a derived type,
	retrieve the iteration type's iterator interface progenitor (if it
	exists) via Iterator_Interface_Ancestor rather than assuming that
	the parent type is the interface progenitor.
	* sem_util.ads (Iterator_Interface_Ancestor): New function.
	* sem_util.adb (Iterator_Interface_Ancestor): New function
	returning a type's associated iterator interface type, if any, by
	collecting and traversing the type's interfaces.
2023-11-21 10:57:42 +01:00
Eric Botcazou
35510341fc ada: Fix internal error on 'Address of task component
This happens when the prefix of the selected component is of an access type,
i.e. there is an implicit dereference. because the prefix is not resolved.

gcc/ada/

	* sem_attr.adb (Resolve_Attribute) <Attribute_Address>: Remove the
	bypass for prefixes with task type.
2023-11-21 10:57:42 +01:00
Viljar Indus
3827a01766 ada: Avoid Style_Checks pragmas affecting other units
gcc/ada/

	* par.adb: Restore Style_Checks after parsing each unit.
2023-11-21 10:57:42 +01:00
Yannick Moy
2d8dc17101 ada: Fix type for SPARK expansion on deep delta aggregates
gcc/ada/

	* exp_spark.adb (Expand_SPARK_Delta_Or_Aggregate): Fix type.
2023-11-21 10:57:42 +01:00
Eric Botcazou
706535a9a2 ada: Further cleanup in finalization machinery
The bodies of generic units are instantiated separately by GNAT at the end
of the processing of the compilation unit.  This requires the deferral of
the generation of cleanups and finalization actions in enclosing scopes,
except for instantiations in generic units where they are not generated.

The criterion used to detect this latter case is Inside_A_Generic, but this
global variable is not properly updated during the instantiation of generic
bodies, leading to problems with nested instantiations, so it is changed to
Expander_Active instead.  As a matter of fact, the exact same idiom is used
a few lines above to clear the Needs_Body variable.

gcc/ada/

	* sem_ch12.adb (Analyze_Package_Instantiation): Test Expander_Active
	to detect generic contexts for the generation of cleanup actions.
2023-11-21 10:57:42 +01:00
Justin Squirek
5c7854b28f ada: Fix string indexing within GNAT.Calendar.Time_IO.Value
The patch fixes an issue in the compiler whereby calls to
GNAT.Calendar.Time_IO.Value where the actual for formal String Date with
indexing starting at any value besides one would result in a spurious runtime
exception.

gcc/ada/

	* libgnat/g-catiio.adb (Value): Modify conditionals to use 'Last
	instead of 'Length
2023-11-21 10:57:42 +01:00
Eric Botcazou
5ee80f7128 ada: Small improvement to Null_Status function
The function is used to optimize away access checks.

gcc/ada/

	* sem_util.adb (Null_Status): Deal with unchecked type conversions.
2023-11-21 10:57:41 +01:00
Eric Botcazou
6f69104c9e ada: Further cleanup in finalization machinery
This removes the specific treatment of transient scopes in initialization
procedures, which is obsolete.

gcc/ada/

	* exp_aggr.adb (Convert_To_Assignments): Do not treat initialization
	procedures specially when it comes to creating a transient scope.
	* exp_ch7.adb (Build_Finalizer.Process_Declarations): Likewise.
	* exp_util.adb (Requires_Cleanup_Actions): Likewise.
2023-11-21 10:57:41 +01:00
Doug Rupp
fee97b366b ada: Use CLOCK_MONOTONIC on VxWorks
The monotonic clock keeps track of the time that has elapsed since
system startup; that is, the value returned by clock_gettime() is the
amount of time (in seconds and nanoseconds) that has passed since the
system booted. The monotonic clock cannot be reset. As a result,
time interval measurements made relative to the monotonic clock are
not subject to errors resulting from the clock time being unexpectedly
adjusted between the interval start and end.

gcc/ada/

	* s-oscons-tmplt.c: #define CLOCK_RT_Ada "CLOCK_MONOTONIC" for
	__vxworks
2023-11-21 10:57:41 +01:00
Steve Baird
d75ca8a67e ada: Deep delta aggregates cleanup.
Cleanup after the introduction of deep delta aggregates.
Eliminate a new gnatcheck message.

gcc/ada/

	* sem_aggr.adb: Replace "not Present (...)" call with "No (...)" call.
2023-11-21 10:57:41 +01:00
Eric Botcazou
d9481c5dc0 ada: Small cleanup in finalization machinery
This removes an obsolete flag and adjusts a couple of obsolete comments.

gcc/ada/

	* gen_il-fields.ads (Opt_Field_Enum): Remove Is_Finalization_Wrapper
	* gen_il-gen-gen_nodes.adb (N_Block_Statement): Likewise.
	* sinfo.ads (Is_Finalization_Wrapper): Delete.
	* exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust comment
	and remove obsolete code testing the Is_Finalization_Wrapper flag.
	* exp_util.adb (Requires_Cleanup_Actions): Likewise.
2023-11-21 10:57:41 +01:00
Doug Rupp
d325c129d1 ada: Runtime recompilation instructions improvements.
Revise instructions to work on both cross and native targets hosted
on Linux

gcc/ada/

	* libgnat/libada.gpr: Revise section 1
2023-11-21 10:57:41 +01:00
Steve Baird
0191a24e2b ada: Deep delta aggregates
Add support for "deep" delta aggregates, a GNAT-defined language extension
conditionally enabled via the -gnatX0 switch. In a deep delta aggregate, a
delta choice may specify a subcomponent (as opposed to just a component).

gcc/ada/

	* par.adb: Add new Boolean variable Inside_Delta_Aggregate.
	* par-ch4.adb (P_Simple_Expression): Add support for a deep delta
	aggregate choice. We turn a sequence of selectors into a peculiar
	tree. We build a component (Indexed or Selected) whose prefix is
	another such component, etc. The leftmost prefix at the bottom of
	the tree has a "name" which is the first selector, without any
	further prefix. For something like "with delta (1)(2) => 3" where
	the type of the aggregate is an array of arrays of integers, we'll
	build an N_Indexed_Component whose prefix is an integer literal 1.
	This is consistent with the trees built for "regular"
	(Ada-defined) delta aggregates.
	* sem_aggr.adb (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice):
	New queries.
	(Resolve_Deep_Delta_Assoc): new procedure.
	(Resolve_Delta_Array_Aggregate): call Resolve_Deep_Delta_Assoc in
	deep case.
	(Resolve_Delta_Record_Aggregate): call Resolve_Deep_Delta_Assoc in
	deep case.
	(Get_Component_Type): new function replaces old Get_Component
	function.
	* sem_aggr.ads (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice):
	New queries.
	* exp_aggr.adb (Expand_Delta_Array_Aggregate): add nested function
	Make_Array_Delta_Assignment_LHS; call it instead of
	Make_Indexed_Component.
	(Expand_Delta_Record_Aggregate): add nested function
	Make_Record_Delta_Assignment_LHS; call it instead of
	Make_Selected_Component.
	* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Insert range
	checks for indexes in deep delta aggregates.
2023-11-21 10:57:41 +01:00
Ronan Desplanques
a5fbba52e9 ada: Fix Ada.Text_IO.Delete with "encoding=8bits" form
Before this patch, on Windows, file with non-ASCII Latin1 names could be created
with Ada.Text_IO.Create by passing "encoding=8bits" through the Form
parameter and a Latin1-encoded string through the Name parameter,
but calling Ada.Text_IO.Delete on them raised an illegitimate exception.

This patch fixes this by making the wrappers of the unlink system function
aware of the encoding value passed through the Form parameter. It also
removes an unnecessary curly-brace block.

gcc/ada/

	* adaint.c (__gnat_unlink): Add new parameter and fix text
	conversion on Windows. Remove unnecessary curly braces.
	* adaint.h (__gnat_unlink): Add new parameter.
	* libgnat/i-cstrea.ads (unlink): Adapt to __gnat_unlink signature
	change.
	* libgnat/i-cstrea.adb (unlink): New Subprogram definition.
	* libgnat/s-crtl.ads (unlink): Adapt to __gnat_unlink signature
	change.
	* libgnat/s-fileio.adb (Delete): Pass encoding argument to unlink.
2023-11-21 10:57:40 +01:00
Eric Botcazou
50e0095904 ada: Fix spurious error on call with default parameter in generic package
This occurs when the default value is a function call returning a private
type, and is caused by a bad interaction between two internal mechanisms.

gcc/ada/

	* sem_ch12.adb (Save_Global_References.Set_Global_Type): Beef up
	comment about the setting of the full view.
	* sem_res.adb (Resolve_Actuals.Insert_Default): Add another bypass
	for the case of a generic context.
2023-11-21 10:57:40 +01:00
Marc Poulhiès
c6cd629ffb ada: Fix misplaced index directive in documentation
The index directive must be located before the indexed element, at least
for the generated texinfo to be correct. See:

https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-index

This was reported along with changes done in https://inbox.sourceware.org/gcc-patches/20230223102714.3606058-3-arsen@aarsen.me/

gcc/ada/

	* doc/gnat_ugn/the_gnat_compilation_model.rst: Move index
	directives.
	* gnat_ugn.texi: Regenerate.
2023-11-21 10:57:40 +01:00
Pierre-Marie de Rodat
fee5b64357 ada: Fix SCOs generation for aspect specifications
The recent overhaul for the representation of aspect specifications in
the tree broke SCOs generation: decisions that appeared in aspects were
processed twice, leading to the emission of erroneous obligations. Tweak
SCOs generation to skip aspect specifications the second time to go back
to the previous behavior.

gcc/ada/

	* par_sco.adb (Process_Decisions)<Process_Node>: Skip aspect
	specifications.
2023-11-21 10:57:40 +01:00
Ronan Desplanques
4b7d0f22b1 ada: Always use -gnatg in run-time GPR files
This patch makes it so -gnatg is always passed to the compiler when
rebuilding the run-time library with the dedicated GPR files. Before
this patch, if a user rebuilt the run-time with -XADAFLAGS=XXX where
XXX didn't include "-gnatg", the build would immediately fail. This
case occurs when following the instructions in libada.gpr, which
use '-XADAFLAGS="-gnatn"'.

gcc/ada/

	* libgnat/libgnat_common.gpr: Unconditionally pass -gnatg.
2023-11-21 10:57:40 +01:00
Marc Poulhiès
20585dc92e ada: Trivial typo fix in comment
gcc/ada/

	* exp_util.ads: Typo fix.
2023-11-21 10:57:40 +01:00
Jakub Jelinek
69813540e3 gcov: Formatting fixes
I've noticed the r14-5579 commit introduced some formatting issues,
this patch fixes what I saw.

2023-11-21  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree-profile.cc (gen_counter_update, tree_profiling): Formatting
	fixes.
libgcc/
	* libgcov.h (GCOV_SUPPORTS_ATOMIC): Formatting fixes.
2023-11-21 10:49:51 +01:00
Jakub Jelinek
1fcfd224ff testsuite: Fix up pr111309-2.c on arm [PR111309]
ARM defaults to -fshort-enums and the following testcase FAILs there in 2
lines.  The difference is that in C++, E0 has enum E type, which normally
has unsigned int underlying type, so it isn't int nor something that
promotes to int, which is why we diagnose it (in C it is promoted to int).
But with -fshort-enums, the underlying type is unsigned char in that case,
which promotes to int just fine.

The following patch adjusts the expectations, such that we don't expect
it on arm or when people manually test with -fshort-enums.

2023-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR c/111309
	* c-c++-common/pr111309-2.c (foo): Don't expect errors for C++ with
	-fshort-enums if second argument is E0.
2023-11-21 10:03:26 +01:00
Jakub Jelinek
8a8a6d60c6 builtins: Fix fold_builtin_query clzg/ctzg side-effects handling [PR112639]
As the testcase shows, I've missed one spot where initially the code thinks
it could use 2 argument IFN_CLZ/IFN_CTZ form, but then verifies it can't
because it doesn't have the right target value and turns it into the
arg0 ? arg1 : .C[LT]Z (arg0)
form.  That form evaluates the argument twice though and so needs save_expr,
which I've missed to call in that case.  In other cases where it is known
from the beginning that it will be needed (e.g. the __builtin_clzg case
on types smaller than unsigned int where we'll need to add an addend
to the clz value) or the unsigned __int128 expansion called save_expr
before.

2023-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/112639
	* builtins.cc (fold_builtin_bit_query): If arg0 has side-effects, arg1
	is specified but cleared, call save_expr on arg0.

	* gcc.dg/torture/pr112639.c: New test.
2023-11-21 09:32:37 +01:00
Hongyu Wang
7ad308bd4c [APX PPX] Support Intel APX PPX
PPX stands for Push-Pop Acceleration. PUSH/PUSH2 and its corresponding POP
can be marked with a 1-bit hint to indicate that the POP reads the
value written by the PUSH from the stack. The processor tracks these marked
instructions internally and fast-forwards register data between
matching PUSH and POP instructions, without going through memory or
through the training loop of the Fast Store Forwarding Predictor (FSFP).
This feature can also be adopted to PUSH2/POP2.

For GCC, we emit explicit suffix 'p' (paired) to indicate the push/pop
pair are marked with PPX hint. To separate form original push/pop, we
add an UNSPEC on top of those PUSH/POP patterns.

In the first implementation we only emit them under prologue/epilogue
when saving/restoring callee-saved registers to make sure push/pop are
paired. So an extra flag was added to check if PPX insns can be emitted
for those register save/restore interfaces.

The PPX hint is purely a performance hint. If the 'p' suffix is not
emitted for paired push/pop, the PPX optimization will be disabled,
while program sematic will not be affected at all.

gcc/ChangeLog:

	* config/i386/i386-expand.h (gen_push): Add default bool
	parameter.
	(gen_pop): Likewise.
	* config/i386/i386-opts.h (enum apx_features): Add apx_ppx, add
	it to apx_all.
	* config/i386/i386.cc (ix86_emit_restore_reg_using_pop): Add
	ppx_p parameter for function declaration.
	(gen_push2): Add ppx_p parameter, emit push2p if ppx_p is true.
	(gen_push): Likewise.
	(ix86_emit_restore_reg_using_pop2): Likewise for pop2p.
	(ix86_emit_save_regs): Emit pushp/push2p under TARGET_APX_PPX.
	(ix86_emit_restore_reg_using_pop): Add ppx_p, emit popp insn
	and adjust cfi when ppx_p is ture.
	(ix86_emit_restore_reg_using_pop2): Add ppx_p and parse to its
	callee.
	(ix86_emit_restore_regs_using_pop2): Likewise.
	(ix86_expand_epilogue): Parse TARGET_APX_PPX to
	ix86_emit_restore_reg_using_pop.
	* config/i386/i386.h (TARGET_APX_PPX): New.
	* config/i386/i386.md (UNSPEC_APX_PPX): New unspec.
	(pushp_di): New define_insn.
	(popp_di): Likewise.
	(push2p_di): Likewise.
	(pop2p_di): Likewise.
	* config/i386/i386.opt: Add apx_ppx enum.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/apx-interrupt-1.c: Adjust option to restrict them
	under certain subfeatures.
	* gcc.target/i386/apx-push2pop2-1.c: Likewise.
	* gcc.target/i386/apx-push2pop2_force_drap-1.c: Likewise.
	* gcc.target/i386/apx-push2pop2_interrupt-1.c: Likewise.
	* gcc.target/i386/apx-ppx-1.c: New test.
2023-11-21 16:00:53 +08:00
Richard Biener
f48244fad2 middle-end/112622 - adjust arm testcases
The error message improved, adjust arm specific testcases.

	* gcc.target/arm/bfloat16_vector_typecheck_1.c: Adjust.
	* gcc.target/arm/bfloat16_vector_typecheck_2.c: Likewise.
	* gcc.target/aarch64/bfloat16_vector_typecheck_1.c: Likewise.
	* gcc.target/aarch64/bfloat16_vector_typecheck_2.c: Likewise.
2023-11-21 08:37:25 +01:00
Richard Biener
c656d268c9 tree-optimization/111970 - fix issue with SLP of emulated gather/scatter
There's a missed index adjustment for the SLP vector number when
computing the index/data vectors for emulated gather/scatter with SLP.
The following fixes this.

	PR tree-optimization/111970
	* tree-vect-stmts.cc (vectorizable_load): Fix offset calculation
	for SLP gather load.
	(vectorizable_store): Likewise for SLP scatter store.
2023-11-21 08:16:57 +01:00
Xi Ruoyao
7bf1de9186
LoongArch: Fix libgcc build failure when libc is not available
To use int64_t we included <stdint.h> in loongarch-def.h.
Unfortunately, loongarch-def.h is also used by libgcc etc., causing a
build failure when building a "stage1" cross compiler at which the
target libc is not built yet.

As int64_t is used for a C-compatible replacement of HOST_WIDE_INT, it's
not directly or indirectly referred by the target libraries.  So
guard everything requiring stdint.h with #if then they'll not block
target libraries.

gcc/ChangeLog:

	* config/loongarch/loongarch-def.h (stdint.h): Guard with #if to
	exclude it for target libraries.
	(loongarch_isa_base_features): Likewise.
	(loongarch_isa): Likewise.
	(loongarch_abi): Likewise.
	(loongarch_target): Likewise.
	(loongarch_cpu_default_isa): Likewise.
2023-11-21 11:05:11 +08:00
Juzhe-Zhong
7e2a429ae8 RISC-V: Fix reduc_run-9.c test value check bug
The current test value check is incorrect which is exposed on -march=rv64gcv_zvl256b

Confirm on X86 also abort:
[jzzhong@rios-cad121:/work/home/jzzhong/work/insn]$./a.out
------33.000000,4078.000000,45001776.000000,63369904.000000---
Aborted (core dumped)

Adapt the value check according to X86 result.

Pushed as it is obvious.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/reduc/reduc_run-9.c: Fix bug.
2023-11-21 10:38:20 +08:00
liuhongt
e5e305e604 Support reduc_{and,ior,xor}_scal_m for V4HI/V8QI/V4QImode
gcc/ChangeLog:

	PR target/112325
	* config/i386/i386-expand.cc (emit_reduc_half): Hanlde
	V8QImode.
	* config/i386/mmx.md (reduc_<code>_scal_<mode>): New expander.
	(reduc_<code>_scal_v4qi): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr112325-mmx-1.c: New test.
2023-11-21 08:34:33 +08:00
GCC Administrator
30d8188e6d Daily bump. 2023-11-21 00:17:53 +00:00
Marc Poulhiès
721cdcd1dd Trivial typo fix in variadic
Fix all occurences of varadic, except for Rust (will be part of another change).

gcc/ChangeLog:

	* config/nvptx/nvptx.h (struct machine_function): Fix typo in variadic.
	* config/nvptx/nvptx.cc (nvptx_function_arg_advance): Adjust to use fixed name.
	(nvptx_declare_function_name): Likewise.
	(nvptx_call_args): Likewise.
	(nvptx_expand_call): Likewise.

gcc/cp/ChangeLog:

	* lambda.cc (compare_lambda_sig): Fix typo in variadic.

libcpp/ChangeLog:

	* macro.cc (parse_params): Fix typo in variadic.
	(create_iso_definition): Likewise.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2023-11-20 21:39:15 +01:00
Sebastian Huber
a034cca0a2 gcov: Use unshare_expr() in gen_counter_update()
This fixes issues like this:

  gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c: In function 'main':
  gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c:19:1: error: incorrect sharing of tree nodes
  __gcov0.main[0]
  # .MEM_12 = VDEF <.MEM_9>
  __gcov0.main[0] = PROF_edge_counter_4;
  during IPA pass: profile
  gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c:19:1: internal compiler error: verify_gimple failed

Unshare the counter expression in the second gimple_build_assign() in
gen_counter_update().  This is similar to the original
gimple_gen_edge_profiler() for "ref":

void
gimple_gen_edge_profiler (int edgeno, edge e)
{
  tree one;

  one = build_int_cst (gcov_type_node, 1);

  if (flag_profile_update == PROFILE_UPDATE_ATOMIC)
[...]
  else
    {
      tree ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
      tree gcov_type_tmp_var = make_temp_ssa_name (gcov_type_node,
						   NULL, "PROF_edge_counter");
      gassign *stmt1 = gimple_build_assign (gcov_type_tmp_var, ref);
      gcov_type_tmp_var = make_temp_ssa_name (gcov_type_node,
					      NULL, "PROF_edge_counter");
      gassign *stmt2 = gimple_build_assign (gcov_type_tmp_var, PLUS_EXPR,
					    gimple_assign_lhs (stmt1), one);
      gassign *stmt3 = gimple_build_assign (unshare_expr (ref),
					    gimple_assign_lhs (stmt2));
      gsi_insert_on_edge (e, stmt1);
      gsi_insert_on_edge (e, stmt2);
      gsi_insert_on_edge (e, stmt3);
    }
}

However, the orignal gimple_gen_time_profiler() did not use unshare_expr() for
the counter expression (tree_time_profiler_counter):

void
gimple_gen_time_profiler (unsigned tag)
{
[...]

  /* Emit: counters[0] = ++__gcov_time_profiler_counter.  */
  if (flag_profile_update == PROFILE_UPDATE_ATOMIC)
[...]
  else
    {
      tree tmp = make_temp_ssa_name (type, NULL, "PROF_time_profile");
      gassign *assign = gimple_build_assign (tmp, tree_time_profiler_counter);
      gsi_insert_before (&gsi, assign, GSI_NEW_STMT);

      tmp = make_temp_ssa_name (type, NULL, "PROF_time_profile");
      assign = gimple_build_assign (tmp, PLUS_EXPR, gimple_assign_lhs (assign),
				    one);
      gsi_insert_after (&gsi, assign, GSI_NEW_STMT);
      assign = gimple_build_assign (original_ref, tmp);
      gsi_insert_after (&gsi, assign, GSI_NEW_STMT);
      assign = gimple_build_assign (tree_time_profiler_counter, tmp);
      gsi_insert_after (&gsi, assign, GSI_NEW_STMT);
    }
}

gcc/ChangeLog:

	* tree-profile.cc (gen_counter_update): Use unshare_expr() for the
	counter expression in the second gimple_build_assign().
2023-11-20 19:46:35 +01:00
Jan Hubicka
53ba8d6695 inter-procedural value range propagation
implement very basic propapgation of return value ranges from VRP
pass.  This helps std::vector's push_back since we work out value range of
allocated block.  This propagates only within single translation unit.  I hoped
we will also do the propagation at WPA stage, but that needs more work on
ipa-cp side.

I also added code auto-detecting return_nonnull and corresponding -Wsuggest-attribute.

gcc/ChangeLog:

	* cgraph.cc (add_detected_attribute_1): New function.
	(cgraph_node::add_detected_attribute): Likewise.
	* cgraph.h (cgraph_node::add_detected_attribute): Declare.
	* common.opt: Add -Wsuggest-attribute=returns_nonnull.
	* doc/invoke.texi: Document new flag.
	* gimple-range-fold.cc (fold_using_range::range_of_call):
	Use known reutrn value ranges.
	* ipa-prop.cc (struct ipa_return_value_summary): New type.
	(class ipa_return_value_sum_t): New type.
	(ipa_return_value_sum): New summary.
	(ipa_record_return_value_range): New function.
	(ipa_return_value_range): New function.
	* ipa-prop.h (ipa_return_value_range): Declare.
	(ipa_record_return_value_range): Declare.
	* ipa-pure-const.cc (warn_function_returns_nonnull): New funcion.
	* ipa-utils.h (warn_function_returns_nonnull): Declare.
	* symbol-summary.h: Fix comment.
	* tree-vrp.cc (execute_ranger_vrp): Record return values.

gcc/testsuite/ChangeLog:

	* g++.dg/ipa/devirt-2.C: Add noipa attribute to prevent ipa-vrp.
	* g++.dg/ipa/devirt-7.C: Disable ipa-vrp.
	* g++.dg/ipa/ipa-icf-2.C: Disable ipa-vrp.
	* g++.dg/ipa/ipa-icf-3.C: Disable ipa-vrp.
	* g++.dg/ipa/ivinline-1.C: Disable ipa-vrp.
	* g++.dg/ipa/ivinline-3.C: Disable ipa-vrp.
	* g++.dg/ipa/ivinline-5.C: Disable ipa-vrp.
	* g++.dg/ipa/ivinline-8.C: Disable ipa-vrp.
	* g++.dg/ipa/nothrow-1.C: Disable ipa-vrp.
	* g++.dg/ipa/pure-const-1.C: Disable ipa-vrp.
	* g++.dg/ipa/pure-const-2.C: Disable ipa-vrp.
	* g++.dg/lto/inline-crossmodule-1_0.C: Disable ipa-vrp.
	* gcc.c-torture/compile/pr106433.c: Add noipa attribute to prevent ipa-vrp.
	* gcc.c-torture/execute/frame-address.c: Likewise.
	* gcc.dg/vla-1.c: Add noipa attribute to prevent ipa-vrp.
	* gcc.dg/ipa/fopt-info-inline-1.c: Disable ipa-vrp.
	* gcc.dg/ipa/ipa-icf-25.c: Disable ipa-vrp.
	* gcc.dg/ipa/ipa-icf-38.c: Disable ipa-vrp.
	* gcc.dg/ipa/pure-const-1.c: Disable ipa-vrp.
	* gcc.dg/ipa/remref-0.c: Add noipa attribute to prevent ipa-vrp.
	* gcc.dg/tree-prof/time-profiler-1.c: Disable ipa-vrp.
	* gcc.dg/tree-prof/time-profiler-2.c: Disable ipa-vrp.
	* gcc.dg/tree-ssa/pr110269.c: Disable ipa-vrp.
	* gcc.dg/tree-ssa/pr20701.c: Disable ipa-vrp.
	* gcc.dg/tree-ssa/vrp05.c: Disable ipa-vrp.
	* gcc.dg/tree-ssa/return-value-range-1.c: New test.
2023-11-20 19:37:45 +01:00
Richard Biener
57c028acbe tree-optimization/112618 - unused .MASK_CALL
We have to make sure to remove unused .MASK_CALL internal function
calls after vectorization.

	PR tree-optimization/112618
	* tree-vect-loop.cc (vect_transform_loop_stmt): For not
	relevant and unused .MASK_CALL make sure we remove the
	scalar stmt.

	* gcc.dg/pr112618.c: New testcase.
2023-11-20 14:58:10 +01:00
Richard Biener
3b34902417 tree-optimization/112281 - loop distribution and zero dependence distances
The following fixes an omission in dependence testing for loop
distribution.  When the overall dependence distance is not zero but
the dependence direction in the innermost common loop is = there is
a conflict between the partitions and we have to merge them.

	PR tree-optimization/112281
	* tree-loop-distribution.cc
	(loop_distribution::pg_add_dependence_edges): For = in the
	innermost common loop record a partition conflict.

	* gcc.dg/torture/pr112281-1.c: New testcase.
	* gcc.dg/torture/pr112281-2.c: Likewise.
2023-11-20 14:58:10 +01:00
Richard Biener
b7a1b89e60 middle-end/112622 - convert and vector-to-float
The following avoids ICEing when trying to convert a vector to
a scalar float.

	PR middle-end/112622
	* convert.cc (convert_to_real_1): Use element_precision
	where a vector type might appear.  Provide specific
	diagnostic for unexpected vector argument.

	* gcc.dg/pr112622.c: New testcase.
	* gcc.dg/simd-2.c: Adjust.
	* gcc.target/i386/vect-bfloat16-typecheck_1.c: Likewise.
	* gcc.target/i386/vect-bfloat16-typecheck_2.c: Likewise.
2023-11-20 14:57:52 +01:00
Juzhe-Zhong
a27f587816 RISC-V: Fix intermediate mode on slide1 instruction for SEW64 on RV32
This bug was discovered on PR112597, with -march=rv32gcv_zvl256b --param=riscv-autovec-preference=fixed-vlmax

ICE:
bug.c:10:1: error: unrecognizable insn:
   10 | }
      | ^
(insn 10 9 11 2 (set (reg:V4SI 140)
        (unspec:V4SI [
                (unspec:V4BI [
                        (const_vector:V4BI [
                                (const_int 1 [0x1]) repeated x4
                            ])
                        (const_int 4 [0x4])
                        (const_int 2 [0x2]) repeated x3
                        (reg:SI 66 vl)
                        (reg:SI 67 vtype)
                    ] UNSPEC_VPREDICATE)
                (unspec:V4SI [
                        (reg:SI 0 zero)
                    ] UNSPEC_VUNDEF)
                (subreg:V4SI (reg:V2DI 138 [ v ]) 0)
                (subreg:SI (reg/v:DI 136 [ b ]) 0)
            ] UNSPEC_VSLIDE1DOWN)) "bug.c":8:10 -1
     (nil))

The rootcase is we don't enable V4SImode, instead, we already have RVVMF2SI which is totally same as V4SI
on -march=rv32gcv_zvl256 + --param=riscv-autovec-preference=fixed-vlmax.

The attribute VDEMODE map to V4SI is incorrect, we remove attributes and use get_vector_mode to get
right mode.

	PR target/112597

gcc/ChangeLog:

	* config/riscv/vector-iterators.md: Remove VDEMOTE and VMDEMOTE.
	* config/riscv/vector.md: Fix slide1 intermediate mode bug.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr112597-1.c: New test.
2023-11-20 21:54:35 +08:00
Robin Dapp
b3677563cd RISC-V: Disallow 64-bit indexed loads and stores for rv32gcv.
We currently allow 64-bit indices/offsets for vector indexed loads and
stores even on rv32 but we should not.

This patch adjusts the iterators as well as the insn conditions to
reflect the RVV spec.

It also fixes an oversight in the VLS modes of the demote iterator that
was found while testing the patch.

gcc/ChangeLog:

	* config/riscv/riscv-v.cc (gather_scatter_valid_offset_mode_p):
	Add check for XLEN == 32.
	* config/riscv/vector-iterators.md: Change VLS part of the
	demote iterator to 2x elements modes
	* config/riscv/vector.md: Adjust iterators and insn conditions.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-1.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-1.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-10.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-10.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-11.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-11.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-12.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-12.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-2.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-2.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-3.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-3.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-4.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-4.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-5.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-5.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-6.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-6.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-7.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-7.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-8.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-8.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-9.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_32-9.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1.c:
	Adjust include.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-10.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-11.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-12.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-3.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-4.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-5.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-6.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-7.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-9.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-1.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-1.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-10.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-10.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-11.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-11.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-2.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-2.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-3.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-3.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-4.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-4.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-5.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-5.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-6.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-6.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-7.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-7.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-8.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-8.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-9.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-9.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-1.c:
	Adjust include.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-10.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-3.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-4.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-5.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-6.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-7.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-9.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-1.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-1.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-10.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-10.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-2.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-2.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-3.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-3.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-4.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-4.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-5.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-5.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-6.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-6.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-7.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-7.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-8.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-8.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store-9.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-9.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-1.c:
	Adjust include.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-10.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-3.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-4.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-5.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-6.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-7.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-9.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-1.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-1.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-10.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-10.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-3.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-2.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-4.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-4.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-5.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-5.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-6.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-6.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-7.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-7.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-8.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-8.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-9.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_32-9.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store-2.c: Moved to...
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-2.c: ...here.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-1.c:
	Adjust include.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-10.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-3.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-4.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-5.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-6.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-7.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_run-9.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-1.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-10.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-11.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-12.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-2.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-3.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-4.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-5.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-6.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-7.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-8.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-9.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-1.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-10.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-11.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-2.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-3.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-4.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-5.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-6.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-7.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-8.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_64-9.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-1.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-10.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-2.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-3.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-4.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-5.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-6.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-7.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-8.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_64-9.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-1.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-10.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-3.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-4.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-5.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-6.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-7.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-8.c: New test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/scatter_store_64-9.c: New test.
2023-11-20 14:16:30 +01:00
Christophe Lyon
4d7647edfd arm: [MVE intrinsics] rework vldq1 vst1q
Implement vld1q, vst1q using the new MVE builtins framework.

2023-11-16  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* config/arm/arm-mve-builtins-base.cc (vld1_impl, vld1q)
	(vst1_impl, vst1q): New.
	* config/arm/arm-mve-builtins-base.def (vld1q, vst1q): New.
	* config/arm/arm-mve-builtins-base.h (vld1q, vst1q): New.
	* config/arm/arm_mve.h
	(vld1q): Delete.
	(vst1q): Delete.
	(vld1q_s8): Delete.
	(vld1q_s32): Delete.
	(vld1q_s16): Delete.
	(vld1q_u8): Delete.
	(vld1q_u32): Delete.
	(vld1q_u16): Delete.
	(vld1q_f32): Delete.
	(vld1q_f16): Delete.
	(vst1q_f32): Delete.
	(vst1q_f16): Delete.
	(vst1q_s8): Delete.
	(vst1q_s32): Delete.
	(vst1q_s16): Delete.
	(vst1q_u8): Delete.
	(vst1q_u32): Delete.
	(vst1q_u16): Delete.
	(__arm_vld1q_s8): Delete.
	(__arm_vld1q_s32): Delete.
	(__arm_vld1q_s16): Delete.
	(__arm_vld1q_u8): Delete.
	(__arm_vld1q_u32): Delete.
	(__arm_vld1q_u16): Delete.
	(__arm_vst1q_s8): Delete.
	(__arm_vst1q_s32): Delete.
	(__arm_vst1q_s16): Delete.
	(__arm_vst1q_u8): Delete.
	(__arm_vst1q_u32): Delete.
	(__arm_vst1q_u16): Delete.
	(__arm_vld1q_f32): Delete.
	(__arm_vld1q_f16): Delete.
	(__arm_vst1q_f32): Delete.
	(__arm_vst1q_f16): Delete.
	(__arm_vld1q): Delete.
	(__arm_vst1q): Delete.
	* config/arm/mve.md (mve_vld1q_f<mode>): Rename into ...
	(@mve_vld1q_f<mode>): ... this.
	(mve_vld1q_<supf><mode>): Rename into ...
	(@mve_vld1q_<supf><mode>) ... this.
	(mve_vst1q_f<mode>): Rename into ...
	(@mve_vst1q_f<mode>): ... this.
	(mve_vst1q_<supf><mode>): Rename into ...
	(@mve_vst1q_<supf><mode>) ... this.
2023-11-20 11:23:57 +00:00
Christophe Lyon
3282fecd82 arm: [MVE intrinsics] fix vst1 tests
vst1q intrinsics return void, so we should not do 'return vst1q_f16 (base, value);'

This was OK so far, but will trigger an error/warning with the new
implementation of these intrinsics.

This patch just removes the 'return' keyword.

2023-11-16  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/mve/intrinsics/vst1q_f16.c: Remove 'return'.
	* gcc.target/arm/mve/intrinsics/vst1q_f32.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vst1q_s16.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vst1q_s32.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vst1q_s8.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vst1q_u16.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vst1q_u32.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vst1q_u8.c: Likewise.
2023-11-20 11:23:56 +00:00
Christophe Lyon
1145875206 arm: [MVE intrinsics] add load and store shapes
This patch adds the load and store shapes descriptions.

2023-11-16  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* config/arm/arm-mve-builtins-shapes.cc (load, store): New.
	* config/arm/arm-mve-builtins-shapes.h (load, store): New.
2023-11-20 11:23:56 +00:00
Christophe Lyon
0c2037d9d9 arm: [MVE intrinsics] Add support for contiguous loads and stores
This patch adds base support for load/store intrinsics to the
framework, starting with loads and stores for contiguous memory
elements, without extension nor truncation.

Compared to the aarch64/SVE implementation, there's no support for
gather/scatter loads/stores yet.  This will be added later as needed.

2023-11-16  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* config/arm/arm-mve-builtins-functions.h (multi_vector_function)
	(full_width_access): New classes.
	* config/arm/arm-mve-builtins.cc
	(find_type_suffix_for_scalar_type, infer_pointer_type)
	(require_pointer_type, get_contiguous_base, add_mem_operand)
	(add_fixed_operand, use_contiguous_load_insn)
	(use_contiguous_store_insn): New.
	* config/arm/arm-mve-builtins.h (memory_vector_mode)
	(infer_pointer_type, require_pointer_type, get_contiguous_base)
	(add_mem_operand)
	(add_fixed_operand, use_contiguous_load_insn)
	(use_contiguous_store_insn): New.
2023-11-20 11:23:56 +00:00
Christophe Lyon
524c892e64 arm: [MVE intrinsics] Add support for void and load/store pointers as argument types.
This patch adds support for '_', 'al' and 'as' for void, load pointer
and store pointer argument/return value types in intrinsic signatures.

It also adds a mew memory_scalar_type() helper to function_instance,
which is used by 'al' and 'as'.

2023-11-16  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* config/arm/arm-mve-builtins-shapes.cc (build_const_pointer):
	New.
	(parse_type): Add support for '_', 'al' and 'as'.
	* config/arm/arm-mve-builtins.h (function_instance): Add
	memory_scalar_type.
	(function_base): Likewise.
2023-11-20 11:23:56 +00:00