platform/upstream/gcc.git
17 months agoRISC-V: Fix bugs for refine vsetvl a5, zero into vsetvl zero, zero incorrectly
Ju-Zhe Zhong [Tue, 3 Jan 2023 06:55:30 +0000 (14:55 +0800)]
RISC-V: Fix bugs for refine vsetvl a5, zero into vsetvl zero, zero incorrectly

Currently we support this optimization:

bb 0:
 vsetvli a5,zero,e32,mf2
bb 1:
 vsetvli a5,zero,e64,m1 --> vsetvli zero,zero,e64,m1

According RVV ISA, we can do this optimization only if both RATIO and AVL are equal.
However, current VSETVL PASS missed the check of AVL. This patch add this condition
check to fix bugs.

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (vector_infos_manager::all_same_avl_p): New function.
(pass_vsetvl::can_refine_vsetvl_p): Add AVL check.
(pass_vsetvl::commit_vsetvls): Ditto.
* config/riscv/riscv-vsetvl.h: New function declaration.

17 months agoRISC-V: Fix vsetivli instruction asm for IMM AVL
Ju-Zhe Zhong [Tue, 3 Jan 2023 01:39:57 +0000 (09:39 +0800)]
RISC-V: Fix vsetivli instruction asm for IMM AVL

Notice that we should used vsetivli zero,4 instead of vsetvli zero,4
for IMM AVL (0 ~ 31) according to RVV ISA.

This patch fix vsetivli instruction asm bug.

gcc/ChangeLog:

* config/riscv/vector.md:

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vle-constraint-1.c:

17 months agoRISC-V: Fix inferior codegen for vse intrinsics.
Ju-Zhe Zhong [Thu, 29 Dec 2022 15:34:02 +0000 (23:34 +0800)]
RISC-V: Fix inferior codegen for vse intrinsics.

Currently we use pred_mov to to do the codegen for vse intrinsics. However, it
generates inferior codegen when I am testing AVL model of VSETVL PASS using vse
intrinsics.

Consider this following code:
void f2 (int * restrict in, int * restrict out, void * restrict mask_in, int n)
{
  vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + 10000), 19);
  __riscv_vse32_v_f32mf2 ((float *)(out + 10000), v, 19);
  vbool64_t mask = *(vbool64_t*)mask_in;
  for (int i = 0; i < n; i++)
    {
      vint16mf2_t v1 = __riscv_vle16_v_i16mf2 ((int16_t *)(in + i + 1), 19);
      __riscv_vse16_v_i16mf2 ((int16_t *)(out + i + 1), v1, 19);

      vint32mf2_t v2 = __riscv_vle32_v_i32mf2 ((int32_t *)(in + i + 2), 19);
      __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 2), v2, 19);

      vint32mf2_t v3 = __riscv_vle32_v_i32mf2_tumu (mask, v2, (int32_t *)(in + i + 200), 13);
      __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 200), v2, 13);

      vfloat64m1_t v4 = __riscv_vle64_v_f64m1_m (mask, (double *)(in + i + 300), 11);
      __riscv_vse64_v_f64m1 ((double *)(out + i + 300), v4, 11);

      vfloat64m1_t v5 = __riscv_vle64_v_f64m1_tum (mask, v4, (double *)(in + i + 500), 11);
      __riscv_vse64_v_f64m1 ((double *)(out + i + 500), v5, 11);

      vfloat64m1_t v6 = __riscv_vle64_v_f64m1_mu (mask, v5, (double *)(in + i + 600), 11);
      __riscv_vse64_v_f64m1_m (mask, (double *)(out + i + 600), v6, 11);

      vuint8mf4_t v7 = __riscv_vle8_v_u8mf4 ((uint8_t *)(in + i + 700), 11);
      __riscv_vse8_v_u8mf4 ((uint8_t *)(out + i + 700), v7, 11);
    }
}

Before this patch:
csrr t2,vlenb
srli t2,t2,1
slli s0,t2,2
vsetvli zero,19,e16,mf2,ta,ma
sub s0,s0,t2
csrr t2,vlenb
vle16.v v24,0(a3)
mv a4,a3
vse16.v v24,0(a1)
srli t2,t2,1
add a2,a3,t6
add s0,s0,sp
vsetvli zero,19,e32,mf2,ta,ma
addi a3,a3,4
vle32.v v24,0(a3)
vsetvli zero,t0,e32,mf2,ta,ma
vse32.v v24,0(s0)
slli s0,t2,2
sub s0,s0,t2
add s0,s0,sp
vsetvli t0,zero,e32,mf2,ta,ma
vle32.v v24,0(s0)
mv s0,t2
slli t2,t2,2
mv a5,a1
vsetvli zero,19,e32,mf2,ta,ma
addi a1,a1,4
sub t2,t2,s0
vse32.v v24,0(a1)
add t2,t2,sp
vsetvli t0,zero,e32,mf2,ta,ma
addi t1,a5,796
vle32.v v24,0(t2)
addi t5,a4,1196
addi a7,a5,1196
addi t4,a4,1996
addi a6,a5,1996
vsetvli zero,13,e32,mf2,ta,ma
add a4,a4,t3
vse32.v v24,0(t1)
add a5,a5,t3
vsetvli zero,11,e64,m1,tu,mu
vle64.v v24,0(t5),v0.t
vse64.v v24,0(a7)
vle64.v v24,0(t4),v0.t
vse64.v v24,0(a6)
vle64.v v24,0(a4),v0.t
vse64.v v24,0(a5),v0.t
vsetvli zero,11,e8,mf4,ta,ma
vle8.v v24,0(a2)
vse8.v v24,0(a2)
bne a0,a3,.L8
csrr t0,vlenb
slli t1,t0,1
add sp,sp,t1
lw s0,12(sp)
addi sp,sp,16
jr ra

We are generating redundant spilling codes.
Here we introduce a dedicated pred_store pattern for vse intrinsics like
maskstore in ARM SVE.

After this patch:
vsetvli zero,19,e16,mf2,ta,ma
mv a5,a4
vle16.v v24,0(a0)
mv a3,a0
vse16.v 19,0(a4)
addi t1,a4,796
vsetvli zero,19,e32,mf2,ta,ma
addi a0,a0,4
addi a4,a4,4
vle32.v v24,0(a0)
addi t0,a3,1196
vse32.v 19,0(a4)
addi a7,a5,1196
addi t6,a3,1996
addi a6,a5,1996
add t5,a3,t4
vsetvli zero,13,e32,mf2,ta,ma
add a2,a5,t4
vse32.v 13,0(t1)
add a3,a3,t3
vsetvli zero,11,e64,m1,tu,mu
add a5,a5,t3
vle64.v v24,0(t0),v0.t
vse64.v 11,0(a7)
vle64.v v24,0(t6),v0.t
vse64.v 11,0(a6)
vle64.v v24,0(t5),v0.t
vse64.v 11,0(a2),v0.t
vsetvli zero,11,e8,mf4,ta,ma
vle8.v v24,0(a3)
vse8.v 11,0(a5)
bne a1,a4,.L8
.L6:
ret

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc (class loadstore): use
pred_store for vse.
* config/riscv/riscv-vector-builtins.cc
(function_expander::add_mem_operand): Refine function.
(function_expander::use_contiguous_load_insn): Adjust new
implementation.
(function_expander::use_contiguous_store_insn): Ditto.
* config/riscv/riscv-vector-builtins.h: Refine function.
* config/riscv/vector.md (@pred_store<mode>): New pattern.

gcc/testsuite/ChangeLog:

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

17 months agoRISC-V: Fix pointer tree type for store pointer.
Ju-Zhe Zhong [Wed, 28 Dec 2022 05:11:08 +0000 (13:11 +0800)]
RISC-V: Fix pointer tree type for store pointer.

For store intrinsic,
the function type should be void store (T *...) instead of void store (const T *...)

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins.cc: Change to scalar pointer.

17 months agoFortran: fix ICE in check_host_association [PR108544]
Harald Anlauf [Wed, 25 Jan 2023 21:47:26 +0000 (22:47 +0100)]
Fortran: fix ICE in check_host_association [PR108544]

gcc/fortran/ChangeLog:

PR fortran/108544
* resolve.cc (check_host_association): Extend host association check
so that it is not restricted to functions.  Also prevent NULL pointer
dereference.

gcc/testsuite/ChangeLog:

PR fortran/108544
* gfortran.dg/pr108544.f90: New test.
* gfortran.dg/pr96102b.f90: New test.

17 months agoopts: SANITIZE_ADDRESS wrongly cleared [PR108543]
Marek Polacek [Wed, 25 Jan 2023 22:19:54 +0000 (17:19 -0500)]
opts: SANITIZE_ADDRESS wrongly cleared [PR108543]

Here we crash on a null fndecl ultimately because we haven't defined
the built-ins described in sanitizer.def.  So
builtin_decl_explicit (BUILT_IN_ASAN_POINTER_SUBTRACT);
returns NULL_TREE, causing an ICE later.

DEF_SANITIZER_BUILTIN only actually defines the built-ins when flag_sanitize
has SANITIZE_ADDRESS, or some of the other SANITIZE_*, but it doesn't check
SANITIZE_KERNEL_ADDRESS or SANITIZE_USER_ADDRESS.  Unfortunately, with
-fsanitize=address -fno-sanitize=kernel-address
or
-fsanitize=kernel-address -fno-sanitize=address
SANITIZE_ADDRESS ends up being unset from flag_sanitize even though
_USER/_KERNEL are set.  That's because -fsanitize=address means
SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS and -fsanitize=kernel-address
is SANITIZE_ADDRESS | SANITIZE_KERNEL_ADDRESS but parse_sanitizer_options
does
  flags &= ~sanitizer_opts[i].flag;
so the subsequent -fno- unsets SANITIZE_ADDRESS.  Then no sanitizer
built-ins are actually defined.

I'm not sure why SANITIZE_ADDRESS isn't just SANITIZE_USER_ADDRESS |
SANITIZE_KERNEL_ADDRESS, I don't think we need 3 bits.

PR middle-end/108543

gcc/ChangeLog:

* opts.cc (parse_sanitizer_options): Don't always clear SANITIZE_ADDRESS
if it was previously set.

gcc/testsuite/ChangeLog:

