]> gcc.gnu.org Git - gcc.git/log
gcc.git
10 months agolibstdc++: [_Hashtable] Add missing node destructor call
François Dumont [Mon, 6 Nov 2023 18:34:50 +0000 (19:34 +0100)]
libstdc++: [_Hashtable] Add missing node destructor call

libstdc++-v3/ChangeLog:

* include/bits/hashtable_policy.h
(_Hashtable_alloc<>::_M_allocate_node): Add missing call to node destructor
on construct exception.

10 months agoc: Change T2X_* format checking macros to T23_*
Joseph Myers [Tue, 7 Nov 2023 20:03:37 +0000 (20:03 +0000)]
c: Change T2X_* format checking macros to T23_*

Analogous to previous changes to code that matched "c2x"
(case-insensitive), also update T2X_* macros used in format checking
tables to be named T23_*.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c-family/
* c-format.h (T2X_UI): Rename to T23_UI.
(T2X_UL): Rename to T23_UL.
(T2X_ULL): Rename to T23_ULL.
(T2X_US): Rename to T23_US.
(T2X_UC): Rename to T23_UC.
(T2X_ST): Rename to T23_ST.
(T2X_UPD): Rename to T23_UPD.
(T2X_UIM): Rename to T23_UIM.
(T2X_D32): Rename to T23_D32.
(T2X_D64): Rename to T23_D64.
(T2X_D128): Rename to T23_D128.
(T2X_I8): Rename to T23_I8.
(T2X_I16): Rename to T23_I16.
(T2X_I32): Rename to T23_I32.
(T2X_I64): Rename to T23_I64.
(T2X_U8): Rename to T23_U8.
(T2X_U16): Rename to T23_U16.
(T2X_U32): Rename to T23_U32.
(T2X_U64): Rename to T23_U64.
(T2X_IF8): Rename to T23_IF8.
(T2X_IF16): Rename to T23_IF16.
(T2X_IF32): Rename to T23_IF32.
(T2X_IF64): Rename to T23_IF64.
(T2X_UF8): Rename to T23_UF8.
(T2X_UF16): Rename to T23_UF16.
(T2X_UF32): Rename to T23_UF32.
(T2X_UF64): Rename to T23_UF64.
* c-format.cc: Update all uses of T2X_* macros to use T23_*.

10 months agoi386: Make flags_reg_operand a special predicate
Uros Bizjak [Tue, 7 Nov 2023 18:32:14 +0000 (19:32 +0100)]
i386: Make flags_reg_operand a special predicate

There is no need to check the mode in flags_reg_operand predicate. The
mode in flags setting instructions is checked with ix86_match_ccmode.

The patch avoids "warning: operand X missing mode?" warnings with
VOIDmode flags_reg_operand predicate.

gcc/ChangeLog:

* config/i386/predicates.md ("flags_reg_operand"):
Make predicate special to avoid automatic mode checks.

10 months agogcc/configure: Regenerate
Martin Jambor [Tue, 7 Nov 2023 17:47:09 +0000 (18:47 +0100)]
gcc/configure: Regenerate

Probabaly because of a re-base of changes to gcc/configure there are
line comment mismatches in between what we have and what would be
generated. This patch brings them in line so that consitency
checkers are happy.

gcc/ChangeLog:

2023-11-07  Martin Jambor  <mjambor@suse.cz>

* configure: Regenerate.

10 months agotestsuite: nodiscard-reason-nonstring.C FAIL in C++26
Marek Polacek [Tue, 7 Nov 2023 15:41:41 +0000 (10:41 -0500)]
testsuite: nodiscard-reason-nonstring.C FAIL in C++26

Since r14-5071, we emit an extra error for this test (the first one):

nodiscard-reason-nonstring.C:5:13: error: expected string-literal before numeric constant
nodiscard-reason-nonstring.C:5:36: error: 'nodiscard' attribute argument must be a string constant

so the test needs adjusting.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nodiscard-reason-nonstring.C: Adjust dg-error.

10 months agoopenmp: Add support for the 'indirect' clause in C/C++
Kwok Cheung Yeung [Tue, 7 Nov 2023 15:18:29 +0000 (15:18 +0000)]
openmp: Add support for the 'indirect' clause in C/C++

This adds support for the 'indirect' clause in the 'declare target'
directive.  Functions declared as indirect may be called via function
pointers passed from the host in offloaded code.

Virtual calls to member functions via the object pointer in C++ are
currently not supported in target regions.

2023-11-07  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/c-family/
* c-attribs.cc (c_common_attribute_table): Add attribute for
indirect functions.
* c-pragma.h (enum parma_omp_clause): Add entry for indirect clause.

