]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
16 months agoamdgcn, libgomp: Manually allocated stacks
Andrew Stubbs [Thu, 1 Dec 2022 17:30:21 +0000 (17:30 +0000)] 
amdgcn, libgomp: Manually allocated stacks

Switch from using stacks in the "private segment" to using a memory block
allocated on the host side.  The primary reason is to permit the reverse
offload implementation to access values located on the device stack, but
there may also be performance benefits, especially with repeated kernel
invocations.

This implementation unifies the stacks with the "team arena" optimization
feature, and now allows both to have run-time configurable sizes.

A new ABI is needed, so all libraries must be rebuilt, and newlib must be
version 4.3.0.20230120 or newer.

gcc/ChangeLog:

* config/gcn/gcn-run.cc: Include libgomp-gcn.h.
(struct kernargs): Replace the common content with kernargs_abi.
(struct heap): Delete.
(main): Read GCN_STACK_SIZE envvar.
Allocate space for the device stacks.
Write the new kernargs fields.
* config/gcn/gcn.cc (gcn_option_override): Remove stack_size_opt.
(default_requested_args): Remove PRIVATE_SEGMENT_BUFFER_ARG and
PRIVATE_SEGMENT_WAVE_OFFSET_ARG.
(gcn_addr_space_convert): Mask the QUEUE_PTR_ARG content.
(gcn_expand_prologue): Move the TARGET_PACKED_WORK_ITEMS to the top.
Set up the stacks from the values in the kernargs, not private.
(gcn_expand_builtin_1): Match the stack configuration in the prologue.
(gcn_hsa_declare_function_name): Turn off the private segment.
(gcn_conditional_register_usage): Ensure QUEUE_PTR is fixed.
* config/gcn/gcn.h (FIXED_REGISTERS): Fix the QUEUE_PTR register.
* config/gcn/gcn.opt (mstack-size): Change the description.

include/ChangeLog:

* gomp-constants.h (GOMP_VERSION_GCN): Bump.

libgomp/ChangeLog:

* config/gcn/libgomp-gcn.h (DEFAULT_GCN_STACK_SIZE): New define.
(DEFAULT_TEAM_ARENA_SIZE): New define.
(struct heap): Move to this file.
(struct kernargs_abi): Likewise.
* config/gcn/team.c (gomp_gcn_enter_kernel): Use team arena size from
the kernargs.
* libgomp.h: Include libgomp-gcn.h.
(TEAM_ARENA_SIZE): Remove.
(team_malloc): Update the error message.
* plugin/plugin-gcn.c (struct kernargs): Move common content to
struct kernargs_abi.
(struct agent_info): Rename team arenas to ephemeral memories.
(struct team_arena_list): Rename ....
(struct ephemeral_memories_list): to this.
(struct heap): Delete.
(team_arena_size): New variable.
(stack_size): New variable.
(print_kernel_dispatch): Update debug messages.
(init_environment_variables): Read GCN_TEAM_ARENA_SIZE.
Read GCN_STACK_SIZE.
(get_team_arena): Rename ...
(configure_ephemeral_memories): ... to this, and set up stacks.
(release_team_arena): Rename ...
(release_ephemeral_memories): ... to this.
(destroy_team_arenas): Rename ...
(destroy_ephemeral_memories): ... to this.
(create_kernel_dispatch): Add num_threads parameter.
Adjust for kernargs_abi refactor and ephemeral memories.
(release_kernel_dispatch): Adjust for ephemeral memories.
(run_kernel): Pass thread-count to create_kernel_dispatch.
(GOMP_OFFLOAD_init_device): Adjust for ephemeral memories.
(GOMP_OFFLOAD_fini_device): Adjust for ephemeral memories.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/pr47237.c: Xfail on amdgcn.
* gcc.dg/builtin-apply3.c: Xfail for amdgcn.
* gcc.dg/builtin-apply4.c: Xfail for amdgcn.
* gcc.dg/torture/stackalign/builtin-apply-3.c: Xfail for amdgcn.
* gcc.dg/torture/stackalign/builtin-apply-4.c: Xfail for amdgcn.

16 months agolibgomp.texi (OpenMP TR11 impl. status): Fix 'strict' item
Tobias Burnus [Thu, 2 Feb 2023 11:05:58 +0000 (12:05 +0100)] 
libgomp.texi (OpenMP TR11 impl. status): Fix 'strict' item

Fix the 'strict' modifier status: it is already listed (as 'Y') for OpenMP
5.1 for num_task and grainsize; only strict on num_threads is new with TR11.

libgomp/
* libgomp.texi (OpenMP TR11): Fix item for 'strict' modifier.

16 months agoarm: Fix MVE predicates synthesis [PR 108443]
Andre Vieira [Thu, 2 Feb 2023 10:01:30 +0000 (10:01 +0000)] 
arm: Fix MVE predicates synthesis [PR 108443]

This patch fixes the way we synthesize MVE predicate immediates and fixes some
other inconsistencies around predicates. For instance this patch fixes the modes
used in the vctp intrinsics, to couple them with predicate modes with the
appropriate lane numbers. For this V2QI is added to represent a predicate
created by vctp64q. The reason we use V2QI and not for instance a V2BI with
8-bit boolean modes is because we are trying to avoid having two 'INT' modes of
the same size. We make sure we use the V2QI mode instead of HI for any
instruction working on two lanes of 64-bits consuming a predicate.

gcc/ChangeLog:

PR target/108443
* config/arm/arm.h (VALID_MVE_PRED_MODE): Add V2QI.
* config/arm/arm.cc (thumb2_legitimate_address_p): Use HImode for
addressing MVE predicate modes.
(mve_bool_vec_to_const): Change to represent correct MVE predicate
format.
(arm_hard_regno_mode_ok): Use VALID_MVE_PRED_MODE instead of checking
modes.
(arm_vector_mode_supported_p): Likewise.
(arm_mode_to_pred_mode): Add V2QI.
* config/arm/arm-builtins.cc (UNOP_PRED_UNONE_QUALIFIERS): New
qualifier.
(UNOP_PRED_PRED_QUALIFIERS): New qualifier
(BINOP_PRED_UNONE_PRED_QUALIFIERS): New qualifier.
(v2qi_UP): New macro.
(v4bi_UP): New macro.
(v8bi_UP): New macro.
(v16bi_UP): New macro.
(arm_expand_builtin_args): Make it able to expand the new predicate
modes.
* config/arm/arm-modes.def (V2QI): New mode.
* config/arm/arm-simd-builtin-types.def (Pred1x16_t, Pred2x8_t
Pred4x4_t): Remove unused predicate builtin types.
* config/arm/arm_mve.h (__arm_vctp16q, __arm_vctp32q, __arm_vctp64q,
__arm_vctp8q, __arm_vpnot, __arm_vctp8q_m, __arm_vctp64q_m,
__arm_vctp32q_m, __arm_vctp16q_m): Use predicate modes.
* config/arm/arm_mve_builtins.def (vctp16q, vctp32q, vctp64q, vctp8q,
vpnot, vctp8q_m, vctp16q_m, vctp32q_m, vctp64q_m): Likewise.
* config/arm/constraints.md (DB): Check for VALID_MVE_PRED_MODE instead
of MODE_VECTOR_BOOL.
* config/arm/iterators.md (MVE_7, MVE_7_HI): Add V2QI
(MVE_VPRED): Likewise.
(MVE_vpred): Add V2QI and map upper case predicate modes to lower case.
(MVE_vctp): New mode attribute.
(mode1): Remove.
(VCTPQ): Remove.
(VCTPQ_M): Remove.
* config/arm/mve.md (mve_vctp<mode1>qhi): Rename this...
(mve_vctp<MVE_vctp>q<MVE_vpred>): ... to this. And use new mode
attributes.
(mve_vpnothi): Rename this...
(mve_vpnotv16bi): ... to this.
(mve_vctp<mode1>q_mhi): Rename this...
(mve_vctp<MVE_vctp>q_m<MVE_vpred>):... to this.
(mve_vldrdq_gather_base_z_<supf>v2di,
mve_vldrdq_gather_offset_z_<supf>v2di,
mve_vldrdq_gather_shifted_offset_z_<supf>v2di,
mve_vstrdq_scatter_base_p_<supf>v2di,
mve_vstrdq_scatter_offset_p_<supf>v2di,
mve_vstrdq_scatter_offset_p_<supf>v2di_insn,
mve_vstrdq_scatter_shifted_offset_p_<supf>v2di,
mve_vstrdq_scatter_shifted_offset_p_<supf>v2di_insn,
mve_vstrdq_scatter_base_wb_p_<supf>v2di,
mve_vldrdq_gather_base_wb_z_<supf>v2di,
mve_vldrdq_gather_base_nowb_z_<supf>v2di,
mve_vldrdq_gather_base_wb_z_<supf>v2di_insn):  Use V2QI insead of HI for
predicates.
* config/arm/unspecs.md (VCTP8Q, VCTP16Q, VCTP32Q, VCTP64Q): Replace
these...
(VCTP): ... with this.
(VCTP8Q_M, VCTP16Q_M, VCTP32Q_M, VCTP64Q_M): Replace these...
(VCTP_M): ... with this.
* config/arm/vfp.md (*thumb2_movhi_vfp, *thumb2_movhi_fp16): Use
VALID_MVE_PRED_MODE instead of checking for MODE_VECTOR_BOOL class.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/pr108443-run.c: New test.
* gcc.target/arm/mve/pr108443.c: New test.

16 months agoarm: Remove unnecessary zero-extending of MVE predicates before use [PR 107674]
Andre Vieira [Thu, 2 Feb 2023 10:01:13 +0000 (10:01 +0000)] 
arm: Remove unnecessary zero-extending of MVE predicates before use [PR 107674]

This patch teaches GCC that zero-extending a MVE predicate from 16-bits to
32-bits and then only using 16-bits is a no-op.
It does so in two steps:
- it lets gcc know that it can access any MVE predicate mode using any other MVE
predicate mode without needing to copy it, using the TARGET_MODES_TIEABLE_P hook,
- it teaches simplify_subreg to optimize a subreg with a vector outermode, by
replacing this outermode with a same-sized integer mode and trying the
avalailable optimizations, then if successful it surrounds the result with a
subreg casting it back to the original vector outermode.

gcc/ChangeLog:

PR target/107674
* config/arm/arm.cc (arm_hard_regno_mode_ok): Use new MACRO.
(arm_modes_tieable_p): Make MVE predicate modes tieable.
* config/arm/arm.h (VALID_MVE_PRED_MODE):  New define.
* simplify-rtx.cc (simplify_context::simplify_subreg): Teach
simplify_subreg to simplify subregs where the outermode is not scalar.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/mve_vpt.c: Change to remove unecessary zero-extend.

16 months agoarm: Fix sign of MVE predicate mve_pred16_t [PR 107674]
Andre Vieira [Thu, 2 Feb 2023 10:00:57 +0000 (10:00 +0000)] 
arm: Fix sign of MVE predicate mve_pred16_t [PR 107674]

The ACLE defines mve_pred16_t as an unsigned short.  This patch makes sure GCC
treats the predicate as an unsigned type, rather than signed.

gcc/ChangeLog:

PR target/107674
* config/arm/arm-builtins.cc (arm_simd_builtin_type): Rewrite to use
new qualifiers parameter and use unsigned short type for MVE predicate.
(arm_init_builtin): Call arm_simd_builtin_type with qualifiers
parameter.
(arm_init_crypto_builtins): Likewise.

gcc/testsuite/ChangeLog:

PR target/107674
* gcc.target/arm/mve/mve_vpt.c: New test.

16 months agoReplace IFN_TRAP with BUILT_IN_UNREACHABLE_TRAP [PR107300]
Jakub Jelinek [Thu, 2 Feb 2023 09:54:54 +0000 (10:54 +0100)] 
Replace IFN_TRAP with BUILT_IN_UNREACHABLE_TRAP [PR107300]

For PR106099 I've added IFN_TRAP as an alternative to __builtin_trap
meant for __builtin_unreachable purposes (e.g. with -funreachable-traps
or some sanitizers) which doesn't need vops because __builtin_unreachable
doesn't need them either.  This works in various cases, but unfortunately
IPA likes to decide on the redirection to unreachable just by tweaking
the cgraph edge to point to a different FUNCTION_DECL.  As internal
functions don't have a decl, this causes problems like in the following
testcase.

The following patch fixes it by removing IFN_TRAP again and replacing
it with user inaccessible BUILT_IN_UNREACHABLE_TRAP, so that e.g.
builtin_decl_unreachable can return it directly and we don't need to tweak
it later in wherever we actually replace the call stmt.

2023-02-02  Jakub Jelinek  <jakub@redhat.com>

PR ipa/107300
* builtins.def (BUILT_IN_UNREACHABLE_TRAP): New builtin.
* internal-fn.def (TRAP): Remove.
* internal-fn.cc (expand_TRAP): Remove.
* tree.cc (build_common_builtin_nodes): Define
BUILT_IN_UNREACHABLE_TRAP if not yet defined.
(builtin_decl_unreachable): Use BUILT_IN_UNREACHABLE_TRAP
instead of BUILT_IN_TRAP.
* gimple.cc (gimple_build_builtin_unreachable): Remove
emitting internal function for BUILT_IN_TRAP.
* asan.cc (maybe_instrument_call): Handle BUILT_IN_UNREACHABLE_TRAP.
* cgraph.cc (cgraph_edge::verify_corresponds_to_fndecl): Handle
BUILT_IN_UNREACHABLE_TRAP instead of BUILT_IN_TRAP.
* ipa-devirt.cc (possible_polymorphic_call_target_p): Handle
BUILT_IN_UNREACHABLE_TRAP.
* builtins.cc (expand_builtin, is_inexpensive_builtin): Likewise.
* tree-cfg.cc (verify_gimple_call,
pass_warn_function_return::execute): Likewise.
* attribs.cc (decl_attributes): Don't report exclusions on
BUILT_IN_UNREACHABLE_TRAP either.

* gcc.dg/pr107300.c: New test.

16 months agoDon't peel nonlinear iv(mult or shift) for epilog when vf is not constant.
liuhongt [Wed, 1 Feb 2023 05:30:12 +0000 (13:30 +0800)] 
Don't peel nonlinear iv(mult or shift) for epilog when vf is not constant.

Normally when vf is not constant, it will be prevented by
vectorizable_nonlinear_inductions, but for this case, it failed going
into

    if (STMT_VINFO_RELEVANT_P (stmt_info))
      {
need_to_vectorize = true;
if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def
   && ! PURE_SLP_STMT (stmt_info))
  ok = vectorizable_induction (loop_vinfo,
       stmt_info, NULL, NULL,
       &cost_vec);

since the iv is never used outside of the loop, and will be dce later, so
vectorizer doesn't bother checking if it's vectorizable. it's
true but hit gcc_assert in vect_can_peel_nonlinear_iv_p when vf is not
constant. One solution is ignoring the nonlinear iv peeling if it's
!STMT_VINFO_RELEVANT_P (stmt_info) just like the upper code, the other
solution is returning false earlier in the
vect_can_peel_nonlinear_iv_p when vf is not constant, the patch chooses
the second incase there's other cases using vect_can_advance_ivs_p which
calls vect_can_peel_nonlinear_iv_p.
Also remove vect_peel_nonlinear_iv_p from
vectorizable_nonlinear_inductions.

gcc/ChangeLog:

PR tree-optimization/108601
* tree-vectorizer.h (vect_can_peel_nonlinear_iv_p): Removed.
* tree-vect-loop.cc
(vectorizable_nonlinear_induction): Remove
vect_can_peel_nonlinear_iv_p.
(vect_can_peel_nonlinear_iv_p): Don't peel
nonlinear iv(mult or shift) for epilog when vf is not
constant and moved the defination to ..
* tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p):
.. Here.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr108601.c: New test.

16 months agonested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for declare_vars [PR108435]
Jakub Jelinek [Thu, 2 Feb 2023 08:54:18 +0000 (09:54 +0100)] 
nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for declare_vars [PR108435]

When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
into a GIMPLE_BIND, but when putting statements directly into
OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
are any temporaries that need to be declared in the sequence).
convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there always
because it called declare_vars on it.

The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
declare_vars on it on demand.

2023-02-02  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/108435
* tree-nested.cc (convert_nonlocal_omp_clauses)
<case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and *seq
is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
before calling declare_vars.
(convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
with the OMP_CLAUSE_LASTPRIVATE handling except for whether
seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).

* gcc.dg/gomp/pr108435.c: New test.

16 months agolibstdc++: Switch a www.open-std.org link to https
Gerald Pfeifer [Thu, 2 Feb 2023 00:50:44 +0000 (01:50 +0100)] 
libstdc++: Switch a www.open-std.org link to https

libstdc++-v3/ChangeLog:

* doc/xml/manual/using_exceptions.xml: Update a www.open-std.org
link to https.
* doc/html/manual/using_exceptions.html: Regenerate.

16 months agolibstdc++: Fix link to online GDB manual
Gerald Pfeifer [Thu, 2 Feb 2023 00:30:02 +0000 (01:30 +0100)] 
libstdc++: Fix link to online GDB manual

libstdc++-v3/ChangeLog:

* doc/xml/manual/debug.xml: Fix link to online GDB manual.
* doc/html/manual/debug.html: Regenerate.

16 months agoDaily bump.
GCC Administrator [Thu, 2 Feb 2023 00:17:43 +0000 (00:17 +0000)] 
Daily bump.

16 months agolibstdc++: Fix std::random_device for avr
Jonathan Wakely [Tue, 31 Jan 2023 22:28:16 +0000 (22:28 +0000)] 
libstdc++: Fix std::random_device for avr

This fixes a build failure that affects avr, but could affect other
targets in theory. The _M_fini function should not try to use ::open or
::fopen if _GLIBCXX_USE_DEV_RANDOM is not defined, because no file can
ever have been opened.

libstdc++-v3/ChangeLog:

* src/c++11/random.cc (random_device::_M_fini): Do not try to
close the file handle if the target doesn't support the
/dev/random and /dev/urandom files.

16 months agolibstdc++: Fix build failures for avr
Jonathan Wakely [Tue, 31 Jan 2023 22:16:31 +0000 (22:16 +0000)] 
libstdc++: Fix build failures for avr

The abr-libc <errno.h> does not define EOVERFLOW, which means that
std::errc::value_too_large is not defined, and so <charconv> cannot be
compiled. Define value_too_large for avr with a value that does not
clash with any that is defined in <errno.h>. This is a kluge to fix
bootstrap for avr; it can be removed after PR libstdc++/104883 is
resolved.

The avr-libc <errno.h> fails to meet the C and POSIX requirements that
each error macro has a distinct integral value, and is usable in #if
directives. Add a special case for avr to system_error.cc so that only
the valid errors are recognized. Also disable the errno checks in
std::filesystem::remove_all that assume a meaningful value for errno.

On avr-libc <unistd.h> exists but does not define the POSIX functions
needed by std::filesystem, so _GLIBCXX_HAVE_UNISTD_H is not sufficient
to check for basic POSIX APIs. Check !defined __AVR__ as well as
_GLIBCXX_HAVE_UNISTD_H before using those functions. This is a kluge and
we should really have a specific macro that says the required functions
are available.

libstdc++-v3/ChangeLog:

* config/os/generic/error_constants.h (errc::value_too_large)
[__AVR__]: Define.
* src/c++11/system_error.cc
(system_category::default_error_condition) [__AVR__]: Only match
recognize values equal to EDOM, ERANGE, ENOSYS and EINTR.
* src/c++17/fs_ops.cc (fs::current_path) [__AVR__]: Do not check
for ENOENT etc. in switch.
(fs::remove_all) [__AVR__]: Likewise.
* src/filesystem/ops-common.h [__AVR__]: Do not use POSIX open,
close etc.

16 months agolibstdc++: Do not embed tzdata.zi for 8-bit and 16-bit targets
Jonathan Wakely [Tue, 31 Jan 2023 22:11:49 +0000 (22:11 +0000)] 
libstdc++: Do not embed tzdata.zi for 8-bit and 16-bit targets

The string literal containing the static tzdata.zi information is too
large for some targets, so do not enable it by default for avr-*-* and
msp430-*-*.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ZONEINFO_DIR) [avr-*-*, msp430-*-*]: Set
embed_zoneinfo=no
* configure: Regenerate.

16 months agoFortran: error recovery on invalid array section [PR108609]
Harald Anlauf [Wed, 1 Feb 2023 20:01:32 +0000 (21:01 +0100)] 
Fortran: error recovery on invalid array section [PR108609]

The testcase for PR108527 uncovered a latent issue with invalid array
sections that resulted in different paths being taken on different
architectures.  Detect the invalid array declaration for a clean recovery.

gcc/fortran/ChangeLog:

PR fortran/108609
* expr.cc (find_array_section): Add check to prevent interpreting an
mpz non-integer constant as an integer.

gcc/testsuite/ChangeLog:

PR fortran/108609
* gfortran.dg/pr108527.f90: Adjust test pattern.

16 months agoAArch64: Fix native detection in the presence of mandatory features which don't have...
Tamar Christina [Wed, 1 Feb 2023 18:31:41 +0000 (18:31 +0000)] 
AArch64: Fix native detection in the presence of mandatory features which don't have midr values

aarch64-option-extensions.def explicitly defines the semantics for an empty midr
field as being:

     In that case this field
     should contain a space (" ") separated list of the strings in 'Features'
     that are required.  Their order is not important.  An empty string means
     do not detect this feature during auto detection.

That is to say, an empty string means that we don't know the midr value for this
feature and so it just shouldn't be taken into account for native features
detection.  However this meaning seems to have gotten lost at some point.

This results in e.g. -mcpu=native on a Neoverse N2 disabling features it does
have.  Essentially we disabled any mandatory feature for which there is no midr
entry.

The rationale for having -mcpu=native being able to disable features at all, is
because the kernel is able to disable a mandatory feature for correctness
issues.  Unfortunately we can't distinguish between "old kernel"
and "kernel disabled".

This patch adds a new field that indicates whether the midr field has any value
at all.  If there's no value we skip the extension when determining the "off"
flags.

gcc/ChangeLog:

* common/config/aarch64/aarch64-common.cc
(struct aarch64_option_extension): Add native_detect and document struct
a bit more.
(all_extensions): Set new field native_detect.
* config/aarch64/aarch64.cc (struct aarch64_option_extension): Delete
unused struct.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/info_19: New test.
* gcc.target/aarch64/cpunative/info_20: New test.
* gcc.target/aarch64/cpunative/info_21: New test.
* gcc.target/aarch64/cpunative/info_22: New test.
* gcc.target/aarch64/cpunative/native_cpu_19.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_20.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_21.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_22.c: New test.

16 months agoFixup noreturn attributes in modula-2 [PR108551] and [PR108612]
Gaius Mulley [Wed, 1 Feb 2023 17:26:00 +0000 (17:26 +0000)] 
Fixup noreturn attributes in modula-2 [PR108551] and [PR108612]

PR108612 - m2/gm2-libs-iso/ClientSocket.mod:229:1: error: control
reaches end of non-void function [-Werror=return-type]
PR108551 - gcc/m2/gm2-libs-pim/Termbase.mod:128:1: error: control
reaches end of non-void function [-Werror=return-type]
This patch adds missing return values to the procedure functions
mentioned in PR108612 and PR108551.  It corrects the noreturn
attribute to throw and rethrow in the modula2 frontend.  The patch
also changes HALT, Halt, Raise procedures in the libraries to use
the <* noreturn *> attribute.  Finally the patch includes
rebuilt bootstrap tools mc and pge.

gcc/m2/ChangeLog:

* Make-lang.in (GM2_FLAGS): Add -fno-return -Wreturn-type.
(GM2_ISO_FLAGS): Add -fno-return -Wreturn-type.
* Make-maintainer.in (GM2PATH): Split into separate -I components.
(MC-LIB-DEFS): Add RTentity.def.
(m2/boot-bin/mc-devel$(exeext)): Changed -I$(GM2PATH) to
$(GM2PATH).
(m2/boot-bin/mc-opt$(exeext)): Separate -I paths.
(m2/mc/decl.o): Separate -I paths.
(gm2-bootstrap): Separate -I paths.
(m2/mc-boot-gen/$(SRC_PREFIX)%.h): Separate -I paths.
(m2/mc-boot-gen/$(SRC_PREFIX)decl.c): Separate -I paths.
(m2/mc-boot-gen/$(SRC_PREFIX)%.c): Separate -I paths.
(gm2.verifyparanoid): Separate -I paths.
(gm2.verifystage12): Separate -I paths.
* gm2-compiler/M2ALU.mod (GetConstructorElement): Add default
Return NulSym.  Remove return from the error case.
* gm2-compiler/M2Base.mod (ComplexToScalar): Return RType
from the error case.
(MixMetaTypes):  Return MakeError as a default.
* gm2-compiler/M2GCCDeclare.mod (GetTypeMin): Return NulSym
from the error case.
(GetTypeMax): Return NulSym from the error case.
* gm2-compiler/M2GenGCC.mod (IsExportedGcc): Replace Assert
by InternalError.
* gm2-compiler/M2Quads.mod (GetItemPointedTo): Add InternalError.
(GetTypeMin): Add InternalError.
(GetTypeMax): Add InternalError.
* gm2-compiler/M2System.mod (InitSystem): Call
PutProcedureNoReturn on Throw.
* gm2-gcc/m2except.cc (m2except_InitExceptions): fn_throw_tree
declare as noreturn.  fn_rethrow_tree declare as noreturn.
* gm2-libs-coroutines/Debug.def (Halt): Add noreturn attribute.
* gm2-libs-coroutines/SYSTEM.def (THROW): Add noreturn attribute.
* gm2-libs-iso/ClientSocket.mod (dorbytes): Add return FALSE.
* gm2-libs-iso/EXCEPTIONS.def (RAISE): Add noreturn attribute.
* gm2-libs-iso/IOLink.def (RAISEdevException): Add noreturn attribute.
* gm2-libs-iso/M2RTS.def (HALT): Add noreturn attribute.
(Halt): Ditto.
(HaltC): Ditto.
(ErrorMessage): Ditto.
(AssignmentException): Ditto.
(ReturnException): Ditto.
(IncException): Ditto.
(DecException): Ditto.
(InclException): Ditto.
(ExclException): Ditto.
(ShiftException): Ditto.
(RotateException): Ditto.
(StaticArraySubscriptException): Ditto.
(DynamicArraySubscriptException): Ditto.
(ForLoopBeginException): Ditto.
(ForLoopToException): Ditto.
(ForLoopEndException): Ditto.
(PointerNilException): Ditto.
(NoReturnException): Ditto.
(CaseException): Ditto.
(WholeNonPosDivException): Ditto.
(WholeNonPosModException): Ditto.
(WholeZeroDivException): Ditto.
(WholeZeroRemException): Ditto.
(WholeValueException): Ditto.
(RealValueException): Ditto.
(ParameterException): Ditto.
(NoException): Ditto.
* gm2-libs-iso/SYSTEM.def (THROW): Ditto.
* gm2-libs-iso/TermFile.mod (dorbytes): Add default return FALSE.
* gm2-libs-min/M2RTS.def: Add noreturn attribute.
* gm2-libs/FIO.mod (BufferedRead): Return -1.
(getFileName): Return NIL.
(getFileNameLength): Return 0.
* gm2-libs/M2RTS.def (HaltC): Add noreturn attribute.
(AssignmentException): Ditto.
(ReturnException): Ditto.
(IncException): Ditto.
(DecException): Ditto.
(InclException): Ditto.
(ExclException): Ditto.
(ShiftException): Ditto.
(RotateException): Ditto.
(StaticArraySubscriptException): Ditto.
(DynamicArraySubscriptException): Ditto.
(ForLoopBeginException): Ditto.
(ForLoopToException): Ditto.
(ForLoopEndException): Ditto.
(PointerNilException): Ditto.
(NoReturnException): Ditto.
(CaseException): Ditto.
(WholeNonPosDivException): Ditto.
(WholeNonPosModException): Ditto.
(WholeZeroDivException): Ditto.
(WholeZeroRemException): Ditto.
(WholeValueException): Ditto.
(RealValueException): Ditto.
(ParameterException): Ditto.
(NoException): Ditto.
* gm2-libs/RTExceptions.def (Raise): Ditto.
* gm2-libs/RTExceptions.mod (InvokeHandler): Ditto.
* gm2-libs/SYSTEM.def (THROW): Ditto.
* m2.flex (_M2_m2flex_fini): Remamed to...
(_M2_m2flex_finish): ...here.
* mc-boot-ch/GBuiltins.c (_M2_Builtins_finish): Remamed to...
(_M2_Builtins_fini): ...this.
* mc-boot-ch/GRTco.c (_M2_RTco_finish): Remamed to...
(_M2_RTco_fini): ...this.
* mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_finish): Remamed to...
(_M2_SYSTEM_fini): ...this.
* mc-boot-ch/GSelective.c (_M2_Selective_finish): Remamed to...
(_M2_Selective_fini): ...this.
* mc-boot-ch/GSysExceptions.c (_M2_SysExceptions_init): Add
parameters.
(_M2_SysExceptions_finish): Remamed to...
(_M2_SysExceptions_fini): ...this.
* mc-boot-ch/GUnixArgs.cc (_M2_UnixArgs_finish): Remamed to...
(_M2_UnixArgs_fini): ...this.
(_M2_UnixArgs_ctor::_M2_UnixArgs_ctor): Change parameter
to _M2_UnixArgs_fini.
* mc-boot-ch/Gdtoa.c (_M2_dtoa_finish): Remamed to...
(_M2_dtoa_fini): ...this.
* mc-boot-ch/Gerrno.c (_M2_errno_finish): Remamed to...
(_M2_errno_fini): ...this.
* mc-boot-ch/Gldtoa.c (_M2_ldtoa_finish): Remamed to...
(_M2_ldtoa_fini): ...this.
* mc-boot-ch/Gtermios.cc (_M2_termios_init): Add parameters.
(_M2_termios_finish): Remamed to...
(_M2_termios_fini): ...this.
* mc-boot-ch/Gwrapc.c (_M2_wrapc_init): Add parameters.
(_M2_wrapc_finish): Remamed to...
(_M2_wrapc_fini): ...this.
* mc-boot/GASCII.c: Rebuild.
* mc-boot/GArgs.c: Rebuild.
* mc-boot/GAssertion.c: Rebuild.
* mc-boot/GBreak.c: Rebuild.
* mc-boot/GCmdArgs.c: Rebuild.
* mc-boot/GDebug.c: Rebuild.
* mc-boot/GDynamicStrings.c: Rebuild.
* mc-boot/GEnvironment.c: Rebuild.
* mc-boot/GFIO.c: Rebuild.
* mc-boot/GFormatStrings.c: Rebuild.
* mc-boot/GFpuIO.c: Rebuild.
* mc-boot/GIO.c: Rebuild.
* mc-boot/GIndexing.c: Rebuild.
* mc-boot/GM2Dependent.c: Rebuild.
* mc-boot/GM2EXCEPTION.c: Rebuild.
* mc-boot/GM2RTS.c: Rebuild.
* mc-boot/GM2RTS.h: Rebuild.
* mc-boot/GMemUtils.c: Rebuild.
* mc-boot/GNumberIO.c: Rebuild.
* mc-boot/GPushBackInput.c: Rebuild.
* mc-boot/GRTExceptions.c: Rebuild.
* mc-boot/GRTExceptions.h: Rebuild.
* mc-boot/GRTco.h: Rebuild.
* mc-boot/GRTint.c: Rebuild.
* mc-boot/GSArgs.c: Rebuild.
* mc-boot/GSFIO.c: Rebuild.
* mc-boot/GStdIO.c: Rebuild.
* mc-boot/GStorage.c: Rebuild.
* mc-boot/GStrCase.c: Rebuild.
* mc-boot/GStrIO.c: Rebuild.
* mc-boot/GStrLib.c: Rebuild.
* mc-boot/GStringConvert.c: Rebuild.
* mc-boot/GSysStorage.c: Rebuild.
* mc-boot/GTimeString.c: Rebuild.
* mc-boot/Galists.c: Rebuild.
* mc-boot/Gdecl.c: Rebuild.
* mc-boot/Gkeyc.c: Rebuild.
* mc-boot/Glists.c: Rebuild.
* mc-boot/GmcComment.c: Rebuild.
* mc-boot/GmcComp.c: Rebuild.
* mc-boot/GmcDebug.c: Rebuild.
* mc-boot/GmcError.c: Rebuild.
* mc-boot/GmcFileName.c: Rebuild.
* mc-boot/GmcLexBuf.c: Rebuild.
* mc-boot/GmcMetaError.c: Rebuild.
* mc-boot/GmcOptions.c: Rebuild.
* mc-boot/GmcPreprocess.c: Rebuild.
* mc-boot/GmcPretty.c: Rebuild.
* mc-boot/GmcPrintf.c: Rebuild.
* mc-boot/GmcQuiet.c: Rebuild.
* mc-boot/GmcReserved.c: Rebuild.
* mc-boot/GmcSearch.c: Rebuild.
* mc-boot/GmcStack.c: Rebuild.
* mc-boot/GmcStream.c: Rebuild.
* mc-boot/Gmcp1.c: Rebuild.
* mc-boot/Gmcp2.c: Rebuild.
* mc-boot/Gmcp3.c: Rebuild.
* mc-boot/Gmcp4.c: Rebuild.
* mc-boot/Gmcp5.c: Rebuild.
* mc-boot/GnameKey.c: Rebuild.
* mc-boot/GsymbolKey.c: Rebuild.
* mc-boot/Gtop.c: Rebuild.
* mc-boot/Gvarargs.c: Rebuild.
* mc-boot/Gwlists.c: Rebuild.
* mc-boot/GRTentity.h: New file.
* mc/decl.mod (scaffoldStatic): Change _finish to _fini.
* mc/mc.flex (_M2_mcflex_fini): New function.
(_M2_mcflex_finish): Remove function.
* tools-src/mklink.c (GenerateFinishCalls): Change
_finish to _fini.
(GeneratePrototypes): Change _finish to _fini.