* c-c++-common/asan/pointer-subtract-5.c: New test.
* c-c++-common/asan/pointer-subtract-6.c: New test.
* c-c++-common/asan/pointer-subtract-7.c: New test.
* c-c++-common/asan/pointer-subtract-8.c: New test.

17 months agoModula-2: Remove debug code [PR108553].
Iain Sandoe [Thu, 26 Jan 2023 09:46:32 +0000 (09:46 +0000)]
Modula-2: Remove debug code [PR108553].

Remove debugging code accidentally left in place in r13-5373-g80cf2c5e8f496b.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/108553

gcc/m2/ChangeLog:

* gm2-lang.cc (gm2_langhook_init_options): Remove debug code.

17 months agofrange: Fix up foperator_{,not_}equal::fold_range for signed zeros [PR108540]
Jakub Jelinek [Thu, 26 Jan 2023 16:21:22 +0000 (17:21 +0100)]
frange: Fix up foperator_{,not_}equal::fold_range for signed zeros [PR108540]

The following testcases are miscompiled, because threader sees some
SSA_NAME would have -0.0 value and when computing range of SSA_NAME == 0.0
foperator_equal::fold_range sees one operand has [-0.0, -0.0] singleton
range, the other [0.0, 0.0], they aren't equal (frange operator== uses
real_identical etc. rather than real comparisons) and so it thinks they
compare unequal.  With signed zeros -0.0 == 0.0 is true though, so we
need to special case the both ranges singleton code.
Similarly, if we see op1 range being say [-42.0, -0.0] and op2 range
[0.0, 42.0], we'd check that the intersection of the two ranges is empty
(that is correct) and fold the result of == between such operands to
[0, 0] which is wrong, because -0.0 == 0.0, it needs to be [0, 1].
Similarly for foperator_not_equal::fold_range.

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

PR tree-optimization/108540
* range-op-float.cc (foperator_equal::fold_range): If both op1 and op2
are singletons, use range_true even if op1 != op2
when one range is [-0.0, -0.0] and another [0.0, 0.0].  Similarly,
even if intersection of the ranges is empty and one has
zero low bound and another zero high bound, use range_true_and_false
rather than range_false.
(foperator_not_equal::fold_range): If both op1 and op2
are singletons, use range_false even if op1 != op2
when one range is [-0.0, -0.0] and another [0.0, 0.0].  Similarly,
even if intersection of the ranges is empty and one has
zero low bound and another zero high bound, use range_true_and_false
rather than range_true.

* gcc.c-torture/execute/ieee/pr108540-1.c: New test.
* gcc.c-torture/execute/ieee/pr108540-2.c: New test.

17 months agovalue-relation: Small tweaks to tables
Jakub Jelinek [Thu, 26 Jan 2023 16:20:23 +0000 (17:20 +0100)]
value-relation: Small tweaks to tables

As I said earlier, all these tables are used solely in value-relation.cc
and never modified, plus because VREL_LAST is small especially the
two-dimensional arrays are vast a lot of .data (or .rodata) space
- 576 bytes each.  The following patch makes those arrays static const
and uses unsigned char instead of relation_kind so that the
two-dimensional arrays shrink to 144 bytes.

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

* value-relation.cc (kind_string): Add const.
(rr_negate_table, rr_swap_table, rr_intersect_table,
rr_union_table, rr_transitive_table): Add static const, change
element type from relation_kind to unsigned char.
(relation_negate, relation_swap, relation_intersect, relation_union,
relation_transitive): Cast rr_*_table element to relation_kind.
(relation_to_code): Add static const.
(relation_tests): Assert VREL_LAST is smaller than UCHAR_MAX.

17 months agotestsuite: Fix hwasan/arguments-3.c failures
Richard Sandiford [Thu, 26 Jan 2023 16:01:09 +0000 (16:01 +0000)]
testsuite: Fix hwasan/arguments-3.c failures

This testcase had three dg-error tests for ".*<message>.*".
But since . matches \n in Tcl regexps, the first dg-error
ate all the output, leaving the other two to fail.

The regexp is eventually embedded in a larger one, so we
can't prefix it with (?n).  But the .*s aren't necessary,
since dg-error tests for a partial rather than a full match.

gcc/testsuite/
* c-c++-common/hwasan/arguments-3.c: Remove extraneous .*s.

17 months agoaarch64: Remove expected error for compound literals
Richard Sandiford [Thu, 26 Jan 2023 15:51:00 +0000 (15:51 +0000)]
aarch64: Remove expected error for compound literals

GCC no longer treats empty compound literals as an error
(see 14cfa01755a66afbae2539f8b5796c960ddcecc6).

gcc/testsuite/
* gcc.target/aarch64/bfloat16_scalar_typecheck.c: Accept empty
compound literals.

17 months agoUpdate guality XFAILs for aarch64*-*-*
Richard Sandiford [Thu, 26 Jan 2023 15:51:00 +0000 (15:51 +0000)]
Update guality XFAILs for aarch64*-*-*

As in previous years, this patch updates the list of guality
XFAILs for aarch64*-*-*, based this time on an aarch64-linux-gnu
target with GDB 12 installed.  The justification for XFAILing
without specific PRs is that anyone who is interested in improving
debug quality can look at the XFAILs in the guality directory,
which is more likely to be kept up-to-date than a bugzilla ticket.

gcc/testsuite/
* gcc.dg/guality/pr36728-2.c: Update XFAILs for aarch64*-*-*.
* gcc.dg/guality/pr54519-1.c: Likewise.
* gcc.dg/guality/pr54519-3.c: Likewise.
* gcc.dg/guality/pr54693-2.c: Likewise.
* gcc.dg/guality/sra-1.c: Likewise.

17 months agoaarch64: Suppress warnings in pr99766.C
Richard Sandiford [Thu, 26 Jan 2023 15:50:59 +0000 (15:50 +0000)]
aarch64: Suppress warnings in pr99766.C

pr99766.C is an ICE regression test that now triggers a warning
about converting float to _Float16.

gcc/testsuite/
* g++.target/aarch64/sve/pr99766.C: Disable warnings.

17 months agoaarch64: Remove slp_13.c XFAILs
Richard Sandiford [Thu, 26 Jan 2023 15:50:59 +0000 (15:50 +0000)]
aarch64: Remove slp_13.c XFAILs

These tests started passing after
g:b073f2b098ba7819450d6c14a0fb96cb1c09f242.

gcc/testsuite/
* gcc.target/aarch64/sve/slp_13.c: Remove XFAILs.

17 months agoc++: Reject UDLs in certain contexts [PR105300]
Marek Polacek [Fri, 11 Nov 2022 22:59:30 +0000 (17:59 -0500)]
c++: Reject UDLs in certain contexts [PR105300]

In this PR, we are crashing because we've encountered a UDL where a
string-literal is expected.  This patch makes the parser reject string
and character UDLs in all places where the grammar requires a
string-literal and not a user-defined-string-literal.

I've introduced two new wrappers; the existing cp_parser_string_literal
was renamed to cp_parser_string_literal_common and should not be called
directly.  finish_userdef_string_literal is renamed from
cp_parser_userdef_string_literal.

PR c++/105300

gcc/c-family/ChangeLog:

* c-pragma.cc (handle_pragma_message): Warn for CPP_STRING_USERDEF.

gcc/cp/ChangeLog:

* parser.cc: Remove unnecessary forward declarations.
(cp_parser_string_literal): New wrapper.
(cp_parser_string_literal_common): Renamed from
cp_parser_string_literal.  Add a bool parameter.  Give an error when
UDLs are not permitted.
(cp_parser_userdef_string_literal): New wrapper.
(finish_userdef_string_literal): Renamed from
cp_parser_userdef_string_literal.
(cp_parser_primary_expression): Call cp_parser_userdef_string_literal
instead of cp_parser_string_literal.
(cp_parser_linkage_specification): Move a variable declaration closer
to its first use.
(cp_parser_static_assert): Likewise.
(cp_parser_operator): Call cp_parser_userdef_string_literal instead of
cp_parser_string_literal.
(cp_parser_asm_definition): Move a variable declaration closer to its
first use.
(cp_parser_asm_specification_opt): Move variable declarations closer to
their first use.
(cp_parser_asm_operand_list): Likewise.
(cp_parser_asm_clobber_list): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/udlit-error1.C: New test.

17 months agoanalyzer: fix SARD-tc841-basic-00182-min.c test case [PR108507]
David Malcolm [Thu, 26 Jan 2023 14:12:21 +0000 (09:12 -0500)]
analyzer: fix SARD-tc841-basic-00182-min.c test case [PR108507]

gcc/testsuite/ChangeLog:
PR analyzer/108507
* gcc.dg/analyzer/SARD-tc841-basic-00182-min.c: Add
-Wno-stringop-overflow.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
17 months agoanalyzer: fix false positives from -Wanalyzer-infinite-recursion [PR108524]
David Malcolm [Thu, 26 Jan 2023 14:12:21 +0000 (09:12 -0500)]
analyzer: fix false positives from -Wanalyzer-infinite-recursion [PR108524]

Reject -Wanalyzer-infinite-recursion diagnostics in which control flow
has been affected by conjured_svalues between the initial call to a
function and the subsequent entry to that function.  This prevents false
positives such as in qemu's recursive JSON parser where function calls are
changing state in the rest of the program (e.g. consuming tokens), despite
the modelled state being effectively identical at both nested entrypoints.

gcc/analyzer/ChangeLog:
PR analyzer/108524
* analyzer.h (class feasible_node): New forward decl.
* diagnostic-manager.cc (epath_finder::get_best_epath): Add "pd"
param.
(epath_finder::explore_feasible_paths): Likewise.
(epath_finder::process_worklist_item): Likewise.  Use it to call
pending_diagnostic::check_valid_fpath_p on the final fpath to
give pending_diagnostic a way to add additional restrictions on
feasibility.
(saved_diagnostic::calc_best_epath): Pass pending_diagnostic to
epath_finder::get_best_epath.
* infinite-recursion.cc: Include "analyzer/feasible-graph.h".
(infinite_recursion_diagnostic::check_valid_fpath_p): New.
(infinite_recursion_diagnostic::fedge_uses_conjured_svalue_p): New.
(infinite_recursion_diagnostic::expr_uses_conjured_svalue_p): New.
* pending-diagnostic.h (pending_diagnostic::check_valid_fpath_p):
New vfunc.