gcc/c/
* c-decl.cc (c_decl_attributes): Add attribute for indirect
functions.
* c-lang.h (c_omp_declare_target_attr): Add indirect field.
* c-parser.cc (c_parser_omp_clause_name): Handle indirect clause.
(c_parser_omp_clause_indirect): New.
(c_parser_omp_all_clauses): Handle indirect clause.
(OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(c_parser_omp_declare_target): Handle indirect clause.  Emit error
message if device_type or indirect clauses used alone.  Emit error
if indirect clause used with device_type that is not 'any'.
(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(c_parser_omp_begin): Handle indirect clause.
* c-typeck.cc (c_finish_omp_clauses): Handle indirect clause.

gcc/cp/
* cp-tree.h (cp_omp_declare_target_attr): Add indirect field.
* decl2.cc (cplus_decl_attributes): Add attribute for indirect
functions.
* parser.cc (cp_parser_omp_clause_name): Handle indirect clause.
(cp_parser_omp_clause_indirect): New.
(cp_parser_omp_all_clauses): Handle indirect clause.
(handle_omp_declare_target_clause): Add extra parameter.  Add
indirect attribute for indirect functions.
(OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(cp_parser_omp_declare_target): Handle indirect clause.  Emit error
message if device_type or indirect clauses used alone.  Emit error
if indirect clause used with device_type that is not 'any'.
(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
(cp_parser_omp_begin): Handle indirect clause.
* semantics.cc (finish_omp_clauses): Handle indirect clause.

gcc/
* lto-cgraph.cc (enum LTO_symtab_tags): Add tag for indirect
functions.
(output_offload_tables): Write indirect functions.
(input_offload_tables): read indirect functions.
* lto-section-names.h (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME): New.
* omp-builtins.def (BUILT_IN_GOMP_TARGET_MAP_INDIRECT_PTR): New.
* omp-offload.cc (offload_ind_funcs): New.
(omp_discover_implicit_declare_target): Add functions marked with
'omp declare target indirect' to indirect functions list.
(omp_finish_file): Add indirect functions to section for offload
indirect functions.
(execute_omp_device_lower): Redirect indirect calls on target by
passing function pointer to BUILT_IN_GOMP_TARGET_MAP_INDIRECT_PTR.
(pass_omp_device_lower::gate): Run pass_omp_device_lower if
indirect functions are present on an accelerator device.
* omp-offload.h (offload_ind_funcs): New.
* tree-core.h (omp_clause_code): Add OMP_CLAUSE_INDIRECT.
* tree.cc (omp_clause_num_ops): Add entry for OMP_CLAUSE_INDIRECT.
(omp_clause_code_name): Likewise.
* tree.h (OMP_CLAUSE_INDIRECT_EXPR): New.
* config/gcn/mkoffload.cc (process_asm): Process offload_ind_funcs
section.  Count number of indirect functions.
(process_obj): Emit number of indirect functions.
* config/nvptx/mkoffload.cc (ind_func_ids, ind_funcs_tail): New.
(process): Emit offload_ind_func_table in PTX code.  Emit indirect
function names and count in image.
* config/nvptx/nvptx.cc (nvptx_record_offload_symbol): Mark
indirect functions in PTX code with IND_FUNC_MAP.

gcc/testsuite/
* c-c++-common/gomp/declare-target-7.c: Update expected error message.
* c-c++-common/gomp/declare-target-indirect-1.c: New.
* c-c++-common/gomp/declare-target-indirect-2.c: New.
* g++.dg/gomp/attrs-21.C (v12): Update expected error message.
* g++.dg/gomp/declare-target-indirect-1.C: New.
* gcc.dg/gomp/attrs-21.c (v12): Update expected error message.

include/
* gomp-constants.h (GOMP_VERSION): Increment to 3.
(GOMP_VERSION_SUPPORTS_INDIRECT_FUNCS): New.

libgcc/
* offloadstuff.c (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME): New.
(__offload_ind_func_table): New.
(__offload_ind_funcs_end): New.
(__OFFLOAD_TABLE__): Add entries for indirect functions.

libgomp/
* Makefile.am (libgomp_la_SOURCES): Add target-indirect.c.
* Makefile.in: Regenerate.
* libgomp-plugin.h (GOMP_INDIRECT_ADDR_MAP): New define.
(GOMP_OFFLOAD_load_image): Add extra argument.
* libgomp.h (struct indirect_splay_tree_key_s): New.
(indirect_splay_tree_node, indirect_splay_tree,
indirect_splay_tree_key): New.
(indirect_splay_compare): New.
* libgomp.map (GOMP_5.1.1): Add GOMP_target_map_indirect_ptr.
* libgomp.texi (OpenMP 5.1): Update documentation on indirect
calls in target region and on indirect clause.
(Other new OpenMP 5.2 features): Add entry for virtual function calls.
* libgomp_g.h (GOMP_target_map_indirect_ptr): Add prototype.
* oacc-host.c (host_load_image): Add extra argument.
* target.c (gomp_load_image_to_device): If the GOMP_VERSION is high
enough, read host indirect functions table and pass to
load_image_func.
* config/accel/target-indirect.c: New.
* config/linux/target-indirect.c: New.
* config/gcn/team.c (build_indirect_map): Add prototype.
(gomp_gcn_enter_kernel): Initialize support for indirect
function calls on GCN target.
* config/nvptx/team.c (build_indirect_map): Add prototype.
(gomp_nvptx_main): Initialize support for indirect function
calls on NVPTX target.
* plugin/plugin-gcn.c (struct gcn_image_desc): Add field for
indirect functions count.
(GOMP_OFFLOAD_load_image): Add extra argument.  If the GOMP_VERSION
is high enough, build address translation table and copy it to target
memory.
* plugin/plugin-nvptx.c (nvptx_tdata): Add field for indirect
functions count.
(GOMP_OFFLOAD_load_image): Add extra argument.  If the GOMP_VERSION
is high enough, Build address translation table and copy it to target
memory.
* testsuite/libgomp.c-c++-common/declare-target-indirect-1.c: New.
* testsuite/libgomp.c-c++-common/declare-target-indirect-2.c: New.
* testsuite/libgomp.c++/declare-target-indirect-1.C: New.

10 months agoOpenMP: invoke.texi - mention C attribute syntax for -fopenmp(-simd)
Tobias Burnus [Tue, 7 Nov 2023 15:23:45 +0000 (16:23 +0100)]
OpenMP: invoke.texi - mention C attribute syntax for -fopenmp(-simd)

gcc/ChangeLog:

* doc/invoke.texi (-fopenmp, -fopenmp-simd): Adjust wording for
attribute syntax supported also in C.

10 months agoaarch64: Add a %Z operand modifier for SVE registers
Richard Sandiford [Tue, 7 Nov 2023 15:22:57 +0000 (15:22 +0000)]
aarch64: Add a %Z operand modifier for SVE registers

This patch adds a %Z operand modifier that prints registers as SVE z
registers.  The SME patches need this, but so do Tamar's patches.
I'm separating this out to unblock those.

We should probably document the [wxbhsdqZ] modifiers as
user-facing, but doing that for all of them is a separate patch.

gcc/
* config/aarch64/aarch64.cc (aarch64_print_operand): Add a %Z
modifier for SVE registers.

10 months agoc: Refer more consistently to C23 not C2X
Joseph Myers [Tue, 7 Nov 2023 14:19:36 +0000 (14:19 +0000)]
c: Refer more consistently to C23 not C2X

Continuing the move to refer to C23 in place of C2X throughout the
source tree, update documentation, diagnostics, comments, variable and
function names, etc., to use the C23 name.

Testsuite updates are left for a future patch, except for testcases
that test diagnostics that previously mentioned C2X (but in those
testcases, sometimes other comments are updated, not just the
diagnostic expectations).

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/
* builtins.def (DEF_C2X_BUILTIN): Rename to DEF_C23_BUILTIN and
use flag_isoc23 and function_c23_misc.
* config/rl78/rl78.cc (rl78_option_override): Compare
lang_hooks.name with "GNU C23" not "GNU C2X".
* coretypes.h (function_c2x_misc): Rename to function_c23_misc.
* doc/cpp.texi (@code{__has_attribute}): Refer to C23 instead of
C2x.
* doc/extend.texi: Likewise.
* doc/invoke.texi: Likewise.
* dwarf2out.cc (highest_c_language, gen_compile_unit_die): Compare
against and return "GNU C23" language string instead of "GNU C2X".
* ginclude/float.h: Refer to C23 instead of C2X in comments.
* ginclude/stdint-gcc.h: Likewise.
* glimits.h: Likewise.
* tree.h: Likewise.

gcc/ada/
* gcc-interface/utils.cc (flag_isoc2x): Rename to flag_isoc23.

gcc/c-family/
* c-common.cc (flag_isoc2x): Rename to flag_isoc23.
(c_common_reswords): Use D_C23 instead of D_C2X.
* c-common.h: Refer throughout to C23 instead of C2X in comments.
(D_C2X): Rename to D_C23.
(flag_isoc2x): Rename to flag_isoc23.
* c-cppbuiltin.cc (builtin_define_float_constants): Use
flag_isoc23 instead of flag_isoc2x.  Refer to C23 instead of C2x
in comments.
* c-format.cc: Use STD_C23 instead of STD_C2X and flag_isoc23
instead of flag_isoc2x.  Refer to C23 instead of C2X in comments.
* c-format.h: Use STD_C23 instead of STD_C2X.
* c-lex.cc: Use warn_c11_c23_compat instead of warn_c11_c2x_compat
and flag_isoc23 instead of flag_isoc2x.  Refer to C23 instead of
C2X in diagnostics.
* c-opts.cc: Use flag_isoc23 instead of flag_isoc2x.  Refer to C23
instead of C2X in comments.
(set_std_c2x): Rename to set_std_c23.
* c.opt (Wc11-c23-compat): Use CPP(cpp_warn_c11_c23_compat)
CppReason(CPP_W_C11_C23_COMPAT) Var(warn_c11_c23_compat) instead
of CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT)
Var(warn_c11_c2x_compat).

gcc/c/
* c-decl.cc: Use flag_isoc23 instead of flag_isoc2x and c23_auto_p
instead of c2x_auto_p.  Refer to C23 instead of C2X in diagnostics
and comments.
* c-errors.cc: Use flag_isoc23 instead of flag_isoc2x and
warn_c11_c23_compat instead of warn_c11_c2x_compat.  Refer to C23
instead of C2X in comments.
* c-parser.cc: Use flag_isoc23 instead of flag_isoc2x,
warn_c11_c23_compat instead of warn_c11_c2x_compat, c23_auto_p
instead of c2x_auto_p and D_C23 instead of D_C2X.  Refer to C23
instead of C2X in diagnostics and comments.
* c-tree.h: Refer to C23 instead of C2X in comments.
(struct c_declspecs): Rename c2x_auto_p to c23_auto_p.
* c-typeck.cc: Use flag_isoc23 instead of flag_isoc2x and
warn_c11_c23_compat instead of warn_c11_c2x_compat.  Refer to C23
instead of C2X in diagnostics and comments.

gcc/fortran/
* gfortran.h (gfc_real_info): Refer to C23 instead of C2X in
comment.

gcc/lto/
* lto-lang.cc (flag_isoc2x): Rename to flag_isoc23.

gcc/testsuite/
* gcc.dg/binary-constants-2.c: Refer to C23 instead of C2X.
* gcc.dg/binary-constants-3.c: Likewise.
* gcc.dg/bitint-23.c: Likewise.
* gcc.dg/bitint-26.c: Likewise.
* gcc.dg/bitint-27.c: Likewise.
* gcc.dg/c11-attr-syntax-1.c: Likewise.
* gcc.dg/c11-attr-syntax-2.c: Likewise.
* gcc.dg/c11-floatn-1.c: Likewise.
* gcc.dg/c11-floatn-2.c: Likewise.
* gcc.dg/c11-floatn-3.c: Likewise.
* gcc.dg/c11-floatn-4.c: Likewise.
* gcc.dg/c11-floatn-5.c: Likewise.
* gcc.dg/c11-floatn-6.c: Likewise.
* gcc.dg/c11-floatn-7.c: Likewise.
* gcc.dg/c11-floatn-8.c: Likewise.
* gcc.dg/c2x-attr-syntax-4.c: Likewise.
* gcc.dg/c2x-attr-syntax-6.c: Likewise.
* gcc.dg/c2x-attr-syntax-7.c: Likewise.
* gcc.dg/c2x-binary-constants-2.c: Likewise.
* gcc.dg/c2x-floatn-5.c: Likewise.
* gcc.dg/c2x-floatn-6.c: Likewise.
* gcc.dg/c2x-floatn-7.c: Likewise.
* gcc.dg/c2x-floatn-8.c: Likewise.
* gcc.dg/c2x-nullptr-4.c: Likewise.
* gcc.dg/c2x-qual-2.c: Likewise.
* gcc.dg/c2x-qual-3.c: Likewise.
* gcc.dg/c2x-qual-6.c: Likewise.
* gcc.dg/cpp/c11-warning-1.c: Likewise.
* gcc.dg/cpp/c11-warning-2.c: Likewise.
* gcc.dg/cpp/c11-warning-3.c: Likewise.
* gcc.dg/cpp/c2x-warning-2.c: Likewise.
* gcc.dg/cpp/gnu11-elifdef-3.c: Likewise.
* gcc.dg/cpp/gnu11-elifdef-4.c: Likewise.
* gcc.dg/cpp/gnu11-warning-1.c: Likewise.
* gcc.dg/cpp/gnu11-warning-2.c: Likewise.
* gcc.dg/cpp/gnu11-warning-3.c: Likewise.
* gcc.dg/cpp/gnu2x-warning-2.c: Likewise.
* gcc.dg/dfp/c11-constants-1.c: Likewise.
* gcc.dg/dfp/c11-constants-2.c: Likewise.
* gcc.dg/dfp/c2x-constants-2.c: Likewise.
* gcc.dg/dfp/constants-pedantic.c: Likewise.
* gcc.dg/pr30260.c: Likewise.
* gcc.dg/system-binary-constants-1.c: Likewise.

libcpp/
* directives.cc: Refer to C23 instead of C2X in diagnostics and
comments.
(STDC2X): Rename to STDC23.
* expr.cc: Use cpp_warn_c11_c23_compat instead of
cpp_warn_c11_c2x_compat and CPP_W_C11_C23_COMPAT instead of
CPP_W_C11_C2X_COMPAT.  Refer to C23 instead of C2X in diagnostics
and comments.
* include/cpplib.h: Refer to C23 instead of C2X in diagnostics and
comments.
(CLK_GNUC2X): Rename to CLK_GNUC23.
(CLK_STDC2X): Rename to CLK_STDC23.
(CPP_W_C11_C2X_COMPAT): Rename to CPP_W_C11_C23_COMPAT.
* init.cc: Use GNUC23 instead of GNUC2X, STDC23 instead of STDC2X
and cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat.
* lex.cc (maybe_va_opt_error): Refer to C23 instead of C2X in
diagnostic.
* macro.cc (_cpp_arguments_ok): Refer to C23 instead of C2X in
comment.

10 months agotest: Fix FAIL of pr65518.c for RVV[PR112420]
Juzhe-Zhong [Tue, 7 Nov 2023 13:30:14 +0000 (21:30 +0800)]
test: Fix FAIL of pr65518.c for RVV[PR112420]

PR target/112420

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr65518.c: Fix check for RVV.

10 months agolibstdc++/112351 - deal with __gthread_once failure during locale init
Richard Biener [Mon, 6 Nov 2023 10:31:40 +0000 (11:31 +0100)]
libstdc++/112351 - deal with __gthread_once failure during locale init

The following makes the C++98 locale init path follow the way the
C++11 performs initialization.  This way we deal with pthread_once
failing, falling back to non-threadsafe initialization which, given we
initialize from the library, should be serialized by the dynamic
loader already.

PR libstdc++/112351
libstdc++-v3/
* src/c++98/locale.cc (locale::facet::_S_initialize_once):
Check whether _S_c_locale is already initialized.
(locale::facet::_S_get_c_locale): Always perform non-threadsafe
init when threadsafe init failed.

10 months agotestsuite/vect: Make check more accurate.
Robin Dapp [Tue, 7 Nov 2023 08:15:02 +0000 (09:15 +0100)]
testsuite/vect: Make check more accurate.

Similar to before this modifies a check so we do only match a
vectorization attempt if it succeeded.  On riscv we potentially try
several modes if which some may fail.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-cond-reduc-4.c: Make check more accurate.

10 months agotestsuite: Change expectation for bb-slp-over-widen-n.c
Robin Dapp [Tue, 7 Nov 2023 07:58:07 +0000 (08:58 +0100)]
testsuite: Change expectation for bb-slp-over-widen-n.c

This patch makes sure we check for
  note: Basic block will be vectorized using SLP
instead of
  optimized: basic block
which will also match
  optimized: basic block part
of which there are many more in an RVV dump.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-over-widen-1.c: Change test expectation.
* gcc.dg/vect/bb-slp-over-widen-2.c: Ditto.

10 months agoRISC-V: Add RISC-V into vect_cmdline_needed
Juzhe-Zhong [Tue, 7 Nov 2023 11:46:34 +0000 (19:46 +0800)]
RISC-V: Add RISC-V into vect_cmdline_needed

Like all other targets, we add RISC-V into vect_cmdline_needed.

This patch fixes following FAILs:

FAIL: gcc.dg/tree-ssa/gen-vect-11b.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/tree-ssa/gen-vect-11c.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/tree-ssa/gen-vect-26.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
FAIL: gcc.dg/tree-ssa/gen-vect-28.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Add RISC-V.

10 months agotestsuite: check for and use -mno-strict-align where needed
Alexandre Oliva [Tue, 7 Nov 2023 11:02:03 +0000 (08:02 -0300)]
testsuite: check for and use -mno-strict-align where needed

Various tests fail on powerpc if the toolchain is configured to enable
-mstrict-align by default.  This patch introduces -mno-strict-align on
tests found to fail that way, when the target supports this option.

I suppose !non_strict_align could be used to skip tests, instead of or
in addition to this tweak, and that might be desirable if they still
fail on targets that do no support -mno-strict-align, but I haven't
observed such scenarios.

The p9-vec-length tests expect vectorization on loop bodies and
epilogues that reference arrays that are not known to be more aligned
than their small element types.

Though VSX vectors work best with 32- or 64-bit alignment, unaligned
vector loads and stores are expected by the tests.  However, with
-mstrict-align by default, vector loads and stores not known to be
aligned end up open coded, which doesn't match the asm output
expectations coded in the tests.

for  gcc/ChangeLog

* doc/sourcebuild.texi (opt_mstrict_align): New target.

for  gcc/testsuite/ChangeLog

* lib/target-supports.exp
(check_effective_target_opt_mstrict_align): New.
* gcc.dg/strlenopt-80.c: Add -mno-strict-align if supported.
* gcc.target/powerpc/prefix-ds-dq.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-run-8.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-8.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-1.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-2.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-3.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-4.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-5.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-6.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-full-run-8.c: Likewise.

10 months agoRISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.h
Christoph Müllner [Tue, 7 Nov 2023 09:43:08 +0000 (10:43 +0100)]
RISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.h

stdint.h can be replaced with stdint-gcc.h to resolve some missing
system headers in non-multilib installations.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadmemidx-helpers.h:
Replace stdint.h with stdint-gcc.h.

10 months agoRISC-V: Add ABI requirement for XTheadFMemIdx tests
Christoph Müllner [Mon, 6 Nov 2023 07:56:17 +0000 (08:56 +0100)]
RISC-V: Add ABI requirement for XTheadFMemIdx tests

The XTheadFMemIdx tests set the required ABI for RV32, but not
for RV64, which has the effect that the tests are expected to
succeed for RV64/LP64.  Let's set the ABI to LP64D in these
tests to clarify the requirements.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadfmemidx-index-update.c: Add ABI.
* gcc.target/riscv/xtheadfmemidx-index-xtheadbb-update.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-index-xtheadbb.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-index.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex-update.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb-update.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb.c: Likewise.
* gcc.target/riscv/xtheadfmemidx-uindex.c: Likewise.

10 months agoada: Fix debug info for aliased packed array with unconstrained nominal subtype
Eric Botcazou [Tue, 17 Oct 2023 17:20:26 +0000 (19:20 +0200)]
ada: Fix debug info for aliased packed array with unconstrained nominal subtype

The front-end now rewrites it as a renaming when it is initialized with a
function call and the same processing must be applied in the renaming case
as in the regular case for this kind of special objects.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Apply the
specific rewriting done for an aliased object with an unconstrained
array nominal subtype in the renaming case too.

10 months agoada: Fix spurious -Wstringop-overflow with link time optimization
Eric Botcazou [Thu, 12 Oct 2023 12:26:46 +0000 (14:26 +0200)]
ada: Fix spurious -Wstringop-overflow with link time optimization

It comes from an incomplete optimization performed by LTO that is caused by
an obsolete transformation done in Gigi, which is redundant with the common
uniquization of constant CONSTRUCTORs now performed during gimplification.

gcc/ada/

* gcc-interface/trans.cc (gnat_gimplify_expr) <CALL_EXPR>: Delete.

10 months agoada: Compiler crash on early alignment clause
Bob Duff [Wed, 18 Oct 2023 13:54:06 +0000 (09:54 -0400)]
ada: Compiler crash on early alignment clause

This patch fixes a bug: if "for T'Alignment use..." is followed
by "for T use (<enum rep>);" the compiler crashes. A workaround is
to move the alignment clause after the enumeration rep clause.

gcc/ada/

* sem_ch13.ads (Set_Enum_Esize): Do not set alignment.
* sem_ch13.adb (Set_Enum_Esize): Do not set alignment. Archaeology
seems to show that this line of code dates from when "Alignment =
0" meant "the Alignment is not known at compile time" and "the
Alignment is not yet known at compile time" as well as "the
Alignment is zero". In any case, it seems to be unnecessary, and
in this case harmful, because gigi would crash. Alignment_Clause
is set (because there is one), so gigi would query the Alignment,
but Alignment was destroyed.

10 months agoada: Update the logo in the gnat doc
Julien Bortolussi [Thu, 12 Oct 2023 15:50:15 +0000 (17:50 +0200)]
ada: Update the logo in the gnat doc

Update the logo and the background color in the top right corner of the
GNAT User’s Guide for Native Platforms

gcc/ada/

* doc/share/conf.py: Changed the background color and the logo.

10 months agoada: Fix incorrect resolution of overloaded function call in instance
Eric Botcazou [Sun, 15 Oct 2023 11:00:10 +0000 (13:00 +0200)]
ada: Fix incorrect resolution of overloaded function call in instance

The problem occurs when the function call is the operand of an equality
operator, the type used to do the comparison is declared outside of the
generic construct but visible inside it, and this generic construct also
declares two functions with the same profile except for the result type,
one result type being the aforementioned type, the other being derived
from this type but not visible inside the generic construct.  When the
second operand is either a literal or also overloaded, the call may be
resolved to the second function instead of the first in instances.

gcc/ada/

* gen_il-fields.ads (Opt_Field_Enum): Add Compare_Type.
* gen_il-gen-gen_nodes.adb (N_Op_Eq): Likewise.
(N_Op_Ge): Likewise.
(N_Op_Gt): Likewise.
(N_Op_Le): Likewise.
(N_Op_Lt): Likewise.
(N_Op_Ne): Likewise.
* sinfo.ads (Compare_Type): Document new field.
* sem_ch4.adb (Analyze_Comparison_Equality_Op): If the entity is
already present, set the Compare_Type on overloaded operands if it
is present on the node.
* sem_ch12.adb (Check_Private_View): Look into the Compare_Type
instead of the Etype for comparison operators.
(Copy_Generic_Node): Remove obsolete code for comparison
operators.
(Save_Global_References.Save_References): Do not walk into the
descendants of N_Implicit_Label_Declaration nodes.
(Save_Global_References.Set_Global_Type): Look into the
Compare_Type instead of the Etype for comparison operators.
* sem_res.adb (Resolve_Comparison_Op): Set Compare_Type.
(Resolve_Equality_Op): Likewise.

10 months agoada: Fix Ada.Directories.Modification_Time on Windows
Ronan Desplanques [Mon, 16 Oct 2023 15:09:25 +0000 (17:09 +0200)]
ada: Fix Ada.Directories.Modification_Time on Windows

Before this patch, Ada.Directories.Modification_Time called
GetFileAttributesExA under the hood on Windows. That would sometimes
fail to work with files whose names were non-ASCII.

This patch replaces the call to GetFileAttributesExA with a call to
GetFileAttributesEx preceded by an encoding scheme conversion, as is
done in other functions of the run-time library. This fixes the issues
that were observed with the previous implementations.

gcc/ada/

* adaint.c (__gnat_file_time): Fix Windows version.

10 months agoada: Elide temporary for aliased array with unconstrained nominal subtype
Eric Botcazou [Mon, 16 Oct 2023 19:16:38 +0000 (21:16 +0200)]
ada: Elide temporary for aliased array with unconstrained nominal subtype

When the array is initialized with the result of a call to a function whose
result type is unconstrained, then the result is allocated with its bounds,
so the array can be rewritten as a renaming of the result in this case too.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Fold initialization
expression of Nominal_Subtype_Is_Constrained_Array constant into
the computation of Rewrite_As_Renaming and remove the constant.
Set it to True for an aliased array with unconstrained nominal
subtype if the subtype of the expression is also unconstrained.

10 months agoada: Fix expansion of type aspects with handling of aspects
Piotr Trojanek [Mon, 16 Oct 2023 15:14:46 +0000 (17:14 +0200)]
ada: Fix expansion of type aspects with handling of aspects

The new handling of aspects stores the aspect expression as the
Expression_Copy of the aspect and not as the Entity of the aspect
identified. This has been changed for most of the aspects, but not for
Type_Invariant and Default_Initial_Condition, which have custom
expansion. Apparently this change only affects GNATprove and not GNAT.

gcc/ada/

* exp_util.adb (Add_Own_DIC, Add_Own_Invariants): Store the aspect
expression in Expression_Copy.

10 months agoada: Rename Is_Limited_View to reflect actual query
Yannick Moy [Mon, 16 Oct 2023 10:24:46 +0000 (12:24 +0200)]
ada: Rename Is_Limited_View to reflect actual query

Function Sem_Aux.Is_Limited_View returns whether the type is
"inherently limited" in a slightly different way from the "immutably
limited" definition in Ada 2012. Rename for clarity.

gcc/ada/

* exp_aggr.adb: Apply the renaming.
* exp_ch3.adb: Same.
* exp_ch4.adb: Same.
* exp_ch6.adb: Same.
* exp_ch7.adb: Same.
* exp_util.adb: Same.
* freeze.adb: Same.
* sem_aggr.adb: Same.
* sem_attr.adb: Same.
* sem_aux.adb: Alphabetize Is_Limited_Type. Rename.
* sem_aux.ads: Same.
* sem_ch3.adb: Apply the renaming.
* sem_ch6.adb: Same.
* sem_ch8.adb: Same.
* sem_prag.adb: Same.
* sem_res.adb: Same.
* sem_util.adb: Same.

10 months agoada: Implement Aspects as fields under nodes
Viljar Indus [Wed, 26 Jul 2023 10:29:14 +0000 (13:29 +0300)]
ada: Implement Aspects as fields under nodes

In the previous implementation Aspect Specifications were
stored in a separate table and not directly under each node.
This implementation included a lot of extra code that needed
to be maintained manually.

The new implementation stores Aspect_Specfications as a syntactic
field under each node. This removes the extra code that was needed
to store, traverse and clone aspects for nodes.

gcc/ada/

* aspects.adb (Exchange_Aspects): Removed. This method was
typically called after a Rewrite method. Now since the Rewrite
switches the aspects between the new and the old node it is no
longer needed.
(Has_Aspects): Converted to a utility method that performs the same
before as the previous Has_Aspects field did. Meaning it shows whether
a node actually has aspects or not.
(Copy_Aspects): New utility method that performs a deep copy of the
From nodes aspects.
(Aspect_Specfications): Removed. No longer needed. Replaced
by the primitive operation for the Aspect_Specification fields.
(Set_Aspect_Specifications): Likewise.
(Aspect_Specifications_Hash_Table): Remove the table and all the
utility methods for storing the old aspects.
* aspects.ads: Likewise.
* atree.adb (Copy_Separate_Tree): Remove custom code for aspects.
(New_Copy): Likewise.
(Replace): Likewise.
(Rewrite): Likewise.
* exp_ch3.adb (Expand_N_Object_Declaration): Keep the aspects from the old node.
* exp_ch6.adb (Validate_Subprogram_Calls): Previously aspects were ignored
because they were not on the tree. Explicitly ignore them here
when traversing the tree.
* exp_unst.adb (Build_Tables): Likewise
* gen_il-fields.ads: Remove Has_Aspects and add
Aspect_Specifications fields.
* gen_il-gen-gen_nodes.adb: Add Aspect_Specification fields
for all nodes that can have aspects. Additionally add
Expression_Copy for Aspect_Speficiations to avoid reusing
the Associated_Node for generic instantiation and aspect
analysis.
* ghost.adb (Remove_Ignored_Ghost_Node): Remove call to Remove_Aspects.
The rewritten node is a Null_Statement that cannot have aspects
and there is not anything to gain from removing them from the
Orignal_Node of N since it technically is not part of the active
tree.
* inline.adb (Process_Formals_In_Aspects): Simplify code for node traversal.
* par-ch13.adb: Avoid setting the parent explicitly for the
Aspect_Specifications list. This is done explicitly in the setter.
* par-ch6.adb: Likewise.
* par_sco.adb (Traverse_Aspects): Handle early return.
* sem_ch10.adb: Simplify code for Analyze_Aspect_Specifications.
* sem_ch11.adb: Likewise.
* sem_ch12.adb (Analyze_Formal_Derived_Interface_Type): Keep the aspects from
the orignal node after rewrite.
(Analyze_Formal_Derived_Type): Likewise.
(Analyze_Formal_Interface_Type): Likewise.
(Analyze_Formal_Object_Declaration): Simplify code for
Analyze_Aspect_Specifications.
(Analyze_Formal_Package_Declaration): Likewise.
(Analyze_Formal_Subprogram_Declaration): Likewise.
(Analyze_Formal_Type_Declaration): Likewise.
(Analyze_Generic_Package_Declaration): Remove Exchange_Aspects.
The new node already has the correct aspects after the rewrite.
Also simplify code for Analyze_Aspect_Specifications.
(Analyze_Generic_Subprogram_Declaration): Likewise.
(Analyze_Package_Instantiation): Simplify code for
Analyze_Aspect_Specifications.
(Build_Instance_Compilation_Unit_Nodes): Remove explicit copy of
aspects that is no longer needed.
(Save_References): Update the traversal code to handle
Aspect_Specifications in the tree.
(Copy_Generic_Node): Remove explicit copy for aspects. New_Copy
took care of that already.
* sem_ch13.adb (Analyze_Aspect_Specifications): Add early return to simplify
code for its calls. Avoid reusing the Entity(Associated_Node)
field for storing the original expression. Instead use the
new Expression_Copy field since Entity(Associated_Node) is
also used in generic instantiation.
(Analyze_Aspects_On_Subprogram_Body_Or_Stub): Simlify call
to Analyze_Aspect_Specifications.
(Check_Aspect_At_End_Of_Declarations): Use Expression_Copy
instead of Entity.
(Check_Aspect_At_Freeze_Point): Likewise.
* sem_ch3.adb: Simplify calls to Analyze_Aspect_Specifications.
* sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Expression_Function): Keep the aspects from the
original node after a rewrite.
(Analyze_Generic_Subprogram_Body): Remove Exchange aspects
that is no longer needed. Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Null_Procedure): Keep the aspects from the
original node after a rewrite.
(Analyze_Subprogram_Body_Helper): Simplify calls to
Analyze_Aspect_Specifications.
(Analyze_Subprogram_Declaration): Likewise.
* sem_ch7.adb (Analyze_Package_Body_Helper): Remove Exchange aspects
that is no longer needed. Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Package_Declaration): Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Private_Type_Declaration): Likewise.
* sem_ch8.adb: Simplify calls to
Analyze_Aspect_Specifications.
* sem_ch9.adb (Analyze_Entry_Body): Simplify call to
Analyze_Aspects_On_Subprogram_Body_Or_Stub.
(Analyze_Entry_Declaration): Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Protected_Body): Likewise.
(Analyze_Protected_Type_Declaration): Likewise.
(Analyze_Single_Protected_Declaration): Keep the aspects from
the original node after a rewrite. Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Single_Task_Declaration): Likewise.
(Analyze_Task_Body): Simplify call to
Analyze_Aspect_Specifications.
(Analyze_Task_Type_Declaration): Simplify calls to
Analyze_Aspect_Specifications.
* sem_dim.adb: Remove explicitly setting the parents
for the Aspect_Specification list.
* sem_disp.adb: Remove the with that is no longer
required since Aspect_Specifications is a node operation now.
* sem_util.adb (Copy_Node_With_Replacement): Remove explicit code for aspects.
* treepr.adb (Print_Field): Remove the version that was used for printing
aspects.
(Print_Node): Remove aspect specific code.