libgm2/ChangeLog:

* libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2cor/Makefile.in: Rebuild.
* libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2iso/Makefile.in: Rebuild.
* libm2log/Makefile.am (libm2log_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2log/Makefile.in: Rebuild.
* libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2pim/Makefile.in: Rebuild.

PR modula2/108612
PR modula2/108551

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agolibstdc++ testsuite: Correct S0 in std/time/hh_mm_ss/1.cc
Hans-Peter Nilsson [Wed, 1 Feb 2023 13:56:47 +0000 (14:56 +0100)] 
libstdc++ testsuite: Correct S0 in std/time/hh_mm_ss/1.cc

For targets where the ABI mandates structure layout that has
no padding, like cris-elf, this test started failing when
introduced as an add-on to the existing 1.cc, thereby
effectively causing a regression in testsuite results.
Adding an empty structure to S0, corresponds better to the
layout of hh_mm_ss<seconds>.

PR testsuite/108632
* testsuite/std/time/hh_mm_ss/1.cc (size): Add empty
struct at end of S0.

16 months agotestsuite: Run __bos tests to completion
Siddhesh Poyarekar [Wed, 1 Feb 2023 16:41:22 +0000 (11:41 -0500)] 
testsuite: Run __bos tests to completion

Instead of failing on first error, run all __builtin_object_size and
__builtin_dynamic_object_size tests to completion and then provide a
summary of which tests failed.

gcc/testsuite/ChangeLog:

* gcc.dg/builtin-dynamic-object-size-0.c: Move FAIL and nfail
into...
* gcc.dg/builtin-object-size-common.h: ... new file.
* g++.dg/ext/builtin-object-size1.C: Include
builtin-object-size-common.h.  Replace all abort with FAIL.
(main): Call DONE.
* g++.dg/ext/builtin-object-size2.C: Likewise.
* gcc.dg/builtin-object-size-1.c: Likewise.
* gcc.dg/builtin-object-size-12.c: Likewise.
* gcc.dg/builtin-object-size-13.c: Likewise.
* gcc.dg/builtin-object-size-15.c: Likewise.
* gcc.dg/builtin-object-size-2.c: Likewise.
* gcc.dg/builtin-object-size-3.c: Likewise.
* gcc.dg/builtin-object-size-4.c: Likewise.
* gcc.dg/builtin-object-size-6.c: Likewise.
* gcc.dg/builtin-object-size-7.c: Likewise.
* gcc.dg/builtin-object-size-8.c: Likewise.
* gcc.dg/pr101836.c: Likewise.
* gcc.dg/strict-flex-array-3.c: Likewise.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
16 months agoipa: silent -Wodr notes with -w
Martin Liska [Fri, 2 Dec 2022 10:37:41 +0000 (11:37 +0100)] 
ipa: silent -Wodr notes with -w

If -w is used, warn_odr properly sets *warned = false and
so it should be preserved when calling warn_types_mismatch.

Noticed that during a LTO reduction where I used -w.

gcc/ChangeLog:

* ipa-devirt.cc (odr_types_equivalent_p): Respect *warned
value if set.

16 months agoRanger cache - always use range_from_dom when updating.
Andrew MacLeod [Tue, 10 Jan 2023 18:40:56 +0000 (13:40 -0500)] 
Ranger cache - always use range_from_dom when updating.

When updating an existing range, if we dont query the dom tree, we can
get the global range instead of a proper range on some incoming edges
which cause the range to not be refined properly.

PR tree-optimization/108356
gcc/
* gimple-range-cache.cc (ranger_cache::range_on_edge): Always
do a search of the DOM tree for a range.

gcc/testsuite/
* gcc.dg/pr108356.c: New.

16 months agoipa: check if cache_token != NULL before hash_set::add call
Martin Liska [Tue, 24 Jan 2023 13:39:11 +0000 (14:39 +0100)] 
ipa: check if cache_token != NULL before hash_set::add call

We should not insert an empty value to the container.

PR ipa/108509

gcc/ChangeLog:

* cgraphunit.cc (walk_polymorphic_call_targets): Insert
ony non-null values.
* ipa.cc (walk_polymorphic_call_targets): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/ipa/pr108509.C: New test.

16 months agoFortran: Extend align-clause checks of OpenMP's allocate directive
Tobias Burnus [Wed, 1 Feb 2023 13:49:36 +0000 (14:49 +0100)] 
Fortran: Extend align-clause checks of OpenMP's allocate directive

gcc/fortran/ChangeLog:

* openmp.cc (resolve_omp_clauses): Check also for
power of two.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/allocate-3.f90: Fix ALIGN
usage, remove unused -fdump-tree-original.
* testsuite/libgomp.fortran/allocate-4.f90: New.

16 months agoc++: ICE with -Wlogical-op [PR107755]
Marek Polacek [Tue, 31 Jan 2023 19:36:30 +0000 (14:36 -0500)] 
c++: ICE with -Wlogical-op [PR107755]

Here we crash in the middle end because warn_logical_operator calls
build_range_check which calls various fold_* functions and those
don't work too well when we're still processing template trees.  For
instance here we crash because we're converting a RECORD_TYPE to bool.
At this point VIEW_CONVERT_EXPR<struct Foo>(b) hasn't yet been converted
to Foo::operator bool (&b).

I was excited to fix this with instantiation_dependent_expression_p
which can now be called from c-family/ as well, but the problem isn't
that the expression is dependent.  So, p_t_d it is.

PR c++/107755

gcc/cp/ChangeLog:

* call.cc (build_new_op): Don't call warn_logical_operator when
processing a template.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wlogical-op-4.C: New test.

16 months agodriver: fix -gz=none error message with missing zstd
Martin Liska [Fri, 27 Jan 2023 13:56:31 +0000 (14:56 +0100)] 
driver: fix -gz=none error message with missing zstd

We wrongly report:

$ echo "int main () {}" | gcc -xc -gz=none -
gcc: error: -gz=zstd is not supported in this configuration

if zstd compression is not supported by binutils. We should emit the
error message only if -gz=zstd.

PR driver/108572

gcc/ChangeLog:

* gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Report error only for
-gz=zstd.

16 months agoree: Fix -fcompare-debug issues in combine_reaching_defs [PR108573]
Jakub Jelinek [Wed, 1 Feb 2023 11:52:52 +0000 (12:52 +0100)] 
ree: Fix -fcompare-debug issues in combine_reaching_defs [PR108573]

The PR78437 r7-4871 changes made combine_reaching_defs punt on
WORD_REGISTER_OPERATIONS targets if a setter of smaller than word
register has wider uses.  This unfortunately breaks -fcompare-debug,
because if such a use appears only in DEBUG_INSN(s), while all other
uses aren't wider than the setter, we can REE optimize it without -g
and not with -g.

Such decisions shouldn't be based on debug instructions.  We could try
to reset them or adjust in some other way after we decide to perform the
change, but at least on the testcase which used to fail on riscv64-linux
the
(debug_insn 8 7 9 2 (var_location:HI s (minus:HI (subreg:HI (and:DI (reg:DI 10 a0 [160])
                (const_int 1 [0x1])) 0)
        (subreg:HI (ashiftrt:DI (reg/v:DI 9 s1 [orig:151 l ] [151])
                (debug_expr:SI D#1)) 0))) "pr108573.c":12:5 -1
     (nil))
clearly doesn't care about the upper bits and I have hard time imaging how
could one end up with DEBUG_INSN which actually cares about those upper
bits.

So, the following patch just ignores uses on DEBUG_INSNs in this case,
if we run into something where we'd need to do something further later on,
let's deal with it when we have a testcase for it.

2023-02-01  Jakub Jelinek  <jakub@redhat.com>

PR debug/108573
* ree.cc (combine_reaching_defs): Don't return false for paradoxical
subregs in DEBUG_INSNs.

* gcc.dg/pr108573.c: New test.

16 months agolibgomp.texi: Reverse-offload updates
Tobias Burnus [Wed, 1 Feb 2023 11:19:27 +0000 (12:19 +0100)] 
libgomp.texi: Reverse-offload updates

libgomp/
* libgomp.texi (5.0 Impl. Status): Update 'requires' and 'ancestor'.
(GCN): Add item about 'omp requires'.
(nvptx): Likewise; add item about reverse offload.

16 months agocompare-elim: Fix an RTL checking failure
Richard Sandiford [Wed, 1 Feb 2023 09:53:50 +0000 (09:53 +0000)] 
compare-elim: Fix an RTL checking failure

find_flags_uses_in_insn used SET_SRC without first checking
for a SET.  This showed up as an RTL checking failure in
g++.dg/torture/pr90994.C on aarch64.

gcc/
* compare-elim.cc (find_flags_uses_in_insn): Guard use of SET_SRC.

16 months agotestsuite: Fix g++.dg/gomp warnings for aarch64
Richard Sandiford [Wed, 1 Feb 2023 09:53:50 +0000 (09:53 +0000)] 
testsuite: Fix g++.dg/gomp warnings for aarch64

A couple of tweaks to make g++.dg/gomp clean on aarch64.

gcc/testsuite/
* g++.dg/gomp/attrs-10.C: Update warning strings for aarch64.
* g++.dg/gomp/declare-simd-8.C: Add expected warning for aarch64.

16 months agoc++, openmp: Handle some OMP_*/OACC_* constructs during constant expression evaluatio...
Jakub Jelinek [Wed, 1 Feb 2023 09:38:46 +0000 (10:38 +0100)] 
c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression evaluation [PR108607]

While potential_constant_expression_1 handled most of OMP_* codes (by saying that
they aren't potential constant expressions), OMP_SCOPE was missing in that list.
I've also added OMP_SCAN, though that is less important (similarly to OMP_SECTION
it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
As the testcase shows, it isn't enough, potential_constant_expression_1
can catch only some cases, as soon as one uses switch or ifs where at least
one of the possible paths could be constant expression, we can run into the
same codes during cxx_eval_constant_expression, so this patch handles those
there as well.

2023-02-01  Jakub Jelinek  <jakub@redhat.com>

PR c++/108607
* constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
and OACC_* constructs as non-constant.
(potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.

* g++.dg/gomp/pr108607.C: New test.

16 months agoIBM zSystems: Save argument registers to the stack -mpreserve-args
Andreas Krebbel [Wed, 1 Feb 2023 07:59:42 +0000 (08:59 +0100)] 
IBM zSystems: Save argument registers to the stack -mpreserve-args

This adds support for preserving the content of parameter registers to
the stack and emit CFI for it. This useful for applications which want
to implement their own stack unwinding and need access to function
arguments.

With the -mpreserve-args option GPRs and FPRs are save to the stack
slots which are reserved for stdargs in the register save area.

gcc/ChangeLog:

* config/s390/s390.cc (s390_restore_gpr_p): New function.
(s390_preserve_gpr_arg_in_range_p): New function.
(s390_preserve_gpr_arg_p): New function.
(s390_preserve_fpr_arg_p): New function.
(s390_register_info_stdarg_fpr): Rename to ...
(s390_register_info_arg_fpr): ... this. Add -mpreserve-args handling.
(s390_register_info_stdarg_gpr): Rename to ...
(s390_register_info_arg_gpr): ... this. Add -mpreserve-args handling.
(s390_register_info): Use the renamed functions above.
(s390_optimize_register_info): Likewise.
(save_fpr): Generate CFI for -mpreserve-args.
(save_gprs): Generate CFI for -mpreserve-args. Drop return value.
(s390_emit_prologue): Adjust to changed calling convention of save_gprs.
(s390_optimize_prologue): Likewise.
* config/s390/s390.opt: New option -mpreserve-args

gcc/testsuite/ChangeLog:

* gcc.target/s390/preserve-args-1.c: New test.
* gcc.target/s390/preserve-args-2.c: New test.

16 months agoIBM zSystems: Make stack_tie to work with hard frame pointer
Andreas Krebbel [Wed, 1 Feb 2023 07:59:42 +0000 (08:59 +0100)] 
IBM zSystems: Make stack_tie to work with hard frame pointer

With this patch a scheduling barrier is created to prevent the insn
setting up the frame-pointer and instructions which save GPRs to the
stack to be swapped.  Otherwise broken CFI information would be
generated since the stack save insns would use a base register which
is not currently declared as holding the CFA.

Without -mpreserve-args this did not happen because the store multiple
we used for saving the GPRs would also cover the frame-pointer
register and therefore creates a dependency on the frame-pointer
hardreg. However, with this patch the stack_tie is emitted regardless
of -mpreserve-args since this in general appears to be the safer
approach.

* config/s390/s390.cc (save_gprs): Use gen_frame_mem.
(restore_gprs): Likewise.
(s390_emit_stack_tie): Make the stack_tie to be dependent on the
frame pointer if a frame-pointer is used.
(s390_emit_prologue): Emit stack_tie when frame-pointer is needed.
* config/s390/s390.md (stack_tie): Add a register operand and
rename to ...
(@stack_tie<mode>): ... this.

16 months agoNew reg note REG_CFA_NORESTORE
Andreas Krebbel [Wed, 1 Feb 2023 07:59:41 +0000 (08:59 +0100)] 
New reg note REG_CFA_NORESTORE

This patch introduces a new reg note which can be used to tell the CFI
verification in dwarf2cfi that a register is stored without intending
to restore from it.

This is useful when storing e.g. register contents to the stack and
generate CFI for it although the register is not really supposed to be
restored.

gcc/ChangeLog:

* dwarf2cfi.cc (dwarf2out_frame_debug_cfa_restore): Add
EMIT_CFI parameter.
(dwarf2out_frame_debug): Add case for REG_CFA_NORESTORE.
* reg-notes.def (REG_CFA_NOTE): New reg note definition.

16 months agomiddle-end/108500 - replace recursive domtree DFS traversal
Richard Biener [Tue, 31 Jan 2023 14:45:43 +0000 (15:45 +0100)] 
middle-end/108500 - replace recursive domtree DFS traversal

The following replaces the recursive DFS traversal of the dominator
tree in assign_dfs_numbers with a tree traversal using the fact
that we have recorded parents.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

This makes r13-5325 somewhat obsolete, though not computing the
DFS numbers at all is beneficial in the cases where we perform
immediate CFG manipulations.

OK for trunk and later branch(es)?

Thanks,
Richard.

PR middle-end/108500
* dominance.cc (assign_dfs_numbers): Replace recursive DFS
with tree traversal algorithm.

16 months agoc++: Add -Wno-changes-meaning
Jason Merrill [Tue, 31 Jan 2023 17:56:56 +0000 (12:56 -0500)] 
c++: Add -Wno-changes-meaning

In recent years this error has been coming up more because other compilers
don't diagnose it as consistently.  So let's add a flag for it, and be more
lenient about cases that aren't likely to cause bugs.

gcc/ChangeLog:

* doc/invoke.texi: Document -Wno-changes-meaning.

gcc/c-family/ChangeLog:

* c.opt: Add -Wno-changes-meaning.

gcc/cp/ChangeLog:

* class.cc (note_name_declared_in_class): Change from permerror to
-Wchanges-meaning pedwarn, forcing -pedantic-errors for most cases.

gcc/testsuite/ChangeLog:

* g++.dg/warn/changes-meaning2.C: New test.
* g++.dg/warn/changes-meaning3.C: New test.

16 months agoanalyzer: fix uses of alloca in testsuite
David Malcolm [Wed, 1 Feb 2023 02:18:22 +0000 (21:18 -0500)] 
analyzer: fix uses of alloca in testsuite

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/call-summaries-2.c: Add
dg-require-effective-target alloca.
* gcc.dg/analyzer/imprecise-floating-point-1.c: Likewise.
* gcc.dg/analyzer/infinite-recursion-alloca.c: Likewise.
* gcc.dg/analyzer/malloc-callbacks.c: Likewise.
* gcc.dg/analyzer/out-of-bounds-5.c: Likewise.  Remove includes
of <stdio.h> and <alloca.h>.  Use "__builtin_free" rather than
"free", to match uses of "__builtin_malloc".
* gcc.dg/analyzer/putenv-1.c: Add dg-require-effective-target
alloca.
* gcc.dg/analyzer/write-to-string-literal-5.c: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
16 months agoanalyzer: fix -Wanalyzer-allocation-size false -ve on alloca [PR108616]
David Malcolm [Wed, 1 Feb 2023 02:18:10 +0000 (21:18 -0500)] 
analyzer: fix -Wanalyzer-allocation-size false -ve on alloca [PR108616]

gcc/analyzer/ChangeLog:
PR analyzer/108616
* pending-diagnostic.cc (fixup_location_in_macro_p): Add "alloca"
to macros that we shouldn't unwind inside.

gcc/testsuite/ChangeLog:
PR analyzer/108616
* gcc.dg/analyzer/allocation-size-multiline-3.c: New test.
* gcc.dg/analyzer/test-alloca.h: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
16 months agodoc: add notes about limitations of -fanalyzer
David Malcolm [Wed, 1 Feb 2023 02:18:00 +0000 (21:18 -0500)] 
doc: add notes about limitations of -fanalyzer

gcc/ChangeLog:
* doc/invoke.texi (Static Analyzer Options): Add notes about
limitations of -fanalyzer.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
16 months agoDaily bump.
GCC Administrator [Wed, 1 Feb 2023 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

16 months agoc++: aggregate base and TARGET_EXPR_ELIDING_P [PR108559]
Jason Merrill [Mon, 30 Jan 2023 23:18:54 +0000 (18:18 -0500)] 
c++: aggregate base and TARGET_EXPR_ELIDING_P [PR108559]

We also need to split up a CONSTRUCTOR in cp_genericize_init if we need to
add extra copy constructor calls to deal with CWG2403.

PR c++/108559

gcc/cp/ChangeLog:

* cp-gimplify.cc (any_non_eliding_target_exprs): New.
(cp_genericize_init): Check it.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/aggr-base13.C: New test.

16 months agolibsanitizer: cherry-pick commit 742bcbf685bc from upstream
H.J. Lu [Tue, 31 Jan 2023 22:34:00 +0000 (14:34 -0800)] 
libsanitizer: cherry-pick commit 742bcbf685bc from upstream

cherry-pick:

742bcbf685bc compiler-rt/lib: Add .Linterceptor_sigsetjmp

PR sanitizer/108106
* hwasan/hwasan_setjmp_x86_64.S (__interceptor_setjmp): Jump
to .Linterceptor_sigsetjmp instead of __interceptor_sigsetjmp.
(__interceptor_sigsetjmp): Add a local alias,
.Linterceptor_sigsetjmp.

16 months agoFor Modula-2 build-tree testing, also set up paths to compiler libraries
Thomas Schwinge [Tue, 31 Jan 2023 10:38:15 +0000 (11:38 +0100)] 
For Modula-2 build-tree testing, also set up paths to compiler libraries

Currently, 'gcc/testsuite/lib/gm2.exp:gm2_link_flags' doesn't set up
paths to compiler libraries (such as libgcc, which libstdc++
may depend on).  For example, I see my x86_64-pc-linux-gnu '-m32' testing
not pick up the build-tree libgcc, but instead some random system one,
which (expectedly) doesn't satisfy requirements of other build-tree
libraries:

    [...]/build-gcc/gcc/testsuite/gm225/m.x0: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by [...]/build-gcc/x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6)

..., and thus a lot of execution FAILs.

As seen in a number of other '[...]_link_flags' procedures, the standard idiom
seems to be to also consider 'gcc-set-multilib-library-path' for
'ld_library_path'.

gcc/testsuite/
* lib/gm2.exp (gm2_link_flags) [$gccpath != ""]: Also consider
'gcc-set-multilib-library-path' for 'ld_library_path'.

16 months agoc++: Add fixed test [PR102870]
Marek Polacek [Tue, 31 Jan 2023 18:27:21 +0000 (13:27 -0500)] 
c++: Add fixed test [PR102870]

This was fixed by r12-7857: now we properly reject instead of
crashing.

PR c++/102870

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic184.C: New test.

16 months agoRISC-V: Add vdiv*.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:10:28 +0000 (21:10 +0800)] 
RISC-V: Add vdiv*.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vdiv_vv-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vmax*.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:08:39 +0000 (21:08 +0800)] 
RISC-V: Add vmax*.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vmax_vv-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vmin*.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:06:50 +0000 (21:06 +0800)] 
RISC-V: Add vmin*.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vmin_vv-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vor.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:05:17 +0000 (21:05 +0800)] 
RISC-V: Add vor.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vor_vv-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vrem*.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:03:19 +0000 (21:03 +0800)] 
RISC-V: Add vrem*.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vrem_vv-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vsll.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:01:37 +0000 (21:01 +0800)] 
RISC-V: Add vsll.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vsll_vv-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vsra.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:59:58 +0000 (20:59 +0800)] 
RISC-V: Add vsra.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vsra_vv-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vsrl.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:58:20 +0000 (20:58 +0800)] 
RISC-V: Add vsrl.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vsrl_vv-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vand.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:55:37 +0000 (20:55 +0800)] 
RISC-V: Add vand.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vand_vv-1.C: New test.
* g++.target/riscv/rvv/base/vand_vv-2.C: New test.
* g++.target/riscv/rvv/base/vand_vv-3.C: New test.
* g++.target/riscv/rvv/base/vand_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vand_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vand_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vand_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vsub_vv-1.C: New test.
* g++.target/riscv/rvv/base/vsub_vv-2.C: New test.
* g++.target/riscv/rvv/base/vsub_vv-3.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsub_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vxor.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:49:46 +0000 (20:49 +0800)] 
RISC-V: Add vxor.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vxor_vv-1.C: New test.
* g++.target/riscv/rvv/base/vxor_vv-2.C: New test.
* g++.target/riscv/rvv/base/vxor_vv-3.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vxor_vv_tumu-3.C: New test.