gcc/testsuite/ChangeLog:
PR analyzer/108524
* gcc.dg/analyzer/infinite-recursion-pr108524-1.c: New test.
* gcc.dg/analyzer/infinite-recursion-pr108524-2.c: New test.
* gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c:
New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
17 months agolibstdc++: Add workaround for old tzdata.zi files
Jonathan Wakely [Thu, 26 Jan 2023 11:35:00 +0000 (11:35 +0000)]
libstdc++: Add workaround for old tzdata.zi files

The tzdata.zi file in the RHEL 6 tzdata-2018e-3.el6 package (with
version "unknown") does not conform to the current rules described in
the zic(8) man page. Specifically, a Rule name must not start with the
character '+' in the current rules, but the older tzdata.zi file
used "+" as the name of rules for the "Europe/Sofia" zone.

Add a special case to the logic that detects whether a RULES field
refers to a named rule or is an offset from standard time. For a string
matching exactly "+" treat it as a named Rule, but for any other string
starting with '+' treat it as an offset.

libstdc++-v3/ChangeLog:

* src/c++20/tzdb.cc (operator>>(istream&, ZoneInfo&)): Allow
rules named "+" for compatibility with older tzdata.zi files.

17 months agolibstdc++: Add returns_nonnull to non-inline std::map detail [PR108554]
Jonathan Wakely [Thu, 26 Jan 2023 10:55:28 +0000 (10:55 +0000)]
libstdc++: Add returns_nonnull to non-inline std::map detail [PR108554]

std::map uses a non-inline function to rebalance its tree and the
compiler can't see that it always returns a valid pointer (assuming
valid inputs, which is a precondition anyway). This can result in
-Wnull-derefernce warnings for valid code, because the compiler thinks
there is a path where the function returns null.

Adding the returns_nonnull attribute tells the compiler that is can't
happen. While we're doing that, we might as well also add a nonnull
attribute to the rebalancing functions too.

libstdc++-v3/ChangeLog:

PR libstdc++/108554
* include/bits/stl_tree.h (_Rb_tree_insert_and_rebalance): Add
nonnull attribute.
(_Rb_tree_rebalance_for_erase): Add nonnull and returns_nonnull
attributes.
* testsuite/23_containers/map/modifiers/108554.cc: New test.

17 months agolibstdc++: Fix strings read from /etc/sysconfig/clock [PR108530]
Jonathan Wakely [Thu, 26 Jan 2023 09:26:35 +0000 (09:26 +0000)]
libstdc++: Fix strings read from /etc/sysconfig/clock [PR108530]

In r13-5339-ge00d5cafbe1a77 I made std::chrono::current_zone() look for
DEFAULT_TIMEZONE in /etc/sysconfig/clock but that is the wrong variable.
Old Suse systems use TIMEZONE to determine which zone /etc/localtime is
a copy of, and old RHEL system use ZONE.

libstdc++-v3/ChangeLog:

PR libstdc++/108530
* src/c++20/tzdb.cc (current_zone): Look for TIMEZONE or ZONE in
/etc/sysconfig/clock, not DEFAULT_TIMEZONE.

17 months agolibstdc++: Move www.open-std.org to https in bugs manual
Gerald Pfeifer [Thu, 26 Jan 2023 13:00:14 +0000 (14:00 +0100)]
libstdc++: Move open-std.org to https in bugs manual

libstdc++-v3/ChangeLog:

* doc/xml/manual/intro.xml: Update links to www.open-std.org to
use https.
* doc/html/manual/bugs.html: Regenerate.

17 months agotree-optimization/108547 - robustify uninit predicate analysis
Richard Biener [Thu, 26 Jan 2023 07:59:20 +0000 (08:59 +0100)]
tree-optimization/108547 - robustify uninit predicate analysis

Predicate analysis, when looking through casts doesn't bother to
convert boundary constants to the type of the bounded variables.
The following robustifies value_sat_pred_p to use widest_ints
to deal with this, like other code in predicate analysis.

PR tree-optimization/108547
* gimple-predicate-analysis.cc (value_sat_pred_p):
Use widest_int.

* gcc.dg/uninit-pr108547.c: New testcase.

17 months agotree-optimization/108522 Use component_ref_field_offset
Siddhesh Poyarekar [Thu, 26 Jan 2023 12:07:03 +0000 (07:07 -0500)]
tree-optimization/108522 Use component_ref_field_offset

Instead of using TREE_OPERAND (expr, 2) directly, use
component_ref_field_offset instead, which does scaling for us.  The
function also substitutes PLACEHOLDER_EXPRs but it is not relevant for
tree-object-size.

gcc/ChangeLog:

PR tree-optimization/108522
* tree-object-size.cc (compute_object_offset): Make EXPR
argument non-const.  Call component_ref_field_offset.

gcc/testsuite/ChangeLog:

PR tree-optimization/108522
* gcc.dg/builtin-dynamic-object-size-0.c (DEFSTRUCT): New
macro.
(test_dynarray_struct_member_b, test_dynarray_struct_member_c,
test_dynarray_struct_member_d,
test_dynarray_struct_member_subobj_b,
test_dynarray_struct_member_subobj_c,
test_dynarray_struct_member_subobj_d): New tests.
(main): Call them.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
17 months agoaarch64: Add Linux kernel hwcap string for FEAT_CSSC
Kyrylo Tkachov [Thu, 26 Jan 2023 11:49:47 +0000 (11:49 +0000)]
aarch64: Add Linux kernel hwcap string for FEAT_CSSC

The Linux kernel has done basic enablement and detection of FEAT_CSSC so
we can use the cpuinfo string that they've specified.

This patchlet does that.

Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/ChangeLog:

* config/aarch64/aarch64-option-extensions.def (cssc): Specify
FEATURE_STRING field.

17 months agodoc: Refer to projects as GCC and GDB
Gerald Pfeifer [Thu, 26 Jan 2023 11:25:44 +0000 (12:25 +0100)]
doc: Refer to projects as GCC and GDB

...instead of gcc and gdb which are the executables (and in case of
GCC the C language front end).

gcc/ChangeLog:

* doc/sourcebuild.texi: Refer to projects as GCC and GDB.

17 months agoopenmp, c++: Workaround fold_for_warn ICE on invalid OpenMP collapsed loops [PR108503]
Jakub Jelinek [Thu, 26 Jan 2023 09:41:10 +0000 (10:41 +0100)]
openmp, c++: Workaround fold_for_warn ICE on invalid OpenMP collapsed loops [PR108503]