10 months agoada: Minor tweaks for comparison operators
Eric Botcazou [Fri, 13 Oct 2023 13:41:37 +0000 (15:41 +0200)]
ada: Minor tweaks for comparison operators

No functional changes.

gcc/ada/

* gen_il-gen-gen_nodes.adb (N_Op_Boolean): Fix description.
* sem_ch4.adb (Analyze_Comparison_Equality_Op): Tidy up.
* sem_ch12.adb (Copy_Generic_Node): Use N_Op_Compare subtype.

10 months agoada: Cleanup "not Present" on List_Id
Piotr Trojanek [Fri, 13 Oct 2023 11:28:00 +0000 (13:28 +0200)]
ada: Cleanup "not Present" on List_Id

gcc/ada/

* exp_ch6.adb, exp_disp.adb, sem_ch13.adb, sem_ch3.adb: Fix newly
detected violations.

10 months agoada: Cleanup more "not Present"
Piotr Trojanek [Fri, 13 Oct 2023 08:40:12 +0000 (10:40 +0200)]
ada: Cleanup more "not Present"

We had a GNATcheck rule that suggests replacing "not Present (...)" with
"No (...)", but it only detected calls with a parameter of type Node_Id.
Now this rules also detects parameters of type Elist_Id.

gcc/ada/

* sem_ch3.adb, sem_ch4.adb, sem_eval.adb: Fix newly detected
violations.

10 months agoada: Fix documentation of -gnatwc
Ronan Desplanques [Thu, 12 Oct 2023 09:31:40 +0000 (11:31 +0200)]
ada: Fix documentation of -gnatwc

-gnatwc has been correctly emitting warnings for expressions outside
of tests for a while, but its documentation in the user's guide had
never been updated to reflect that. Also, the documentation used
"conditional expressions" to designate boolean expressions, but
"conditional expressions" has been defined by Ada 2012 to designate
if expressions and case expressions. This patch fixes those issues.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix
-gnatwc documentation.
* gnat_ugn.texi: Regenerate.

10 months agoada: New Local_Restrictions and User_Aspect aspects.
Steve Baird [Thu, 10 Aug 2023 21:11:22 +0000 (14:11 -0700)]
ada: New Local_Restrictions and User_Aspect aspects.

A GNAT-defined aspect, Local_Restrictions, is defined.
This provides a way of enforcing a given restriction for an individual
subprogram (and its call-closure) without requiring that the entire
program satisfy the restriction.
A GNAT-defined aspect, User_Aspect, is defined.
This (along with the new User_Aspect_Definition configuration pragma) provides
a way of naming a set of aspect specifications which can then be applied
to multiple declarations without textual repetition of the set.

gcc/ada/

* local_restrict.ads: A new package. Declares Local_Restriction
enumeration type and provides operations to check for local
restriction violations.
* local_restrict.adb: Corresponding package body. Replace "not
Present (X)" calls with "No (X)" calls.
* aspects.ads: Add a new enumeration elements,
Aspect_Local_Restrictions and Aspect_User_Aspect, to the Aspect_Id
enumeration type. Update Aspect_Id-indexed aggregates. Add nested
package User_Aspect_Support to manage two pieces of state. One is
a map from identifiers to User_Aspect_Definition pragmas (updated
when such a pragma is encountered). The other is an
access-to-subprogram variable that is introduced in order to keep
the bulk of semantics out of the closure of package Aspects while
allowing a call from aspects.adb to the sem_ch13 procedure that
analyzes a User_Aspect aspect specification.
* aspects.adb (Find_Aspect): Cope with a case of a block statement
with an empty parent. It is not clear whether this is papering
over a compiler bug. Add indirect call through the aforementioned
access-to-subprogram variable when Find_Aspect enounters an
unanalyzed User_Aspect aspect specification. If Find_Aspect is
called looking for aspect Foo, then a User_Aspect specification
might generate (during analysis) a Foo aspect specification. So
the Find_Aspect call needs to trigger that analysis if it has not
already taken place. Provide a body for package
User_Aspect_Support. Replace "not Present (X)" call with "No (X)"
call.
* freeze.adb (Freeze_Subprogram): Check local restriction
compatibility when a dispatching operation is overridden.
* par-prag.adb: Add support for parsing a User_Aspect_Definition
pragma.
* restrict.ads: We'd like to have the body of package Restrict
include a call to a procedure declared in package Local_Restrict.
Doing that in the obvious way pulls most of semantics into the
closure of package Restrict, and that turns out to cause problems.
So we introduce a level of indirection and instead call through an
access-to-subprogram value. In this unit, we declare the
access-to-subprogram type and object.
* restrict.adb (Check Restriction): When a construct is
encountered that could violate a global restriction (depending on
whether the given restriction is in effect), Check_Restriction is
called. At this point, we also check for a violation of any
corresponding local restriction that is in effect. For reasons
described above, this check is performed via an indirect call.
* sem_ch13.ads (Parse_Aspect_Local_Restrictions): A new function,
similar to the existing Parse_Aspect_Xxx subprograms.
* sem_ch13.adb: Perform semantic analysis of Local_Restrictions
and User_Aspect aspect specifications. Declare and call new
Validate_Aspect_Local_Restrictions and
Analyze_User_Aspect_Aspect_Specification procedures (a reference
to the latter is registered during package elaboration). In
Analyze_Aspect_Specifications, do not set the Analyzed flag of a
User_Aspect aspect specification. Replace "not Present (X)" call
with "No (X)" call. Replace 'Image with 'Img in a case where the
prefix of the attribute reference is an object; this is done to
accomodate older compilers.
* sem_ch6.adb (Check_Subtype_Conformant): Include in subtype
conformance check a check for overriding-related compatibility of
local restrictions.
* sem_ch8.adb (Analyze_Subprogram_Renaming): In the case of an
instance of a generic that takes a formal subprogram, check that
formal and actual are compatible with respect to local
restrictions.
* sem_prag.adb: Add support for User_Aspect_Definition pragma.
* sem_res.adb (Resolve_Call): Check caller/callee compatibility
with respect to local restrictions.
* snames.ads-tmpl: Add Name_Local_Restrictions, Name_User_Aspect,
and Name_User_Aspect_Definition constants.
* doc/gnat_rm/implementation_defined_aspects.rst: Document new
aspects.
* doc/gnat_rm/implementation_defined_pragmas.rst: Document new
pragma.
* doc/gnat_ugn/the_gnat_compilation_model.rst: Add
User_Aspect_Definition to list of GNAT pragmas.
* gcc-interface/Make-lang.in: Add local_restrict.o.
* gnat-style.texi: Regenerate.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

10 months agoada: Error in prefix-notation call
Bob Duff [Thu, 12 Oct 2023 19:52:27 +0000 (15:52 -0400)]
ada: Error in prefix-notation call

The compiler gives a wrong error for a call of the form X.Y(...)
when Y is inherited indirectly via an interface.

gcc/ada/

* sem_ch4.adb (Is_Private_Overriding): Return True in the case
where a primitive operation is publicly inherited but privately
overridden.

10 months agoada: Remove duplicated code for expansion of packed array assignments
Piotr Trojanek [Tue, 3 Oct 2023 17:43:04 +0000 (19:43 +0200)]
ada: Remove duplicated code for expansion of packed array assignments

Expansion of assignments to packed array objects has two cases and
had duplicated code for both these cases.

gcc/ada/

* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Remove code from the
ELSE branch, because it was is identical to code before the IF
statements itself.

10 months agoada: Simplify expansion of packed array assignments
Piotr Trojanek [Tue, 3 Oct 2023 17:04:16 +0000 (19:04 +0200)]
ada: Simplify expansion of packed array assignments

