platform/upstream/gcc.git
19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

19 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.

20 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.

20 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>
20 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>
20 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>
20 months agoDaily bump.
GCC Administrator [Wed, 1 Feb 2023 00:18:50 +0000 (00:18 +0000)]
Daily bump.

20 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.

20 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.

20 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'.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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>
20 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>
20 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.

20 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.

20 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

20 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.

20 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.

20 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.

20 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.

20 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.

20 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.

20 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>
20 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>
20 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>
20 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>
20 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>
20 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.

20 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.

20 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.

20 months agogccrs: Create canonical process of compiling constant items
Philip Herron [Thu, 25 Aug 2022 13:46:32 +0000 (14:46 +0100)]
gccrs: Create canonical process of compiling constant items

In order to compile a block expression constant, the simplest way for us
was to reuse what code we have and to generate an artifical function which
does not get added to the translation unit. The constant then becomes
a CALL_EXPR to this artifical function which we can pass to the constexpr
evaluator to resolve the result of this artifical 'CALL_EXPR'.

Before this patch we seperated the difference between block expressions
and non block expressions in constants. So for non block expressions we
simply compiled them as if it was a simple constant but this is not
guaranteed to be the case in rust, for example coercion sites can generate
temporaries during autoderef which we let the constant evaluator resolve
for us. This makes all constants handled in the same way to simplify the
logic here.

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc: Improve compilation pipeline and simplify
function.

20 months agogccrs: Remove param_use_canonical_types checks ported from c++ front-end
Philip Herron [Wed, 31 Aug 2022 13:08:43 +0000 (14:08 +0100)]
gccrs: Remove param_use_canonical_types checks ported from c++ front-end

We are not fully setting TYPE_CANONICAL yet but we don't need to be as
strict as the C++ front-end yet. param_use_canonical_types is a command
line option we are not using either.

gcc/rust/ChangeLog:

* backend/rust-tree.cc (comptypes): Remove some C++ specific checks in
Rust const folder for now.

20 months agogccrs: Refactor unify to hit a unify_site
Philip Herron [Fri, 26 Aug 2022 14:09:55 +0000 (15:09 +0100)]
gccrs: Refactor unify to hit a unify_site

This allows us to enforce better error handling on unify sites

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site): Add
better unification function with debug calls.
* typecheck/rust-autoderef.cc (AutoderefCycle::cycle): Add more debug
calls and use new unify API.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
(TypeCoercionRules::select): Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): Likewise.
(TypeCheckBase::coercion_site): Likewise.
(TypeCheckBase::cast_site): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelImplItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): Likewise.
* typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* typecheck/rust-tyctx.cc (TypeCheckContext::peek_return_type): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::visit): Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-rules.h: Likewise.
* typecheck/rust-tyty.cc (BaseType::mappings_str): Likewise.
(BaseType::debug): Print type name more clearly.
(BaseType::debug_str): Add new function to print type pointer and name.
(TupleType::get_name): Improve type name fetching function.
(ReferenceType::get_name): Likewise.
(PointerType::get_name): Likewise.
* typecheck/rust-tyty.h: Refactor definitions outside of the header.

gcc/testsuite/ChangeLog:

* rust/compile/issue-1152.rs: Fix dejagnu assertion.
* rust/compile/tuple1.rs: Likewise.
* rust/compile/type-alias1.rs: Likewise.
* rust/execute/torture/operator_overload_9.rs: Likewise.
* rust/execute/torture/slice1.rs: Rework test to use new parsing
capability and stick to the original implementation.

20 months agogccrs: Add missing location info to coercions
Philip Herron [Fri, 26 Aug 2022 10:32:24 +0000 (11:32 +0100)]
gccrs: Add missing location info to coercions

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::TypeCheckBase):
Remove constructor.
(TypeCheckBase::coercion_site): Add `Location` argument to function.
* typecheck/rust-hir-type-check-base.h: Use `TypeCheckBase::coercion_site`
function with location argument.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h (class TypeCheckExpr): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::visit): Likewise.
* typecheck/rust-tyty.h: Add missing locus field.
* typecheck/rust-tyty.cc (StructFieldType::clone): Use locus field.
(StructFieldType::monomorphized_clone): Likewise.

20 months agogccrs: Add guards against getting data from an empty vector
Philip Herron [Fri, 26 Aug 2022 19:52:35 +0000 (20:52 +0100)]
gccrs: Add guards against getting data from an empty vector

gcc/rust/ChangeLog:

* typecheck/rust-tyctx.cc (TypeCheckContext::pop_return_type): Add
guards around `std::vector<T>.pop_back()`.
(TypeCheckContext::peek_context): Likewise for `std::vector<T>.back()`.

20 months agogccrs: ast: Add better assertion on AST fragments
Arthur Cohen [Mon, 29 Aug 2022 12:59:18 +0000 (14:59 +0200)]
gccrs: ast: Add better assertion on AST fragments

gcc/rust/ChangeLog:

* ast/rust-ast.h: Improve assertions within ASTFragment API.

Co-authored-by: philberty <philip.herron@embecosm.com>
20 months agogccrs: ast: Only expand expressions and types if the kind is right
Arthur Cohen [Mon, 29 Aug 2022 11:37:13 +0000 (13:37 +0200)]
gccrs: ast: Only expand expressions and types if the kind is right

gcc/rust/ChangeLog:

* ast/rust-ast.h: Add assertions and accessors for fragment nodes.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Fix expansion
context typo when visiting `InherentImpl` items.
(AttrVisitor::maybe_expand_expr): Use new Fragment accessor to fetch
properly typed node.
(AttrVisitor::maybe_expand_type): Likewise.
* expand/rust-macro-expand.cc (transcribe_type): Emit parse errors
when trying to parse a type.

20 months agogccrs: dump: Add AST debugging using the AST::Dump class
Arthur Cohen [Mon, 29 Aug 2022 11:37:00 +0000 (13:37 +0200)]
gccrs: dump: Add AST debugging using the AST::Dump class

gcc/rust/ChangeLog:

* ast/rust-ast-dump.h: Add shorthand `AST::Dump::debug` function to
dump an AST node on `stderr`.

20 months agogccrs: transcriber: Do not infinite loop if the current parsed node is an error
Arthur Cohen [Mon, 29 Aug 2022 14:23:51 +0000 (16:23 +0200)]
gccrs: transcriber: Do not infinite loop if the current parsed node is an error

gcc/rust/ChangeLog:

* expand/rust-macro-expand.cc (parse_many): Return early from parsing
loop if we encounter an error, and emit that error in the meantime.