My recent change to deduce structured binding vars earlier caused the following
invalid testcase to ICE.  The problem is that because at cp_convert_omp_range_for
when !processing_template_decl we aren't yet ready to finalize the structured bindings
(e.g. can't emit there associated code) but need to deduce types of the vars so that
we don't get errors if we parse invalid uses of those vars in inner loops of the
collapsed construct.  This is done by temporarily bumping processing_template_decl
around the call to cp_finish_decomp.  Unfortunately, as we can't finalize it yet,
the types of the vars will be deduced, but their DECL_VALUE_EXPR is not finalized
yet and if say fold_for_warn tries to constant expression evaluate them, it
recurses on DECL_VALUE_EXPR and ICEs because it sees e.g. ARRAY_REF (with NULL type)
on a VAR_DECL with class type.

The following patch works around that by temporarily hiding the DECL_VALUE_EXPRs
by clearing DECL_HAS_VALUE_EXPR_P in that case during cp_convert_omp_range_for
and arranging for cp_finish_omp_range_for to set it back before doing the
final cp_finish_decomp.

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

PR c++/108503
* parser.cc (cp_convert_omp_range_for): If cp_finish_decomp has been
called in !processing_template_decl with processing_template_decl
temporarily set, clear DECL_HAS_VALUE_EXPR_P on the vars temporarily.
(cp_finish_omp_range_for): And set it back again here.

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

17 months agotree-optimization/108523 - testcase for the bug
Richard Biener [Thu, 26 Jan 2023 07:38:35 +0000 (08:38 +0100)]
tree-optimization/108523 - testcase for the bug

This adds a reduced testcase for the PR.

PR tree-optimization/108523
* gcc.dg/torture/pr108523.c: New testcase.

17 months agolibgm2/configure.ac use newer automake (1.15.1)
Gaius Mulley [Thu, 26 Jan 2023 01:41:09 +0000 (01:41 +0000)]
libgm2/configure.ac use newer automake (1.15.1)

Use a newer automake (1.15.1).

libgm2/ChangeLog:

* configure.ac (AM_INIT_AUTOMAKE): Specify 1.15.1.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agoPR-108135 Remove PACKAGE_* definitions from gm2config.h
Gaius Mulley [Thu, 26 Jan 2023 00:55:56 +0000 (00:55 +0000)]
PR-108135 Remove PACKAGE_* definitions from gm2config.h

PR-108135 gcc/m2/configure generates gm2config.h and
automatically adds PACKAGE defines.  gcc/m2/Make-lang.in
now removes these PACKAGE definitions.  The patch also
contains fixes to remove an unused variable Dim from
BuildConstHighFromSym and also uses withTok in StartBuildWith.
StartBuildWith will generate a nop (for improved debugging)
if requested.

gcc/m2/ChangeLog:

* Make-lang.in (m2/gm2config.h): Rewrite rule to be
dependent upon m2/gm2config.aci.
(m2/gm2config.aci): Newrule.
* configure.ac (AC_CONFIG_HEADERS): Change destination
to gm2config.aci.
* configure: Regenerate.
* gm2-libs/config-host: Regenerate.
* gm2-compiler/M2GCCDeclare.mod (AddSymToWatch): Comment
out.
* gm2-compiler/M2Quads.mod (BuildConstHighFromSym): Remove
Dim.
(StartBuildWith): Call BuildStmtNoteTok.
(BuildStmtNoteTok): New procedure.
(BuildStmtNote): Re-implement re-factor into two
procedures and call BuildStmtNoteTok.
* gm2config.h.in: Remove.
* gm2config.aci.in: New file.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agoDaily bump.
GCC Administrator [Thu, 26 Jan 2023 00:17:46 +0000 (00:17 +0000)]
Daily bump.

17 months agoFortran: ICE in gfc_compare_array_spec [PR108528]
Steve Kargl [Wed, 25 Jan 2023 19:38:43 +0000 (20:38 +0100)]
Fortran: ICE in gfc_compare_array_spec [PR108528]

gcc/fortran/ChangeLog:

PR fortran/108528
* array.cc (compare_bounds): Return false instead of generating an
internal error on an invalid argument type.

gcc/testsuite/ChangeLog:

PR fortran/108528
* gfortran.dg/pr108528.f90: New test.

17 months agomodula-2: Fixes for preprocessing [PR102343, PR108182].
Iain Sandoe [Mon, 16 Jan 2023 14:07:20 +0000 (14:07 +0000)]
modula-2: Fixes for preprocessing [PR102343, PR108182].

Modula-2 uses the C preprocessor to implement handling for conditional
code and macros.  However, this is not done directly, because the process
is applied recursively to imported definitions and modules.

The cc1gm2 executable records the parameters as a template command line
needed to create a composite 'cc1 -E' for each file to be preprocessed
starting with the main file from the original command line.

This patch fixes the capture of the C preprocessor template to include
the target information needed for correct multilib operation.

In order to match the existing semantics of '-E, -M and -MM' these have
to be handled as a 'pre-processor only' job (i.e. the recursion is omitted
and only the main file is processed).

Whereas C-family front ends always pre-process, Modula-2 only does so
when specifically requested (via the -fcpp option).

'-MD, -MMD and -MQ' also require special handling, since (in principle)
these options can be applied to any command line (with -fcpp) providing
dependency information as a by-product.

TODO: the preprocessor is not able to determine def and mod dependencies
for Modula-2 and so the output of this only shows the object to module
dep.  We should be able to append the .def and .mod dependencies.

The patch amends save-temps handling to cater for the preprocessor
recursion and to avoid writing saved files into the source directories.

The patch changes the extension for Modula-2 preprocessed source to .m2i
to avoid clashes with .i.

The main driver code is amended to add default handlers for .mod and .m2i
so that a useful error message will be emitted if the Modula-2 compiler
is not built-in.

The compiler will now also handle code generation from a .m2i preprocessed
source.

TODO: We should not need to pass the '-c' option to the compiler to alter
the processing of init code.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/102343
PR modula2/108182

gcc/ChangeLog:

* gcc.cc: Provide default specs for Modula-2 so that when the
language is not built-in better diagnostics are emitted for
attempts to use .mod or .m2i file extensions.

gcc/m2/ChangeLog:

* gm2-compiler/M2Comp.mod: Early exit for pre-processor-only jobs.
* gm2-compiler/M2Options.def (SetPPOnly, GetPPOnly, SetMD, GetMD,
SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir,
GetDumpDir):New.
* gm2-compiler/M2Options.mod:(SetPPOnly, GetPPOnly, SetMD, GetMD,
SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir,
GetDumpDir):New.
* gm2-compiler/M2Preprocess.def (PreprocessModule): Add flag to
indicate the main file.
* gm2-compiler/M2Preprocess.mod: Handle Preprocess-only jobs,
handle MD, MMD and MQ options.
* gm2-gcc/m2options.h (M2Options_SetPPOnly, M2Options_GetPPOnly,
M2Options_SetDumpDir, M2Options_SetMD, M2Options_GetMD,
M2Options_SetMMD, M2Options_GetMMD, M2Options_SetMQ, M2Options_GetMQ,
M2Options_SetObj, M2Options_GetObj): New.
* gm2-gcc/m2type.cc (m2type_InitBaseTypes): Early exit for pre-
processor-only jobs.
* gm2-lang.cc (gm2_langhook_init): Handle preprocess-only commands.
(gm2_langhook_option_lang_mask): Claim C and Driver options so that
we can intercept them for building pre-processor commands.
(gm2_langhook_init_options): Collect the preprocessor line here.
Save options that have different actions for preprocessor and compile
commands.
(gm2_langhook_handle_option): Only handle the modula-2 options here.
(gm2_langhook_post_options): Do not create a back-end for pre-
processor-only jobs.
* gm2spec.cc (lang_specific_driver): Ignore PCH options, append a
scaffold-main for cases where we are building a main module with
-c.
* lang-specs.h: Revise to handle preprocessor-only jobs and to
consume pre-processed files.
* lang.opt: Remove Driver and C options copies (we claim these
separately).

17 months agoc++: Fix up mangling of static lambdas [PR108525]
Jakub Jelinek [Wed, 25 Jan 2023 14:13:30 +0000 (15:13 +0100)]
c++: Fix up mangling of static lambdas [PR108525]

Before the P1169R4 changes, operator () of a lambda was
always a method, so it was fine to pass method_p = 1 unconditionally,
but it isn't always the case, so this patch adds a check for whether
it is a method or nor.

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

PR c++/108525
* mangle.cc (write_closure_type_name): Don't assume all
lambda operator() fns are methods.

* g++.dg/cpp23/static-operator-call5.C: New test.

17 months agoarm: fix missing extern "C" in MVE tests
Andrea Corallo [Wed, 18 Jan 2023 16:38:42 +0000 (17:38 +0100)]
arm: fix missing extern "C" in MVE tests

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c: Add missing extern
"C".
* gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqaddq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c: Likewise.

17 months agoarm: improve tests for vld2q*
Andrea Corallo [Tue, 29 Nov 2022 15:45:10 +0000 (16:45 +0100)]
arm: improve tests for vld2q*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vld2q_f16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vld2q_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld2q_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld2q_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld2q_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld2q_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld2q_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld2q_u8.c: Likewise.

17 months agoarm: improve tests and fix vqnegq*
Andrea Corallo [Mon, 28 Nov 2022 16:49:36 +0000 (17:49 +0100)]
arm: improve tests and fix vqnegq*

gcc/ChangeLog:

* config/arm/mve.md (mve_vqnegq_s<mode>): Fix spacing.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqnegq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqnegq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqnegq_s8.c: Likewise.

17 months agoarm: improve tests for vqrdmulhq*
Andrea Corallo [Mon, 28 Nov 2022 16:47:54 +0000 (17:47 +0100)]
arm: improve tests for vqrdmulhq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c: Likewise.

17 months agoarm: improve tests for vqrdmlsdhxq*
Andrea Corallo [Mon, 28 Nov 2022 16:47:00 +0000 (17:47 +0100)]
arm: improve tests for vqrdmlsdhxq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c: Likewise.

17 months agoarm: improve tests for vqrdmlsdhq*
Andrea Corallo [Mon, 28 Nov 2022 16:46:25 +0000 (17:46 +0100)]
arm: improve tests for vqrdmlsdhq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c: Likewise.

17 months agoarm: improve tests for vqdmlsdhxq*
Andrea Corallo [Mon, 28 Nov 2022 16:45:45 +0000 (17:45 +0100)]
arm: improve tests for vqdmlsdhxq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c: Likewise.

17 months agoarm: improve tests for vqdmlsdhq*
Andrea Corallo [Mon, 28 Nov 2022 16:44:48 +0000 (17:44 +0100)]
arm: improve tests for vqdmlsdhq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c: Likewise.

17 months agoarm: improve tests for vqrdmlashq*
Andrea Corallo [Mon, 28 Nov 2022 16:44:29 +0000 (17:44 +0100)]
arm: improve tests for vqrdmlashq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c: Likewise.

17 months agoarm: improve tests for vqrdmladhxq*
Andrea Corallo [Mon, 28 Nov 2022 16:42:42 +0000 (17:42 +0100)]
arm: improve tests for vqrdmladhxq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c: Likewise.

17 months agoarm: improve tests for vqrdmladhq*
Andrea Corallo [Mon, 28 Nov 2022 16:42:09 +0000 (17:42 +0100)]
arm: improve tests for vqrdmladhq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c: Likewise.

17 months agoarm: improve tests for vqdmladhxq*
Andrea Corallo [Mon, 28 Nov 2022 16:41:30 +0000 (17:41 +0100)]
arm: improve tests for vqdmladhxq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c: Likewise.

17 months agoarm: improve tests for vqdmladhq*
Andrea Corallo [Mon, 28 Nov 2022 16:40:39 +0000 (17:40 +0100)]
arm: improve tests for vqdmladhq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c: Likewise.

17 months agoarm: improve tests and fix vqabsq*
Andrea Corallo [Mon, 28 Nov 2022 16:39:16 +0000 (17:39 +0100)]
arm: improve tests and fix vqabsq*

gcc/ChangeLog:

* config/arm/mve.md (mve_vqabsq_s<mode>): Fix spacing.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqabsq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqabsq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vqabsq_s8.c: Likewise.

17 months agoarm: improve tests for vcmulq*
Andrea Corallo [Mon, 28 Nov 2022 16:35:24 +0000 (17:35 +0100)]
arm: improve tests for vcmulq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vcmulq_f16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vcmulq_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c: Likewise.

17 months agoarm: improve tests for vcmlaq*
Andrea Corallo [Mon, 28 Nov 2022 16:34:41 +0000 (17:34 +0100)]
arm: improve tests for vcmlaq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vcmlaq_f16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vcmlaq_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c: Likewise.

17 months agoarm: improve tests for vcaddq*
Andrea Corallo [Mon, 28 Nov 2022 16:33:58 +0000 (17:33 +0100)]
arm: improve tests for vcaddq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c: Likewise.

17 months agoarm: improve tests for vmulltq*
Andrea Corallo [Mon, 28 Nov 2022 16:14:13 +0000 (17:14 +0100)]
arm: improve tests for vmulltq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c: Likewise.

17 months agoarm: improve tests for vmullbq*
Andrea Corallo [Mon, 28 Nov 2022 16:12:08 +0000 (17:12 +0100)]
arm: improve tests for vmullbq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c: Likewise.

17 months agoarm: improve tests for vmulhq*
Andrea Corallo [Mon, 28 Nov 2022 16:11:01 +0000 (17:11 +0100)]
arm: improve tests for vmulhq*

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c: Likewise.

17 months agoarm: improve tests and fix vnegq*
Andrea Corallo [Mon, 28 Nov 2022 16:09:16 +0000 (17:09 +0100)]
arm: improve tests and fix vnegq*

gcc/ChangeLog:

* config/arm/mve.md (mve_vnegq_f<mode>, mve_vnegq_s<mode>):
Fix spacing.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vnegq_f16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vnegq_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_m_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_m_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_m_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_x_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_x_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vnegq_x_s8.c: Likewise.
* gcc.target/arm/simd/mve-vneg.c: Update test.
* gcc.target/arm/simd/mve-vshr.c: Likewise

17 months agoarm: improve tests and fix vclzq*
Andrea Corallo [Mon, 28 Nov 2022 16:04:41 +0000 (17:04 +0100)]
arm: improve tests and fix vclzq*

gcc/ChangeLog:

* config/arm/mve.md (@mve_vclzq_s<mode>): Fix spacing.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vclzq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks.  Use
extern "C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vclzq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_m_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_m_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_m_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_x_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_x_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_x_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclzq_x_u8.c: Likewise.
* gcc.target/arm/simd/mve-vclz.c: Update test.

17 months agoarm: improve tests and fix vclsq*
Andrea Corallo [Mon, 28 Nov 2022 16:01:26 +0000 (17:01 +0100)]
arm: improve tests and fix vclsq*

gcc/ChangeLog:

* config/arm/mve.md (mve_vclsq_s<mode>): Fix spacing.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vclsq_m_s16.c: Use
check-function-bodies instead of scan-assembler checks. Use extern
"C" for C++ testing.
* gcc.target/arm/mve/intrinsics/vclsq_m_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_m_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_x_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_x_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vclsq_x_s8.c: Likewise.

17 months agotree-optimization/108523 - fix endless iteration in VN
Richard Biener [Wed, 25 Jan 2023 12:31:46 +0000 (13:31 +0100)]
tree-optimization/108523 - fix endless iteration in VN

The following fixes not converging iteration in value-numbering of
PHI nodes when we use an equivalence to prove the PHI node is
degenerate.  We have to avoid the situation where we oscillate
between the two equivalent values because the result is fed back
via a backedge.

PR tree-optimization/108523
* tree-ssa-sccvn.cc (visit_phi): Avoid using the exclusive
backedge value for the result when using predication to
prove equivalence.

17 months agoFixup LTO internal docs for option processing
Richard Biener [Wed, 25 Jan 2023 12:28:01 +0000 (13:28 +0100)]
Fixup LTO internal docs for option processing

Andreas noticed that when I removed lto_read_all_file_options I
failed to update the internals manual which refers to it.  The
following attempts to reflect the current situation.

* doc/lto.texi (Command line options): Reword and update reference
to removed lto_read_all_file_options.

17 months agoaarch64: Restore generation of SVE UQDEC instructions
Richard Sandiford [Wed, 25 Jan 2023 11:24:32 +0000 (11:24 +0000)]
aarch64: Restore generation of SVE UQDEC instructions

The addition of TARGET_CSSC meant that we wouldn't generate SVE
UQDEC instructions unless +cssc was also enabled.

Fixes:
- gcc.target/aarch64/sve/slp_4.c
- gcc.target/aarch64/sve/slp_10.c
- gcc.target/aarch64/sve/while_4.c

gcc/
* config/aarch64/aarch64.md (umax<mode>3): Separate the CNT and CSSC
tests.

17 months agoaarch64: Update sizeless tests
Richard Sandiford [Wed, 25 Jan 2023 11:24:32 +0000 (11:24 +0000)]
aarch64: Update sizeless tests

The sizeless-*.c tests contained (deliberately) invalid constructors
that had two errors.  The first error now suppresses the second error,
but the second error was the main focus of the test.  This patch
therefore rewrites it into a different form.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Avoid
"initializer element is not constant" error.
* gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise.

17 months agodoc/contrib.texi: Add Jose E. Marchesi
Gerald Pfeifer [Wed, 25 Jan 2023 10:33:58 +0000 (11:33 +0100)]
doc/contrib.texi: Add Jose E. Marchesi

gcc/ChangeLog:

* doc/contrib.texi: Add Jose E. Marchesi.

17 months agoaarch64: Add aarch64*-*-* to the list of vect_long_long targets
Andre Vieira [Wed, 25 Jan 2023 10:01:02 +0000 (10:01 +0000)]
aarch64: Add aarch64*-*-* to the list of vect_long_long targets

This patch adds aarch64 to the list of vect_long_long targets. Regression tested
on aarch64-none-linux-gnu.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_vect_long_long): Add
aarch64 to list of targets supporting long long vectorization.