When expanding assignment to a packed array object, e.g. a formal
parameter with mode OUT that might have unconstrained type, we took the
component type and component size from the constrained actual subtype.
It is simpler to take these properties from the nominal type of the
assigned object.

Semantics is unaffected, because constraining the array doesn't change
the type or size of the array components.

gcc/ada/

* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Change Ctyp and Csiz
from variables to constants and compute them using the nominal type
of the assigned array object.

10 months agoada: Fix extra whitespace after END keywords
Piotr Trojanek [Tue, 3 Oct 2023 13:00:12 +0000 (15:00 +0200)]
ada: Fix extra whitespace after END keywords

Style cleanup.

gcc/ada/

* exp_pakd.adb, libgnarl/s-osinte__android.ads,
libgnarl/s-osinte__linux.ads, libgnarl/s-osinte__qnx.ads,
libgnarl/s-osinte__rtems.ads, libgnat/s-gearop.adb,
libgnat/s-poosiz.adb, sem_util.adb: Fix style.

10 months agoada: Avoid extra conversion in expansion of packed array assignments
Piotr Trojanek [Tue, 3 Oct 2023 19:33:32 +0000 (21:33 +0200)]
ada: Avoid extra conversion in expansion of packed array assignments

Expansion of assignments to packed array objects with string literals on
the right-hand side, created an unnecessary conversion, i.e.:

  ... :=
    component_type
      (declare
         temp : component_type := "string_literal";
       begin
         temp)

Now the expansion omits the outer type conversion.

Cleanup; behavior is unaffected.

gcc/ada/

* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Simplify handling of
assignments with string literals.

10 months agoada: Simplify handling of known values in expansion of packed arrays
Piotr Trojanek [Tue, 3 Oct 2023 19:28:16 +0000 (21:28 +0200)]
ada: Simplify handling of known values in expansion of packed arrays

If an expression value is not known at compile time, it can be
represented with No_Uint and doesn't require a dedicated flag.

Code cleanup; behavior is unaffected.

gcc/ada/

* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Remove Rhs_Val_Known;
represent unknown value by assigning Rhs_Val with No_Uint.

10 months agoada: Change local variables to constants in expansion of packed arrays
Piotr Trojanek [Tue, 3 Oct 2023 19:08:29 +0000 (21:08 +0200)]
ada: Change local variables to constants in expansion of packed arrays

Cleanup; semantics is unaffected.

gcc/ada/

* exp_pakd.adb
(Expand_Bit_Packed_Element_Set): Change local Decl object from
variable to constant.
(Setup_Inline_Packed_Array_Reference): Likewise for Csiz.

10 months agoada: Fix style in declaration of routine for expansion of packed arrays
Piotr Trojanek [Tue, 3 Oct 2023 19:06:41 +0000 (21:06 +0200)]
ada: Fix style in declaration of routine for expansion of packed arrays

Style cleanup.

gcc/ada/

* exp_pakd.adb (Setup_Inline_Packed_Array_Reference): Remove extra
whitespace from the list of parameters.

10 months agoada: Cleanup getting of actual subtypes
Piotr Trojanek [Mon, 25 Sep 2023 22:17:26 +0000 (00:17 +0200)]
ada: Cleanup getting of actual subtypes

Avoid potentially unnecessary call to Etype.

gcc/ada/

* sem_util.adb (Get_Actual_Subtype_If_Available): Only call Etype
when necessary.

10 months agoada: Fix handling of actual subtypes for expanded names
Piotr Trojanek [Mon, 25 Sep 2023 22:17:12 +0000 (00:17 +0200)]
ada: Fix handling of actual subtypes for expanded names

gcc/ada/

* sem_util.adb
(Get_Actual_Subtype,Get_Actual_Subtype_If_Available): Fix handling
of expanded names.

10 months agoada: Simplify code for Ignore_Style_Checks_Pragmas
Viljar Indus [Wed, 11 Oct 2023 10:53:10 +0000 (13:53 +0300)]
ada: Simplify code for Ignore_Style_Checks_Pragmas

gcc/ada/

* sem_prag.adb: (Analyze_Pragma): Reduce the number of nested if
statements.

10 months agoada: Fix scope of semantic style_check pragmas
Viljar Indus [Fri, 6 Oct 2023 10:12:29 +0000 (13:12 +0300)]
ada: Fix scope of semantic style_check pragmas

Restore the original state of Style_Check pragmas before analyzing
each compilation unit to avoid Style_Check pragmas from unit affecting
the style checks of a different unit.

gcc/ada/

* sem_ch10.adb: (Analyze_Compilation_Unit): Restore the orignal
state of style check pragmas at the end of the analysis.

10 months agoada: Fix internal error on address of element of packed array component
Eric Botcazou [Tue, 10 Oct 2023 09:13:59 +0000 (11:13 +0200)]
ada: Fix internal error on address of element of packed array component

This occurs when the component is part of a discriminated type and its
offset depends on a discriminant, the problem being that the front-end
generates an incomplete Bit_Position attribute reference.

gcc/ada/

* exp_pakd.adb (Get_Base_And_Bit_Offset): Use the full component
reference instead of just the selector name for 'Bit_Position.

10 months agoRISC-V regression test: Fix FAIL bb-slp-cond-1.c for RVV
Juzhe-Zhong [Tue, 7 Nov 2023 08:02:43 +0000 (16:02 +0800)]
RISC-V regression test: Fix FAIL bb-slp-cond-1.c for RVV

Previously, in this patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-November/635392.html
I use vect64 && vect128 to represent both RVV and AMDGCN. However, it caused additional FAIL on ARM SVE.
I don't know why ARM SVE vect64 is set as true since their AdvSIMD is 128bit vector and they don't use 64bit vector.

So, here we leverage current AMDGCN solution, just add RISCV like AMDGCN.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-cond-1.c: Add riscv.

10 months agors6000,testcase: Add require-effective-target has_arch_ppc64 to pr106550_1.c
Jiufu Guo [Tue, 7 Nov 2023 07:19:36 +0000 (15:19 +0800)]
rs6000,testcase: Add require-effective-target has_arch_ppc64 to pr106550_1.c

With the latest trunk, case pr106550_1.c runs with failure on ppc under -m32.
Previously, this case failed with ICE due to PR111971. Now, this emission is
exposed.
While, the case is testing 64bit constant building. So, "has_arch_ppc64"
is required.

PR target/112340

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr106550_1.c: Add has_arch_ppc64 target require.

10 months agoRISC-V: Fixed failed rvv combine testcases
Lehua Ding [Tue, 7 Nov 2023 07:33:20 +0000 (15:33 +0800)]
RISC-V: Fixed failed rvv combine testcases

This patch fixed the fellowing failed testcases on the trunk:
FAIL: gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c scan-assembler-times \\tvfwredusum\\.vs\\tv[0-9]+,v[0-9]+,v[0-9]+,v0\\.t 2
...
FAIL: gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c scan-assembler-times \\tvwredsumu\\.vs\\tv[0-9]+,v[0-9]+,v[0-9]+,v0\\.t 3
...

The reason for these failed testcases is the introduce of .VCOND_MASK_LEN
in midend for other bugfix and further leads to a new vcond_mask_len rtl
pattern after expand. So we need add new combine patterns handle this case.

Consider this code:

int16_t foo (int8_t *restrict a, int8_t *restrict pred)
{
  int16_t sum = 0;
  for (int i = 0; i < 16; i += 1)
    if (pred[i])
      sum += a[i];
  return sum;
}

Before this patch:
foo:
        vsetivli        zero,16,e8,m1,ta,ma
        vle8.v  v0,0(a1)
        vsetvli a5,zero,e8,m1,ta,ma
        vmsne.vi        v0,v0,0
        vsetvli zero,zero,e16,m2,ta,ma
        li      a3,0
        vmv.v.i v2,0
        vsetivli        zero,16,e16,m2,ta,ma
        vle8.v  v6,0(a0),v0.t
        vmv.s.x v1,a3
        vsetvli a5,zero,e16,m2,ta,ma
        vsext.vf2       v4,v6
        vsetivli        zero,16,e16,m2,tu,ma
        vmerge.vvm      v2,v2,v4,v0
        vsetvli a5,zero,e16,m2,ta,ma
        vredsum.vs      v2,v2,v1
        vmv.x.s a0,v2
        slliw   a0,a0,16
        sraiw   a0,a0,16
        ret

After this patch:
foo:
vsetivli zero,16,e16,m2,ta,ma
li a5,0
vle8.v v0,0(a1)
vmv.s.x v1,a5
vsetvli zero,zero,e8,m1,ta,ma
vmsne.vi v0,v0,0
vle8.v v2,0(a0),v0.t
vwredsum.vs v1,v2,v1,v0.t
vsetvli zero,zero,e16,m1,ta,ma
vmv.x.s a0,v1
slliw a0,a0,16
sraiw a0,a0,16
ret

Combine the vsext.vf2, vmerge.vvm, and vredsum.vs instructions while
reducing the corresponding vsetvl instructions.

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*cond_len_<optab><v_double_trunc><mode>):
New combine pattern.
(*cond_len_<optab><v_quad_trunc><mode>): Ditto.
(*cond_len_<optab><v_oct_trunc><mode>): Ditto.
(*cond_len_extend<v_double_trunc><mode>): Ditto.
(*cond_len_widen_reduc_plus_scal_<mode>): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-1.c:
* gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c:

10 months agotest: Fix FAIL of vect-sdiv-pow2-1.c for RVV test: Fix FAIL of vect-sdiv-pow2-1.c...
Juzhe-Zhong [Tue, 7 Nov 2023 03:50:14 +0000 (11:50 +0800)]
test: Fix FAIL of vect-sdiv-pow2-1.c for RVV test: Fix FAIL of vect-sdiv-pow2-1.c for RVV#

RVV didn't explictly enable DIV_POW2 optab but we cen vectorize it.
We should check pattern recognition instead of explicit pattern check.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-sdiv-pow2-1.c: Fix dump check.

10 months agotest: Fix FAIL of SAD tests for RVV
Juzhe-Zhong [Tue, 7 Nov 2023 03:36:44 +0000 (11:36 +0800)]
test: Fix FAIL of SAD tests for RVV

RVV didn't explicitly enable SAD optab but we can vectorize it
since loop vectorizer is able to recognize SAD pattern for RVV during analysis.

Current scan check of explicit SAD pattern looks odd,
it should be more reasonable to check recognition of SAD pattern during Loop vectorize analysis.

Other SAD tests like slp-reduc-sad-2.c are checking pattern recognition instead of explicit pattern enable.
Fix SAD dump check to fix the FAILS for RVV.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/slp-reduc-sad.c: Fix check.
* gcc.dg/vect/vect-reduc-sad.c: Ditto.

10 months agotest: Fix XPASS of bb-slp-43.c for RVV
Juzhe-Zhong [Mon, 6 Nov 2023 22:35:31 +0000 (06:35 +0800)]
test: Fix XPASS of bb-slp-43.c for RVV

RVV is variable length vector but also has 256 bit VLS mode vector.
This test is vectorized as:

f:
        vsetivli        zero,8,e32,m2,ta,ma
        vle32.v v2,0(a0)
        vmv.v.i v4,1
        vle16.v v1,0(a1)
        vmseq.vv        v0,v2,v4
        vsetvli zero,zero,e16,m1,ta,ma
        vmseq.vi        v1,v1,2
        vsetvli zero,zero,e32,m2,ta,ma
        vmv.v.i v2,0
        vmand.mm        v0,v0,v1
        vmerge.vvm      v2,v2,v4,v0
        vse32.v v2,0(a0)
        ret

Use 256 bit vector, so remove XFAIL for 256 bits vector.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-43.c: Fix XPASS for RVV.

10 months agoRISC-V: Enhance AVL propagation for complicate reduction auto-vectorization
Juzhe-Zhong [Mon, 6 Nov 2023 03:34:26 +0000 (11:34 +0800)]
RISC-V: Enhance AVL propagation for complicate reduction auto-vectorization

I notice we failed to AVL propagate for reduction with more complicate situation:

double foo (double *__restrict a,
double *__restrict b,
double *__restrict c,
int n)
{
  double result = 0;
  for (int i = 0; i < n; i++)
    result += a[i] * b[i] * c[i];
  return result;
}

        vsetvli a5,a3,e8,mf8,ta,ma           -> should be fused into e64m1,TU
        slli    a4,a5,3
        vle64.v v3,0(a0)
        vle64.v v1,0(a1)
        vsetvli a6,zero,e64,m1,ta,ma         -> redundant
        vfmul.vv        v1,v1,v3
        vsetvli zero,a5,e64,m1,tu,ma         -> redundant
        vle64.v v3,0(a2)
        vfmacc.vv       v2,v1,v3
        add     a0,a0,a4
        add     a1,a1,a4
        add     a2,a2,a4
        sub     a3,a3,a5
        bne     a3,zero,.L3

The failed AVL propgation causes redundant AVL/VL togglling.
The root cause as follows:

vsetvl a5, zero
vadd.vv def r136
vsetvl zero, a3, ... TU
vsub.vv (use r136)

We propagate AVL (r136) from 'vsub.vv' into 'vadd.vv' when 'vsub.vv' is TA policy.
However, it's too restrict so we missed optimization here. We enhance AVL propation
for TU policy for following situation:

vsetvl a5, zero
vadd.vv def r136
vsetvl zero, a3, ... TU
vsub.vv (use r136, merge != r136)

Note that we should only propagate AVL when merge != r136 for 'vsub.vv' doesn't
depend on the tail elements.
After this patch:

vsetvli a5,a3,e64,m1,tu,ma
slli a4,a5,3
vle64.v v3,0(a0)
vle64.v v1,0(a1)
vfmul.vv v1,v1,v3
vle64.v v3,0(a2)
vfmacc.vv v2,v3,v1
add a0,a0,a4
add a1,a1,a4
add a2,a2,a4
sub a3,a3,a5
bne a3,zero,.L3

PR target/112399

gcc/ChangeLog:

* config/riscv/riscv-avlprop.cc
(pass_avlprop::get_vlmax_ta_preferred_avl): Enhance AVL propagation.
* config/riscv/t-riscv: Add new include.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/imm_switch-2.c: Adapt test.
* gcc.target/riscv/rvv/autovec/pr112399.c: New test.

10 months agoRISC-V: Support FP ceil to i/l/ll diff size autovec
Pan Li [Tue, 7 Nov 2023 03:19:56 +0000 (11:19 +0800)]
RISC-V: Support FP ceil to i/l/ll diff size autovec

This patch would like to support the FP below API auto vectorization
with different type size

+---------+-----------+----------+
| API     | RV64      | RV32     |
+---------+-----------+----------+
| iceil   | DF => SI  | DF => SI |
| iceilf  | -         | -        |
| lceil   | -         | DF => SI |
| lceilf  | SF => DI  | -        |
| llceil  | -         | -        |
| llceilf | SF => DI  | SF => DI |
+---------+-----------+----------+

Given below code:
void
test_lceilf (long *out, float *in, unsigned count)
{
  for (unsigned i = 0; i < count; i++)
    out[i] = __builtin_lceilf (in[i]);
}