16 months agoRISC-V: Add vadd.vv C++ API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:41:06 +0000 (20:41 +0800)] 
RISC-V: Add vadd.vv C++ API tests

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/vadd_vv-1.C: New test.
* g++.target/riscv/rvv/base/vadd_vv-2.C: New test.
* g++.target/riscv/rvv/base/vadd_vv-3.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vadd_vv_tumu-3.C: New test.

16 months agoRISC-V: Add binop constraint tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:39:33 +0000 (20:39 +0800)] 
RISC-V: Add binop constraint tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/binop_vv_constraint-1.c: New test.

16 months agoRISC-V: Add vadd.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:37:43 +0000 (20:37 +0800)] 
RISC-V: Add vadd.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vadd_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vadd_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vand.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:34:11 +0000 (20:34 +0800)] 
RISC-V: Add vand.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vand_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vand_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vand_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vand_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vdiv*.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:30:06 +0000 (20:30 +0800)] 
RISC-V: Add vdiv*.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vdiv_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vdiv_vv_tumu-3.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vdivu_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vmax*.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:28:36 +0000 (20:28 +0800)] 
RISC-V: Add vmax*.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vmax_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vmax_vv_tumu-3.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vmaxu_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vmin*.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:27:09 +0000 (20:27 +0800)] 
RISC-V: Add vmin*.vv C API tests