17 months agostore-merging: Disable string_concatenate mode if start or end aren't byte aligned...
Jakub Jelinek [Wed, 25 Jan 2023 09:50:27 +0000 (10:50 +0100)]
store-merging: Disable string_concatenate mode if start or end aren't byte aligned [PR108498]

The first of the following testcases is miscompiled on powerpc64-linux -O2
-m64 at least, the latter at least on x86_64-linux -m32/-m64.
Since GCC 11 store-merging has a separate string_concatenation mode which
turns stores into setting a MEM_REF from a STRING_CST.
This mode is triggered if at least one of the to be merged stores
is a STRING_CST store and either the first store (to earliest address)
is that STRING_CST store or the first store is 8-bit INTEGER_CST store
and then there are some rules when to turn that mode off or not merge
further stores into it.

The problem with these 2 testcases is that the actual implementation
relies on start/width of the store to be at byte boundaries, as it
simply creates a char array, MEM_REF can be only on byte boundaries
and the char array too, plus obviously STRING_CST as well.
But as can be easily seen in the second testcase, nothing verifies this,
while the first store has to be a STRING_CST (which will be aligned)
or 8-bit INTEGER_CST, that 8-bit INTEGER_CST store could be a bitfield
store, nothing verifies any stores in between whether they actually are
8-bit and aligned, the only major requirement is that all the stores
are consecutive.

For GCC 14 I think we should reconsider this, simply treat STRING_CST
stores during the merging like INTEGER_CST stores and deal with it only
during split_group where we can create multiple parts, this part
would be a normal store, this part would be STRING_CST store, this part
another normal store etc.  But that is quite a lot of work, the following
patch just disables the string_concatenate mode if boundaries aren't byte
aligned in the spot where we disable it if it is too short too.
If that happens, we'll just try to do the merging using normal 1/2/4/8 etc.
byte stores as usually with RMW masking for any bits that shouldn't be
touched or punt if we end up with too many stores compared to the original.

Note, an original STRING_CST store will count as one store in that case,
something we might want to reconsider later too (but, after all, CONSTRUCTOR
stores (aka zeroing) already have the same problem, they can be large and
expensive and we still count them as one store).

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

PR tree-optimization/108498
* gimple-ssa-store-merging.cc (class store_operand_info):
End coment with full stop rather than comma.
(split_group): Likewise.
(merged_store_group::apply_stores): Clear string_concatenation if
start or end aren't on a byte boundary.

* gcc.c-torture/execute/pr108498-1.c: New test.
* gcc.c-torture/execute/pr108498-2.c: New test.

17 months agotree-optimization/108522 Use COMPONENT_REF offset when available
Siddhesh Poyarekar [Wed, 25 Jan 2023 00:47:05 +0000 (19:47 -0500)]
tree-optimization/108522 Use COMPONENT_REF offset when available

Use the offset in TREE_OPERAND(component_ref, 2) when available instead
of DECL_FIELD_OFFSET when trying to compute offset for a COMPONENT_REF.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
gcc/ChangeLog:

PR tree-optimization/108522
* tree-object-size.cc (compute_object_offset): Use
TREE_OPERAND(ref, 2) for COMPONENT_REF when available.

gcc/testsuite/ChangeLog:

PR tree-optimization/108522
* gcc.dg/builtin-dynamic-object-size-0.c
(test_dynarray_struct_member): New test.
(main): Call it.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
17 months agoDaily bump.
GCC Administrator [Wed, 25 Jan 2023 00:17:57 +0000 (00:17 +0000)]
Daily bump.

17 months agolibstdc++: Use /etc/sysconfig/clock for std::chrono::current_zone() [PR108530]
Jonathan Wakely [Tue, 24 Jan 2023 23:43:24 +0000 (23:43 +0000)]
libstdc++: Use /etc/sysconfig/clock for std::chrono::current_zone() [PR108530]

On some systems /etc/localtime is a tzfile, not a symlink to one. We
cannot use it to determine the current time zone in that case. See if
/etc/sysconfig/clock sets the variable DEFAULT_TIMEZONE instead.

libstdc++-v3/ChangeLog:

PR libstdc++/108530
* src/c++20/tzdb.cc (current_zone): Look for DEFAULT_TIMEZONE in
/etc/sysconfig/clock.

17 months agolibstdc++: Include std::ranges::subrange definition in <tuple> [PR102301]
Jonathan Wakely [Mon, 23 Jan 2023 12:25:36 +0000 (12:25 +0000)]
libstdc++: Include std::ranges::subrange definition in <tuple> [PR102301]

In order for std::make_from_tuple to work with tuple-like types, the
overloads of std::get for those types must have been declared before the
definition of std::make_from_tuple. That means we need to include the
definition of std::ranges::subrange in <tuple>.

The definitions of std::pair and its overloads of std::get are already
included in <tuple>. We provide forward declarations of std::array and
its std::get overloads in <tuple>. We could just declare subrange
without defining it, and give ranges::get a non-deduced return type,
like so:

  namespace ranges
  {
    enum class subrange_kind : bool { unsized, sized};

    template<input_or_output_iterator I, sentinel_for<I> S,
     subrange_kind K>
      requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
      class subrange;

    template<size_t _Num, class _It, class _Sent, subrange_kind _Kind>
      requires (_Num < 2)
      constexpr __conditional_t<_Num == 0, _It, _Sent>
      get(const subrange<_It, _Sent, _Kind>& __r);

    template<size_t _Num, class _It, class _Sent, subrange_kind _Kind>
      requires (_Num < 2)
      constexpr __conditional_t<_Num == 0, _It, _Sent>
      get(subrange<_It, _Sent, _Kind>&& __r)
  }
  using ranges::get;

It is a bit late in the GCC 13 dev cycle to do this, so just include the
right headers for now.

Also add the dangling check to std::make_from_tuple added by P2255.

libstdc++-v3/ChangeLog:

PR libstdc++/102301
* include/bits/ranges_base.h: Include <bits/stl_iterator.h> for
std::make_reverse_iterator.
* include/std/tuple: Include <bits/ranges_util.h> for subrange.
(make_from_tuple): Add static assertion from P2255 to diagnose
dangling references.
* testsuite/20_util/tuple/make_from_tuple/dangling_ref.cc: New test.
* testsuite/20_util/tuple/make_from_tuple/tuple_like.cc: New test.