Before this patch:
.L3:
  flw      fa0,0(s0)
  addi     s0,s0,4
  addi     s1,s1,8
  call     ceilf
  fcvt.l.s a5,fa0,rtz
  sd       a5,-8(s1)
  bne      s2,s0,.L3
  ld       ra,24(sp)
  ld       s0,16(sp)
  ld       s1,8(sp)
  ld       s2,0(sp)
  addi     sp,sp,32
  jr       ra

After this patch:
  fsrmi        3  // RUP mode
.L3:
  vsetvli      a5,a2,e32,mf2,ta,ma
  vle32.v      v2,0(a1)
  slli         a3,a5,2
  slli         a4,a5,3
  vfwcvt.x.f.v v1,v2
  sub          a2,a2,a5
  vse64.v      v1,0(a0)
  add          a1,a1,a3
  add          a0,a0,a4
  bne          a2,zero,.L3

Unfortunately, the HF mode is not include due to it requires
additional middle-end support from internal-fun.def.

gcc/ChangeLog:

* config/riscv/autovec.md: Remove the size check of lceil.l
* config/riscv/riscv-v.cc (expand_vec_lceil):  Leverage
emit_vec_rounding_to_integer for ceil.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/unop/math-iceil-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-iceil-run-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lceil-rv32-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lceil-rv32-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lceilf-rv64-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lceilf-rv64-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-llceilf-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-llceilf-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-iceil-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lceil-rv32-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lceilf-rv64-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-llceilf-0.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
10 months agoRevert "test: Fix FAIL of bb-slp-cond-1.c for RVV"
Pan Li [Tue, 7 Nov 2023 06:05:34 +0000 (14:05 +0800)]
Revert "test: Fix FAIL of bb-slp-cond-1.c for RVV"

This reverts commit ee7ba242cf43884477f09e59d9b80af4bf91d143.

10 months agotest: Fix FAIL of bb-slp-cond-1.c for RVV
Juzhe-Zhong [Mon, 6 Nov 2023 23:03:43 +0000 (07:03 +0800)]
test: Fix FAIL of bb-slp-cond-1.c for RVV

This patch fixes:
FAIL: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "loop vectorized" 1
FAIL: gcc.dg/vect/bb-slp-cond-1.c scan-tree-dump-times vect "loop vectorized" 1

For RVV, "loop vectorized" appears 2 times instead of 1. Because:
optimized: loop vectorized using 16 byte vectors
optimized: loop vectorized using 8 byte vectors

As long as targets have both 64bit and 128bit vectors, it will occur 2 times.
2 targets are same situation, one is AMDGCN, the other is RVV.

Replace it target amdgcn with vect64 && vect128 to make test more general and easy maintain.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-cond-1.c: Fix FAIL.

10 months agoRISC-V regression test: Fix FAIL of bb-slp-39.c
Juzhe-Zhong [Tue, 7 Nov 2023 02:32:12 +0000 (10:32 +0800)]
RISC-V regression test: Fix FAIL of bb-slp-39.c

Like s390, add riscv to fix the fail.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-39.c: Add RISCV.

10 months agoDaily bump.
GCC Administrator [Tue, 7 Nov 2023 00:17:18 +0000 (00:17 +0000)]
Daily bump.

10 months agolibstdc++: use -D_GNU_SOURCE when building libbacktrace
Ian Lance Taylor [Mon, 6 Nov 2023 23:09:18 +0000 (15:09 -0800)]
libstdc++: use -D_GNU_SOURCE when building libbacktrace

PR libbacktrace/111315
PR libbacktrace/112263
* acinclude.m4: Set -D_GNU_SOURCE in BACKTRACE_CPPFLAGS and when
grepping link.h for dl_iterate_phdr.
* configure: Regenerate.

10 months agoMAINTAINERS: Update my email address
Carl Love [Mon, 6 Nov 2023 22:23:31 +0000 (17:23 -0500)]
MAINTAINERS: Update my email address

ChangeLog:

* MAINTAINERS: Update my email address.

10 months agohppa: Fix typo in PA 2.0 trampoline template
John David Anglin [Mon, 6 Nov 2023 20:45:13 +0000 (20:45 +0000)]
hppa: Fix typo in PA 2.0 trampoline template

2023-11-06  John David Anglin  <danglin@gcc.gnu.org>

* config/pa/pa.cc (pa_asm_trampoline_template): Fix typo.

10 months agoEnable generation of GNU stack notes on Linux
John David Anglin [Mon, 6 Nov 2023 20:33:15 +0000 (20:33 +0000)]
Enable generation of GNU stack notes on Linux

2023-11-06  John David Anglin  <danglin@gcc.gnu.org>

* config/pa/pa-linux.h (NEED_INDICATE_EXEC_STACK): Define to 1.

10 months agodiagnostics: split out struct diagnostic_source_printing_options
David Malcolm [Mon, 6 Nov 2023 19:28:41 +0000 (14:28 -0500)]
diagnostics: split out struct diagnostic_source_printing_options

This patch removes almost all use of diagnostic_context from the
source-printing code.

No functional change intended.

gcc/ChangeLog:
* diagnostic-show-locus.cc (class colorizer): Take just a
pretty_printer rather than a diagnostic_context.
(layout::layout): Make context param a const reference,
and pretty_printer param non-optional.
(layout::m_context): Drop field.
(layout::m_options): New field.
(layout::m_colorize_source_p): Drop field.
(layout::m_show_labels_p): Drop field.
(layout::m_show_line_numbers_p): Drop field.
(layout::print_gap_in_line_numbering): Use m_options.
(layout::calculate_line_spans): Likewise.
(layout::calculate_linenum_width): Likewise.
(layout::calculate_x_offset_display): Likewise.
(layout::print_source_line): Likewise.
(layout::start_annotation_line): Likewise.
(layout::print_annotation_line): Likewise.
(layout::print_line): Likewise.
(gcc_rich_location::add_location_if_nearby): Update for changes to
layout ctor.
(diagnostic_show_locus): Likewise.
(selftest::test_offset_impl): Likewise.
(selftest::test_layout_x_offset_display_utf8): Likewise.
(selftest::test_layout_x_offset_display_tab): Likewise.
(selftest::test_tab_expansion): Likewise.
* diagnostic.h (diagnostic_context::m_source_printing): Move
declaration of struct outside diagnostic_context as...
(struct diagnostic_source_printing_options)... this.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
10 months agodiagnostics: introduce class diagnostic_option_classifier
David Malcolm [Mon, 6 Nov 2023 19:28:41 +0000 (14:28 -0500)]
diagnostics: introduce class diagnostic_option_classifier

This patch gathers the 6 fields in diagnostic_context relating to
keeping track of overriding the severity of warnings, and
pushing/popping those severities, moving them all into a new class
diagnostic_option_classifier.

No functional change intended.

gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::push_diagnostics): Convert
to...
(diagnostic_option_classifier::push): ...this.
(diagnostic_context::pop_diagnostics): Convert to...
(diagnostic_option_classifier::pop): ...this.
(diagnostic_context::initialize): Move code to...
(diagnostic_option_classifier::init): ...this new function.
(diagnostic_context::finish): Move code to...
(diagnostic_option_classifier::fini): ...this new function.
(diagnostic_context::classify_diagnostic): Convert to...
(diagnostic_option_classifier::classify_diagnostic): ...this.
(diagnostic_context::update_effective_level_from_pragmas): Convert
to...
(diagnostic_option_classifier::update_effective_level_from_pragmas):
...this.
(diagnostic_context::diagnostic_enabled): Update for refactoring.
* diagnostic.h (struct diagnostic_classification_change_t): Move into...
(class diagnostic_option_classifier): ...this new class.
(diagnostic_context::option_unspecified_p): Update for move of
fields into m_option_classifier.
(diagnostic_context::classify_diagnostic): Likewise.
(diagnostic_context::push_diagnostics): Likewise.
(diagnostic_context::pop_diagnostics): Likewise.
(diagnostic_context::update_effective_level_from_pragmas): Delete.
(diagnostic_context::m_classify_diagnostic): Move into class
diagnostic_option_classifier.
(diagnostic_context::m_option_classifier): Likewise.
(diagnostic_context::m_classification_history): Likewise.
(diagnostic_context::m_n_classification_history): Likewise.
(diagnostic_context::m_push_list): Likewise.
(diagnostic_context::m_n_push): Likewise.
(diagnostic_context::m_option_classifier): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
10 months agodiagnostics: make diagnostic_context::m_urlifier private
David Malcolm [Mon, 6 Nov 2023 19:28:41 +0000 (14:28 -0500)]
diagnostics: make diagnostic_context::m_urlifier private

No functional change intended.

gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::set_urlifier): New.
* diagnostic.h (diagnostic_context::set_urlifier): New decl.
(diagnostic_context::m_urlifier): Make private.
* gcc.cc (driver::global_initializations): Use set_urlifier rather
than directly setting field.
* toplev.cc (general_init): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
10 months agodiagnostics: eliminate diagnostic_kind_count
David Malcolm [Mon, 6 Nov 2023 19:28:41 +0000 (14:28 -0500)]
diagnostics: eliminate diagnostic_kind_count

No functional change intended.

gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::check_max_errors): Replace
uses of diagnostic_kind_count with simple field acesss.
(diagnostic_context::report_diagnostic): Likewise.
(diagnostic_text_output_format::~diagnostic_text_output_format):
Replace use of diagnostic_kind_count with
diagnostic_context::diagnostic_count.
* diagnostic.h (diagnostic_kind_count): Delete.
(errorcount): Replace use of diagnostic_kind_count with
diagnostic_context::diagnostic_count.
(warningcount): Likewise.
(werrorcount): Likewise.
(sorrycount): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
10 months agoAvoid undeclared use of abort in gcc.dg/cpp/wchar-1.c
Florian Weimer [Mon, 6 Nov 2023 17:38:04 +0000 (18:38 +0100)]
Avoid undeclared use of abort in gcc.dg/cpp/wchar-1.c

This should be safe because this is a preprocessor test; it
should not exercise implicit function declarations.

* gcc.dg/cpp/wchar-1.c (main): Call __builtin_abort instead of
abort.

10 months agotestsuite: Force use of -c when precompiling headers
Christophe Lyon [Fri, 27 Oct 2023 14:38:02 +0000 (14:38 +0000)]
testsuite: Force use of -c when precompiling headers

In some configurations of our validation setup, we always call the
compiler with -Wl,-rpath=XXX, which instructs the driver to invoke the
linker if none of -c, -S or -E is used.

This happens to be the case in the PCH tests, where dg-flags-pch sets
dg-do-what-default to precompile.

This works most of the time, in absence of any linker option, the
compiler defaults to generating a precompiled header (otherwise the
linker complains because it cannot find 'main').

This small patch forces the use of '-c' when generating the .gch file,
which is sufficient not to invoke the linker.

Arguably, this could be seen as a dejagnu bug: in gcc-dg-test-1 (in
gcc-dg.exp), we set compile_type to "precompiled_header", which is not
one of the supported values in dejagnu's default_target_compile (in
target.exp).

2023-10-27  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* lib/dg-pch.exp (dg-flags-pch): Add -c when generating the
precompiled header.

10 months agotestsuite: Add and use thread_fence effective-target
Christophe Lyon [Fri, 8 Sep 2023 10:22:13 +0000 (10:22 +0000)]
testsuite: Add and use thread_fence effective-target

Some targets like arm-eabi with newlib and default settings rely on
__sync_synchronize() to ensure synchronization.  Newlib does not
implement it by default, to make users aware they have to take special
care.

This makes a few tests fail to link.

This patch adds a new thread_fence effective target (similar to the
corresponding one in libstdc++ testsuite), and uses it in the tests
that need it, making them UNSUPPORTED instead of FAIL and UNRESOLVED.

2023-09-10  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* doc/sourcebuild.texi (Other attributes): Document thread_fence
effective-target.

gcc/testsuite/
* g++.dg/init/array54.C: Require thread_fence.
* gcc.dg/c2x-nullptr-1.c: Likewise.
* gcc.dg/pr103721-2.c: Likewise.
* lib/target-supports.exp (check_effective_target_thread_fence):
New.

10 months agoFortran: Fix generate_error library function fnspec
Martin Jambor [Mon, 6 Nov 2023 16:04:33 +0000 (17:04 +0100)]
Fortran: Fix generate_error library function fnspec

when developing an otherwise unrelated patch I've discovered that the
fnspec for the Fortran library function generate_error is wrong. It is
currently ". R . R " where the first R describes the first parameter
and means that it "is only read and does not escape."  The function
itself, however, with signature:

  bool
  generate_error_common (st_parameter_common *cmp, int family, const char *message)

contains the following:

  /* Report status back to the compiler.  */
  cmp->flags &= ~IOPARM_LIBRETURN_MASK;

which does not correspond to the fnspec and breaks testcase
gfortran.dg/large_unit_2.f90 when my patch is applied, since it tries
to re-use the flags from before the call.

This patch replaces the "R" with "W" which stands for "specifies that
the memory pointed to by the parameter does not escape."

gcc/fortran/ChangeLog:

2023-11-02  Martin Jambor  <mjambor@suse.cz>

* trans-decl.cc (gfc_build_builtin_function_decls): Fix fnspec of
generate_error.

10 months agoi386: Use "addr" attribute to limit address regclass to non-REX regs
Uros Bizjak [Mon, 6 Nov 2023 15:27:52 +0000 (16:27 +0100)]
i386: Use "addr" attribute to limit address regclass to non-REX regs

Use "addr" attribute with "gpr8" value to limit address register class
to non-REX registers in instructions with high registers, where REX
registers can not be used in the address.

gcc/ChangeLog:

* config/i386/constraints.md (Bc): Remove constraint.
(Bn): Rewrite to use x86_extended_reg_mentioned_p predicate.
* config/i386/i386.cc (ix86_memory_address_reg_class):
Do not limit processing to TARGET_APX_EGPR.  Exit early for
NULL insn.  Do not check recog_data.insn before calling
extract_insn_cached.
(ix86_insn_base_reg_class): Handle ADDR_GPR8.
(ix86_regno_ok_for_insn_base_p): Ditto.
(ix86_insn_index_reg_class): Ditto.
* config/i386/i386.md (*cmpqi_ext<mode>_1_mem_rex64):
Remove insn pattern and corresponding peephole2 pattern.
(*cmpi_ext<mode>_1): Remove (m,Q) alternative.
Change (QBc,Q) alternative to (QBn,Q).  Add "addr" attribute.
(*cmpqi_ext<mode>_3_mem_rex64): Remove insn pattern
and corresponding peephole2 pattern.
(*cmpi_ext<mode>_3): Remove (Q,m) alternative.
Change (Q,QnBc) alternative to (Q,QnBn).  Add "addr" attribute.
(*extzvqi_mem_rex64): Remove insn pattern and
corresponding peephole2 pattern.
(*extzvqi): Remove (Q,m) alternative.  Change (Q,QnBc)
alternative to (Q,QnBn).  Add "addr" attribute.
(*insvqi_1_mem_rex64): Remove insn pattern and
corresponding peephole2 pattern.
(*insvqi_1): Remove (Q,m) alternative.  Change (Q,QnBc)
alternative to (Q,QnBn).  Add "addr" attribute.
(@insv<mode>_1): Ditto.
(*addqi_ext<mode>_0): Remove (m,0,Q) alternative.  Change (QBc,0,Q)
alternative to (QBn,0,Q).  Add "addr" attribute.
(*subqi_ext<mode>_0): Ditto.
(*andqi_ext<mode>_0): Ditto.
(*<any_or:code>qi_ext<mode>_0): Ditto.
(*addqi_ext<mode>_1): Remove (Q,0,m) alternative.  Change (Q,0,QnBc)
alternative to (Q,0,QnBn).  Add "addr" attribute.
(*andqi_ext<mode>_1): Ditto.
(*andqi_ext<mode>_1_cc): Ditto.
(*<any_or:code>qi_ext<mode>_1): Ditto.
(*xorqi_ext<mode>_1_cc): Ditto.
* config/i386/predicates.md (nonimm_x64constmem_operand):
Remove predicate.
(general_x64constmem_operand): Ditto.
(norex_memory_operand): Ditto.