* gcc.target/riscv/rvv/base/vmin_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vmin_vv_tumu-3.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vminu_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vor.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:25:19 +0000 (20:25 +0800)] 
RISC-V: Add vor.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vor_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vor_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vor_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vor_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vrem*.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:22:35 +0000 (20:22 +0800)] 
RISC-V: Add vrem*.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vrem_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vrem_vv_tumu-3.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vremu_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vsll.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:20:23 +0000 (20:20 +0800)] 
RISC-V: Add vsll.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vsll_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vsra.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:18:20 +0000 (20:18 +0800)] 
RISC-V: Add vsra.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vsra_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vv_tumu-3.c: New test.

16 months agoRISC-V: Add srl.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:16:47 +0000 (20:16 +0800)] 
RISC-V: Add srl.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vsrl_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vsub.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:13:40 +0000 (20:13 +0800)] 
RISC-V: Add vsub.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vsub_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsub_vv_tumu-3.c: New test.

16 months agoRISC-V: Add vxor.vv C API tests
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:12:06 +0000 (20:12 +0800)] 
RISC-V: Add vxor.vv C API tests

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vxor_vv-1.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv-2.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv-3.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_m-1.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_m-2.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_m-3.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vxor_vv_tumu-3.c: New test.

16 months agoRISC-V: Add integer binary vv C/C++ API support
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:06:31 +0000 (20:06 +0800)] 
RISC-V: Add integer binary vv C/C++ API support

Add vector intrinsic for integer binary operation, but only vector to
vector form.

gcc/ChangeLog:

* config/riscv/constraints.md (vj): New.
(vk): Ditto
* config/riscv/iterators.md: Add more opcode.
* config/riscv/predicates.md (vector_arith_operand): New.
(vector_neg_arith_operand): New.
(vector_shift_operand): New.
* config/riscv/riscv-vector-builtins-bases.cc (class binop): New.
* config/riscv/riscv-vector-builtins-bases.h: (vadd): New.
(vsub): Ditto.
(vand): Ditto.
(vor): Ditto.
(vxor): Ditto.
(vsll): Ditto.
(vsra): Ditto.
(vsrl): Ditto.
(vmin): Ditto.
(vmax): Ditto.
(vminu): Ditto.
(vmaxu): Ditto.
(vmul): Ditto.
(vdiv): Ditto.
(vrem): Ditto.
(vdivu): Ditto.
(vremu): Ditto.
* config/riscv/riscv-vector-builtins-functions.def (vadd): New.
(vsub): Ditto.
(vand): Ditto.
(vor): Ditto.
(vxor): Ditto.
(vsll): Ditto.
(vsra): Ditto.
(vsrl): Ditto.
(vmin): Ditto.
(vmax): Ditto.
(vminu): Ditto.
(vmaxu): Ditto.
(vmul): Ditto.
(vdiv): Ditto.
(vrem): Ditto.
(vdivu): Ditto.
(vremu): Ditto.
* config/riscv/riscv-vector-builtins-shapes.cc (struct binop_def): New.
* config/riscv/riscv-vector-builtins-shapes.h (binop): New.
* config/riscv/riscv-vector-builtins.cc (DEF_RVV_I_OPS): New.
(DEF_RVV_U_OPS): New.
(rvv_arg_type_info::get_base_vector_type): Handle
RVV_BASE_shift_vector.
(rvv_arg_type_info::get_tree_type): Ditto.
* config/riscv/riscv-vector-builtins.h (enum rvv_base_type): Add
RVV_BASE_shift_vector.
* config/riscv/riscv.cc (riscv_print_operand): Handle 'V'.
* config/riscv/vector-iterators.md: Handle more opcode.
* config/riscv/vector.md (@pred_<optab><mode>): New.

16 months agoc++: fix ICE with -Wduplicated-cond [PR107593]
Marek Polacek [Thu, 26 Jan 2023 14:34:28 +0000 (09:34 -0500)] 
c++: fix ICE with -Wduplicated-cond [PR107593]

Here we crash because a CAST_EXPR, representing T(), doesn't have
its operand, and operand_equal_p's STRIP_ANY_LOCATION_WRAPPER doesn't
expect that.  (o_e_p is called from warn_duplicated_cond_add_or_warn.)

In the past we've adjusted o_e_p to better cope with template codes,
but in this case I think we just want to avoid attempting to warn
about inst-dependent expressions; I don't think I've ever envisioned
-Wduplicated-cond to warn about them.  Also destroy the chain when
an inst-dependent expression is encountered to not warn in
Wduplicated-cond4.C.

The ICE started with r12-6022, two-stage name lookup for overloaded
operators, which gave dependent operators a TREE_TYPE (in particular,
DEPENDENT_OPERATOR_TYPE), so we no longer bail out here in o_e_p:

  /* Similar, if either does not have a type (like a template id),
     they aren't equal.  */
  if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1))
    return false;

PR c++/107593
PR c++/108597

gcc/c-family/ChangeLog:

* c-common.h (instantiation_dependent_expression_p): Declare.
* c-warn.cc (warn_duplicated_cond_add_or_warn): If the condition
is dependent, invalidate the chain.