17 months agotestsuite: Fix up new51.C test on various targets [PR108533]
Jakub Jelinek [Tue, 24 Jan 2023 23:12:46 +0000 (00:12 +0100)]
testsuite: Fix up new51.C test on various targets [PR108533]

The test fails on targets where size_t is not unsigned long
due to extra diagnostics.

As the testcase is tested in C++98 too, I'm not using decltype (sizeof 0)
but __SIZE_TYPE__.

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

PR c++/107329
PR testsuite/108533
* g++.dg/init/new51.C (size_t): New typedef.
(RexxClass::operator new, RexxClass::operator delete): Use size_t
instead of unsigned long.

17 months agoIntroduce new module to create search paths of dynamic strings.
Gaius Mulley [Tue, 24 Jan 2023 22:41:45 +0000 (22:41 +0000)]
Introduce new module to create search paths of dynamic strings.

Introduce a simple DynamicStringPath module to allow the front end
to create and modify a search path from dynamic strings.

gcc/m2/ChangeLog:

* Make-lang.in (GM2-COMP-BOOT-DEFS): Add
DynamicStringPath.def.
(GM2-COMP-BOOT-MODS): Add DynamicStringPath.mod.
(GM2-COMP-DEFS): Add DynamicStringPath.def.
(GM2-COMP-MODS): Add DynamicStringPath.mod.
($(objdir)/m2/gm2-libs-min/SYSTEM.def): Split path into
multiple -I components.
($(objdir)/m2/gm2-libs/SYSTEM.def): Ditto.
($(objdir)/m2/gm2-libs-coroutines/SYSTEM.def): Ditto.
* gm2-compiler/M2Options.mod: Import DynamicStringPath.
(SetSearchPath): Reimplement using DynamicStringPath
procedures.
* gm2-compiler/M2Search.def (InitSearchPath): Remove.
(PrependSearchPath): Remove.
* gm2-compiler/M2Search.mod (SFIO): Remove import.
(DynamicStringPath): Add import.
(Directory): Remove.
(UserPath): Remove.
(InitialPath): Remove.
(InitSearchPath): Remove.
(PrependSearchPath): Remove.
(FindSourceFile): Re-implement.
(FindSourceDefFile): Re-implement.
(FindSourceModFile): Re-implement.
* gm2-gcc/init.cc (_M2_DynamicStringPath_init):
New prototype.
(init_FrontEndInit): Call _M2_DynamicStringPath_init.
* tools-src/makeSystem: Allow multiple -I paths.
* gm2-compiler/DynamicStringPath.def: New file.
* gm2-compiler/DynamicStringPath.mod: New file.
* gm2-gcc/m2options.h (M2Options_SetMakeIncludePath): Add
prototype.
    Co-Authored by: Iain Sandoe  <iain@sandoe.co.uk>

libgm2/ChangeLog:

* libm2cor/Makefile.am (SYSTEM.def): Split path into
multiple -I components.
* libm2cor/Makefile.in: Rebuild.
* libm2min/Makefile.am (SYSTEM.def): Split path into
multiple -I components.
* libm2min/Makefile.in: Rebuild.
* libm2iso/Makefile.am (SYSTEM.def): Split path into
multiple -I components.
* libm2iso/Makefile.in: Rebuild.
    Co-Authored by: Iain Sandoe  <iain@sandoe.co.uk>

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agoc++: "" #pragma at BOF [PR108504]
Jason Merrill [Tue, 24 Jan 2023 21:26:50 +0000 (16:26 -0500)]
c++: "" #pragma at BOF [PR108504]

Since r11-2095 we pass flags to cp_lexer_get_preprocessor_token, and
cp_lexer_new_main passes C_LEX_STRING_NO_JOIN when lexing most of the
translation unit, but doesn't do that for the very first token; as a
result, if the first token is a string literal, we try to join strings and
get confused if that encounters a pragma.

PR c++/108504

gcc/cp/ChangeLog:

* parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first
token, too.

gcc/testsuite/ChangeLog:

* g++.dg/ext/pragma1.C: New test.

17 months agoc++: static lambda in template [PR108526]
Jason Merrill [Tue, 24 Jan 2023 20:29:35 +0000 (15:29 -0500)]
c++: static lambda in template [PR108526]

tsubst_lambda_expr uses build_memfn_type to build a METHOD_TYPE for the new
lamba op().  This is not what we want for a C++23 static op(), but since we
also use that METHOD_TYPE to communicate the closure type down to
tsubst_function_decl, let's wait and turn it back at that point.

PR c++/108526

gcc/cp/ChangeLog:

* pt.cc (tsubst_function_decl): Handle static lambda.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/static-operator-call5.C: New test.

17 months agoxtensa: Revise complex hard register clobber elimination
Takayuki 'January June' Suwa [Fri, 20 Jan 2023 03:33:37 +0000 (12:33 +0900)]
xtensa: Revise complex hard register clobber elimination

In the previously posted patch
"xtensa: Make complex hard register clobber elimination more robust and accurate",
the check code for insns that refer to the [DS]Cmode hard register before
it is overwritten after it is clobbered is incomplete.  Fortunately such
insns are seldom emitted, so it didn't matter.

This patch fixes that for the sake of completeness.

gcc/ChangeLog:

* config/xtensa/xtensa.md:
Fix exit from loops detecting references before overwriting in the
split pattern.

17 months agoLRA: Always do elimination and only for hard register to check insn constraints
Vladimir N. Makarov [Tue, 24 Jan 2023 21:10:59 +0000 (16:10 -0500)]
LRA: Always do elimination and only for hard register to check insn constraints

LRA does elimination but not always checks insn constraints in this case.
This results in LRA failure for PDP11 target whose addition is only 2-op insn.
The same might happen for other analogous targets.  The patch fixes this problem.

        PR rtl-optimization/108388

gcc/ChangeLog:

* lra-constraints.cc (get_hard_regno): Remove final_p arg.  Always
do elimination but only for hard register.
(operands_match_p, uses_hard_regs_p, process_alt_operands): Adjust
calls of get_hard_regno.

gcc/testsuite/ChangeLog:

* gcc.target/pdp11/pdp11.exp: New.
* gcc.target/pdp11/pr108388.c: New.

17 months agoFortran: ICE in transformational_result [PR108529]
Harald Anlauf [Tue, 24 Jan 2023 20:39:43 +0000 (21:39 +0100)]
Fortran: ICE in transformational_result [PR108529]

gcc/fortran/ChangeLog:

PR fortran/108529
* simplify.cc (simplify_transformation): Do not try to simplify
transformational intrinsic when the ARRAY argument has a NULL shape.

gcc/testsuite/ChangeLog:

PR fortran/108529
* gfortran.dg/pr108529.f90: New test.

17 months agoIBM zSystems: Fix TARGET_D_CPU_VERSIONS
Stefan Schulze Frielinghaus [Tue, 24 Jan 2023 19:23:07 +0000 (20:23 +0100)]
IBM zSystems: Fix TARGET_D_CPU_VERSIONS

In the context of D the interpretation of S390, S390X, and SystemZ is a
bit fuzzy.  The wording S390X was wrongly deprecated in favour of
SystemZ by commit
https://github.com/dlang/dlang.org/commit/3b50a4c3faf01c32234d0ef8be5f82915a61c23f
Thus, SystemZ is used for 64-bit targets, now, and S390 for 31-bit
targets.  However, in TARGET_D_CPU_VERSIONS depending on TARGET_ZARCH we
set the CPU version to SystemZ.  This is also the case if compiled for
31-bit targets leading to the following error:

libphobos/libdruntime/core/sys/posix/sys/stat.d:967:13: error: static assert:  '96u == 144u' is false
  967 |             static assert(stat_t.sizeof == 144);
      |             ^

Thus in order to keep this patch simple I went for keeping SystemZ for
64-bit targets and S390, as usual, for 31-bit targets and dropped the
distinction between ESA and z/Architecture.

gcc/ChangeLog:

* config/s390/s390-d.cc (s390_d_target_versions): Fix detection
of CPU version.

17 months agoChange m2 lexical analysis to optionally consume C comments.
Gaius Mulley [Tue, 24 Jan 2023 19:21:20 +0000 (19:21 +0000)]
Change m2 lexical analysis to optionally consume C comments.

This patch allows a subsequent patch to turn on/off the consuming
of C comments.

gcc/m2/ChangeLog:

* m2.flex (cpreprocessor): Add temporary variable
which is initialized to 0.
(commentCLevel): New variable.
(endOfCComment): New function.
(splitSlashStar): New function to split /* into / and *
tokens.
(COMMENTC): New flex state.
("/*"): New rule to test whether we should treat /*
as a single token or as two tokens.
(<COMMENTC>.): New rule to skip a character.
(<COMMENTC>\n.*): New rule to consume the line.
(<COMMENTC>"*/"): New rule to call endOfCComment.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agoBugfix ensure RTentity is a dependent of RTco.cc
Gaius Mulley [Tue, 24 Jan 2023 17:33:18 +0000 (17:33 +0000)]
Bugfix ensure RTentity is a dependent of RTco.cc

RTco is a definition for C module and therefore there is no
RTco.mod.  The RTco.cc uses RTentity and the import in RTco.def
ensures that cc1gm2 can build a graph of all dependencies
should -fscaffold-static be used.

gcc/m2/ChangeLog:

* gm2-libs-iso/RTco.def: Import RTentity.
Declare RTco as a definition for C module.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agoarm: Make MVE masked stores read memory operand [PR 108177]
Andre Vieira [Tue, 24 Jan 2023 16:59:23 +0000 (16:59 +0000)]
arm: Make MVE masked stores read memory operand [PR 108177]

This patch adds the memory operand of MVE masked stores as input operands to
mimic the 'partial' writes, to prevent erroneous write-after-write
optimizations as described in the PR.

gcc/ChangeLog:

PR target/108177
* config/arm/mve.md (mve_vstrbq_p_<supf><mode>, mve_vstrhq_p_fv8hf,
mve_vstrhq_p_<supf><mode>, mve_vstrwq_p_<supf>v4si): Add memory operand
as input operand.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/pr108177-1-run.c: New test.
* gcc.target/arm/mve/pr108177-1.c: New test.
* gcc.target/arm/mve/pr108177-10-run.c: New test.
* gcc.target/arm/mve/pr108177-10.c: New test.
* gcc.target/arm/mve/pr108177-11-run.c: New test.
* gcc.target/arm/mve/pr108177-11.c: New test.
* gcc.target/arm/mve/pr108177-12-run.c: New test.
* gcc.target/arm/mve/pr108177-12.c: New test.
* gcc.target/arm/mve/pr108177-13-run.c: New test.
* gcc.target/arm/mve/pr108177-13.c: New test.
* gcc.target/arm/mve/pr108177-14-run.c: New test.
* gcc.target/arm/mve/pr108177-14.c: New test.
* gcc.target/arm/mve/pr108177-2-run.c: New test.
* gcc.target/arm/mve/pr108177-2.c: New test.
* gcc.target/arm/mve/pr108177-3-run.c: New test.
* gcc.target/arm/mve/pr108177-3.c: New test.
* gcc.target/arm/mve/pr108177-4-run.c: New test.
* gcc.target/arm/mve/pr108177-4.c: New test.
* gcc.target/arm/mve/pr108177-5-run.c: New test.
* gcc.target/arm/mve/pr108177-5.c: New test.
* gcc.target/arm/mve/pr108177-6-run.c: New test.
* gcc.target/arm/mve/pr108177-6.c: New test.
* gcc.target/arm/mve/pr108177-7-run.c: New test.
* gcc.target/arm/mve/pr108177-7.c: New test.
* gcc.target/arm/mve/pr108177-8-run.c: New test.
* gcc.target/arm/mve/pr108177-8.c: New test.
* gcc.target/arm/mve/pr108177-9-run.c: New test.
* gcc.target/arm/mve/pr108177-9.c: New test.
* gcc.target/arm/mve/pr108177-main.x: New test include.
* gcc.target/arm/mve/pr108177.x: New test include.

17 months agoC-SKY: Fix wrong sysroot suffix when disable multilib.
Xianmiao Qu [Tue, 24 Jan 2023 16:14:46 +0000 (00:14 +0800)]
C-SKY: Fix wrong sysroot suffix when disable multilib.

The SYSROOT_SUFFIX_SPEC works even when multilib is disabled.
So when build no-multilib glibc toolchain and the options are
not same as MULTILIB_DEFAULTS, the sysroot will specify wrong
because the libc will not be installed as such.
This bug causes glibc regression test error:
  https://sourceware.org/pipermail/libc-testresults/2023q1/010706.html
The error is:
  /scratch/jmyers/glibc-bot/install/compilers/csky-linux-gnuabiv2/csky-glibc-linux-gnuabiv2/bin/ld: cannot find -lc: No such file or directory

gcc/
* config.gcc(csky-*-linux*): Define CSKY_ENABLE_MULTILIB
and only include 'csky/t-csky-linux' when enable multilib.
* config/csky/csky-linux-elf.h(SYSROOT_SUFFIX_SPEC): Don't
define it when disable multilib.

17 months agotree-optimization/108500 - avoid useless fast-query compute in CFG cleanup
Richard Biener [Tue, 24 Jan 2023 09:49:18 +0000 (10:49 +0100)]
tree-optimization/108500 - avoid useless fast-query compute in CFG cleanup

CFG cleanup computes dominators before the loop over blocks looking
for merging opportunities.  That computes also the fast-query DFS
numbers but that's a bit pointless since any CFG cleanup will invalidate
them immediately (they are re-computed before fixing up loops).
The following avoids this and fixes the SIGSEGV due to the deep
recursion in assign_dfs_numbers after inlining very many small
functions.

PR tree-optimization/108500
* dominance.h (calculate_dominance_info): Add parameter
to indicate fast-query compute, defaulted to true.
* dominance.cc (calculate_dominance_info): Honor
fast-query compute parameter.
* tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Do
not compute the dominator fast-query DFS numbers.

17 months agooptions: fix cl_target_option_print_diff() with strings
Eric Biggers [Tue, 24 Jan 2023 10:54:41 +0000 (11:54 +0100)]
options: fix cl_target_option_print_diff() with strings

Fix an obvious copy-and-paste error where ptr1 was used instead of ptr2.
This bug caused the dump file produced by -fdump-ipa-inline-details to
not correctly show the difference in target options when a function
could not be inlined due to a target option mismatch.

gcc/ChangeLog:
PR bootstrap/90543
* optc-save-gen.awk: Fix copy-and-paste error.

Signed-off-by: Eric Biggers <ebiggers@google.com>
17 months agoc++: Handle structured bindings like anon unions in initializers [PR108474]
Jakub Jelinek [Tue, 24 Jan 2023 10:28:00 +0000 (11:28 +0100)]
c++: Handle structured bindings like anon unions in initializers [PR108474]

As reported by Andrew Pinski, structured bindings (with the exception
of the ones using std::tuple_{size,element} and get which are really
standalone variables in addition to the binding one) also use
DECL_VALUE_EXPR and needs the same treatment in static initializers.

On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote:
> Though, actually, why not instead fix expand_expr_real_1 (and staticp) to
> look through DECL_VALUE_EXPR?

Doing it when emitting the initializers seems to be too late to me,
we in various spots try to put parts of the static var DECL_INITIAL expressions
into the IL, or e.g. for varpool purposes remember which vars are referenced
there.

This patch moves it to record_reference, which is called from varpool_node::analyze
and so about the same time as gimplification of the bodies which also
replaces DECL_VALUE_EXPRs.

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

PR c++/108474
* cgraphbuild.cc: Include gimplify.h.
(record_reference): Replace VAR_DECLs with DECL_HAS_VALUE_EXPR_P with
their corresponding DECL_VALUE_EXPR expressions after unsharing.

* cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes.

* g++.dg/cpp1z/decomp57.C: New test.
* g++.dg/cpp1z/decomp58.C: New test.

17 months agoarm: Fix inclusion of arm-mlib.h header more than once (pr108505).
Srinath Parvathaneni [Tue, 24 Jan 2023 09:57:52 +0000 (09:57 +0000)]
arm: Fix inclusion of arm-mlib.h header more than once (pr108505).

The patch fixes the build issue for arm-none-eabi target configured with
--with-multilib-list=aprofile,rmprofile, in which case the header file
arm/arm-mlib.h is being included more than once and the toolchain build
is failing (PR108505).

gcc/ChangeLog:

2023-01-24  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/108505
* config.gcc (tm_file): Move the variable out of loop.

17 months agotestsuite: Fix gcc.dg/vect/vect-bitfield-write-[23].c on SPARC [PR107808]
Rainer Orth [Tue, 24 Jan 2023 07:49:44 +0000 (08:49 +0100)]
testsuite: Fix gcc.dg/vect/vect-bitfield-write-[23].c on SPARC [PR107808]

The gcc.dg/vect/vect-bitfield-write-[23].c tests FAIL on 32 and 64-bit
SPARC:

FAIL: gcc.dg/vect/vect-bitfield-write-2.c -flto -ffat-lto-objects
scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-bitfield-write-2.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-bitfield-write-3.c -flto -ffat-lto-objects
scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-bitfield-write-3.c scan-tree-dump-times vect
"vectorized 1 loops" 1

As discussed in the PR, they require vect_long_long support, but fail
to require that.

This patch fixes this.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

2023-01-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
PR testsuite/107808
* gcc.dg/vect/vect-bitfield-write-2.c: Require vect_long_long.
* gcc.dg/vect/vect-bitfield-write-3.c: Likewise.

17 months agotestsuite: Fix gcc.dg/vect/vect-fmax-1.c etc. on SPARC [PR104756]
Rainer Orth [Tue, 24 Jan 2023 07:48:11 +0000 (08:48 +0100)]
testsuite: Fix gcc.dg/vect/vect-fmax-1.c etc. on SPARC [PR104756]

The gcc.dg/vect/vect-fmax-?.c etc. tests FAIL on 32 and 64-bit SPARC:

FAIL: gcc.dg/vect/vect-fmax-1.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmax-1.c scan-tree-dump vect "Detected reduction"
FAIL: gcc.dg/vect/vect-fmax-2.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmax-2.c scan-tree-dump vect "Detected reduction"
FAIL: gcc.dg/vect/vect-fmax-3.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmax-3.c scan-tree-dump vect "Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-1.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-1.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-1.c scan-tree-dump vect "Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-1.c scan-tree-dump vect "Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-2.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-2.c scan-tree-dump vect "Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-3.c -flto -ffat-lto-objects scan-tree-dump vect
"Detected reduction"
FAIL: gcc.dg/vect/vect-fmin-3.c scan-tree-dump vect "Detected reduction"

As discussed in the PR, they require vect_float support, but the tests
don't declare it.

This patch fixes this.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

2023-01-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
PR testsuite/104756
* gcc.dg/vect/vect-fmax-1.c: Require vect_float.
* gcc.dg/vect/vect-fmax-2.c: Likewise.
* gcc.dg/vect/vect-fmax-3.c: Likewise.
* gcc.dg/vect/vect-fmin-1.c: Likewise.
* gcc.dg/vect/vect-fmin-2.c: Likewise.
* gcc.dg/vect/vect-fmin-3.c: Likewise.

17 months agoLoongArch: Fixed a compilation failure with '%c' in inline assembly [PR107731].
Lulu Cheng [Wed, 18 Jan 2023 03:06:56 +0000 (11:06 +0800)]
LoongArch: Fixed a compilation failure with '%c' in inline assembly [PR107731].

Co-authored-by: Yang Yujie <yangyujie@loongson.cn>
PR target/107731

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_classify_address):
Add precessint for CONST_INT.
(loongarch_print_operand_reloc): Operand modifier 'c' is supported.
(loongarch_print_operand): Increase the processing of '%c'.
* doc/extend.texi: Adds documents for LoongArch operand modifiers.
And port the public operand modifiers information to this document.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/tst-asm-const.c: Moved to...
* gcc.target/loongarch/pr107731.c: ...here.

17 months agoc++: TARGET_EXPR collapsing [PR107303]
Jason Merrill [Mon, 23 Jan 2023 21:25:07 +0000 (16:25 -0500)]
c++: TARGET_EXPR collapsing [PR107303]