10 months agoc: Add -std=c23, -std=gnu23, -Wc11-c23-compat options [PR107954]
Joseph Myers [Mon, 6 Nov 2023 15:01:22 +0000 (15:01 +0000)]
c: Add -std=c23, -std=gnu23, -Wc11-c23-compat options [PR107954]

At the June WG14 meeting, WG14 decided it preferred to keep C23 as the
informal name for the next revision of the C standard, despite
publication not being before 2024 (publication is due in 2024 whether
or not technical changes at the January meeting result in an FDIS
ballot being needed).  At the Cauldron I raised the question of
whether we should thus now add option names such as -std=c23 to GCC,
and there was support for doing so.

Add -std=c23, making -std=c2x a deprecated alias; also add the alias
-std=iso9899:2024.  Likewise, add -std=gnu23, making -std=gnu2x a
deprecated alias, and add -Wc11-c23-compat, making -Wc11-c2x-compat a
deprecated alias.

Here, I'm generally just adding the new options and making the minimum
changes required to do so, with documentation changed to refer to C23
instead of C2X only where directly associated with documentation of
these options.  It's intended that future changes will update
documentation, diagnostics, comments, variable names, testcase names,
etc. to refer consistently to C23.  When such changes are made, the
new tests c23-opts-3.c, c23-opts-5.c and gnu23-opts-2.c are intended
to keep using the old option names they are specifically testing,
while other tests would start using the c23/gnu23 versions of the
names (as well as the tests themselves being renamed).

Updating option names is independent of updating to the final
__STDC_VERSION__ value.  There, the question is whether we should
update the value now or wait for the remaining significant features to
be implemented first.  (I intend to review Martin's tag compatibility
patches for GCC 14.  I'm not aware of anyone working on #embed - or on
the [[unsequenced]] and [[reproducible]] attributes, though support
for standard attributes is optional.)

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

PR c/107954

gcc/
* doc/cpp.texi (__STDC_VERSION__): Refer to -std=c23 and
-std=gnu23 instead of -std=c2x and -std=gnu2x.
* doc/extend.texi (Attribute Syntax): Refer to C23 and -std=c23
instead of C2x and -std=c2x.
* doc/invoke.texi (-Wc11-c23-compat, -std=c23, -std=gnu23)
(-std=iso9899:2024): Document, with -Wc11-c2x-compat, -std=c2x and
-std=gnu2x as deprecated aliases.  Update descriptions of C23.
* doc/standards.texi (Standards): Describe C23 with C2X as an old
name.

gcc/c-family/
* c.opt (Wc11-c2x-compat): Rename to Wc11-c23-compat and make into
a deprecated alias of Wc11-c23-compat.
(std=c2x): Rename to std=c23 and make into a deprecated alias of
std=c23.
(std=gnu2x): Rename to std=gnu23 and make into a deprecated alias
of std=gnu23.
(std=iso9899:2024): New option.  Alias of std=c23.
* c-lex.cc (interpret_float): Use OPT_Wc11_c23_compat instead of
OPT_Wc11_c2x_compat.
* c-opts.cc (c_common_handle_option): Use OPT_std_c23 instead of
OPT_std_c2x and OPT_std_gnu23 instead of OPT_std_gnu2x.

gcc/c/
* c-errors.cc (pedwarn_c11): Use OPT_Wc11_c23_compat instead of
OPT_Wc11_c2x_compat.
* c-typeck.cc (build_conditional_expr, convert_for_assignment):
Use OPT_Wc11_c23_compat instead of OPT_Wc11_c2x_compat.

gcc/testsuite/
* gcc.dg/c23-opts-1.c, gcc.dg/c23-opts-2.c, gcc.dg/c23-opts-3.c,
gcc.dg/c23-opts-4.c, gcc.dg/c23-opts-5.c, gcc.dg/gnu23-opts-1.c,
gcc.dg/gnu23-opts-2.c: New tests.

10 months agonvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)'
Thomas Schwinge [Thu, 14 Jul 2022 21:22:35 +0000 (23:22 +0200)]
nvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)'

With this 'MAKE_DECL_ONE_ONLY' definition, we get 'SUPPORTS_ONE_ONLY', and thus
'__GXX_WEAK__', and thus '__GXX_TYPEINFO_EQUALITY_INLINE'.  This unblocks build
of 'libstdc++-v3/libsupc++/tinfo.cc', which otherwise depends on symbol alias
support, which GCC/nvptx doesn't generally provide.  Also, this gets us a
number of FAIL -> PASS progressions in the test suite.

Given that GCC/nvptx support for weak symbols isn't complete, we also get a few
more of the already-known
'error: PTX does not support weak declarations (only weak definitions)':

    [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C  -std=c++14 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C  -std=c++17 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C  -std=c++20 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C  -std=c++98 (test for excess errors)

    [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C  -std=c++14 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C  -std=c++17 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C  -std=c++20 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C  -std=c++98 (test for excess errors)

    [-PASS:-]{+FAIL:+} 23_containers/map/56613.cc  -std=gnu++17 (test for excess errors)

... as well as one more of the already-known
'sorry, unimplemented: target cannot support nonlocal goto':

    PASS: g++.dg/tree-ssa/pr22488.C  -std=gnu++14 (test for excess errors)
    PASS: g++.dg/tree-ssa/pr22488.C  -std=gnu++17 (test for excess errors)
    PASS: g++.dg/tree-ssa/pr22488.C  -std=gnu++20 (test for excess errors)
    [-PASS:-]{+FAIL:+} g++.dg/tree-ssa/pr22488.C  -std=gnu++98 (test for excess errors)

We shall look into these, later.

gcc/
* config/nvptx/nvptx.h (MAKE_DECL_ONE_ONLY): Define.

10 months agotree-optimization/112405 - SIMD clone calls with (loop) mask
Richard Biener [Mon, 6 Nov 2023 13:34:07 +0000 (14:34 +0100)]
tree-optimization/112405 - SIMD clone calls with (loop) mask

The following fixes the mask argument generation for SIMD clone
calls under either loop masking or when the actual call is not
masked but only a inbranch simd clone is available.  The issue
was that we tried to directly convert the vector mask to the
call argument type but SIMD clone masks require 1 or 0 (which
could be even float) values for mask elements so we have to
resort to a VEC_COND_EXPR to generate them just like we do for
regular passing of the mask.

PR tree-optimization/112405
* tree-vect-stmts.cc (vectorizable_simd_clone_call):
Properly handle invariant and/or loop mask passing.

10 months agoRISC-V: Support FP round to i/l/ll diff size autovec
Pan Li [Mon, 6 Nov 2023 14:10:14 +0000 (22:10 +0800)]
RISC-V: Support FP round to i/l/ll diff size autovec

This patch would like to support the FP below API auto vectorization
with different type size

+----------+-----------+----------+
| API      | RV64      | RV32     |
+----------+-----------+----------+
| iround   | DF => SI  | DF => SI |
| iroundf  | -         | -        |
| lround   | -         | DF => SI |
| lroundf  | SF => DI  | -        |
| llround  | -         | -        |
| llroundf | SF => DI  | SF => DI |
+----------+-----------+----------+

Given below code:
void
test_lroundf (long *out, float *in, unsigned count)
{
  for (unsigned i = 0; i < count; i++)
    out[i] = __builtin_lroundf (in[i]);
}

Before this patch:
.L3:
  flw      fa5,0(a1)
  addi     a1,a1,4
  addi     a0,a0,8
  fcvt.l.s a5,fa5,rmm
  sd       a5,-8(a0)
  bne      a4,a1,.L3

After this patch:
  fsrmi        4  // RMM rounding mode
  vsetivli     zero,16,e32,m4,ta,ma
.L4:
  vle32.v      v4,0(a5)
  addi         a5,a5,64
  vfwcvt.x.f.v v8,v4
  vse64.v      v8,0(a4)
  addi         a4,a4,128
  bne          a3,a5,.L4
  andi         a5,a2,15
  andi         a4,a2,-16
  beq          a5,zero,.L16

Unfortunately, the HF mode is not include due to it requires
additional middle-end support from internal-fun.def.

gcc/ChangeLog:

* config/riscv/autovec.md: Remove the size check of lround.
* config/riscv/riscv-v.cc (expand_vec_lround): Leverage
emit_vec_rounding_to_integer for round.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/unop/math-iround-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-iround-run-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-llroundf-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-llroundf-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lround-rv32-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lround-rv32-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lroundf-rv64-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lroundf-rv64-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-iround-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-llroundf-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lround-rv32-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lroundf-rv64-0.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
10 months agoRISC-V: Early expand DImode vec_duplicate in RV32 system
Juzhe-Zhong [Mon, 6 Nov 2023 14:12:48 +0000 (22:12 +0800)]
RISC-V: Early expand DImode vec_duplicate in RV32 system

An ICE was discovered in recent rounding autovec support:

config/riscv/riscv-v.cc:4314
   65 | }
      | ^
0x1fa5223 riscv_vector::validate_change_or_fail(rtx_def*, rtx_def**,
rtx_def*, bool)
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-v.cc:4314
0x1fb1aa2 pre_vsetvl::remove_avl_operand()
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3342
0x1fb18c1 pre_vsetvl::cleaup()
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3308
0x1fb216d pass_vsetvl::lazy_vsetvl()
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3480
0x1fb2214 pass_vsetvl::execute(function*)
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3504

The root cause is that the RA reload into (set (reg) vec_duplicate:DI). However, it is not valid in RV32 system
since we don't have a single broadcast instruction DI scalar in RV32 system.
We should expand it early for RV32 system.

gcc/ChangeLog:

* config/riscv/predicates.md: Adapt predicate.
* config/riscv/riscv-protos.h (can_be_broadcasted_p): New function.
* config/riscv/riscv-v.cc (can_be_broadcasted_p): Ditto.
* config/riscv/vector.md (vec_duplicate<mode>): New pattern.
(*vec_duplicate<mode>): Adapt vec_duplicate insn pattern.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/unop/sew64-rv32.c: New test.

10 months agotree-optimization/111950 - vectorizer loop copying
Richard Biener [Fri, 3 Nov 2023 13:24:10 +0000 (14:24 +0100)]
tree-optimization/111950 - vectorizer loop copying

The following simplifies LC-PHI arg population during epilog peeling,
thereby fixing the testcase in this PR.

PR tree-optimization/111950
* tree-vect-loop-manip.cc (slpeel_duplicate_current_defs_from_edges):
Remove.
(find_guard_arg): Likewise.
(slpeel_update_phi_nodes_for_guard2): Likewise.
(slpeel_tree_duplicate_loop_to_edge_cfg): Remove calls to
slpeel_duplicate_current_defs_from_edges, do not elide
LC-PHIs for invariant values.
(vect_do_peeling): Materialize PHI arguments for the edge
around the epilog from the PHI defs of the main loop exit.

* gcc.dg/torture/pr111950.c: New testcase.

10 months agotree-optimization/112404 - two issues with SLP of .MASK_LOAD
Richard Biener [Mon, 6 Nov 2023 11:43:11 +0000 (12:43 +0100)]
tree-optimization/112404 - two issues with SLP of .MASK_LOAD

The following fixes an oversight in vect_check_scalar_mask when
the mask is external or constant.  When doing BB vectorization
we need to provide a group_size, best via an overload accepting
the SLP node as argument.

When fixed we then run into the issue that we have not analyzed
alignment of the .MASK_LOADs because they were not identified
as loads by vect_gather_slp_loads.  Fixed by reworking the
detection.

PR tree-optimization/112404
* tree-vectorizer.h (get_mask_type_for_scalar_type): Declare
overload with SLP node argument.
* tree-vect-stmts.cc (get_mask_type_for_scalar_type): Implement it.
(vect_check_scalar_mask): Use it.
* tree-vect-slp.cc (vect_gather_slp_loads): Properly identify
loads also for nodes with children, like .MASK_LOAD.
* tree-vect-loop.cc (vect_analyze_loop_2): Look at the
representative for load nodes and check whether it is a grouped
access before looking for load-lanes support.

* gfortran.dg/pr112404.f90: New testcase.

10 months agoC99 testsuite readiness: Some unverified test case un-reductions
Florian Weimer [Mon, 6 Nov 2023 11:57:12 +0000 (12:57 +0100)]
C99 testsuite readiness: Some unverified test case un-reductions

gcc/testsuite/

* gcc.c-torture/compile/20000412-2.c (f): Call
__builtin_strlen instead of strlen.
* gcc.c-torture/compile/20000427-1.c (FindNearestPowerOf2):
Declare.
* gcc.c-torture/compile/20000802-1.c (bar): Call
__builtin_memcpy instead of memcpy.
* gcc.c-torture/compile/20010525-1.c (kind_varread): Likewise.
* gcc.c-torture/compile/20010706-1.c (foo): Add missing int
return type.
* gcc.c-torture/compile/20020314-1.c (add_output_space_event)
(del_tux_atom, add_req_to_workqueue): Declare.
* gcc.c-torture/compile/20020701-1.c (f): Call
__builtin_memcpy instead of memcpy.
* gcc.c-torture/compile/20021015-2.c (f): Call __builtin_bcmp
instead of bcmo.
* gcc.c-torture/compile/20030110-1.c (inb): Declare.
* gcc.c-torture/compile/20030314-1.c (bar): Add missing
void return type.
* gcc.c-torture/compile/20030405-1.c (bar): Add missing int
return type.
* gcc.c-torture/compile/20030416-1.c (bar): Declare.
(main): Add missing int return type.
* gcc.c-torture/compile/20030503-1.c (bar): Declare.
* gcc.c-torture/compile/20030530-1.c: (bar): Declare.
* gcc.c-torture/compile/20031031-2.c (foo, bar, baz): Declare.
* gcc.c-torture/compile/20040101-1.c (test16): Call
__builtin_printf instead of printf.
* gcc.c-torture/compile/20040124-1.c (f2, f3): Declare.
* gcc.c-torture/compile/20040304-1.c (macarg): Declare.
* gcc.c-torture/compile/20040705-1.c (f): Call
__builtin_memcpy instead of memcpy.
* gcc.c-torture/compile/20040908-1.c (bar): Declare.
* gcc.c-torture/compile/20050510-1.c (dont_remove): Declare.
* gcc.c-torture/compile/20051228-1.c (bar): Declare.
* gcc.c-torture/compile/20060109-1.c (cpp_interpret_string):
Declare.
(int_c_lex, cb_ident): Add missing void return type.
(cb_ident): Define as static.
* gcc.c-torture/compile/20060202-1.c (sarray_get): Declare.
* gcc.c-torture/compile/20070129.c (regcurly)
(reguni): Declare.
* gcc.c-torture/compile/20070529-1.c (__fswab16): Declare.
* gcc.c-torture/compile/20070529-2.c (kmem_free): Declare.
* gcc.c-torture/compile/20070605-1.c (quantize_fs_dither):
Add missing void return type.
* gcc.c-torture/compile/20071107-1.c
(settings_install_property_parser): Declare.
* gcc.c-torture/compile/20090907-1.c (load_waveform): Call
__builtin_abort instead of abort.
* gcc.c-torture/compile/20100907.c (t): Add missing void
types.
* gcc.c-torture/compile/20120524-1.c (build_packet): Call
__builtin_memcpy instead of memcpy.
* gcc.c-torture/compile/20120830-2.c
(ubidi_writeReordered_49): Add missing void return type.
* gcc.c-torture/compile/20121010-1.c (read_long): Add missing
int return type.
* gcc.c-torture/compile/920301-1.c (f, g): Add missing void
types.
* gcc.c-torture/compile/920409-1.c (x): Likewise.
* gcc.c-torture/compile/920410-1.c (main): Add missing int
return type.  Call __builtin_printf instead of printf.
* gcc.c-torture/compile/920410-2.c (joe): Add missing void
types.
* gcc.c-torture/compile/920411-2.c (x): Likewise.
* gcc.c-torture/compile/920413-1.c (f): Add missing int return
type.
* gcc.c-torture/compile/920428-3.c (x): Add missing int types.
* gcc.c-torture/compile/920428-4.c (x): Add missing void
return type and int parameter type.
* gcc.c-torture/compile/920501-10.c (x): Add missing int
types.
* gcc.c-torture/compile/920501-12.c (x, a, b, A, B): Likewise.
* gcc.c-torture/compile/920501-17.c (x): Add missing void
types.
* gcc.c-torture/compile/920501-19.c (y): Likewise.
* gcc.c-torture/compile/920501-22.c (x): Likewise.
* gcc.c-torture/compile/920501-3.c (x): Likewise.
* gcc.c-torture/compile/920501-4.c (foo): Likewise.
* gcc.c-torture/compile/920529-1.c (f): Call __builtin_abort
instead of abort.
* gcc.c-torture/compile/920615-1.c (f): Add missing void
types.
* gcc.c-torture/compile/920623-1.c (g): Likewise.
* gcc.c-torture/compile/920624-1.c (f): Likewise.
* gcc.c-torture/compile/920711-1.c (f): Add missing int types.
* gcc.c-torture/compile/920729-1.c (f): Add missing void
types.
* gcc.c-torture/compile/920806-1.c (f): Likewise.
* gcc.c-torture/compile/920821-2.c (f): Likewise.
* gcc.c-torture/compile/920825-1.c (f): Likewise.
* gcc.c-torture/compile/920825-2.c (f, g): Add missing void
return type.
* gcc.c-torture/compile/920826-1.c (f): Likewise.
* gcc.c-torture/compile/920828-1.c (f): Add missing int types.
* gcc.c-torture/compile/920829-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/920928-3.c (f): Likewise.
* gcc.c-torture/compile/921012-2.c (f): Likewise.
* gcc.c-torture/compile/921013-1.c (f): Likewise.
* gcc.c-torture/compile/921019-1.c (f): Add missing void
types.
* gcc.c-torture/compile/921026-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/921126-1.c (f): Add missing int
return type and missing void.
* gcc.c-torture/compile/921227-1.c (f): Add missing void
types.
* gcc.c-torture/compile/930109-2.c (f): Add missing int types.
* gcc.c-torture/compile/930210-1.c (f): Add missing void
types.
* gcc.c-torture/compile/930222-1.c (g): Declare.
(f): Add missing int return type.
* gcc.c-torture/compile/930421-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/930503-1.c (f): Likewise.
* gcc.c-torture/compile/930513-1.c (f): Add missing int return
type.
* gcc.c-torture/compile/930513-3.c (test): Add missing void
types.
* gcc.c-torture/compile/930523-1.c (f): Likewise.
* gcc.c-torture/compile/930527-1.c (f): Likewise.
* gcc.c-torture/compile/930603-1.c (f): Likewise.
* gcc.c-torture/compile/930607-1.c (g): Likewise.
* gcc.c-torture/compile/930702-1.c (f): Add missing int
return type and missing void.
* gcc.c-torture/compile/931018-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/931031-1.c (f): Likewise.
* gcc.c-torture/compile/931102-1.c (xxx): Add missing void
types.
* gcc.c-torture/compile/940611-1.c (f): Likewise.
* gcc.c-torture/compile/940712-1.c (f): Add missing int
return type and missing void.
* gcc.c-torture/compile/950512-1.c (g): Declare.
(f): Add missing void return type.
* gcc.c-torture/compile/950530-1.c (f): Add missing int
return type.
* gcc.c-torture/compile/950610-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/950613-1.c (f): Add missing void
types.
* gcc.c-torture/compile/950816-1.c (f): Add missing int return
type and missing void.
* gcc.c-torture/compile/950816-2.c (func): Declare.
(f): Add missing void types.
* gcc.c-torture/compile/950816-3.c (f): Add missing int
return type and missing void.
* gcc.c-torture/compile/950919-1.c (f): Add missing void
types.
* gcc.c-torture/compile/950921-1.c (f): Add missing int
return type and missing void.
* gcc.c-torture/compile/951004-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/951116-1.c (f): Add missing int
return type and missing void.
* gcc.c-torture/compile/951128-1.c (f): Add missing void
return type.
* gcc.c-torture/compile/951220-1.c (f): Add missing int return
type.
* gcc.c-torture/compile/960220-1.c (f): Add missing void
types.
* gcc.c-torture/compile/960221-1.c (foo): Add missing void
return type.
* gcc.c-torture/compile/960704-1.c (main): Add missing int
return type and missing void.
* gcc.c-torture/compile/961031-1.c (f): Add missing void
types.
* gcc.c-torture/compile/961126-1.c (sub, sub2): Declare.
(main): Add missing int return type and missing void.
* gcc.c-torture/compile/961203-1.c (main): Call __builtin_exit
instead of exit.
* gcc.c-torture/compile/981001-1.c (main): Likewise.
* gcc.c-torture/compile/981107-1.c (call): Declare.
* gcc.c-torture/compile/990517-1.c (sdbm__splpage): Call
__builtin_memcpy instead of memcpy.
* gcc.c-torture/compile/990617-1.c (main): Call
__builtin_printf instead of printf.
* gcc.c-torture/compile/991026-2.c (detach): Add missing void
types.
* gcc.c-torture/compile/991229-1.c (ejEval): Likewise.
* gcc.c-torture/compile/991229-3.c (rand): Declare.

10 months agogcc.c-torture/execute/builtins/fputs.c: fputs_unlocked prototype
Florian Weimer [Mon, 6 Nov 2023 11:57:12 +0000 (12:57 +0100)]
gcc.c-torture/execute/builtins/fputs.c: fputs_unlocked prototype

Current glibc headers only declare fputs_unlocked for _GNU_SOURCE,
so define it to obtain an official prototype.

Add a fallback prototype declaration for other systems that do not
have fputs_unlocked.  This seems to the most straightforward approach
to avoid an implicit function declaration, without reducing test
coverage and introducing ongoing maintenance requirements (e.g.,
FreeBSD added fputs_unlocked support fairly recently).

gcc/testsuite/

* gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE):
Define.
(fputs_unlocked): Declare.