gcc/c/ChangeLog:

* c-objc-common.cc (instantiation_dependent_expression_p): New.

gcc/cp/ChangeLog:

* cp-tree.h (instantiation_dependent_expression_p): Don't
declare here.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wduplicated-cond3.C: New test.
* g++.dg/warn/Wduplicated-cond4.C: New test.
* g++.dg/warn/Wduplicated-cond5.C: New test.

16 months agoPR target/108589 - Check REG_P for AARCH64_FUSE_ADDSUB_2REG_CONST1
Philipp Tomsich [Mon, 30 Jan 2023 22:40:26 +0000 (23:40 +0100)] 
PR target/108589 - Check REG_P for AARCH64_FUSE_ADDSUB_2REG_CONST1

This adds a check for REG_P on SET_DEST for the new idiom recognizer
for AARCH64_FUSE_ADDSUB_2REG_CONST1.  The reported ICE is only
observable with checking=rtl.

Bootstrapped/regtested aarch64-linux, committed.

PR target/108589

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch_macro_fusion_pair_p): Check
REG_P on SET_DEST.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr108589.c: New test.

16 months agovect: Fix single def-use cycle for ifn reductions [PR108608]
Richard Sandiford [Tue, 31 Jan 2023 15:03:43 +0000 (15:03 +0000)] 
vect: Fix single def-use cycle for ifn reductions [PR108608]

The patch that added support for fmin/fmax reductions didn't
handle single def-use cycles.  In some ways, this seems like
going out of our way to make things slower, but that's a
discussion for another day.

gcc/
PR tree-optimization/108608
* tree-vect-loop.cc (vect_transform_reduction): Handle single
def-use cycles that involve function calls rather than tree codes.

gcc/testsuite/
PR tree-optimization/108608
* gcc.dg/vect/pr108608.c: New test.
* gcc.target/aarch64/sve/pr108608-1.c: Likewise.

16 months agoAdd op2_range to pointer_plus.
Andrew MacLeod [Tue, 17 Jan 2023 16:39:47 +0000 (11:39 -0500)] 
Add op2_range to pointer_plus.

Implement op2_range for pointer_plus to determine the offset (operand 2) is
zero or non-zero based on equality/inequality between the LHS and op1.
Also allow GORI computations to continue if the LHS is VARYING and there
is also a relation.

PR tree-optimization/108385
gcc/
* gimple-range-gori.cc (gori_compute::compute_operand_range):
Allow VARYING computations to continue if there is a relation.
* range-op.cc (pointer_plus_operator::op2_range): New.

gcc/testsuite/
* gcc.dg/pr108385.c: New.

16 months agoUtilize op1 == op2 when invoking range-ops folding.
Andrew MacLeod [Tue, 17 Jan 2023 16:14:41 +0000 (11:14 -0500)] 
Utilize op1 == op2 when invoking range-ops folding.

If there exists an equivalence relationship between op1 and op2,
any binary operation can be broken into individual operations and
unioned if there are sufficently few elements in the set.

PR tree-optimization/108359
gcc/
* range-op.cc (range_operator::wi_fold_in_parts_equiv): New.
(range_operator::fold_range): If op1 is equivalent to op2 then
invoke new fold_in_parts_equiv to operate on sub-components.
* range-op.h (wi_fold_in_parts_equiv): New prototype.

gcc/testsuite/
* gcc.dg/pr108359.c: New.

16 months agoProperly set GORI relation trios.
Andrew MacLeod [Wed, 25 Jan 2023 21:26:39 +0000 (16:26 -0500)] 
Properly set GORI relation trios.

When relation trios were added to GORI, there was only one use.  As they are
utilized more by range-ops, it is apparent that the implelemtation was
not complete.  This patch fleshes it out completely so that every GORI
operation has a complete relation trio.

* gimple-range-gori.cc (gori_compute::compute_operand_range): Do
not abort calculations if there is a valid relation available.
(gori_compute::refine_using_relation): Pass correct relation trio.
(gori_compute::compute_operand1_range): Create trio and use it.
(gori_compute::compute_operand2_range): Ditto.
* range-op.cc (operator_plus::op1_range): Use correct trio member.
(operator_minus::op1_range): Use correct trio member.
* value-relation.cc (value_relation::create_trio): New.
* value-relation.h (value_relation::create_trio): New prototype.

16 months agomodula2/108462 - duplicate install of static modula2 target libs
Richard Biener [Mon, 23 Jan 2023 10:43:53 +0000 (11:43 +0100)] 
modula2/108462 - duplicate install of static modula2 target libs

The following addresses the fact that libgm2 installs static libraries
into two places, one performed by

toolexeclib_LTLIBRARIES = libm2cor.la

and one performed as part of the install-data-local rule to a
m2/m2cor subdirectory alongside Modula-2 .def and .mod files.

This patch opts to keep the copy installed by libtool and removes
the extra installs in the install-data-local rules.

I've built and installed both with and without
--enable-version-specific-runtime-libs and compiled and linked
a Modula-2 testcase with the installed compiler with the two
multilibs and with and without static successfully.

PR modula2/108462
libgm2/
* libm2cor/Makefile.am: Remove static lib install from
install-data-local.
* libm2iso/Makefile.am: Likewise.
* libm2log/Makefile.am: Likewise.
* libm2min/Makefile.am: Likewise.
* libm2pim/Makefile.am: Likewise.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.in: Likewise.
* libm2log/Makefile.in: Likewise.
* libm2min/Makefile.in: Likewise.
* libm2pim/Makefile.in: Likewise.

16 months agogccrs: Add testcase to show forward declared items work via TypeAlias
Philip Herron [Tue, 27 Sep 2022 07:57:49 +0000 (08:57 +0100)] 
gccrs: Add testcase to show forward declared items work via TypeAlias

Fixes #1073

gcc/testsuite/ChangeLog:

* rust/compile/issue-1073.rs: New test.

16 months agogccrs: Add testcase to show forward declared items work
Philip Herron [Tue, 27 Sep 2022 07:56:16 +0000 (08:56 +0100)] 
gccrs: Add testcase to show forward declared items work

Fixes #1006

gcc/testsuite/ChangeLog:

* rust/compile/issue-1006.rs: New test.

16 months agogccrs: Refactor TypeResolution to be a simple query based system
Philip Herron [Mon, 16 Jan 2023 11:36:53 +0000 (12:36 +0100)] 
gccrs: Refactor TypeResolution to be a simple query based system

This patch refactors the type resolution system to introduce a new
interface

  bool query_type (HirId, TyTy::BaseType** result)

This is needed in order to properly support forward declared items. Our
name resolution system has two parts:

  1. Toplevel scan
  2. Item resolution

The toplevel scan gathers all the nesseacry 'names' into their respective
namespace by doing a full toplevel scan and generate canonical paths for
each item. The second pass is responsible for drilling down into each
structure or function to resolve each field or variable etc. This means
our name resolution system supports forward decalred items but our type
resolution system did not.

This patch removes the toplevel scan from our type resolution pass which
is not able to handle all cases such as a function with return type and
the type is decalred after the fact or a type alias to a type declared
after the fact. The name resolution mappings are resolved so when errors
occured here we got errors such as unable to lookup HirId 1234, which meant
yes we have 'resolved' this reference to this HirId but we are unable to
find any type information for it. This means we needed a new way to figure
out the type in a query based way.

This is where the new query_type inferface comes in so when we have an
HirId we want to resolve the mappings class allows us to figure out what
item this is such as:

  1. HIR::Item (normal HIR::Function, Struct, TypeAlias, ...)
  2. HIR::ImplItem (function, constant, ... within an impl-block)
  3. HIR::ImplBlock (Self type on an impl-block)
  4. HIR::ExternalItem (extern-block item)

The mappings class allows us to simply lookup these HIR nodes and then
call the relevant resolver class to compute the type. This patch does not
add support for self-referencial types but is the starting point to be able
to support such types.

Fixes #1455

gcc/rust/ChangeLog:

* Make-lang.in: Remove `rust-hir-typecheck-toplevel` object and add
`rust-hir-path-probe` one.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::MethodResolver):
Remove no longer used `context` and `mapping` fields, and use new
`query_type` API.
(MethodResolver::MethodResolver): Likewise.
(MethodResolver::select): Use new `query_type` API.
* typecheck/rust-hir-path-probe.h: New header.
* typecheck/rust-hir-path-probe.cc: New file.
* typecheck/rust-hir-dot-operator.h (class MethodResolver): Remove no
longer used `context` and `mapping` fields, and use new `query_type` API.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): New function.
* typecheck/rust-hir-type-check-base.h: Declare `query_type` function.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add debug print.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::Resolve):
Refactor and make use of new query system.
(TypeCheckTopLevelExternItem::Resolve): Likewise.
(TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckTopLevelImplItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItem::TypeCheckImplItem): Likewise.
(TypeCheckImplItem::Resolve): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h (class TypeCheckTopLevelImplItem): Likewise.
(class TypeCheckImplItemWithTrait): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::TypeCheckItem): Likewise.
(TypeCheckItem::Resolve): Likewise.
(TypeCheckItem::ResolveImplItem): Likewise.
(TypeCheckItem::ResolveImplBlockSelf): Likewise.
(TypeCheckItem::visit): Likewise.
(TypeCheckItem::resolve_impl_item): Likewise.
(TypeCheckItem::resolve_impl_block_substitutions): Likewise.
(TypeCheckItem::resolve_impl_block_self): Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::Resolve): Likewise.
(TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* typecheck/rust-hir-type-check.h: Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
(TypeBoundsMappings::add_bound): Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-tyty.cc (SubstitutionRef::infer_substitions): Likewise.
(ParamType::resolve): Do not infinite loop anymore.
* util/rust-hir-map.h: Add new `hirImplBlockTypeMappings` and
declare `lookup_impl_block_type`.
* util/rust-hir-map.cc (Mappings::insert_hir_impl_block): Use new
`hirImplBlockTypeMappings`
(Mappings::lookup_impl_block_type): New function.

gcc/testsuite/ChangeLog:

* rust/compile/const_generics_5.rs: Fix assertions.
* rust/compile/unconstrained_type_param.rs: Add more assertions.

16 months agogccrs: Fix duplicated function generation on higher ranked trait bounds
Philip Herron [Tue, 27 Sep 2022 11:19:43 +0000 (12:19 +0100)] 
gccrs: Fix duplicated function generation on higher ranked trait bounds

Deuplicate function elimination can fail when we compile helpers during
higher ranked trait bound monomorphization. This because the
TyTy::BaseType info can be lost/reset during the compilation process. This
adds a second mechanism to match based on the manged names which is a bit
more reliable. This patch is required since the query based refactor of
the type system so this issue was likely hidden to to using duplicated type
info for higher ranked trait bounds.

gcc/rust/ChangeLog:

* backend/rust-compile-context.h: Add new optional `asm_name` string
argument to `lookup_function_decl`.
* backend/rust-compile-item.cc (CompileItem::visit): Compute assembly
name and pass it to `lookup_function_decl` when calling it.

16 months agogccrs: Make constexpr constructors type-checking more permissive
Philip Herron [Tue, 27 Sep 2022 10:36:35 +0000 (11:36 +0100)] 
gccrs: Make constexpr constructors type-checking more permissive

gcc/rust/ChangeLog:

* backend/rust-constexpr.cc (eval_store_expression): Remove invalid
assertion on constexpr constructors.

16 months agogccrs: Cleanup formatting of backend expression visitor
Philip Herron [Tue, 27 Sep 2022 10:34:21 +0000 (11:34 +0100)] 
gccrs: Cleanup formatting of backend expression visitor

gcc/rust/ChangeLog:

* backend/rust-compile-expr.h: Formatting.

16 months agogccrs: testsuite/rust: add a testcase for testing ...
liushuyu [Tue, 27 Sep 2022 04:30:33 +0000 (22:30 -0600)] 
gccrs: testsuite/rust: add a testcase for testing ...

... builtin macro and decl macro mixed expansion

gcc/testsuite/ChangeLog:

* rust/compile/builtin_macro_recurse.rs: New test.

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
16 months agogccrs: expand: eager evaluate macros inside builtin macros
liushuyu [Fri, 2 Sep 2022 22:08:39 +0000 (16:08 -0600)] 
gccrs: expand: eager evaluate macros inside builtin macros

gcc/rust/ChangeLog:

* ast/rust-ast.h (class MacroInvocData): Store expander as
member of the class.
(class Expr): Add `is_literal` virtual method
* ast/rust-expr.h: Override `is_literal` for `LiteralExpr`s.
* expand/rust-macro-builtins.cc (try_expand_macro_expression): New function.
(try_extract_string_literal_from_fragment): Likewise.
(try_expand_single_string_literal): Likewise.
(try_expand_many_expr): Likewise.
(parse_single_string_literal): Add macro expander as argument.
(MacroBuiltin::include_bytes): Pass expander as argument to
`parse_single_string_literal`.
(MacroBuiltin::include_str): Likewise.
(MacroBuiltin::compile_error): Likewise.
(MacroBuiltin::include): Likewise.
(MacroBuiltin::concat): Likewise and add better error handling.
(MacroBuiltin::env): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Expand
invocations recursively.

gcc/testsuite/ChangeLog:

* rust/compile/builtin_macro_concat.rs: Fix test error messages.
* rust/compile/builtin_macro_env.rs: Likewise.

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
16 months agogccrs: rust: Add -frust-compile-until option
Arthur Cohen [Wed, 31 Aug 2022 11:53:28 +0000 (13:53 +0200)] 
gccrs: rust: Add -frust-compile-until option

This option helps ensure that we do not introduce regressions on various
parts of the compilation pipeline. For example, a testcase (or testsuite
from the `testing` project) might pass attribute checking, expansion and
lowering, but fail during typechecking. Should a change suddenly make
that testcase fail expansion, we would not be able to notice it. By
generating tests that run up until expansion, typechecking, compilation
and so forth we ensure that no regressions are added accidentally to
already failing tests/testsuites.

gcc/rust/ChangeLog:

* lang.opt: Add new ``-frust-compile-until` option.
* rust-session-manager.cc (Session::compile_crate): Add stops around
various compilation steps in the pipeline.
* rust-session-manager.h (struct CompileOptions): Add `CompileStep` enum
and field.

gcc/testsuite/ChangeLog:

* rust/compile/frust-compile-until.rs: New test.

16 months agogccrs: Add testcase for const-eval issue from rust-blog
Philip Herron [Sun, 18 Sep 2022 09:37:06 +0000 (10:37 +0100)] 
gccrs: Add testcase for const-eval issue from rust-blog

see:
https://blog.rust-lang.org/2022/09/15/const-eval-safety-rule-revision.html

gcc/testsuite/ChangeLog:

* rust/compile/rust-const-blog-issue.rs: New test.

16 months agogccrs: remove bad assertion
Philip Herron [Sat, 17 Sep 2022 09:06:48 +0000 (10:06 +0100)] 
gccrs: remove bad assertion

gcc/rust/ChangeLog:

* backend/rust-tree.cc (rs_type_quals): Comment out bad assertion

16 months agogccrs: Statics are a coercion site
Philip Herron [Sat, 17 Sep 2022 09:05:59 +0000 (10:05 +0100)] 
gccrs: Statics are a coercion site

Statics can be assigned to a block expression meaning they need to behave
similarly to constant items.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit):
Make static items behave more similarly to const items.

16 months agogccrs: Static Items must be const evaluated
Philip Herron [Sat, 17 Sep 2022 09:04:49 +0000 (10:04 +0100)] 
gccrs: Static Items must be const evaluated

Statics like constants need to have a singular value they are not functions
to be lazy evaluated. So to evaluate a block expr we can just reuse our
const code to resolve this to a singular value.

gcc/rust/ChangeLog:

* backend/rust-compile-item.cc (CompileItem::visit): Const evaluate
static item expressions.

16 months agogccrs: module lowering: Do not append null pointers as items
Arthur Cohen [Wed, 14 Sep 2022 08:23:46 +0000 (10:23 +0200)] 
gccrs: module lowering: Do not append null pointers as items

Some module items do not need to get lowered to HIR such as `macro_rules!` definitions. Hence, module lowering should act the same as crate lowering: Only emplace back the lowered item if it is a valid pointer

gcc/rust/ChangeLog:

* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Do not lower
null items within modules.

gcc/testsuite/ChangeLog:

* rust/compile/macro44.rs: New test.

16 months agogccrs: attributes: Add #[macro_use] as builtin
Arthur Cohen [Tue, 13 Sep 2022 14:30:28 +0000 (16:30 +0200)] 
gccrs: attributes: Add #[macro_use] as builtin

gcc/rust/ChangeLog:

* util/rust-attributes.cc: Add `macro_use` to list of builtin
attributes.

gcc/testsuite/ChangeLog:

* rust/compile/macro_export_1.rs: New test.

16 months agogccrs: const generics: Forbid default values in Functions, Traits and Impls
Arthur Cohen [Mon, 12 Sep 2022 14:26:46 +0000 (16:26 +0200)] 
gccrs: const generics: Forbid default values in Functions, Traits and Impls

gcc/rust/ChangeLog:

* checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Allow
getting an error string from a specific constant context.
(ConstChecker::ctx_allows_default): New function, check if a context
allows default values for Const generics.
(ConstChecker::visit): Call into `ctx_allows_default`.
* checks/errors/rust-const-checker.h: Declare `ctx_allows_default`.

gcc/testsuite/ChangeLog:

* rust/compile/const_generics_8.rs: New test.

16 months agogccrs: const generics: Make sure const generic types are visited properly
Arthur Cohen [Mon, 12 Sep 2022 13:53:01 +0000 (15:53 +0200)] 
gccrs: const generics: Make sure const generic types are visited properly

...in all contexts.

gcc/testsuite/ChangeLog:

* rust/compile/const_generics_7.rs: New test.

16 months agogccrs: testsuite: add loop condition execution test
liushuyu [Wed, 7 Sep 2022 04:41:17 +0000 (22:41 -0600)] 
gccrs: testsuite: add loop condition execution test

gcc/testsuite/ChangeLog:

* rust/execute/torture/loop-condition-eval.rs: New test.

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
16 months agogccrs: add testcase with struct to test component_ref and constructor codes..
Faisal Abbas [Tue, 6 Sep 2022 21:24:52 +0000 (22:24 +0100)] 
gccrs: add testcase with struct to test component_ref and constructor codes..

..in eval_constant_expression()

gcc/testsuite/ChangeLog:

* rust/compile/const8.rs: New test.

Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
16 months agogccrs: backend: correctly formulate the exit condition ...
liushuyu [Mon, 5 Sep 2022 23:56:03 +0000 (17:56 -0600)] 
gccrs: backend: correctly formulate the exit condition ...

... previously the exit condition was treated the same as the loop
condition (which is the inverse condition of the exit condition). Now
this is corrected.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): Properly formulate
exit condition when compiling while loops.

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
16 months agogccrs: add testcase to test component_ref and constructor codes in eval_constant_expr...
Faisal Abbas [Sun, 4 Sep 2022 15:18:40 +0000 (16:18 +0100)] 
gccrs: add testcase to test component_ref and constructor codes in eval_constant_expression()

gcc/testsuite/ChangeLog:

* rust/compile/const7.rs: New test.

Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
16 months agogccrs: bugfix: initialize slice from array in const context
Faisal Abbas [Sun, 4 Sep 2022 15:07:43 +0000 (16:07 +0100)] 
gccrs: bugfix: initialize slice from array in const context

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Turn
constant item typechecking into a coercion site instead of a unify
site.

gcc/testsuite/ChangeLog:

* rust/compile/const6.rs: New test.

Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
16 months agogccrs: Unit structs are not concrete when they need substitutions
Philip Herron [Wed, 31 Aug 2022 16:16:13 +0000 (17:16 +0100)] 
gccrs: Unit structs are not concrete when they need substitutions

Fixes #1518

gcc/rust/ChangeLog:

* typecheck/rust-tyty.h: Fix `is_concrete` for unit types with
substitutions.

16 months agogccrs: Add new check for contains_associated_types
Philip Herron [Wed, 31 Aug 2022 16:07:51 +0000 (17:07 +0100)] 
gccrs: Add new check for contains_associated_types

We don't need to setup associated types when a trait does not contain any
associated types.

gcc/rust/ChangeLog:

* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::contains_associated_types):
Check if a type bound predicate contains assocated types.
* typecheck/rust-tyty.h: Declare the above mentioned function.
* typecheck/rust-hir-trait-resolve.cc: Use `contains_associated_types`
function.

16 months agogccrs: Add extra debugging for method call expressions
Philip Herron [Wed, 31 Aug 2022 16:07:09 +0000 (17:07 +0100)] 
gccrs: Add extra debugging for method call expressions

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add
more calls to `rust_debug` for development.