Co-authored-by: philberty <philip.herron@embecosm.com>
20 months agogccrs: macros: Handle matchers properly in repetitions
Arthur Cohen [Mon, 29 Aug 2022 10:51:33 +0000 (12:51 +0200)]
gccrs: macros: Handle matchers properly in repetitions

gcc/rust/ChangeLog:

* expand/rust-macro-expand.cc (MacroExpander::match_matcher): Handle
fragments differently based on whether or not we are currently trying
to match a matcher in a repetition context.
(MacroExpander::match_n_matches): Use new `in_repetition` argument
properly when calling `match_matcher`.
* expand/rust-macro-expand.h (MacroExpander::match_matcher): Allow
passing extra `in_repetition` bool argument

gcc/testsuite/ChangeLog:

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

20 months agogccrs: parser: Parse RangeFullExpr without erroring out
Arthur Cohen [Mon, 29 Aug 2022 14:37:16 +0000 (16:37 +0200)]
gccrs: parser: Parse RangeFullExpr without erroring out

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h: Allow parsing full range expressions without
erroring out.

gcc/testsuite/ChangeLog:

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

20 months agogccrs: lint: Do not emit unused warnings for public items
Arthur Cohen [Fri, 26 Aug 2022 12:09:24 +0000 (14:09 +0200)]
gccrs: lint: Do not emit unused warnings for public items

gcc/rust/ChangeLog:

* checks/lints/rust-lint-scan-deadcode.h: Do not report public items
as dead code.

gcc/testsuite/ChangeLog:

* rust/compile/issue-1031.rs: Remove extraneous dead code warnings.
* rust/compile/issue-1289.rs: Likewise.
* rust/compile/test_mod.rs: Likewise.
* rust/compile/torture/raw_identifiers.rs: Likewise.
* rust/compile/torture/raw_identifiers_keywords.rs: Likewise.
* rust/compile/privacy7.rs: New test.

20 months agogccrs: rustc_attrs: Allow `rustc_inherit_overflow_checks` as a builtin..
Arthur Cohen [Fri, 26 Aug 2022 12:06:23 +0000 (14:06 +0200)]
gccrs: rustc_attrs: Allow `rustc_inherit_overflow_checks` as a builtin..

..attribute. We cannot yet handle this attribute, but we should not reject it either

gcc/rust/ChangeLog:

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

gcc/testsuite/ChangeLog:

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

20 months agogccrs: backend: Add overflow checks to every arithmetic operation
Arthur Cohen [Fri, 26 Aug 2022 06:44:02 +0000 (08:44 +0200)]
gccrs: backend: Add overflow checks to every arithmetic operation

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): Insert overflow
checks logic.
(CompileExpr::array_copied_expr): Insert overflow checks logic.
* backend/rust-compile-item.cc (CompileItem::visit): Insert overflow
checks logic.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Insert
overflow checks logic.
* rust-gcc.cc (Gcc_backend::arithmetic_or_logical_expression): Differentiate
existing function from `arithmetic_or_logical_expression_checked`.
This function does insert perform overflow checks.
(Gcc_backend::arithmetic_or_logical_expression_checked): New
function.
(is_overflowing_expr): New function. Check if an expression is an
overflowing one (ADD, SUB, MUL).
(fetch_overflow_builtins): New function.
* rust-backend.h: Declare `arithmetic_or_logical_expression_checked` in
abstract `Backend` class.

gcc/testsuite/ChangeLog:

* rust/debug/win64-abi.rs: Fix assertion to take into account
overflow builtins
* rust/compile/torture/macro-issue1426.rs: Moved to...
* rust/execute/torture/macro-issue1426.rs: ...here.
* rust/execute/torture/overflow1.rs: New test.

20 months agogccrs: builtins: Add add_overflow builtin and refactor class
Arthur Cohen [Wed, 24 Aug 2022 15:21:38 +0000 (17:21 +0200)]
gccrs: builtins: Add add_overflow builtin and refactor class

gcc/rust/ChangeLog:

* backend/rust-builtins.h: Refactor builtin context class and add
overflow builtins.

20 months agogccrs: backend: Expose Bvariable class through rust-gcc header
Arthur Cohen [Wed, 24 Aug 2022 15:20:57 +0000 (17:20 +0200)]
gccrs: backend: Expose Bvariable class through rust-gcc header

gcc/rust/ChangeLog:

* rust-gcc.cc (class Bvariable): Move class to `rust-gcc.h` header.
* rust-gcc.h: New file.

20 months agogccrs: Desugar double borrows into two HIR:BorrowExpr's
Philip Herron [Thu, 25 Aug 2022 14:33:02 +0000 (15:33 +0100)]
gccrs: Desugar double borrows into two HIR:BorrowExpr's

We simply hit a gcc_unreachable() on double borrows but it seems reasonable
to just desugar the AST into a borrow of a borrow to foo. Instead of a
borrow expression with a flag to be respected.

Fixes #1506

gcc/rust/ChangeLog:

* hir/rust-ast-lower-expr.h: Lower double borrow expressions to two
`HIR::BorrowExpr`s.
* hir/tree/rust-hir-expr.h: Remove `is_double_borrow` field from
`HIR::BorrowExpr`.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove
call to `gcc_unreachable` on double borrow expressions.

gcc/testsuite/ChangeLog:

* rust/compile/torture/issue-1506.rs: New test.

20 months agogccrs: const folding port
Faisal Abbas [Mon, 27 Jun 2022 15:05:49 +0000 (16:05 +0100)]
gccrs: const folding port

This changeset ports cp_global_trees structure which is used throughout the
cp constexpr.cc code. I am not sure what it's purpose is but it seems it is used
to add and manipulate tree information during the c++ compilation process.
It is possible this is not needed in the Rust code and may be taken out later.
Also, the initialization function isn't being called from anywhere yet, so
we will need to find a suitable point for it.