10 months agointernal-fn: Add VCOND_MASK_LEN.
Robin Dapp [Wed, 25 Oct 2023 20:19:43 +0000 (22:19 +0200)]
internal-fn: Add VCOND_MASK_LEN.

In order to prevent simplification of a COND_OP with degenerate mask
(CONSTM1_RTX) into just an OP in the presence of length masking this
patch introduces a length-masked analog to VEC_COND_EXPR:
IFN_VCOND_MASK_LEN.

It also adds new match patterns that allow the combination of
unconditional unary, binary and ternay operations with the
VCOND_MASK_LEN into a conditional operation if the target supports it.

gcc/ChangeLog:

PR tree-optimization/111760

* config/riscv/autovec.md (vcond_mask_len_<mode><vm>): Add
expander.
* config/riscv/riscv-protos.h (enum insn_type): Add.
* config/riscv/riscv-v.cc (needs_fp_rounding): Add !pred_mov.
* doc/md.texi: Add vcond_mask_len.
* gimple-match-exports.cc (maybe_resimplify_conditional_op):
Create VCOND_MASK_LEN when length masking.
* gimple-match.h (gimple_match_op::gimple_match_op): Always
initialize len and bias.
* internal-fn.cc (vec_cond_mask_len_direct): Add.
(direct_vec_cond_mask_len_optab_supported_p): Add.
(internal_fn_len_index): Add VCOND_MASK_LEN.
(internal_fn_mask_index): Ditto.
* internal-fn.def (VCOND_MASK_LEN): New internal function.
* match.pd: Combine unconditional unary, binary and ternary
operations into the respective COND_LEN operations.
* optabs.def (OPTAB_D): Add vcond_mask_len optab.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-cond-arith-2.c: No vect cost model for
riscv_v.

10 months agoexplow: Avoid unnecessary alignment operations
Richard Sandiford [Mon, 6 Nov 2023 10:49:59 +0000 (10:49 +0000)]
explow: Avoid unnecessary alignment operations

align_dynamic_address would output alignment operations even
for a required alignment of 1 byte.

gcc/
* explow.cc (align_dynamic_address): Do nothing if the required
alignment is a byte.

10 months agoexplow: Allow dynamic allocations after vregs
Richard Sandiford [Mon, 6 Nov 2023 10:49:58 +0000 (10:49 +0000)]
explow: Allow dynamic allocations after vregs

This patch allows allocate_dynamic_stack_space to be called before
or after virtual registers have been instantiated.  It uses the
same approach as allocate_stack_local, which already supported this.

gcc/
* function.h (get_stack_dynamic_offset): Declare.
* function.cc (get_stack_dynamic_offset): New function,
split out from...
(get_stack_dynamic_offset): ...here.
* explow.cc (allocate_dynamic_stack_space): Handle calls made
after virtual registers have been instantiated.

10 months agolibgfortran: Fix calloc call by swapping arg order [PR112364]
Tobias Burnus [Mon, 6 Nov 2023 10:34:31 +0000 (11:34 +0100)]
libgfortran: Fix calloc call by swapping arg order [PR112364]

The prototype of calloc is
  void *calloc(size_t nmemb, size_t size);
denoting "an array of nmemb objects, each of whose size is size." (C23)

In order to follow the meaning of the argument names and to silence
a -Walloc-size warning, this commit swaps the order of the two args
to read now:  calloc (1, sizeof (transfer_queue));

libgfortran/ChangeLog:

PR libfortran/112364
* io/async.c (enqueue_transfer, enqueue_done_id, enqueue_done,
enqueue_close): Swap 1st and 2nd arg in calloc call.

10 months agoAvoid generating RTL code when d->testing_p.
liuhongt [Mon, 6 Nov 2023 02:58:15 +0000 (10:58 +0800)]
Avoid generating RTL code when d->testing_p.

gcc/ChangeLog:

PR target/112393
* config/i386/i386-expand.cc (ix86_expand_vec_perm_vpermt2):
Avoid generating RTL code when d->testing_p.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr112393.c: New test.

10 months agolibstdc++: Improve static assert messages for monadic operations
Jonathan Wakely [Wed, 1 Nov 2023 14:28:55 +0000 (14:28 +0000)]
libstdc++: Improve static assert messages for monadic operations

The monadic operations for std::optional and std::expected make use of
internal helper traits __is_optional nad __is_expected, which are not
very user-friendly when shown in diagnostics. Add messages to the
assertions explaining the problem more clearly.

libstdc++-v3/ChangeLog:

* include/std/expected (expected::and_then, expected::or_else):
Add string literals to static assertions.
* include/std/optional (optional::and_then, optional::or_else):
Likewise.

10 months agotree-optimization/112369 - strip_float_extensions and vectors
Richard Biener [Mon, 6 Nov 2023 07:58:18 +0000 (08:58 +0100)]
tree-optimization/112369 - strip_float_extensions and vectors

The following fixes an error in strip_float_extensions when facing
vector conversions.

PR tree-optimization/112369
* tree.cc (strip_float_extensions): Use element_precision.

* gcc.dg/pr112369.c: New testcase.

10 months agoRISC-V: Adjust FP rint round tests for RV32
Pan Li [Mon, 6 Nov 2023 08:26:09 +0000 (16:26 +0800)]
RISC-V: Adjust FP rint round tests for RV32

The FP rint test cases for RV32 need some additional adjust
for types and data. This patch would like to fix this which
is missed in FP rint support PATCH for RV32 only by mistake.

Please note the math-llrintf-run-0.c will trigger one ICE in the
vsetvl pass in RV32 only.

./riscv32-unknown-elf-gcc -march=rv32gcv -mabi=ilp32d \
  -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math \
  gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c \
  -o test.elf -lm

Then there will have ICE similar as below, and will file bugzilla for it.

config/riscv/riscv-v.cc:4314
   65 | }
      | ^
0x1fa5223 riscv_vector::validate_change_or_fail(rtx_def*, rtx_def**,
rtx_def*, bool)
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-v.cc:4314
0x1fb1aa2 pre_vsetvl::remove_avl_operand()
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3342
0x1fb18c1 pre_vsetvl::cleaup()
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3308
0x1fb216d pass_vsetvl::lazy_vsetvl()
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3480
0x1fb2214 pass_vsetvl::execute(function*)
        /home/pli/repos/gcc/222/riscv-gnu-toolchain/gcc/__RISC-V_BUILD/../gcc/config/riscv/riscv-vsetvl.cc:3504

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c: Adjust
test cases.
* gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c: Ditto.
* gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
10 months agomiddle-end/112296 - __builtin_constant_p and side-effects
Richard Biener [Fri, 3 Nov 2023 07:11:05 +0000 (08:11 +0100)]
middle-end/112296 - __builtin_constant_p and side-effects

The following tries to clarify the __builtin_constant_p documentation,
stating that the argument expression is not evaluated and side-effects
are discarded.  I'm struggling to find the correct terms matching
what the C language standard would call things so I'd appreciate
some help here.

OK for trunk?

Shall we diagnose arguments with side-effects?  It seems to me
such use is usually unintended?  I think rather than dropping
side-effects as a side-effect of folding the frontend should
discard them at parsing time instead, no?

Thanks,
Richard.

PR middle-end/112296
* doc/extend.texi (__builtin_constant_p): Clarify that
side-effects are discarded.

10 months agors6000: Consider inline asm as safe if no assembler complains [PR111828]
Kewen Lin [Mon, 6 Nov 2023 06:14:43 +0000 (00:14 -0600)]
rs6000: Consider inline asm as safe if no assembler complains [PR111828]