In r13-2978 I tried to eliminate TARGET_EXPR around TARGET_EXPR by
discarding the outer one, but as in this testcase that breaks if the
TARGET_EXPR_SLOT of the outer one is used elsewhere.  But it should always
be safe to strip the inner one; if its slot were reused, there would be a
COMPOUND_EXPR around the TARGET_EXPR.

For 107329, if we're setting *walk_subtrees, we also need to fold
TARGET_EXPR_CLEANUP.

PR c++/107303
PR c++/107329

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double
TARGET_EXPR, keep the outer one instead of the inner one.
(maybe_replace_decl): New.

gcc/testsuite/ChangeLog:

* g++.dg/ext/builtin-shufflevector-5.C: New test.
* g++.dg/init/new51.C: New test.

17 months agoDaily bump.
GCC Administrator [Tue, 24 Jan 2023 00:17:23 +0000 (00:17 +0000)]
Daily bump.

17 months agoc++: TARGET_EXPR_ELIDING_P and std::move [PR107267]
Jason Merrill [Mon, 23 Jan 2023 22:14:11 +0000 (17:14 -0500)]
c++: TARGET_EXPR_ELIDING_P and std::move [PR107267]

With -ffold-simple-inlines, we turn calls to std::move into the static_cast
equivalent.  In this testcase, this exposes the FindResult temporary to copy
elision which is not specified by the standard, through an optimization in
gimplify_modify_expr_rhs.  Since the type is not TREE_ADDRESSABLE, this is
not detectable by the user, so we just need to soften the assert.

PR c++/107267

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision
of trivial types.

gcc/testsuite/ChangeLog:

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

17 months agoFortran: fix NULL pointer dereference in gfc_check_dependency [PR108502]
Harald Anlauf [Mon, 23 Jan 2023 21:13:44 +0000 (22:13 +0100)]
Fortran: fix NULL pointer dereference in gfc_check_dependency [PR108502]

gcc/fortran/ChangeLog:

PR fortran/108502
* dependency.cc (gfc_check_dependency): Prevent NULL pointer
dereference while recursively checking expressions.

gcc/testsuite/ChangeLog:

PR fortran/108502
* gfortran.dg/pr108502.f90: New test.

17 months agoc++: Quash bogus -Wunused-value with new [PR107797]
Marek Polacek [Thu, 19 Jan 2023 22:12:34 +0000 (17:12 -0500)]
c++: Quash bogus -Wunused-value with new [PR107797]

We shouldn't emit "right operand of comma operator has no effect"
when that comma operator was created by the compiler for "new int{}".
convert_to_void/COMPOUND_EXPR already checks warning_suppressed_p so
we can just suppress -Wunused-value.

PR c++/107797

gcc/cp/ChangeLog:

* cvt.cc (ocp_convert): copy_warning when creating a new
COMPOUND_EXPR.
* init.cc (build_new_1): Suppress -Wunused-value on
compiler-generated COMPOUND_EXPRs.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wunused-value-1.C: New test.

17 months agoc++: vector of class with bool ctor [PR108195]
Jason Merrill [Mon, 23 Jan 2023 20:03:47 +0000 (15:03 -0500)]
c++: vector of class with bool ctor [PR108195]

The transformation done by r13-4564 to use the iterator constructor instead
of the initializer-list constructor breaks if the iterator pointers are
themselves treated as elements of an initializer-list, so check for that.

PR c++/108195

gcc/cp/ChangeLog:

* call.cc (build_user_type_conversion_1): Check whether the
iterators also find a list ctor.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/initlist-vect2.C: New test.

17 months agoFortran: avoid ICE on invalid array subscript triplets [PR108501]
Harald Anlauf [Mon, 23 Jan 2023 20:19:03 +0000 (21:19 +0100)]
Fortran: avoid ICE on invalid array subscript triplets [PR108501]

gcc/fortran/ChangeLog:

PR fortran/108501
* interface.cc (get_expr_storage_size): Check array subscript triplets
that we actually have integer values before trying to extract with
mpz_get_si.

gcc/testsuite/ChangeLog:

PR fortran/108501
* gfortran.dg/pr108501.f90: New test.

17 months agoFortran: fix ICE in check_charlen_present [PR108420]
Harald Anlauf [Mon, 16 Jan 2023 20:41:09 +0000 (21:41 +0100)]
Fortran: fix ICE in check_charlen_present [PR108420]

gcc/fortran/ChangeLog:

PR fortran/108420
* iresolve.cc (check_charlen_present): Preserve character length if
there is no array constructor.

gcc/testsuite/ChangeLog:

PR fortran/108420
* gfortran.dg/pr108420.f90: New test.

17 months agoc++: result location and explicit inst [PR108496]
Jason Merrill [Mon, 23 Jan 2023 18:33:07 +0000 (13:33 -0500)]
c++: result location and explicit inst [PR108496]

In r13-4469 we started to build the RESULT_DECL in grokdeclarator, while we
still know the location of the return type.  But in this testcase, we hit
that code again when parsing the explicit instantiation, and clobber the
DECL_RESULT that was previously used in parsing the function.  So, only set
DECL_RESULT if it isn't already set.

PR c++/108496

gcc/cp/ChangeLog:

* decl.cc (grokdeclarator): Check whether DECL_RESULT is already
set.

gcc/testsuite/ChangeLog:

* g++.dg/template/explicit-instantiation5.C: New test.

17 months agolibstdc++: [_GLIBCXX_DEBUG] Remove useless constructor checks
François Dumont [Mon, 23 Jan 2023 05:26:34 +0000 (06:26 +0100)]
libstdc++: [_GLIBCXX_DEBUG] Remove useless constructor checks

Creating a safe iterator from a normal iterator is done within the library where we
already know that it is done correctly. The rare situation where a user would use safe
iterators for his own purpose is non-Standard code so outside _GLIBCXX_DEBUG scope. For
those reasons the __msg_init_singular is useless and can be removed.

Additionally in the copy constructor used for post-increment and post-decrement operators
the __msg_init_copy_singular check can also be ommitted because of the preliminary
__msg_bad_incr and __msg_bad_decr checks.

libstdc++-v3/ChangeLog:

* include/debug/safe_iterator.h (_Safe_iterator<>::_Unchecked): New.
(_Safe_iterator(const _Safe_iterator&, _Unchecked)): New.
(_Safe_iterator::operator++(int)): Use latter.
(_Safe_iterator::operator--(int)): Likewise.
(_Safe_iterator(_Iterator, const _Safe_sequence_base*)): Remove !_M_insular()
check.
* include/debug/safe_local_iterator.h (_Safe_local_iterator<>::_Unchecked):
New.
(_Safe_local_iterator(const _Safe_local_iterator&, _Unchecked)): New.
(_Safe_local_iterator::operator++(int)): Use latter.
* src/c++11/debug.cc (_S_debug_messages): Add as comment the _Debug_msg_id
entry associated to the array entry.

17 months agomodula-2, driver, Front end: Revise handling of I and L paths [PR108182].
Iain Sandoe [Wed, 11 Jan 2023 10:22:34 +0000 (10:22 +0000)]
modula-2, driver, Front end: Revise handling of I and L paths [PR108182].

The adds the includes in the FE as done in other GCC languages.
It also revises the library handling to avoid additional -L options
from hiding LIBDIR.

For the include/import paths as presented to the front end initialisation,
we capture them and then arrange to emit the 'standard library' paths in
the same order as specified for C.

The specs are tidied up.

The use of the internal prefix also fixes searching in a relocated compiler.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/108182
PR modula2/108480

gcc/m2/ChangeLog:

* Make-lang.in: Pass libsubdir to the language init
build.
* gm2-lang.cc (INCLUDE_VECTOR): Define.
(add_one_import_path): New.
(add_m2_import_paths): New.
(gm2_langhook_post_options): Arrange to add the include
paths (and add the system ones) in the same order as C
uses.
* gm2spec.cc (build_archive_path): Remove.
(add_default_combination): Remove.
(add_default_archives): Remove.
(add_default_libs): We no longer need a '-L' option, just
emit the -l and each library in use.
(build_include_path): Remove.
(add_include): Remove.
(add_default_includes): Remove.
(library_installed): Remove.
(check_valid_library): Remove.
(check_valid_list): Remove.
(convert_abbreviation): Diagnose unhandled cases.
(lang_specific_driver): Skip options where we will add back
a validated version.
* lang-specs.h (M2CPP): Reformat, append %I when -fcpp is not
in use.  Revise the cc1gm2 spec to omit mentioning options that
are handled in the c pre-processor line.
* lang.opt: Allow preprocessing and path options as input to the
cc1gm2 invocation, so that they can be passed to the preprocessor
invocation.

17 months agomodula-2: Fix stack size request in initPreemptive [PR108405]
Iain Sandoe [Sat, 14 Jan 2023 10:20:47 +0000 (10:20 +0000)]
modula-2: Fix stack size request in initPreemptive [PR108405]

As noted in the PR, the problem is that we make a request for additional
stack that violates the constraints on some systems.

This patch chooses a value that is divisible by common OS page sizes.

TODO: the user value should be checked and then an exception thrown if it
is not suitable.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/108405

gcc/m2/ChangeLog:

* gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for
extra space that is divisible by common OS pagesizes.

17 months agoarm: Documentation fix for -mbranch-protection option.
Srinath Parvathaneni [Mon, 23 Jan 2023 13:37:07 +0000 (13:37 +0000)]
arm: Documentation fix for -mbranch-protection option.

This patch fixes the documentation for -mbranch-protection command line option.

gcc/ChangeLog:

2023-01-23  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

* doc/invoke.texi (-mbranch-protection): Update documentation.

17 months agosparc: Don't add crtfastmath.o for -shared
Richard Biener [Fri, 13 Jan 2023 07:54:33 +0000 (08:54 +0100)]
sparc: Don't add crtfastmath.o for -shared

Don't add crtfastmath.o for -shared to avoid altering the FP
environment when loading a shared library.

PR target/55522
* config/sparc/freebsd.h (ENDFILE_SPEC): Don't add crtfastmath.o
for -shared.
* config/sparc/linux.h (ENDFILE_SPEC): Likewise.
* config/sparc/linux64.h (ENDFILE_SPEC): Likewise.
* config/sparc/sp-elf.h (ENDFILE_SPEC): Likewise.
* config/sparc/sp64-elf.h (ENDFILE_SPEC): Likewise.