gcc/rust/ChangeLog:
* backend/rust-tree.cc : Add new includes.
(scope_chain): New.
(maybe_add_global): New.
(init_modules): New (copied from cp)
(var_in_constexpr_fn): Likewise.
(member_vec_linear_search): Likewise.
(member_vec_binary_search): Likewise.
(is_overloaded_fn): Likewise.
(ovl_make): Likewise.
(lookup_add): Likewise.
(type_memfn_quals): Likewise.
(struct find_parameter_pack_data): Likewise.
(struct conv_type_hasher): Likewise.
(make_conv_op_name): Likewise.
(builtin_pack_fn_p): Likewise.
(builtin_pack_call_p): Likewise.
(has_extra_args_mechanism_p): Likewise.
(find_parameter_packs_r): Likewise.
(WALK_SUBTREE): Likewise.
(type_memfn_rqual): Likewise.
(maybe_add_lang_type_raw): Likewise.
(struct c_fileinfo): Likewise.
(get_fileinfo): Likewise.
(cxx_make_type): Likewise.
(build_min_array_type): Likewise.
(fields_linear_search): Likewise.
(nothrow_spec_p): Likewise.
(maybe_get_fns): Likewise.
(get_fns): Likewise.
(get_first_fn): Likewise.
(dependent_name): Likewise.
(called_fns_equal): Likewise.
(canonical_eh_spec): Likewise.
(rs_tree_code_length): Likewise.
(rs_tree_operand_length): Likewise.
(rs_tree_equal): Likewise.
(publicly_uniquely_derived_p): Likewise.
(comp_except_types): Likewise.
(comp_except_specs): Likewise.
(compparms): Likewise.
(set_array_type_canon): Likewise.
(struct cplus_array_info): Likewise.
(struct cplus_array_hasher): Likewise.
(cplus_array_hasher::hash): Likewise.
(cplus_array_hasher::equal): Likewise.
(is_byte_access_type): Likewise.
(build_cplus_array_type): Likewise.
(rs_build_qualified_type_real): Likewise.
(vector_targets_convertible_p): Likewise.
(comp_array_types): Likewise.
(same_type_ignoring_top_level_qualifiers_p): Likewise.
(comp_ptr_ttypes_const): Likewise.
(similar_type_p): Likewise.
(structural_comptypes): Likewise.
(comptypes): Likewise.
(next_initializable_field): Likewise.
(sufficient_parms_p): Likewise.
(default_ctor_p): Likewise.
(user_provided_p): Likewise.
(type_has_non_user_provided_default_constructor): Likewise.
(default_init_uninitialized_part): Likewise.
(extract_conversion_operator): Likewise.
(get_class_binding_direct): Likewise.
(lang_check_failed): Likewise.
(skip_artificial_parms_for): Likewise.
(in_class_defaulted_default_constructor): Likewise.
(is_instantiation_of_constexpr): Likewise.
(check_for_uninitialized_const_var): Likewise.
(cv_unqualified): Likewise.
(make_tree_vector): Likewise.
(release_tree_vector): Likewise.
(instantiation_dependent_expression_p): Likewise.
(cp_get_callee): Likewise.
(build_nop): Likewise.
(scalarish_type_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(build_local_temp): Likewise.
(is_normal_capture_proxy): Likewise.
(reject_gcc_builtin): Likewise.
(is_bitfield_expr_with_lowered_type): Likewise.
(maybe_undo_parenthesized_ref): Likewise.
(fold_offsetof): Likewise.
(char_type_p): Likewise.
(resolve_nondeduced_context): Likewise.
(instantiate_non_dependent_or_null): Likewise.
(resolve_nondeduced_context_or_error): Likewise.
(really_overloaded_fn): Likewise.
(invalid_nonstatic_memfn_p): Likewise.
(strip_top_quals): Likewise.
(cxx_incomplete_type_inform): Likewise.
(cxx_incomplete_type_diagnostic): Likewise.
(decl_constant_var_p): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
* backend/rust-tree.h (enum c_tree_index): Likewise.
(GTY): Likewise.
(enum cp_tree_index): Likewise.
(wchar_decl_node): Likewise.
(vtable_entry_type): Likewise.
(delta_type_node): Likewise.
(vtable_index_type): Likewise.
(class_type_node): Likewise.
(unknown_type_node): Likewise.
(init_list_type_node): Likewise.
(explicit_void_list_node): Likewise.
(vtbl_type_node): Likewise.
(vtbl_ptr_type_node): Likewise.
(std_node): Likewise.
(abi_node): Likewise.
(global_namespace): Likewise.
(const_type_info_type_node): Likewise.
(conv_op_marker): Likewise.
(abort_fndecl): Likewise.
(current_aggr): Likewise.
(nullptr_node): Likewise.
(nullptr_type_node): Likewise.
(align_type_node): Likewise.
(char8_type_node): Likewise.
(char16_type_node): Likewise.
(char32_type_node): Likewise.
(wchar_type_node): Likewise.
(underlying_wchar_type_node): Likewise.
(wint_type_node): Likewise.
(signed_size_type_node): Likewise.
(unsigned_ptrdiff_type_node): Likewise.
(intmax_type_node): Likewise.
(uintmax_type_node): Likewise.
(widest_integer_literal_type_node): Likewise.
(widest_unsigned_literal_type_node): Likewise.
(sig_atomic_type_node): Likewise.
(int8_type_node): Likewise.
(int16_type_node): Likewise.
(int32_type_node): Likewise.
(int64_type_node): Likewise.
(uint8_type_node): Likewise.
(c_uint16_type_node): Likewise.
(c_uint32_type_node): Likewise.
(c_uint64_type_node): Likewise.
(int_least8_type_node): Likewise.
(int_least16_type_node): Likewise.
(int_least32_type_node): Likewise.
(int_least64_type_node): Likewise.
(uint_least8_type_node): Likewise.
(uint_least16_type_node): Likewise.
(uint_least32_type_node): Likewise.
(uint_least64_type_node): Likewise.
(int_fast8_type_node): Likewise.
(int_fast16_type_node): Likewise.
(int_fast32_type_node): Likewise.
(int_fast64_type_node): Likewise.
(uint_fast8_type_node): Likewise.
(uint_fast16_type_node): Likewise.
(uint_fast32_type_node): Likewise.
(uint_fast64_type_node): Likewise.
(intptr_type_node): Likewise.
(uintptr_type_node): Likewise.
(truthvalue_type_node): Likewise.
(truthvalue_true_node): Likewise.
(truthvalue_false_node): Likewise.
(char_array_type_node): Likewise.
(char8_array_type_node): Likewise.
(char16_array_type_node): Likewise.
(char32_array_type_node): Likewise.
(wchar_array_type_node): Likewise.
(string_type_node): Likewise.
(const_string_type_node): Likewise.
(default_function_type): Likewise.
(function_name_decl_node): Likewise.
(pretty_function_name_decl_node): Likewise.
(c99_function_name_decl_node): Likewise.
(saved_function_name_decls): Likewise.
(null_node): Likewise.
(ctor_identifier): Likewise.
(complete_ctor_identifier): Likewise.
(base_ctor_identifier): Likewise.
(dtor_identifier): Likewise.
(complete_dtor_identifier): Likewise.
(base_dtor_identifier): Likewise.
(deleting_dtor_identifier): Likewise.
(conv_op_identifier): Likewise.
(delta_identifier): Likewise.
(in_charge_identifier): Likewise.
(vtt_parm_identifier): Likewise.
(as_base_identifier): Likewise.
(this_identifier): Likewise.
(pfn_identifier): Likewise.
(vptr_identifier): Likewise.
(global_identifier): Likewise.
(anon_identifier): Likewise.
(auto_identifier): Likewise.
(decltype_auto_identifier): Likewise.
(init_list_identifier): Likewise.
(for_range__identifier): Likewise.
(for_begin__identifier): Likewise.
(for_end__identifier): Likewise.
(for_range_identifier): Likewise.
(for_begin_identifier): Likewise.
(for_end_identifier): Likewise.
(abi_tag_identifier): Likewise.
(aligned_identifier): Likewise.
(begin_identifier): Likewise.
(end_identifier): Likewise.
(get__identifier): Likewise.
(gnu_identifier): Likewise.
(tuple_element_identifier): Likewise.
(tuple_size_identifier): Likewise.
(type_identifier): Likewise.
(value_identifier): Likewise.
(fun_identifier): Likewise.
(closure_identifier): Likewise.
(heap_uninit_identifier): Likewise.
(heap_identifier): Likewise.
(heap_deleted_identifier): Likewise.
(heap_vec_uninit_identifier): Likewise.
(heap_vec_identifier): Likewise.
(omp_identifier): Likewise.
(lang_name_c): Likewise.
(lang_name_cplusplus): Likewise.
(empty_except_spec): Likewise.
(noexcept_true_spec): Likewise.
(noexcept_false_spec): Likewise.
(noexcept_deferred_spec): Likewise.
(terminate_fn): Likewise.
(call_unexpected_fn): Likewise.
(get_exception_ptr_fn): Likewise.
(begin_catch_fn): Likewise.
(end_catch_fn): Likewise.
(allocate_exception_fn): Likewise.
(free_exception_fn): Likewise.
(throw_fn): Likewise.
(rethrow_fn): Likewise.
(atexit_fn_ptr_type_node): Likewise.
(atexit_node): Likewise.
(dso_handle_node): Likewise.
(dynamic_cast_node): Likewise.
(cleanup_type): Likewise.
(vtt_parm_type): Likewise.
(any_targ_node): Likewise.
(source_location_impl): Likewise.
(OVL_FUNCTION): Likewise.
(OVL_CHAIN): Likewise.
(OVL_DEDUP_P): Likewise.
(OVL_USING_P): Likewise.
(OVL_HIDDEN_P): Likewise.
(OVL_NESTED_P): Likewise.
(OVL_LOOKUP_P): Likewise.
(OVL_EXPORT_P): Likewise.
(OVL_FIRST): Likewise.
(OVL_NAME): Likewise.
(OVL_P): Likewise.
(OVL_SINGLE_P): Likewise.
(TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise.
(CLASSTYPE_LAZY_DEFAULT_CTOR): Likewise.
(CLASSTYPE_CONSTRUCTORS): Likewise.
(ATTR_IS_DEPENDENT): Likewise.
(ABI_TAG_IMPLICIT): Likewise.
(PARENTHESIZED_LIST_P): Likewise.
(DECL_DEPENDENT_P): Likewise.
(USING_DECL_SCOPE): Likewise.
(USING_DECL_DECLS): Likewise.
(USING_DECL_TYPENAME_P): Likewise.
(USING_DECL_UNRELATED_P): Likewise.
(DECL_DECLARES_FUNCTION_P): Likewise.
(DECL_DECLARES_TYPE_P): Likewise.
(IDENTIFIER_KIND_BIT_0): Likewise.
(IDENTIFIER_KIND_BIT_1): Likewise.
(IDENTIFIER_KIND_BIT_2): Likewise.
(IDENTIFIER_MARKED): Likewise.
(IDENTIFIER_VIRTUAL_P): Likewise.
(IDENTIFIER_KEYWORD_P): Likewise.
(IDENTIFIER_CDTOR_P): Likewise.
(IDENTIFIER_CTOR_P): Likewise.
(IDENTIFIER_DTOR_P): Likewise.
(IDENTIFIER_ANY_OP_P): Likewise.
(IDENTIFIER_OVL_OP_P): Likewise.
(IDENTIFIER_ASSIGN_OP_P): Likewise.
(IDENTIFIER_CONV_OP_P): Likewise.
(IDENTIFIER_NEWDEL_OP_P): Likewise.
(IDENTIFIER_NEW_OP_P): Likewise.
(CLASSTYPE_DIAMOND_SHAPED_P): Likewise.
(CLASSTYPE_REPEATED_BASE_P): Likewise.
(CLASSTYPE_KEY_METHOD): Likewise.
(CLASSTYPE_MEMBER_VEC): Likewise.
(CLASSTYPE_DECL_LIST): Likewise.
(CLASSTYPE_DESTRUCTOR): Likewise.
(CLASSTYPE_HAS_PRIMARY_BASE_P): Likewise.
(CLASSTYPE_PRIMARY_BINFO): Likewise.
(CLASSTYPE_VBASECLASSES): Likewise.
(CLASSTYPE_AS_BASE): Likewise.
(DECL_CONV_FN_P): Likewise.
(DECL_CONV_FN_TYPE): Likewise.
(same_type_p): Likewise.
(WILDCARD_TYPE_P): Likewise.
(MAYBE_CLASS_TYPE_P): Likewise.
(FUNCTION_REF_QUALIFIED): Likewise.
(FUNCTION_RVALUE_QUALIFIED): Likewise.
(TYPE_PTRMEMFUNC_FN_TYPE): Likewise.
(TYPE_PTRMEMFUNC_FN_TYPE_RAW): Likewise.
(TYPE_DEPENDENT_P): Likewise.
(TYPE_DEPENDENT_P_VALID): Likewise.
(TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise.
(TYPE_RAISES_EXCEPTIONS): Likewise.
(IDENTIFIER_BINDING): Likewise.
(LANG_IDENTIFIER_CAST): Likewise.
(IF_COND): Likewise.
(THEN_CLAUSE): Likewise.
(ELSE_CLAUSE): Likewise.
(IF_SCOPE): Likewise.
(IF_STMT_CONSTEXPR_P): Likewise.
(IF_STMT_CONSTEVAL_P): Likewise.
(DECLTYPE_TYPE_EXPR): Likewise.
(SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise.
(CLASSTYPE_INTERFACE_ONLY): Likewise.
(TYPE_NAME_STRING): Likewise.
(TYPE_NAME_LENGTH): Likewise.
(CONSTRAINT_VAR_P): Likewise.
(KOENIG_LOOKUP_P): Likewise.
(DECL_PARM_INDEX): Likewise.
(DECL_PARM_LEVEL): Likewise.
(CONV_IMPLICIT): Likewise.
(CONV_STATIC): Likewise.
(CONV_CONST): Likewise.
(CONV_REINTERPRET): Likewise.
(CONV_PRIVATE): Likewise.
(CONV_FORCE_TEMP): Likewise.
(CONV_FOLD): Likewise.
(CONV_OLD_CONVERT): Likewise.
(CONV_C_CAST): Likewise.
(CONV_BACKEND_CONVERT): Likewise.
(WANT_INT): Likewise.
(WANT_FLOAT): Likewise.
(WANT_ENUM): Likewise.
(WANT_POINTER): Likewise.
(WANT_NULL): Likewise.
(WANT_VECTOR_OR_COMPLEX): Likewise.
(WANT_ARITH): Likewise.
(COMPARE_STRICT): Likewise.
(COMPARE_BASE): Likewise.
(COMPARE_DERIVED): Likewise.
(COMPARE_REDECLARATION): Likewise.
(COMPARE_STRUCTURAL): Likewise.
(SF_DEFAULT): Likewise.
(SF_PRE_PARSED): Likewise.
(SF_INCLASS_INLINE): Likewise.
(SD_UNINITIALIZED): Likewise.
(SD_INITIALIZED): Likewise.
(SD_DECOMPOSITION): Likewise.
(SD_DEFAULTED): Likewise.
(SD_DELETED): Likewise.
(TYPE_PTRDATAMEM_P): Likewise.
(RS_TYPE_CONST_P): Likewise.
(TYPE_MAIN_DECL): Likewise.
(DECL_NONTRIVIALLY_INITIALIZED_P): Likewise.
(DECL_DEFAULTED_FN): Likewise.
(TYPE_HAS_USER_CONSTRUCTOR): Likewise.
(DECL_INITIALIZED_IN_CLASS_P): Likewise.
(DECL_DEFAULTED_IN_CLASS_P): Likewise.
(DECL_NONSTATIC_MEMBER_FUNCTION_P): Likewise.
(DECL_HAS_IN_CHARGE_PARM_P): Likewise.
(DECL_HAS_VTT_PARM_P): Likewise.
(FUNCTION_FIRST_USER_PARMTYPE): Likewise.
(FUNCTION_FIRST_USER_PARM): Likewise.
(DECL_CONSTRUCTOR_P): Likewise.
(DECL_DELETED_FN): Likewise.
(BRACE_ENCLOSED_INITIALIZER_P): Likewise.
(DECL_IMMEDIATE_FUNCTION_P): Likewise.
(SET_DECL_IMMEDIATE_FUNCTION_P): Likewise.
(CONSTRUCTOR_MUTABLE_POISON): Likewise.
(PTRMEM_CST_MEMBER): Likewise.
(REF_PARENTHESIZED_P): Likewise.
(TYPE_PTRMEM_P): Likewise.
(TYPE_PTR_OR_PTRMEM_P): Likewise.
(DECL_DECOMPOSITION_P): Likewise.
(DECL_DECOMP_BASE): Likewise.
(DECL_MAYBE_IN_CHARGE_CDTOR_P): Likewise.
(DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise.
(DECL_CLONED_FUNCTION_P): Likewise.
(DECL_CLONED_FUNCTION): Likewise.
(DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise.
(cp_function_chain): Likewise.
(cdtor_label): Likewise.
(current_class_ptr): Likewise.
(current_class_ref): Likewise.
(current_eh_spec_block): Likewise.
(current_in_charge_parm): Likewise.
(current_vtt_parm): Likewise.
(current_retval_sentinel): Likewise.
(current_function_returns_value): Likewise.
(current_function_returns_null): Likewise.
(current_function_returns_abnormally): Likewise.
(current_function_infinite_loop): Likewise.
(in_base_initializer): Likewise.
(in_function_try_handler): Likewise.
(current_function_return_value): Likewise.
(current_class_type): Likewise.
(TYPE_BEING_DEFINED): Likewise.
(DECL_STATIC_FUNCTION_P): Likewise.
(DECL_FUNCTION_MEMBER_P): Likewise.
(LANG_DECL_MIN_CHECK): Likewise.
(LANG_DECL_FN_CHECK): Likewise.
(LANG_DECL_NS_CHECK): Likewise.
(LANG_DECL_PARM_CHECK): Likewise.
(LANG_DECL_DECOMP_CHECK): Likewise.
(RS_INTEGRAL_TYPE_P): Likewise.
(STAT_HACK_P): Likewise.
(STAT_TYPE_VISIBLE_P): Likewise.
(STAT_TYPE): Likewise.
(STAT_DECL): Likewise.
(STAT_VISIBLE): Likewise.
(MAYBE_STAT_DECL): Likewise.
(MAYBE_STAT_TYPE): Likewise.
(STAT_TYPE_HIDDEN_P): Likewise.
(STAT_DECL_HIDDEN_P): Likewise.
(class warning_sentinel): Likewise.
(struct uid_sensitive_constexpr_evaluation_checker): Likewise.
(class iloc_sentinel): Likewise.
(struct GTY): Likewise.
(struct named_decl_hash): Likewise.
(enum lang_decl_selector): Likewise.
(LANG_DECL_HAS_MIN): Likewise.
(struct named_label_entry): Likewise.
(struct named_label_hash): Likewise.
(enum ref_operator): Likewise.
(struct c_fileinfo): Likewise.
(class ovl_iterator): Likewise.
(class lkp_iterator): Likewise.
(enum rs_ref_qualifier): Likewise.
(enum tsubst_flags): Likewise.
(enum cp_identifier_kind): Likewise.
(enum tag_types): Likewise.
(enum compare_bounds_t): Likewise.
(mark_rvalue_use): Likewise.
(type_unknown_p): Likewise.
(init_modules): Likewise.
(var_in_constexpr_fn): Likewise.
(ovl_first): Likewise.
(lookup_add): Likewise.
(ovl_make): Likewise.
(is_overloaded_fn): Likewise.
(maybe_add_lang_type_raw): Likewise.
(type_memfn_rqual): Likewise.
(builtin_pack_fn_p): Likewise.
(make_conv_op_name): Likewise.
(type_memfn_quals): Likewise.
(get_fileinfo): Likewise.
(cxx_make_type): Likewise.
(build_cplus_array_type): Likewise.
(is_byte_access_type): Likewise.
(comptypes): Likewise.
(canonical_eh_spec): Likewise.
(cp_tree_operand_length): Likewise.
(rs_tree_equal): Likewise.
(compparms): Likewise.
(rs_build_qualified_type_real): Likewise.
(rs_build_qualified_type): Likewise.
(cv_qualified_p): Likewise.
(similar_type_p): Likewise.
(vector_targets_convertible_p): Likewise.
(same_type_ignoring_top_level_qualifiers_p): Likewise.
(comp_ptr_ttypes_const): Likewise.
(get_class_binding_direct): Likewise.
(skip_artificial_parms_for): Likewise.
(lang_check_failed): Likewise.
(default_init_uninitialized_part): Likewise.
(type_has_non_user_provided_default_constructor): Likewise.
(default_ctor_p): Likewise.
(user_provided_p): Likewise.
(sufficient_parms_p): Likewise.
(next_initializable_field): Likewise.
(in_class_defaulted_default_constructor): Likewise.
(is_instantiation_of_constexpr): Likewise.
(check_for_uninitialized_const_var): Likewise.
(reduced_constant_expression_p): Likewise.
(cv_unqualified): Likewise.
(cp_get_callee): Likewise.
(cp_get_callee_fndecl_nofold): Likewise.
(is_nondependent_static_init_expression): Likewise.
(maybe_constant_init): Likewise.
(build_nop): Likewise.
(scalarish_type_p): Likewise.
(is_bitfield_expr_with_lowered_type): Likewise.
(convert_bitfield_to_declared_type): Likewise.
(cp_fold_maybe_rvalue): Likewise.
(maybe_undo_parenthesized_ref): Likewise.
(fold_offsetof): Likewise.
(cp_truthvalue_conversion): Likewise.
(fold_non_dependent_expr): Likewise.
(char_type_p): Likewise.
(instantiation_dependent_expression_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(build_local_temp): Likewise.
(is_normal_capture_proxy): Likewise.
(reject_gcc_builtin): Likewise.
(resolve_nondeduced_context): Likewise.
(cxx_incomplete_type_diagnostic): Likewise.
(cxx_incomplete_type_error): Likewise.
(invalid_nonstatic_memfn_p): Likewise.
(really_overloaded_fn): Likewise.
(resolve_nondeduced_context_or_error): Likewise.
(instantiate_non_dependent_or_null): Likewise.
(cxx_incomplete_type_inform): Likewise.
(strip_top_quals): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
(decl_constant_var_p): Likewise.
(type_of_this_parm): Likewise.
(class_of_this_parm): Likewise.
(identifier_p): Likewise.
(gnu_vector_type_p): Likewise.
(make_tree_vector): Likewise.
(release_tree_vector): Likewise.
(class releasing_vec): Likewise.
(vec_safe_push): Likewise.
(null_node_p): Likewise.
* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl): Correctly
set fndecl as constexpr from qualifiers.
(HIRCompileBase::compile_function): Test if fndecl is constexpr.
(HIRCompileBase::compile_constant_item): Set fndecl as constexpr.
* backend/rust-compile-intrinsic.cc : Update include.
(finalize_intrinsic_block): Set fndecl as constexpr.
* backend/rust-constexpr.cc : Update include.
(VERIFY_CONSTANT): New.
(is_instantiation_of_constexpr): New.
(literal_type_p): New.
(verify_constant): New.
(find_array_ctor_elt): New.
(array_index_cmp): New.
(potential_constant_expression_1): New.
(get_nth_callarg): New.
(unshare_constructor): New.
(maybe_save_constexpr_fundef): New.
(returns): New.
(breaks): New.
(continues): New.
(switches): New.
(struct constexpr_global_ctx): Add new fields.
(constexpr_fundef): New.
(struct constexpr_call): New.
(constexpr_call_hasher : ggc_ptr_hash<constexpr_call>): New.
(enum constexpr_switch_state): New.
(struct constexpr_ctx): Add new fields.
(struct constexpr_fundef_hasher): New.
(constexpr_fundef_table): New.
(constexpr_fundef_hasher::equal): New.
(constexpr_fundef_hasher::hash): New.
(retrieve_constexpr_fundef): New.
(uid_sensitive_constexpr_evaluation_value): New.
(uid_sensitive_constexpr_evaluation_true_counter): New.
(uid_sensitive_constexpr_evaluation_p): New.
(class temp_override): New.
(struct uid_sensitive_constexpr_evaluation_sentinel): New.
(struct uid_sensitive_constexpr_evaluation_checker): New.
(::uid_sensitive_constexpr_evaluation_sentinel): New.
(::uid_sensitive_constexpr_evaluation_checker): New.
(uid_sensitive_constexpr_evaluation_checker::evaluation_restricted_p): New.
(constexpr_call_table): New.
(constexpr_call_hasher::hash): New.
(constexpr_call_hasher::equal): New.
(maybe_initialize_constexpr_call_table): New.
(fundef_copies_table): New.
(get_fundef_copy): New.
(save_fundef_copy): New.
(constexpr_expression): Refactor in ...
(eval_constant_expression): ...this.
(eval_store_expression): Add 3 bool params.
(eval_call_expression): Likewise.
(eval_binary_expression): Likewise.
(eval_statement_list): New.
(extract_string_elt): New.
(eval_conditional_expression): New.
(eval_bit_field_ref): New.
(eval_loop_expr): New.
(eval_switch_expr): New.
(eval_unary_expression): New.
(call_stack): New.
(call_stack_tick): New.
(last_cx_error_tick): New.
(push_cx_call_context): New.
(pop_cx_call_context): New.
(cx_error_context): New.
(fold_expr): Adjust call to eval_constant_expression.
(same_type_ignoring_tlq_and_bounds_p): New.
(union_active_member): Port more for cxx constexpr.
(fold_indirect_ref_1): New.
(rs_fold_indirect_ref): Likewise.
(rs_eval_indirect_ref): New (from corresponding cxx FE file).
(eval_logical_expression): Adjust parameter list.
(lookup_placeholder): New (from corresponding cxx FE file).
(constant_value_1): Remove.
(inline_asm_in_constexpr_error): New (from corresponding cxx FE file).
(verify_ctor_sanity): New.
(get_callee): Remove.
(initialized_type): New.
(maybe_constexpr_fn): Remove.
(init_subob_ctx): New.
(base_field_constructor_elt): New.
(get_or_insert_ctor_field): New.
(eval_vector_conditional_expression): New (from correponding cxx FE file).
(eval_bare_aggregate): New.
(cxx_eval_trinary_expression): New.
(reduced_constant_expression_p): New.
(adjust_temp_type): New.
(free_constructor): New.
(eval_and_check_array_index): New.
(eval_array_reference): New.
(eval_component_reference): New.
(label_matches): New.
(eval_constant_expression): New.
(modifying_const_object_error): New.
(is_empty_field): New.
(eval_store_expression): New.
(eval_binary_expression): New.
(addr_of_non_const_var): New.
(rs_bind_parameters_in_call): New.
(eval_builtin_function_call): New.
(eval_call_expression): New.
(build_anon_member_initialization): New.
(build_data_member_initialization): New.
(constexpr_fn_retval): New.
(constant_value_1): New.
(decl_constant_value): New.
(non_const_var_error): New.
(get_callee): New.
(get_function_named_in_call): New.
(maybe_constexpr_fn): New.
(get_nth_callarg): New.
(var_in_maybe_constexpr_fn): New.
(instantiate_cx_fn_r): New.
(instantiate_constexpr_fns): New.
(array_index_cmp): New.
(unshare_constructor): New.
(find_array_ctor_elt): New.
(verify_constant): New.
(find_heap_var_refs): New.
(find_immediate_fndecl): New.
(diag_array_subscript): New.
(get_array_or_vector_nelts): New.
(eval_and_check_array_index): New.
(extract_string_elt): New.
(is_valid_constexpr_fn): New.
(explain_invalid_constexpr_fn): New.
(register_constexpr_fundef): New.
(maybe_save_constexpr_fundef): New.
(eval_statement_list): New.
(eval_conditional_expression): New.
(eval_bit_field_ref): New.
(returns): New.
(breaks): New.
(continues): New.
(switches): New.
(eval_loop_expr): New.
(eval_switch_expr): New.
(eval_unary_expression): New.
(cxx_eval_outermost_constant_expr): New.
(is_static_init_expression): New.
(is_constant_expression): New.
(is_nondependent_static_init_expression): New.
(maybe_constant_init_1): New.
(maybe_constant_init): New.
(is_nondependent_constant_expression): New.
(cv_cache): New.
(maybe_constant_value): New.
(potential_constant_expression): New.
(struct check_for_return_continue_data): New.
(check_for_return_continue): New.
(decl_namespace_context): New.
(decl_in_std_namespace_p): New.
(is_std_construct_at): New.
(cxx_dynamic_cast_fn_p): New.
(is_std_allocator_allocate): New.
(is_std_allocator_allocate): New.
(potential_constant_expression_1): New.
(potential_constant_expression_1): New.
(fold_non_dependent_init): New.
* backend/rust-constexpr.h (maybe_save_constexpr_fundef): New.

gcc/testsuite:
* rust/compile/const4.rs: New.
* rust/compile/const5.rs: New.

Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
20 months agogccrs: session-manager: Add ast-pretty-expanded dump
Arthur Cohen [Thu, 11 Aug 2022 15:16:24 +0000 (17:16 +0200)]
gccrs: session-manager: Add ast-pretty-expanded dump

gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::compile_crate): Allow the dump of prettified AST
(Session::dump_ast_pretty): New
* rust-session-manager.h: Add new output file for pretty AST dump

20 months agoModula-2 rename logitech libraries to log
Gaius Mulley [Tue, 31 Jan 2023 12:37:36 +0000 (12:37 +0000)]
Modula-2 rename logitech libraries to log

Rename the gcc/m2/gm2-libs-pim to gcc/m2/gm2-libs-log for
consistency.

gcc/m2/ChangeLog:

* Make-lang.in (gm2-libs.texi-check): Rename
m2/gm2-libs-pim to m2/gm2-libs-log.
* gm2-libs-pim/BitBlockOps.def: Moved to...
* gm2-libs-log/BitBlockOps.def: ...here.
* gm2-libs-pim/BitBlockOps.mod: Moved to...
* gm2-libs-log/BitBlockOps.mod: ...here.
* gm2-libs-pim/BitByteOps.def: Moved to...
* gm2-libs-log/BitByteOps.def: ...here.
* gm2-libs-pim/BitByteOps.mod: Moved to...
* gm2-libs-log/BitByteOps.mod: ...here.
* gm2-libs-pim/BitWordOps.def: Moved to...
* gm2-libs-log/BitWordOps.def: ...here.
* gm2-libs-pim/BitWordOps.mod: Moved to...
* gm2-libs-log/BitWordOps.mod: ...here.
* gm2-libs-pim/BlockOps.def: Moved to...
* gm2-libs-log/BlockOps.def: ...here.
* gm2-libs-pim/BlockOps.mod: Moved to...
* gm2-libs-log/BlockOps.mod: ...here.
* gm2-libs-pim/Break.c: Moved to...
* gm2-libs-log/Break.c: ...here.
* gm2-libs-pim/Break.def: Moved to...
* gm2-libs-log/Break.def: ...here.
* gm2-libs-pim/CardinalIO.def: Moved to...
* gm2-libs-log/CardinalIO.def: ...here.
* gm2-libs-pim/CardinalIO.mod: Moved to...
* gm2-libs-log/CardinalIO.mod: ...here.
* gm2-libs-pim/Conversions.def: Moved to...
* gm2-libs-log/Conversions.def: ...here.
* gm2-libs-pim/Conversions.mod: Moved to...
* gm2-libs-log/Conversions.mod: ...here.
* gm2-libs-pim/DebugPMD.def: Moved to...
* gm2-libs-log/DebugPMD.def: ...here.
* gm2-libs-pim/DebugPMD.mod: Moved to...
* gm2-libs-log/DebugPMD.mod: ...here.
* gm2-libs-pim/DebugTrace.def: Moved to...
* gm2-libs-log/DebugTrace.def: ...here.
* gm2-libs-pim/DebugTrace.mod: Moved to...
* gm2-libs-log/DebugTrace.mod: ...here.
* gm2-libs-pim/Delay.def: Moved to...
* gm2-libs-log/Delay.def: ...here.
* gm2-libs-pim/Delay.mod: Moved to...
* gm2-libs-log/Delay.mod: ...here.
* gm2-libs-pim/Display.def: Moved to...
* gm2-libs-log/Display.def: ...here.
* gm2-libs-pim/Display.mod: Moved to...
* gm2-libs-log/Display.mod: ...here.
* gm2-libs-pim/ErrorCode.def: Moved to...
* gm2-libs-log/ErrorCode.def: ...here.
* gm2-libs-pim/ErrorCode.mod: Moved to...
* gm2-libs-log/ErrorCode.mod: ...here.
* gm2-libs-pim/FileSystem.def: Moved to...
* gm2-libs-log/FileSystem.def: ...here.
* gm2-libs-pim/FileSystem.mod: Moved to...
* gm2-libs-log/FileSystem.mod: ...here.
* gm2-libs-pim/FloatingUtilities.def: Moved to...
* gm2-libs-log/FloatingUtilities.def: ...here.
* gm2-libs-pim/FloatingUtilities.mod: Moved to...
* gm2-libs-log/FloatingUtilities.mod: ...here.
* gm2-libs-pim/InOut.def: Moved to...
* gm2-libs-log/InOut.def: ...here.
* gm2-libs-pim/InOut.mod: Moved to...
* gm2-libs-log/InOut.mod: ...here.
* gm2-libs-pim/Keyboard.def: Moved to...
* gm2-libs-log/Keyboard.def: ...here.
* gm2-libs-pim/Keyboard.mod: Moved to...
* gm2-libs-log/Keyboard.mod: ...here.
* gm2-libs-pim/LongIO.def: Moved to...
* gm2-libs-log/LongIO.def: ...here.
* gm2-libs-pim/LongIO.mod: Moved to...
* gm2-libs-log/LongIO.mod: ...here.
* gm2-libs-pim/NumberConversion.def: Moved to...
* gm2-libs-log/NumberConversion.def: ...here.
* gm2-libs-pim/NumberConversion.mod: Moved to...
* gm2-libs-log/NumberConversion.mod: ...here.
* gm2-libs-pim/README.texi: Moved to...
* gm2-libs-log/README.texi: ...here.
* gm2-libs-pim/Random.def: Moved to...
* gm2-libs-log/Random.def: ...here.
* gm2-libs-pim/Random.mod: Moved to...
* gm2-libs-log/Random.mod: ...here.
* gm2-libs-pim/RealConversions.def: Moved to...
* gm2-libs-log/RealConversions.def: ...here.
* gm2-libs-pim/RealConversions.mod: Moved to...
* gm2-libs-log/RealConversions.mod: ...here.
* gm2-libs-pim/RealInOut.def: Moved to...
* gm2-libs-log/RealInOut.def: ...here.
* gm2-libs-pim/RealInOut.mod: Moved to...
* gm2-libs-log/RealInOut.mod: ...here.
* gm2-libs-pim/Strings.def: Moved to...
* gm2-libs-log/Strings.def: ...here.
* gm2-libs-pim/Strings.mod: Moved to...
* gm2-libs-log/Strings.mod: ...here.
* gm2-libs-pim/Termbase.def: Moved to...
* gm2-libs-log/Termbase.def: ...here.
* gm2-libs-pim/Termbase.mod: Moved to...
* gm2-libs-log/Termbase.mod: ...here.
* gm2-libs-pim/Terminal.def: Moved to...
* gm2-libs-log/Terminal.def: ...here.
* gm2-libs-pim/Terminal.mod: Moved to...
* gm2-libs-log/Terminal.mod: ...here.
* gm2-libs-pim/TimeDate.def: Moved to...
* gm2-libs-log/TimeDate.def: ...here.
* gm2-libs-pim/TimeDate.mod: Moved to...
* gm2-libs-log/TimeDate.mod: ...here.

libgm2/ChangeLog:

* libm2log/Makefile.am (VPATH): Replace gm2-libs-pim
with gm2-libs-log.
(libm2log_la_M2FLAGS): Replace gm2-libs-pim with
gm2-libs-log.
(install-data-local): Replace gm2-libs-pim with
gm2-libs-log.
* libm2log/Makefile.in: Rebuilt.

gcc/testsuite/ChangeLog:

* lib/gm2.exp (gm2_init_pimx): Replace gm2-libs-pim with
gm2-libs-log.
(gm2_init_iso): Replace gm2-libs-pim with gm2-libs-log.
(gm2_init_ulm): Replace gm2-libs-pim with gm2-libs-log.
(gm2_init_log): Replace gm2-libs-pim with gm2-libs-log.
(gm2_init_cor): Replace gm2-libs-pim with gm2-libs-log.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
20 months agolibsanitizer: Regenerate configure
Martin Liska [Tue, 31 Jan 2023 09:35:33 +0000 (10:35 +0100)]
libsanitizer: Regenerate configure

libsanitizer/ChangeLog:

* configure: Regenerate.

20 months agoi386: Fix up ix86_convert_const_wide_int_to_broadcast [PR108599]
Jakub Jelinek [Tue, 31 Jan 2023 09:12:19 +0000 (10:12 +0100)]
i386: Fix up ix86_convert_const_wide_int_to_broadcast [PR108599]

The following testcase is miscompiled.  The problem is that during
RTL DSE we see a V4DI register is being loaded { 16, 16, 0, 0 }
value and DSE mostly works in terms of scalar modes, so it calls
movoi to set an OImode REG to (const_wide_int 0x100000000000000010)
and ix86_convert_const_wide_int_to_broadcast thinks it can compute
that value by broadcasting DImode 0x10.  While it is true that
for TImode result the broadcast could be used, for OImode/XImode
it can't be, because all but the lowest 2 HOST_WIDE_INTs aren't
present (so are 0 or -1 depending on sign), not 0x10 in this case.
The function checks if the least significant HOST_WIDE_INT elt
of the CONST_WIDE_INT is broadcastable from QI/HI/SI/DImode and then
  /* Check if OP can be broadcasted from VAL.  */
  for (int i = 1; i < CONST_WIDE_INT_NUNITS (op); i++)
    if (val != CONST_WIDE_INT_ELT (op, i))
      return nullptr;
That is needed of course, but nothing checks that
CONST_WIDE_INT_NUNITS (op) isn't too small for the mode in question.
I think if op would be 0 or -1, it ought to be never CONST_WIDE_INT,
but CONST_INT and so we can just punt whenever the number of
CONST_WIDE_INT elts is not the expected one.

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

PR target/108599
* config/i386/i386-expand.cc
(ix86_convert_const_wide_int_to_broadcast): Return nullptr if
CONST_WIDE_INT_NUNITS (op) times HOST_BITS_PER_WIDE_INT isn't
equal to bitsize of mode.

* gcc.target/i386/avx2-pr108599.c: New test.