As discussed in PR111828, rs6000_update_ipa_fn_target_info
is much conservative, currently for any non-empty inline
asm, without any parsing, it would take inline asm could
have HTM insns.  It means for one function attributed with
power8 having inline asm, even if it has no HTM insns, we
don't make a function attributed with power10 inline it.

Peter pointed out an inline asm parser can be a slippery
slope, and noticed that the current gnu assembler still
allows HTM insns even with power10 machine type, so he
suggested that we can aggressively ignore the handling on
inline asm, this patch goes for this suggestion.

Considering that there are a few assembler alternatives
and assembler can update its behaviors (complaining HTM
insns at power10 and later cpus sounds reasonable from a
certain point of view), this patch also checks assembler
complains on HTM insns at power10 or not.  For a case that
a caller attributed power10 calls a callee attributed
power8 having inline asm with HTM insn, without inlining
at least the compilation succeeds, but if assembler
complains HTM insns at power10, after inlining the
compilation would fail.

The two associated test cases are fine without and with
this patch (effective target takes effect or not).

PR target/111828

gcc/ChangeLog:

* config.in: Regenerate.
* config/rs6000/rs6000.cc (rs6000_update_ipa_fn_target_info): Guard
inline asm handling under !HAVE_AS_POWER10_HTM.
* configure: Regenerate.
* configure.ac: Detect assembler support for HTM insns at power10.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_powerpc_as_p10_htm): New proc.
* g++.target/powerpc/pr111828-1.C: New test.
* g++.target/powerpc/pr111828-2.C: New test.

10 months agoRISC-V: Implement RESOLVE_OVERLOADED_BUILTIN for RVV intrinsic
xuli [Mon, 30 Oct 2023 08:23:15 +0000 (08:23 +0000)]
RISC-V: Implement RESOLVE_OVERLOADED_BUILTIN for RVV intrinsic

Update in v6:
* Rename maybe_require_frm_p to may_require_frm_p.
* Rename maybe_require_vxrm_p to may_require_vxrm_p.
* Move may_require_frm_p and may_require_vxrm_p to function_base.

Update in v5:
* Split has_vxrm_or_frm_p into maybe_require_frm_p and
  maybe_require_vxrm_p.
* Adjust comments.

Update in v4:
* Remove class function_resolver.
* Remove function get_non_overloaded_instance.
* Add overloaded hash traits for non-overloaded intrinsic.
* All overloaded intrinsics are implemented, and the tests pass.

Update in v3:

* Rewrite comment for overloaded function add.
* Move get_non_overloaded_instance to function_base.

Update in v2:

* Add get_non_overloaded_instance for function instance.
* Fix overload check for policy function.
* Enrich the test cases check.

Original log:

This patch would like add the framework to support the RVV overloaded
intrinsic API in riscv-xxx-xxx-gcc, like riscv-xxx-xxx-g++ did.

However, it almost leverage the hook TARGET_RESOLVE_OVERLOADED_BUILTIN
with below steps.

* Register overloaded functions.
* Add function_resolver for overloaded function resolving.
* Add resolve API for function shape with default implementation.
* Implement HOOK for navigating the overloaded API to non-overloaded API.

gcc/ChangeLog:

* config/riscv/riscv-c.cc (riscv_resolve_overloaded_builtin): New function for the hook.
(riscv_register_pragmas): Register the hook.
* config/riscv/riscv-protos.h (resolve_overloaded_builtin): New decl.
* config/riscv/riscv-vector-builtins-bases.cc: New function impl.
* config/riscv/riscv-vector-builtins-shapes.cc (build_one): Register overloaded function.
* config/riscv/riscv-vector-builtins.cc (struct non_overloaded_registered_function_hasher):
New hash table.
(function_builder::add_function): Add overloaded arg.
(function_builder::add_unique_function): Map overloaded function to non-overloaded function.
(function_builder::add_overloaded_function): New API impl.
(registered_function::overloaded_hash): Calculate hash value.
(has_vxrm_or_frm_p): New function impl.
(non_overloaded_registered_function_hasher::hash): Ditto.
(non_overloaded_registered_function_hasher::equal): Ditto.
(handle_pragma_vector): Allocate space for hash table.
(resolve_overloaded_builtin): New function impl.
* config/riscv/riscv-vector-builtins.h (function_base::may_require_frm_p): Ditto.
(function_base::may_require_vxrm_p): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/overloaded_rv32_vadd.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv32_vfadd.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv32_vget_vset.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv32_vloxseg2ei16.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv32_vmv.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv32_vreinterpret.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv64_vadd.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv64_vfadd.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv64_vget_vset.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv64_vloxseg2ei16.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv64_vmv.c: New test.
* gcc.target/riscv/rvv/base/overloaded_rv64_vreinterpret.c: New test.
* gcc.target/riscv/rvv/base/overloaded_vadd.h: New test.
* gcc.target/riscv/rvv/base/overloaded_vfadd.h: New test.
* gcc.target/riscv/rvv/base/overloaded_vget_vset.h: New test.
* gcc.target/riscv/rvv/base/overloaded_vloxseg2ei16.h: New test.
* gcc.target/riscv/rvv/base/overloaded_vmv.h: New test.
* gcc.target/riscv/rvv/base/overloaded_vreinterpret.h: New test.

Signed-off-by: Li Xu <xuli1@eswincomputing.com>
Co-Authored-By: Pan Li <pan2.li@intel.com>
10 months agoPush no-evex512 target for 128/256 bit intrins
Haochen Jiang [Mon, 6 Nov 2023 01:38:31 +0000 (09:38 +0800)]
Push no-evex512 target for 128/256 bit intrins

gcc/ChangeLog:

PR target/111889
* config/i386/avx512bf16intrin.h: Push no-evex512 target.
* config/i386/avx512bf16vlintrin.h: Ditto.
* config/i386/avx512bitalgvlintrin.h: Ditto.
* config/i386/avx512bwintrin.h: Ditto.
* config/i386/avx512dqintrin.h: Ditto.
* config/i386/avx512fintrin.h: Ditto.
* config/i386/avx512fp16intrin.h: Ditto.
* config/i386/avx512fp16vlintrin.h: Ditto.
* config/i386/avx512ifmavlintrin.h: Ditto.
* config/i386/avx512vbmi2vlintrin.h: Ditto.
* config/i386/avx512vbmivlintrin.h: Ditto.
* config/i386/avx512vlbwintrin.h: Ditto.
* config/i386/avx512vldqintrin.h: Ditto.
* config/i386/avx512vlintrin.h: Ditto.
* config/i386/avx512vnnivlintrin.h: Ditto.
* config/i386/avx512vp2intersectvlintrin.h: Ditto.
* config/i386/avx512vpopcntdqvlintrin.h: Ditto.

gcc/testsuite/ChangeLog:

PR target/111889
* gcc.target/i386/pr111889.c: New test.

10 months ago[PATCH 3/3] Change internal intrin call for AVX512 intrins
Haochen Jiang [Mon, 6 Nov 2023 01:38:12 +0000 (09:38 +0800)]
[PATCH 3/3] Change internal intrin call for AVX512 intrins

gcc/ChangeLog:

* config/i386/avx512bf16vlintrin.h
(_mm_avx512_castsi128_ps): New.
(_mm256_avx512_castsi256_ps): Ditto.
(_mm_avx512_slli_epi32): Ditto.
(_mm256_avx512_slli_epi32): Ditto.
(_mm_avx512_cvtepi16_epi32): Ditto.
(_mm256_avx512_cvtepi16_epi32): Ditto.
(__attribute__): Change intrin call.
* config/i386/avx512bwintrin.h
(_mm_avx512_set_epi32): New.
(_mm_avx512_set_epi16): Ditto.
(_mm_avx512_set_epi8): Ditto.
(__attribute__): Change intrin call.
* config/i386/avx512fp16intrin.h: Ditto.
* config/i386/avx512fp16vlintrin.h
(_mm_avx512_set1_ps): New.
(_mm256_avx512_set1_ps): Ditto.
(_mm_avx512_and_si128): Ditto.
(_mm256_avx512_and_si256): Ditto.
(__attribute__): Change intrin call.
* config/i386/avx512vlbwintrin.h
(_mm_avx512_set1_epi32): New.
(_mm_avx512_set1_epi16): Ditto.
(_mm_avx512_set1_epi8): Ditto.
(_mm256_avx512_set_epi16): Ditto.
(_mm256_avx512_set_epi8): Ditto.
(_mm256_avx512_set1_epi16): Ditto.
(_mm256_avx512_set1_epi32): Ditto.
(_mm256_avx512_set1_epi8): Ditto.
(_mm_avx512_max_epi16): Ditto.
(_mm_avx512_min_epi16): Ditto.
(_mm_avx512_max_epu16): Ditto.
(_mm_avx512_min_epu16): Ditto.
(_mm_avx512_max_epi8): Ditto.
(_mm_avx512_min_epi8): Ditto.
(_mm_avx512_max_epu8): Ditto.
(_mm_avx512_min_epu8): Ditto.
(_mm256_avx512_max_epi16): Ditto.
(_mm256_avx512_min_epi16): Ditto.
(_mm256_avx512_max_epu16): Ditto.
(_mm256_avx512_min_epu16): Ditto.
(_mm256_avx512_insertf128_ps): Ditto.
(_mm256_avx512_extractf128_pd): Ditto.
(_mm256_avx512_extracti128_si256): Ditto.
(_MM256_AVX512_REDUCE_OPERATOR_BASIC_EPI16): Ditto.
(_MM256_AVX512_REDUCE_OPERATOR_MAX_MIN_EP16): Ditto.
(_MM256_AVX512_REDUCE_OPERATOR_BASIC_EPI8): Ditto.
(_MM256_AVX512_REDUCE_OPERATOR_MAX_MIN_EP8): Ditto.
(__attribute__): Change intrin call.

10 months ago[PATCH 2/3] Change internal intrin call for AVX512 intrins
Haochen Jiang [Mon, 6 Nov 2023 01:37:49 +0000 (09:37 +0800)]
[PATCH 2/3] Change internal intrin call for AVX512 intrins

gcc/ChangeLog:

* config/i386/avx512bf16vlintrin.h: Change intrin call.
* config/i386/avx512fintrin.h
(_mm_avx512_undefined_ps): New.
(_mm_avx512_undefined_pd): Ditto.
(__attribute__): Change intrin call.
* config/i386/avx512vbmivlintrin.h: Ditto.
* config/i386/avx512vlbwintrin.h: Ditto.
* config/i386/avx512vldqintrin.h: Ditto.
* config/i386/avx512vlintrin.h
(_mm_avx512_undefined_si128): New.
(_mm256_avx512_undefined_ps): Ditto.
(_mm256_avx512_undefined_pd): Ditto.
(_mm256_avx512_undefined_si256): Ditto.
(__attribute__): Change intrin call.

10 months ago[PATCH 1/3] Change internal intrin call for AVX512 intrins
Haochen Jiang [Mon, 6 Nov 2023 01:37:31 +0000 (09:37 +0800)]
[PATCH 1/3] Change internal intrin call for AVX512 intrins

The newly added  _mm{,256}_avx512* intrins are duplicated from their
_mm{,256}_* forms from AVX2 or before. We need to add them to prevent target
option mismatch when calling AVX512 intrins implemented with these intrins
under no-evex512 function attribute. All AVX512 intrins calling those AVX2
intrins or before will change their calls to these newly added AVX512 version.

gcc/ChangeLog:

* config/i386/avx512bitalgvlintrin.h: Change intrin call.
* config/i386/avx512dqintrin.h: Ditto.
* config/i386/avx512fintrin.h:
(_mm_avx512_setzero_ps): New.
(_mm_avx512_setzero_pd): Ditto.
(__attribute__): Change intrin call.
* config/i386/avx512fp16intrin.h: Ditto.
* config/i386/avx512fp16vlintrin.h: Ditto.
* config/i386/avx512vbmi2vlintrin.h: Ditto.
* config/i386/avx512vbmivlintrin.h: Ditto.
* config/i386/avx512vlbwintrin.h: Ditto.
* config/i386/avx512vldqintrin.h: Ditto.
* config/i386/avx512vlintrin.h
(_mm_avx512_setzero_si128): New.
(_mm256_avx512_setzero_pd): Ditto.
(_mm256_avx512_setzero_ps): Ditto.
(_mm256_avx512_setzero_si256): Ditto.
(__attribute__): Change intrin call.
* config/i386/avx512vpopcntdqvlintrin.h: Ditto.
* config/i386/gfniintrin.h: Ditto.

10 months agoDaily bump.
GCC Administrator [Mon, 6 Nov 2023 00:18:16 +0000 (00:18 +0000)]
Daily bump.

10 months agoTestsuite, i386: Mark test as requiring dfp
Francois-Xavier Coudert [Mon, 30 Oct 2023 14:14:42 +0000 (15:14 +0100)]
Testsuite, i386: Mark test as requiring dfp

Test is currently failing on x86_64-apple-darwin with
"decimal floating-point not supported for this target".

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr111753.c: Require dfp.

10 months agoi386: Add LEGACY_INDEX_REG register class.
Uros Bizjak [Sun, 5 Nov 2023 19:53:02 +0000 (20:53 +0100)]
i386: Add LEGACY_INDEX_REG register class.

Also rename LEGACY_REGS to LEGACY_GENERAL_REGS.

gcc/ChangeLog:

* config/i386/i386.h (enum reg_class): Add LEGACY_INDEX_REGS.
Rename LEGACY_REGS to LEGACY_GENERAL_REGS.
(REG_CLASS_NAMES): Ditto.
(REG_CLASS_CONTENTS): Ditto.
* config/i386/constraints.md ("R"): Update for rename.

10 months agomode-switching: Remove unused bbnum field
Richard Sandiford [Sun, 5 Nov 2023 18:28:46 +0000 (18:28 +0000)]
mode-switching: Remove unused bbnum field

seginfo had an unused bbnum field, presumably dating from before
BB information was attached directly to insns.

gcc/
* mode-switching.cc: Remove unused forward references.
(seginfo): Remove bbnum.
(new_seginfo): Remove associated argument.
(optimize_mode_switching): Update calls accordingly.

10 months agoread-rtl: Fix infinite loop while parsing [...]
Richard Sandiford [Sun, 5 Nov 2023 18:24:40 +0000 (18:24 +0000)]
read-rtl: Fix infinite loop while parsing [...]

read_rtx_operand would spin endlessly for:

   (unspec [(...))] UNSPEC_FOO)

because read_nested_rtx does nothing if the next character is not '('.

gcc/
* read-rtl.cc (read_rtx_operand): Avoid spinning endlessly for
invalid [...] operands.

10 months agoopenmp: Mention C attribute syntax in documentation
Jakub Jelinek [Sun, 5 Nov 2023 17:32:46 +0000 (18:32 +0100)]
openmp: Mention C attribute syntax in documentation

This patch mentions the C attribute syntax support in the libgomp documentation.

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

* libgomp.texi (Enabling OpenMP): Adjust wording for attribute syntax
supported also in C.

This page took 0.126602 seconds and 5 git commands to generate.