]> gcc.gnu.org Git - gcc.git/log
gcc.git
9 months agoc++modules: report imported CMI files as dependencies
Ben Boeckel [Fri, 1 Sep 2023 13:04:03 +0000 (09:04 -0400)]
c++modules: report imported CMI files as dependencies

They affect the build, so report them via `-MF` mechanisms.

gcc/cp/

* module.cc (do_import): Report imported CMI files as
dependencies.

gcc/testsuite/

* g++.dg/modules/depreport-1_a.C: New test.
* g++.dg/modules/depreport-1_b.C: New test.
* g++.dg/modules/test-depfile.py: New tool for validating depfile
information.
* lib/modules.exp: Support for validating depfile contents.

Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
9 months agop1689r5: initial support
Ben Boeckel [Fri, 1 Sep 2023 13:04:02 +0000 (09:04 -0400)]
p1689r5: initial support

This patch implements support for [P1689R5][] to communicate to a build
system the C++20 module dependencies to build systems so that they may
build `.gcm` files in the proper order.

Support is communicated through the following three new flags:

- `-fdeps-format=` specifies the format for the output. Currently named
  `p1689r5`.

- `-fdeps-file=` specifies the path to the file to write the format to.

- `-fdeps-target=` specifies the `.o` that will be written for the TU
  that is scanned. This is required so that the build system can
  correlate the dependency output with the actual compilation that will
  occur.

CMake supports this format as of 17 Jun 2022 (to be part of 3.25.0)
using an experimental feature selection (to allow for future usage
evolution without committing to how it works today). While it remains
experimental, docs may be found in CMake's documentation for
experimental features.

Future work may include using this format for Fortran module
dependencies as well, however this is still pending work.

[P1689R5]: https://isocpp.org/files/papers/P1689R5.html
[cmake-experimental]: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Help/dev/experimental.rst

TODO:

- header-unit information fields

Header units (including the standard library headers) are 100%
unsupported right now because the `-E` mechanism wants to import their
BMIs. A new mode (i.e., something more workable than existing `-E`
behavior) that mocks up header units as if they were imported purely
from their path and content would be required.

- non-utf8 paths

The current standard says that paths that are not unambiguously
represented using UTF-8 are not supported (because these cases are rare
and the extra complication is not worth it at this time). Future
versions of the format might have ways of encoding non-UTF-8 paths. For
now, this patch just doesn't support non-UTF-8 paths (ignoring the
"unambiguously representable in UTF-8" case).

- figure out why junk gets placed at the end of the file

Sometimes it seems like the file gets a lot of `NUL` bytes appended to
it. It happens rarely and seems to be the result of some
`ftruncate`-style call which results in extra padding in the contents.
Noting it here as an observation at least.

libcpp/

* include/cpplib.h: Add cpp_fdeps_format enum.
(cpp_options): Add fdeps_format field
(cpp_finish): Add structured dependency fdeps_stream parameter.
* include/mkdeps.h (deps_add_module_target): Add flag for
whether a module is exported or not.
(fdeps_add_target): Add function.
(deps_write_p1689r5): Add function.
* init.cc (cpp_finish): Add new preprocessor parameter used for C++
module tracking.
* mkdeps.cc (mkdeps): Implement P1689R5 output.

gcc/

* doc/invoke.texi: Document -fdeps-format=, -fdeps-file=, and
-fdeps-target= flags.
* gcc.cc: add defaults for -fdeps-target= and -fdeps-file= when
only -fdeps-format= is specified.
* json.h: Add a TODO item to refactor out to share with
`libcpp/mkdeps.cc`.

gcc/c-family/

* c-opts.cc (c_common_handle_option): Add fdeps_file variable and
-fdeps-format=, -fdeps-file=, and -fdeps-target= parsing.
* c.opt: Add -fdeps-format=, -fdeps-file=, and -fdeps-target=
flags.

gcc/cp/

* module.cc (preprocessed_module): Pass whether the module is
exported to dependency tracking.

gcc/testsuite/

* g++.dg/modules/depflags-f-MD.C: New test.
* g++.dg/modules/depflags-f.C: New test.
* g++.dg/modules/depflags-fi.C: New test.
* g++.dg/modules/depflags-fj-MD.C: New test.
* g++.dg/modules/depflags-fj.C: New test.
* g++.dg/modules/depflags-fjo-MD.C: New test.
* g++.dg/modules/depflags-fjo.C: New test.
* g++.dg/modules/depflags-fo-MD.C: New test.
* g++.dg/modules/depflags-fo.C: New test.
* g++.dg/modules/depflags-j-MD.C: New test.
* g++.dg/modules/depflags-j.C: New test.
* g++.dg/modules/depflags-jo-MD.C: New test.
* g++.dg/modules/depflags-jo.C: New test.
* g++.dg/modules/depflags-o-MD.C: New test.
* g++.dg/modules/depflags-o.C: New test.
* g++.dg/modules/p1689-1.C: New test.
* g++.dg/modules/p1689-1.exp.ddi: New test expectation.
* g++.dg/modules/p1689-2.C: New test.
* g++.dg/modules/p1689-2.exp.ddi: New test expectation.
* g++.dg/modules/p1689-3.C: New test.
* g++.dg/modules/p1689-3.exp.ddi: New test expectation.
* g++.dg/modules/p1689-4.C: New test.
* g++.dg/modules/p1689-4.exp.ddi: New test expectation.
* g++.dg/modules/p1689-5.C: New test.
* g++.dg/modules/p1689-5.exp.ddi: New test expectation.
* g++.dg/modules/modules.exp: Load new P1689 library routines.
* g++.dg/modules/test-p1689.py: New tool for validating P1689 output.
* lib/modules.exp: Support for validating P1689 outputs.

Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
9 months agospec: add a spec function to join arguments
Ben Boeckel [Fri, 1 Sep 2023 13:04:01 +0000 (09:04 -0400)]
spec: add a spec function to join arguments

When passing `-o` flags to other options, the typical `-o foo` spelling
leaves a leading whitespace when replacing elsewhere. This ends up
creating flags spelled as `-some-option-with-arg= foo.ext` which doesn't
parse properly. When attempting to make a spec function to just remove
the leading whitespace, the argument splitting ends up masking the
whitespace. However, the intended extension *also* ends up being its own
argument. To perform the desired behavior, the arguments need to be
concatenated together.

gcc/:

* gcc.cc (join_spec_func): Add a spec function to join all
arguments.

Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Co-authored-by: Jason Merrill <jason@redhat.com>
9 months agoRISC-V: Fix --enable-checking=rtl ICE on rv32gc bootstrap
Patrick O'Neill [Tue, 19 Sep 2023 17:03:35 +0000 (10:03 -0700)]
RISC-V: Fix --enable-checking=rtl ICE on rv32gc bootstrap

Resolves PR 111461.

during RTL pass: expand
offtime.c: In function '__offtime':
offtime.c:79:6: internal compiler error: RTL check: expected elt 0 type 'e' or 'u', have 'w' (rtx const_int) in riscv_legitimize_const_move, at config/riscv/riscv.cc:2176
   79 |   ip = __mon_yday[__isleap(y)];

Tested on rv32gc glibc with --enable-checking=rtl.

2023-09-19 Juzhe Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_legitimize_const_move): Eliminate
src_op_0 var to avoid rtl check error.

Tested-by: Patrick O'Neill <patrick@rivosinc.com>
9 months ago[frange] Clean up floating point relational folding.
Aldy Hernandez [Tue, 19 Sep 2023 01:41:08 +0000 (21:41 -0400)]
[frange] Clean up floating point relational folding.

The following patch removes all the special casing from the floating
point relational folding code.  Now all the code relating to folding
of relationals is in frelop_early_resolve() and in
operator_not_equal::fold_range() which requires a small tweak.

I have written new relational tests, and moved them to
gcc.dg/tree-ssa/vrp-float-relations-* for easy reference.  In the
tests it's easy to see the type of things we need to handle:

(a)
if (x != y)
  if (x == y)
    link_error ();

(b)
if (a != b)
  if (a != b) // Foldable as true.

(c)
/* We can thread BB2->BB4->BB5 even though we have no knowledge
   of the NANness of either x_1 or a_5.  */
__BB(4):
  x_1 = __PHI (__BB2: a_5(D), __BB3: b_4(D));
  if (x_1 __UNEQ a_5(D))

(d)
/* Even though x_1 and a_4 are equivalent on the BB2->BB4 path,
   we cannot fold the conditional because of possible NANs:  */
__BB(4):
  # x_1 = __PHI (__BB2: a_4(D), __BB3: 8.0e+0(3));
  if (x_1 == a_4(D))

(e)
if (cond)
  x = a;
else
  x = 8.0;

/* We can fold this as false on the path coming out of cond==1,
   regardless of NANs on either "x" or "a".  */
if (x < a)
  stuff ();

[etc, etc]

We can implement everything without either special casing,
get_identity_relation(), or adding new unordered relationals.

The basic idea is that if we accurately reflect NANs in op[12]_range,
this information gets propagated to the relevant edges, and there's no
need for unordered relations (VREL_UN*), because the information is in
the range itself.  This information is then used in
frelop_early_resolve() to fold certain combinations.

I don't mean this patch as a hard-no against implementing the
unordered relations Jakub preferred, but seeing that it's looking
cleaner and trivially simple without the added burden of more enums,
I'd like to flesh it out completely and then discuss if we still think
new codes are needed.

More testcases or corner cases are highly welcome.

In follow-up patches I will finish up unordered relation folding, and
come up with suitable tests.

gcc/ChangeLog:

* range-op-float.cc (frelop_early_resolve): Clean-up and remove
special casing.
(operator_not_equal::fold_range): Handle VREL_EQ.
(operator_lt::fold_range): Remove special casing for VREL_EQ.
(operator_gt::fold_range): Same.
(foperator_unordered_equal::fold_range): Same.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/vrp-float-12.c: Moved to...
* gcc.dg/tree-ssa/vrp-float-relations-1.c: ...here.
* gcc.dg/tree-ssa/vrp-float-relations-2.c: New test.
* gcc.dg/tree-ssa/vrp-float-relations-3.c: New test.
* gcc.dg/tree-ssa/vrp-float-relations-4.c: New test.

9 months agoc++: extend cold, hot attributes to classes
Javier Martinez [Wed, 23 Aug 2023 13:02:40 +0000 (15:02 +0200)]
c++: extend cold, hot attributes to classes

Most code is cold. This patch extends support for attribute ((cold)) to C++
Classes, Unions, and Structs (RECORD_TYPES and UNION_TYPES) to benefit from
encapsulation - reducing the verbosity of using the attribute where
deserved. The ((hot)) attribute is also extended for its semantic relation.

gcc/c-family/ChangeLog:

* c-attribs.cc (handle_hot_attribute): remove warning on
RECORD_TYPE and UNION_TYPE when in c_dialect_xx.
(handle_cold_attribute): Likewise.

gcc/cp/ChangeLog:

* class.cc (propagate_class_warmth_attribute): New function.
(check_bases_and_members): propagate hot and cold attributes
to all FUNCTION_DECL when the record is marked hot or cold.
* cp-tree.h (maybe_propagate_warmth_attributes): New function.
* decl2.cc (maybe_propagate_warmth_attributes): New function.
* method.cc (lazily_declare_fn): propagate hot and cold
attributes to lazily declared functions when the record is
marked hot or cold.

gcc/ChangeLog:

* doc/extend.texi: Document attributes hot, cold on C++ types.

gcc/testsuite/ChangeLog:

* g++.dg/ext/attr-hotness.C: New test.

Signed-off-by: Javier Martinez <javier.martinez.bugzilla@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
9 months agoc++: fix cxx_print_type's template-info dumping
Patrick Palka [Tue, 19 Sep 2023 18:38:10 +0000 (14:38 -0400)]
c++: fix cxx_print_type's template-info dumping

Unlike DECL_TEMPLATE_INFO which is stored in DECL_LANG_SPECIFIC,
TYPE_TEMPLATE_INFO isn't stored in TYPE_LANG_SPECIFIC, so we don't
need to check for both in cxx_print_type.  This fixes dumping the
template-info of ENUMERAL_TYPE and BOUND_TEMPLATE_TEMPLATE_PARM,
which seem to never have TYPE_LANG_SPECIFIC.

gcc/cp/ChangeLog:

* ptree.cc (cxx_print_type): Remove TYPE_LANG_SPECIFIC
test guarding TYPE_TEMPLATE_INFO.

9 months agoDisable generation of scalar modulo instructions.
Pat Haugen [Tue, 19 Sep 2023 18:19:59 +0000 (13:19 -0500)]
Disable generation of scalar modulo instructions.

It was recently discovered that the scalar modulo instructions can suffer
noticeable performance issues for certain input values. This patch disables
their generation since the equivalent div/mul/sub sequence does not suffer
the same problem.

gcc/
* config/rs6000/rs6000.cc (rs6000_rtx_costs): Check whether the
modulo instruction is disabled.
* config/rs6000/rs6000.h (RS6000_DISABLE_SCALAR_MODULO): New.
* config/rs6000/rs6000.md (mod<mode>3, *mod<mode>3): Check it.
(define_expand umod<mode>3): New.
(define_insn umod<mode>3): Rename to *umod<mode>3 and check if the modulo
instruction is disabled.
(umodti3, modti3): Check if the modulo instruction is disabled.

gcc/testsuite/
* gcc.target/powerpc/clone1.c: Add xfails.
* gcc.target/powerpc/clone3.c: Likewise.
* gcc.target/powerpc/mod-1.c: Update scan strings and add xfails.
* gcc.target/powerpc/mod-2.c: Likewise.
* gcc.target/powerpc/p10-vdivq-vmodq.c: Add xfails.

9 months agoPR 108143/modula2 LONGREAL and powerpc64le-linux
Gaius Mulley [Tue, 19 Sep 2023 18:23:03 +0000 (19:23 +0100)]
PR 108143/modula2 LONGREAL and powerpc64le-linux

This patch introduces a configure for LONGREAL as float128 when
targetting or hosting cc1gm2 on ppc64le.  It fixes calls to builtins
and fixes the -fdebug-builtins option.

gcc/ChangeLog:

* doc/gm2.texi (fdebug-builtins): Correct description.

gcc/m2/ChangeLog:

* Make-lang.in (host_mc_longreal): Detect hosting on powerpc64le
and if so use __float128 for longreal in mc.
(MC_ARGS): Append host_mc_longreal.
* config-make.in (TEST_TARGET_CPU_DEFAULT): New variable.
(TEST_HOST_CPU_DEFAULT): New variable.
* configure: Regenerate.
* configure.ac (M2C_LONGREAL_FLOAT128): New define set if target
is powerpc64le.
(M2C_LONGREAL_PPC64LE): New define set if target is powerpc64le.
* gm2-compiler/M2GCCDeclare.mod: Correct comment case.
* gm2-compiler/M2GenGCC.mod (MaybeDebugBuiltinAlloca): Call
SetLastFunction for the builtin function call.
(MaybeDebugBuiltinMemcpy): Call SetLastFunction for the builtin
function call.
(MaybeDebugBuiltinMemset): New procedure function.
(MakeCopyUse): Use GNU formatting.
(UseBuiltin): Rewrite to check BuiltinExists.
(CodeDirectCall): Rewrite to check BuiltinExists and call
SetLastFunction.
(CodeMakeAdr): Re-format.
* gm2-compiler/M2Options.def (SetDebugBuiltins): New procedure.
* gm2-compiler/M2Options.mod (SetUninitVariableChecking): Allow
"cond" to switch UninitVariableConditionalChecking separately.
(SetDebugBuiltins): New procedure.
* gm2-compiler/M2Quads.def (BuildFunctionCall): Add parameter
ConstExpr.
* gm2-compiler/M2Quads.mod (BuildRealProcedureCall): Add parameter
to BuildRealFuncProcCall.
(BuildRealFuncProcCall): Add ConstExpr parameter.  Pass ConstExpr
to BuildFunctionCall.
(BuildFunctionCall): Add parameter ConstExpr.  Pass ConstExpr to
BuildRealFunctionCall.
(BuildConstFunctionCall): Add parameter ConstExpr.  Pass ConstExpr to
BuildFunctionCall.
(BuildRealFunctionCall): Add parameter ConstExpr.  Pass ConstExpr to
BuildRealFuncProcCall.
* gm2-compiler/P3Build.bnf (SetOrDesignatorOrFunction): Pass FALSE
to BuildFunctionCall.
(AssignmentOrProcedureCall): Pass FALSE to BuildFunctionCall.
* gm2-compiler/SymbolTable.def (IsProcedureBuiltinAvailable): New
procedure function.
* gm2-compiler/SymbolTable.mod (CanUseBuiltin): New procedure
function.
(IsProcedureBuiltinAvailable): New procedure function.
* gm2-gcc/m2builtins.cc (DEBUGGING): Undef.
(bf_category): New enum type.
(struct builtin_function_entry): New field function_avail.
(m2builtins_BuiltInMemCopy): Rename from ...
(m2builtins_BuiltinMemCopy): ... this.
(DoBuiltinMemSet): New function.
(m2builtins_BuiltinMemSet): New function.
(do_target_support_exists): New function.
(target_support_exists): New function.
(m2builtins_BuiltinExists): Return true or false.
(m2builtins_BuildBuiltinTree): Rename local variables.
Replace long_double_type_node with GetM2LongRealType.
(m2builtins_init): Use GetM2LongRealType rather than
long_double_type_node.
* gm2-gcc/m2builtins.def (BuiltInMemCopy): Rename to ...
(BuiltinMemCopy): ... this.
(BuiltinMemSet): New procedure function.
* gm2-gcc/m2builtins.h (m2builtins_BuiltInMemCopy): Rename to ...
(m2builtins_BuiltinMemCopy): ... this.
(m2builtins_BuiltinMemSet): New procedure function.
* gm2-gcc/m2configure.cc (m2configure_M2CLongRealFloat128): New
procedure function.
(m2configure_M2CLongRealIBM128): New procedure function.
(m2configure_M2CLongRealLongDouble): New procedure function.
(m2configure_M2CLongRealLongDoublePPC64LE): New procedure function.
* gm2-gcc/m2configure.def (M2CLongRealFloat128): New procedure function.
(M2CLongRealIBM128): New procedure function.
(M2CLongRealLongDouble): New procedure function.
(M2CLongRealLongDoublePPC64LE): New procedure function.
* gm2-gcc/m2configure.h (m2configure_FullPathCPP): New procedure function.
(m2configure_M2CLongRealFloat128): New procedure function.
(m2configure_M2CLongRealIBM128): New procedure function.
(m2configure_M2CLongRealLongDouble): New procedure function.
(m2configure_M2CLongRealLongDoublePPC64LE): New procedure function.
* gm2-gcc/m2convert.cc (m2convert_BuildConvert): Use convert_loc.
* gm2-gcc/m2options.h (M2Options_SetDebugBuiltins): New function.
* gm2-gcc/m2statement.cc (m2statement_BuildAssignmentTree): Set
TREE_USED to true.
(m2statement_BuildGoto):Set TREE_USED to true.
(m2statement_BuildParam): Set TREE_USED to true.
(m2statement_BuildBuiltinCallTree): New function.
(m2statement_BuildFunctValue): Set TREE_USED to true.
* gm2-gcc/m2statement.def (BuildBuiltinCallTree): New procedure function.
* gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): New
procedure function.
* gm2-gcc/m2treelib.cc (m2treelib_DoCall0): Remove spacing.
(m2treelib_DoCall1): Remove spacing.
(m2treelib_DoCall2): Remove spacing.
(m2treelib_DoCall3): Remove spacing.
(add_stmt): Rename parameter.
* gm2-gcc/m2type.cc (build_set_type): Remove spacing.
(build_m2_specific_size_type): Remove spacing.
(finish_build_pointer_type): Remove spacing.
(m2type_BuildVariableArrayAndDeclare): Remove spacing.
(build_m2_short_real_node): Remove spacing.
(build_m2_real_node): Remove spacing.
(build_m2_long_real_node): Use float128_type_node if
M2CLongRealFloat128 is set.
(build_m2_ztype_node): Remove spacing.
(build_m2_long_int_node): Remove spacing.
(build_m2_long_card_node): Remove spacing.
(build_m2_short_int_node): Remove spacing.
(build_m2_short_card_node): Remove spacing.
(build_m2_iso_loc_node): Remove spacing.
(m2type_SameRealType): New function.
(m2type_InitBaseTypes): Create m2_c_type_node using
m2_long_complex_type_node.
(m2type_SetAlignment): Tidy up comment.
* gm2-gcc/m2type.def (SameRealType):  New procedure function.
* gm2-gcc/m2type.h (m2type_SameRealType): New procedure function.
* gm2-lang.cc (gm2_langhook_type_for_mode): Build long complex
node from m2 language specific long double node.
* gm2-libs-log/RealConversions.mod (IsNan): New procedure
function.
(doPowerOfTen): Re-implement.
* gm2-libs/Builtins.mod: Add newline.
* gm2-libs/DynamicStrings.def (ReplaceChar): New procedure function.
* gm2-libs/DynamicStrings.mod (ReplaceChar): New procedure function.
* gm2config.aci.in (M2C_LONGREAL_FLOAT128): New config value.
(M2C_LONGREAL_PPC64LE): New config value.
* gm2spec.cc (lang_specific_driver): New local variable
need_default_mabi set to default value depending upon
M2C_LONGREAL_PPC64LE and M2C_LONGREAL_FLOAT128.
* lang.opt (Wcase-enum): Moved to correct section.
* m2pp.cc (m2pp_real_type): New function.
(m2pp_type): Call m2pp_real_type.
(m2pp_print_mode): New function.
(m2pp_simple_type): Call m2pp_simple_type.
(m2pp_float): New function.
(m2pp_expression): Call m2pp_float.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GDynamicStrings.h: Rebuild.
* mc-boot/GFIO.cc: Rebuild.
* mc-boot/GFIO.h: Rebuild.
* mc-boot/GIO.cc: Rebuild.
* mc-boot/GRTint.cc: Rebuild.
* mc-boot/Gdecl.cc: Rebuild.
* mc-boot/GmcOptions.cc: Rebuild.
* mc-boot/GmcOptions.h: Rebuild.
* mc/decl.mod: Rebuild.
* mc/mcOptions.def (getCRealType): New procedure function.
(getCLongRealType): New procedure function.
(getCShortRealType): New procedure function.
* mc/mcOptions.mod (getCRealType): New procedure function.
(getCLongRealType): New procedure function.
(getCShortRealType): New procedure function.

libgm2/ChangeLog:

* Makefile.am (TARGET_LONGDOUBLE_ABI): New variable set to
-mabi=ieeelongdouble if the target is powerpc64le.
(AM_MAKEFLAGS): Append TARGET_LONGDOUBLE_ABI.
* Makefile.in: Rebuild.
* libm2cor/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2cor_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2cor_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2cor/Makefile.in: Rebuild.
* libm2iso/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2iso_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2iso_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2iso/Makefile.in: Rebuild.
* libm2log/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2log_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2log_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2log/Makefile.in: Rebuild.
* libm2min/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2min_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2min_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2min/Makefile.in: Rebuild.
* libm2pim/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2pim_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2pim_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2pim/Makefile.in: Rebuild.

gcc/testsuite/ChangeLog:

* gm2/extensions/pass/libc.def: Add spacing.
* gm2/pimlib/logitech/run/pass/realconv.mod: Add debugging print.
* gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp:
Add -fdebug-builtins flag.
* lib/gm2.exp (gm2_target_compile_default): Add
-mabi=ieeelongdouble if the target is powerpc.
(gm2_link_flags): Add
-mabi=ieeelongdouble if the target is powerpc.
* gm2/pim/intrinsic/run/pass/cstub.c: New test.
* gm2/pim/intrinsic/run/pass/cstub.def: New test.
* gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp: New test.
* gm2/pim/intrinsic/run/pass/test.mod: New test.
* gm2/pim/run/pass/builtins.mod: New test.
* gm2/pim/run/pass/convert1.mod: New test.
* gm2/pim/run/pass/longint1.mod: New test.
* gm2/pim/run/pass/longint2.mod: New test.
* gm2/pim/run/pass/longint3.mod: New test.
* gm2/pim/run/pass/longint4.mod: New test.
* gm2/pim/run/pass/longint5.mod: New test.
* gm2/pim/run/pass/longint6.mod: New test.
* gm2/pim/run/pass/longint7.mod: New test.
* gm2/pim/run/pass/longint8.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
9 months agoFix bogus operand predicate on iq2000
Jeff Law [Tue, 19 Sep 2023 17:28:53 +0000 (11:28 -0600)]
Fix bogus operand predicate on iq2000

The iq2000-elf port regressed these tests recently:

> iq2000-sim: gcc.c-torture/execute/20040703-1.c   -O2  (test for excess errors)
> iq2000-sim: gcc.c-torture/execute/20040703-1.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
> iq2000-sim: gcc.c-torture/execute/20040703-1.c   -O3 -g  (test for excess errors)

It turns out one of the patterns had an operand predicate that allowed REG,
SUBREG, CONST_INT (with a limited set of CONST_INTs).  Yet the constraint only
allowed the limited set of immediates.  This naturally triggered an LRA
constraint failure.

The fix is trivial, create an operand predicate that accurately reflects the
kinds of operands allowed by the instruction.

It turns out this was a long standing bug -- fixing the pattern resolved 55
failing tests in the testsuite.

gcc/
* config/iq2000/predicates.md (uns_arith_constant): New predicate.
* config/iq2000/iq2000.md (rotrsi3): Use it.

9 months agofortran: fix checking of CHARACTER lengths in array constructors [PR70231]
Harald Anlauf [Mon, 18 Sep 2023 20:11:40 +0000 (22:11 +0200)]
fortran: fix checking of CHARACTER lengths in array constructors [PR70231]

gcc/fortran/ChangeLog:

PR fortran/70231
* trans-array.cc (trans_array_constructor): In absence of a typespec,
use string length determined by get_array_ctor_strlen() to reasonably
initialize auxiliary variable for bounds-checking.

gcc/testsuite/ChangeLog:

PR fortran/70231
* gfortran.dg/bounds_check_fail_7.f90: New test.

9 months ago[frange] Remove redundant known_isnan() checks.
Aldy Hernandez [Tue, 19 Sep 2023 01:45:35 +0000 (21:45 -0400)]
[frange] Remove redundant known_isnan() checks.

The known_isnan() method is a subset of maybe_isnan().  This patch
removes redundant calls to known_isnan().

gcc/ChangeLog:

* range-op-float.cc (operator_lt::op1_range): Remove known_isnan check.
(operator_lt::op2_range): Same.
(operator_le::op1_range): Same.
(operator_le::op2_range): Same.
(operator_gt::op1_range): Same.
(operator_gt::op2_range): Same.
(operator_ge::op1_range): Same.
(operator_ge::op2_range): Same.
(foperator_unordered_lt::op1_range): Same.
(foperator_unordered_lt::op2_range): Same.
(foperator_unordered_le::op1_range): Same.
(foperator_unordered_le::op2_range): Same.
(foperator_unordered_gt::op1_range): Same.
(foperator_unordered_gt::op2_range): Same.
(foperator_unordered_ge::op1_range): Same.
(foperator_unordered_ge::op2_range): Same.

9 months agoAdd frange::update_nan (const nan_state &).
Aldy Hernandez [Mon, 18 Sep 2023 15:39:32 +0000 (11:39 -0400)]
Add frange::update_nan (const nan_state &).

We can set_nan() with a nan_state so it's good form to have the
analogous form for update_nan().

gcc/ChangeLog:

* value-range.h (frange::update_nan): New.

9 months ago[frange] Add op2_range for operator_not_equal.
Aldy Hernandez [Fri, 15 Sep 2023 12:24:24 +0000 (08:24 -0400)]
[frange] Add op2_range for operator_not_equal.

We're missing an op2_range entry for operator_not_equal so GORI can
calculate an outgoing edge.  The false side of != is true and
guarantees we don't have a NAN, so it's important to get this right.
We eventually get it through an intersection of various ranges in
ranger, but it's best to get things correct as early as possible.

gcc/ChangeLog:

* range-op-float.cc (operator_not_equal::op2_range): New.
* range-op-mixed.h: Add operator_not_equal::op2_range.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/vrp-float-13.c: New test.

9 months agotestsuite work-around compound-assignment-1.c C++ failures on various targets [PR111377]
Jakub Jelinek [Tue, 19 Sep 2023 15:48:42 +0000 (17:48 +0200)]
testsuite work-around compound-assignment-1.c C++ failures on various targets [PR111377]

On Mon, Sep 11, 2023 at 11:11:30PM +0200, Jakub Jelinek via Gcc-patches wrote:
> I think the divergence is whether called_by_test_5b returns the struct
> in registers or in memory.  If in memory (like in the x86_64 -m32 case), we have
>   [compound-assignment-1.c:71:21] D.3191 = called_by_test_5b (); [return slot optimization]
>   [compound-assignment-1.c:71:21 discrim 1] D.3191 ={v} {CLOBBER(eol)};
>   [compound-assignment-1.c:72:1] return;
> in the IL, while if in registers (like x86_64 -m64 case), just
>   [compound-assignment-1.c:71:21] D.3591 = called_by_test_5b ();
>   [compound-assignment-1.c:72:1] return;
>
> If you just want to avoid the differences, putting } on the same line as the
> call might be a usable workaround for that.

Here is the workaround in patch form.

2023-09-19  Jakub Jelinek  <jakub@redhat.com>

PR testsuite/111377
* c-c++-common/analyzer/compound-assignment-1.c (test_5b): Move
closing } to the same line as the call to work-around differences in
diagnostics line.

9 months agoc++: inherited default constructor [CWG2799]
Jason Merrill [Tue, 19 Sep 2023 02:16:04 +0000 (22:16 -0400)]
c++: inherited default constructor [CWG2799]

In this testcase, it seems clear that B should be trivially
default-constructible, since the inherited default constructor is trivial
and there are no other subobjects to initialize.  But we were saying no
because we don't define triviality of inherited constructors.

CWG discussion suggested that the solution is to implicitly declare a
default constructor when inheriting a default constructor; that makes sense
to me.

DR 2799

gcc/cp/ChangeLog:

* class.cc (add_implicit_default_ctor): Split out...
(add_implicitly_declared_members): ...from here.
Also call it when inheriting a default ctor.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/inh-ctor38.C: New test.

9 months agoNew early __builtin_unreachable processing.
Andrew MacLeod [Wed, 13 Sep 2023 15:52:15 +0000 (11:52 -0400)]
New early __builtin_unreachable processing.

in VRP passes before __builtin_unreachable MUST be removed, only remove it
if all exports affected by the unreachable can have global values updated, and
do not involve loads from memory.

PR tree-optimization/110080
PR tree-optimization/110249
gcc/
* tree-vrp.cc (remove_unreachable::final_p): New.
(remove_unreachable::maybe_register): Rename from
maybe_register_block and call early or final routine.
(fully_replaceable): New.
(remove_unreachable::handle_early): New.
(remove_unreachable::remove_and_update_globals): Remove
non-final processing.
(rvrp_folder::rvrp_folder): Add final flag to constructor.
(rvrp_folder::post_fold_bb): Remove unreachable registration.
(rvrp_folder::pre_fold_stmt): Move unreachable processing to here.
(execute_ranger_vrp): Adjust some call parameters.

gcc/testsuite/
* g++.dg/pr110249.C: New.
* gcc.dg/pr110080.c: New.
* gcc.dg/pr93917.c: Adjust.

9 months agoc++: Move consteval folding to cp_fold_r
Marek Polacek [Fri, 1 Sep 2023 00:11:50 +0000 (20:11 -0400)]
c++: Move consteval folding to cp_fold_r

In the review of P2564:
<https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628747.html>
it turned out that in order to correctly handle an example in the paper,
we should stop doing immediate evaluation in build_over_call and
bot_replace, and instead do it in cp_fold_r.  This patch does that.

Another benefit is that this is a pretty significant simplification, at
least in my opinion.  Also, this fixes the c++/110997 ICE (but the test
doesn't compile yet).

The main drawback seems to be that cp_fold_r doesn't process
uninstantiated templates.  We still have to handle things like
"false ? foo () : 1".  To that end, I've added cp_fold_immediate, called
on dead branches in cxx_eval_conditional_expression.

You'll see that I've reintroduced ADDR_EXPR_DENOTES_CALL_P here.  This
is to detect

  *(&foo)) ()
  (s.*&S::foo) ()

which were deemed ill-formed.

gcc/cp/ChangeLog:

* call.cc (build_over_call): Set ADDR_EXPR_DENOTES_CALL_P.  Don't handle
immediate_invocation_p here.
* constexpr.cc (cxx_eval_call_expression): Use mce_true for
DECL_IMMEDIATE_FUNCTION_P.
(cxx_eval_conditional_expression): Call cp_fold_immediate.
* cp-gimplify.cc (enum fold_flags): Add ff_fold_immediate.
(maybe_replace_decl): Make static.
(cp_fold_r): Expand immediate invocations.
(cp_fold_immediate_r): New.
(cp_fold_immediate): New.
* cp-tree.h (ADDR_EXPR_DENOTES_CALL_P): Define.
(cp_fold_immediate): Declare.
* tree.cc (bot_replace): Don't handle immediate invocations here.

libstdc++-v3/ChangeLog:

* testsuite/20_util/allocator/105975.cc: Add dg-error.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/consteval-if2.C: Add xfail.
* g++.dg/cpp2a/consteval-memfn1.C: Adjust.
* g++.dg/cpp2a/consteval11.C: Remove dg-message.
* g++.dg/cpp2a/consteval3.C: Remove dg-message and dg-error.
* g++.dg/cpp2a/consteval9.C: Remove dg-message.
* g++.dg/cpp2a/consteval32.C: New test.
* g++.dg/cpp2a/consteval33.C: New test.
* g++.dg/cpp2a/consteval34.C: New test.
* g++.dg/cpp2a/consteval35.C: New test.

9 months agoc/111468 - dump unordered compare operators in their GIMPLE form with -gimple
Richard Biener [Tue, 19 Sep 2023 11:18:51 +0000 (13:18 +0200)]
c/111468 - dump unordered compare operators in their GIMPLE form with -gimple

The following adjusts -gimple dumping to dump the unordered compare ops
and *h in their GIMPLE form.  It also adds parsing for __LTGT which I
missed before.

PR c/111468
gcc/c/
* gimple-parser.cc (c_parser_gimple_binary_expression): Handle __LTGT.

gcc/
* tree-pretty-print.h (op_symbol_code): Add defaulted flags
argument.
* tree-pretty-print.cc (op_symbol): Likewise.
(op_symbol_code): Print TDF_GIMPLE variant if requested.
* gimple-pretty-print.cc (dump_binary_rhs): Pass flags to
op_symbol_code.
(dump_gimple_cond): Likewise.

gcc/testsuite/
* gcc.dg/gimplefe-50.c: Amend.

9 months agoc++: overeager type completion in convert_to_void [PR111419]
Patrick Palka [Tue, 19 Sep 2023 12:29:39 +0000 (08:29 -0400)]
c++: overeager type completion in convert_to_void [PR111419]

Here convert_to_void always completes the type of an indirection or
id-expression, but according to [expr.context] an lvalue-to-rvalue
conversion is applied to a discarded-value expression only if "the
expression is a glvalue of volatile-qualified type".  This patch
restricts convert_to_void's type completion to match.

PR c++/111419

gcc/cp/ChangeLog:

* cvt.cc (convert_to_void) <case INDIRECT_REF>: Only call
complete_type if the type is volatile.
<case VAR_DECL>: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires36.C: New test.
* g++.dg/expr/discarded1.C: New test.
* g++.dg/expr/discarded1a.C: New test.

9 months agoc++: constness of decltype of NTTP object [PR99631]
Patrick Palka [Tue, 19 Sep 2023 12:21:05 +0000 (08:21 -0400)]
c++: constness of decltype of NTTP object [PR99631]

This corrects resolving decltype of a (class) NTTP object as per
[dcl.type.decltype]/1.2 and [temp.param]/6 in the type-dependent case.

Note that in the non-dependent case we resolve the decltype ahead of
time, in which case finish_decltype_type drops the const VIEW_CONVERT_EXPR
wrapper around the TEMPLATE_PARM_INDEX, and the latter has the desired
non-const type.

In the type-dependent case, at instantiation time tsubst drops the
VIEW_CONVERT_EXPR since the substituted NTTP is the already-const object
created by get_template_parm_object.  So in this case finish_decltype_type
sees the const object, which this patch now adds special handling for.

PR c++/99631

gcc/cp/ChangeLog:

* semantics.cc (finish_decltype_type): For an NTTP object,
return its type modulo cv-quals.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class60.C: New test.

9 months agoRISC-V: Add FNMS floating-point VLS tests
Juzhe-Zhong [Tue, 19 Sep 2023 11:33:12 +0000 (19:33 +0800)]
RISC-V: Add FNMS floating-point VLS tests

Add tests and committed.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add FNMS VLS modes tests.
* gcc.target/riscv/rvv/autovec/vls/fnms-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnms-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnms-3.c: New test.

9 months agoLTO: Get rid of 'lto_mode_identity_table'
Thomas Schwinge [Thu, 10 Aug 2023 13:23:37 +0000 (15:23 +0200)]
LTO: Get rid of 'lto_mode_identity_table'

This, in particular, resolves LTO ICEs with big 'machine_mode's, as for RISC-V.
('mode_table' in 'lto_file_decl_data' still is 'unsigned char'; changing that
is still to be done (for use in offloading compilation), but is not trivial.)
For now, get rid of 'lto_mode_identity_table' to resolve the RISC-V LTO ICEs;
we don't need an actual table for a 1-to-1 mapping.

gcc/lto/
* lto-common.cc (lto_mode_identity_table): Remove.
(lto_file_finalize) [!ACCEL_COMPILER]: 'NULL'-intialize
'file_data->mode_table'.
(lto_fe_init): Don't initialize 'lto_mode_identity_table'.
* lto-common.h (lto_mode_identity_table): Remove.
gcc/
* tree-streamer.h (bp_unpack_machine_mode): If
'ib->file_data->mode_table' not available, apply 1-to-1 mapping.

Co-authored-by: Pan Li <pan2.li@intel.com>
9 months agoRISC-V: Fix RVV can change mode class bug
Juzhe-Zhong [Tue, 19 Sep 2023 02:59:22 +0000 (10:59 +0800)]
RISC-V: Fix RVV can change mode class bug

After support the VLS mode conversion, current case triggers a latent bug that we are
lucky we didn't encounter.

This is a real bug in 'cprop_hardreg':

orig:RVVMF8BI,16,16
new:V32BI,32,0
during RTL pass: cprop_hardreg
auto.c: In function 'main':
auto.c:79:1: internal compiler error: in partial_subreg_p, at rtl.h:3186
   79 | }
      | ^
0x10979a7 partial_subreg_p(machine_mode, machine_mode)
        ../../../../gcc/gcc/rtl.h:3186
0x1723eda mode_change_ok
        ../../../../gcc/gcc/regcprop.cc:402
0x1724007 maybe_mode_change
        ../../../../gcc/gcc/regcprop.cc:436
0x172445d find_oldest_value_reg
        ../../../../gcc/gcc/regcprop.cc:489
0x172534d copyprop_hardreg_forward_1
        ../../../../gcc/gcc/regcprop.cc:808
0x1727017 cprop_hardreg_bb
        ../../../../gcc/gcc/regcprop.cc:1358
0x17272f7 execute
        ../../../../gcc/gcc/regcprop.cc:1425

When trying to do reg copy propagation between RVVMF8BI (precision = 16,16)
and V32BI (precision = 32,0).

The assertion failed in partial_subreg_p:
gcc_checking_assert (ordered_p (outer_prec, inner_prec));

In regcprop.cc:

  if (partial_subreg_p (orig_mode, new_mode))
    return false;

If orig_mode (RVVMF8BI) smaller than new_mode (V32BI), we don't do the hard reg propogation.
However, the 'partial_subreg_p' cause ICE since gcc_checking_assert (ordered_p (outer_prec, inner_prec)).

After analysis in aarch64.cc, they do careful block in 'TARGET_CAN_CHANGE_MODE_CLASS'.
So it's reasonable block regcprop when old mode size maybe_lt than new mode size since we won't do the
copy propgation.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_can_change_mode_class): Block unordered VLA and VLS modes.

9 months agoada: TSS finalize address subprogram generation for constrained...
Richard Wai [Sun, 17 Sep 2023 15:00:00 +0000 (11:00 -0400)]
ada: TSS finalize address subprogram generation for constrained...

...subtypes of unconstrained synchronized private extensions should take
care to designate the corresponding record of the underlying concurrent
type.

When generating TSS finalize address subprograms for class-wide types of
constrained root types, it follows the parent chain looking for the
first "non-constrained" type. It is possible that such a type is a
private extension with the “synchronized” keyword, in which case the
underlying type is a concurrent type. When that happens, the designated
type of the finalize address subprogram should be the corresponding
record’s class-wide-type.

gcc/ada/ChangeLog:
* exp_ch3.adb (Expand_Freeze_Class_Wide_Type): Expanded comments
explaining why TSS Finalize_Address is not generated for
concurrent class-wide types.
* exp_ch7.adb (Make_Finalize_Address_Stmts): Handle cases where the
underlying non-constrained parent type is a concurrent type, and
adjust the designated type to be the corresponding record’s
class-wide type.

gcc/testsuite/ChangeLog:

* gnat.dg/sync_tag_finalize.adb: New test.

Signed-off-by: Richard Wai <richard@annexi-strayline.com>
9 months agoada: Private extensions with the keyword "synchronized" are always limited.
Richard Wai [Wed, 9 Aug 2023 05:54:48 +0000 (01:54 -0400)]
ada: Private extensions with the keyword "synchronized" are always limited.

GNAT was relying on synchronized private type extensions deriving from a
concurrent interface to determine its limitedness. This does not cover the case
where such an extension derives a limited interface. RM-7.6(6/2) makes is clear
that "synchronized" in a private extension implies the derived type is limited.
GNAT should explicitly check for the presence of "synchronized" in a private
extension declaration, and it should have the same effect as the presence of
“limited”.

gcc/ada/ChangeLog:

* sem_ch3.adb (Build_Derived_Record_Type): Treat presence of
keyword "synchronized" the same as "limited" when determining if a
private extension is limited.

gcc/testsuite/ChangeLog:

* gnat.dg/sync_tag_discriminals.adb: New test.
* gnat.dg/sync_tag_limited.adb: New test.

Signed-off-by: Richard Wai <richard@annexi-strayline.com>
9 months agoRISC-V: Support VLS unary floating-point patterns
Juzhe-Zhong [Tue, 19 Sep 2023 11:01:24 +0000 (19:01 +0800)]
RISC-V: Support VLS unary floating-point patterns

Extend current VLA patterns with VLS modes.

Regression all passed.

gcc/ChangeLog:

* config/riscv/autovec.md: Extend VLS modes.
* config/riscv/vector.md: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add unary test.
* gcc.target/riscv/rvv/autovec/vls/neg-2.c: New test.

9 months agoada: Refine upper array bound for bit packed array
Marc Poulhiès [Fri, 8 Sep 2023 15:15:48 +0000 (15:15 +0000)]
ada: Refine upper array bound for bit packed array

When using bit-packed arrays, the compiler creates new array subtypes of
1-bit component indexed by integers. The existing routine checks the
index subtype to find the min/max values. Bit-packed arrays being
indexed by integers, the routines gives up as returning the maximum
possible integer carries no useful information.

This change adds a simple max_value routine that can evaluate very
simple expressions by substituting variables by their min/max value.
Bit-packed array subtypes are currently declared as:

  subtype bp_array is packed_bytes1 (0 .. integer((1 * Var +  7) / 8 - 1));

The simple max_value evaluator handles the bare minimum for this
expression pattern.

gcc/ada/ChangeLog:

* gcc-interface/utils.cc (max_value): New.
* gcc-interface/gigi.h (max_value): New.
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>:
When computing gnu_min/gnu_max, try to use max_value if there is
an initial expression.

9 months agoada: Crash processing type invariants on child subprogram
Javier Miranda [Fri, 8 Sep 2023 11:53:44 +0000 (11:53 +0000)]
ada: Crash processing type invariants on child subprogram

gcc/ada/

* contracts.adb
(Has_Public_Visibility_Of_Subprogram): Add missing support for
child subprograms.

9 months agotree-optimization/111465 - bougs jump threading with no-copy src block
Richard Biener [Tue, 19 Sep 2023 10:36:04 +0000 (12:36 +0200)]
tree-optimization/111465 - bougs jump threading with no-copy src block

The following avoids to forward thread a path with a EDGE_NO_COPY_SRC_BLOCK
block that became non-empty due to folding.

PR tree-optimization/111465
* tree-ssa-threadupdate.cc (fwd_jt_path_registry::thread_block_1):
Cancel the path when a EDGE_NO_COPY_SRC_BLOCK became non-empty.

* g++.dg/torture/pr111465.C: New testcase.

9 months agoc/111468 - add unordered compare and pointer diff to GIMPLE FE parsing
Richard Biener [Tue, 19 Sep 2023 09:49:54 +0000 (11:49 +0200)]
c/111468 - add unordered compare and pointer diff to GIMPLE FE parsing

The following adds __UN{LT,LE,GT,GE,EQ}, __UNORDERED and __ORDERED
operator parsing support and support for parsing - as POINTER_DIFF_EXPR.

PR c/111468
gcc/c/
* gimple-parser.cc (c_parser_gimple_binary_expression): Add
return type argument.
(c_parser_gimple_statement): Adjust.
(c_parser_gimple_paren_condition): Likewise.
(c_parser_gimple_binary_expression): Use passed in return type,
add support for - as POINTER_DIFF_EXPR, __UN{LT,LE,GT,GE,EQ},
__UNORDERED and __ORDERED.

gcc/testsuite/
* gcc.dg/gimplefe-50.c: New testcase.
* gcc.dg/gimplefe-51.c: Likewise.

9 months agoRISC-V: Support VLS floating-point FMA/FNMA/FMS auto-vectorization
Juzhe-Zhong [Tue, 19 Sep 2023 09:19:09 +0000 (17:19 +0800)]
RISC-V: Support VLS floating-point FMA/FNMA/FMS auto-vectorization

Support VLS floating-point FMA/FNMA/FMS patterns.

Regression no difference after this patch, Committed.

gcc/ChangeLog:

* config/riscv/autovec.md: Extend VLS floating-point modes.
* config/riscv/vector.md: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add FMS tests.
* gcc.target/riscv/rvv/autovec/vls/fma-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fms-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fms-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fms-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-7.c: New test.

9 months agomatch.pd: Some build_nonstandard_integer_type tweaks
Jakub Jelinek [Tue, 19 Sep 2023 08:44:54 +0000 (10:44 +0200)]
match.pd: Some build_nonstandard_integer_type tweaks

As discussed earlier, using build_nonstandard_integer_type blindly for all
INTEGRAL_TYPE_Ps is problematic now that we have BITINT_TYPE, because it
always creates an INTEGRAL_TYPE with some possibly very large precision.
The following patch attempts to deal with 3 such spots in match.pd, others
still need looking at.

In the first case, I think it is quite expensive/undesirable to create
a non-standard INTEGER_TYPE with possibly huge precision and then
immediately just see type_has_mode_precision_p being false for it, or even
worse introducing a cast to TImode or OImode or XImode INTEGER_TYPE which
nothing will be able to actually handle.  128-bit or 64-bit (on 32-bit
targets) types are the largest supported by the backend, so the following
patch avoids creating and matching conversions to larger types, it is
an optimization anyway and so should be used when it is cheap that way.

In the second hunk, I believe the uses of build_nonstandard_integer_type
aren't useful at all.  It is when matching a ? -1 : 0 and trying to express
it as say -(type) (bool) a etc., but this is all GIMPLE only, where most of
integral types with same precision/signedness are compatible and we know
-1 is representable in that type, so I really don't see any reason not to
perform the negation of a [0, 1] valued expression in type, rather
than doing it in
build_nonstandard_integer_type (TYPE_PRECISION (type), TYPE_UNSIGNED (type))
(except that it breaks the BITINT_TYPEs).  I don't think we need to do
something like range_check_type.
While in there, I've also noticed it was using a (with {
tree booltrue = constant_boolean_node (true, boolean_type_node);
} and removed that + replaced uses of booltrue with boolean_true_node
which the above function always returns.

2023-09-19  Jakub Jelinek  <jakub@redhat.com>

* match.pd ((x << c) >> c): Don't call build_nonstandard_integer_type
nor check type_has_mode_precision_p for width larger than [TD]Imode
precision.
(a ? CST1 : CST2): Don't use build_nonstandard_type, just convert
to type.  Use boolean_true_node instead of
constant_boolean_node (true, boolean_type_node).  Formatting fixes.

9 months agoRISC-V: Support integer FMA/FNMA VLS modes autovectorization
Juzhe-Zhong [Tue, 19 Sep 2023 08:13:10 +0000 (16:13 +0800)]
RISC-V: Support integer FMA/FNMA VLS modes autovectorization

Simpily extend the current VLA iterator and patterns.

Regression passed with no difference.

gcc/ChangeLog:

* config/riscv/autovec.md: Add VLS modes.
* config/riscv/vector.md: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add VLS FMA/FNMA test.
* gcc.target/riscv/rvv/autovec/vls/fma-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-4.c: New test.

9 months agosmall _BitInt tweaks
Jakub Jelinek [Tue, 19 Sep 2023 07:50:35 +0000 (09:50 +0200)]
small _BitInt tweaks

I think it is undesirable when being asked for signed_type_for
of unsigned _BitInt(1) (which is valid) to get signed _BitInt(1) (which is
invalid, the standard only allows signed _BitInt(2) and larger), so the
patch returns 1-bit signed INTEGER_TYPE for those cases.
Furthermore it asserts in build_bitint_type that nothing attempts to create
signed _BitInt(0), unsigned _BitInt(0) or signed _BitInt(1) types.

2023-09-18  Jakub Jelinek  <jakub@redhat.com>

gcc/
* tree.cc (build_bitint_type): Assert precision is not 0, or
for signed types 1.
(signed_or_unsigned_type_for): Return INTEGER_TYPE for signed variant
of unsigned _BitInt(1).
gcc/c-family/
* c-common.cc (c_common_signed_or_unsigned_type): Return INTEGER_TYPE
for signed variant of unsigned _BitInt(1).

9 months agolibgomp: Handle NULL environ like pointer to NULL pointer [PR111413]
Jakub Jelinek [Tue, 19 Sep 2023 07:26:35 +0000 (09:26 +0200)]
libgomp: Handle NULL environ like pointer to NULL pointer [PR111413]

clearenv function just sets environ to NULL (after sometimes freeing it),
rather than setting it to a pointer to NULL, and our code was assuming
it is always non-NULL.

Fixed thusly, the change seems to be large but actually is just
+  if (environ)
     for (env = environ; *env != 0; env++)
plus reindentation.  I've also noticed the block after this for loop
was badly indented (too much) and fixed that too.

No testcase added, as it needs clearenv + dlopen.

2023-09-19  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/111413
* env.c (initialize_env): Don't dereference environ if it is NULL.
Reindent.

9 months ago[testsuite][aarch64] Adjust vect_copy_lane_1.c for new code-gen.
Prathamesh Kulkarni [Tue, 19 Sep 2023 05:51:39 +0000 (11:21 +0530)]
[testsuite][aarch64] Adjust vect_copy_lane_1.c for new code-gen.

gcc/testsuite/ChangeLog:
* gcc.target/aarch64/vect_copy_lane_1.c: Scan for zip1 instead
of ins for float32x2_t, int32x2_t and uint32x2_t tests.

9 months agoRISC-V: Refactor and cleanup fma patterns
Lehua Ding [Mon, 18 Sep 2023 11:37:17 +0000 (19:37 +0800)]
RISC-V: Refactor and cleanup fma patterns

At present, FMA autovec's patterns do not fully use the corresponding pattern
in vector.md. The previous reason is that the merge operand of pattern in
vector.md cannot be VUNDEF. Now allowing it to be VUNDEF, reunify insn used for
reload pass into vector.md, and the corresponding vlmax pattern in autovec.md
is used for combine. This patch also refactors the corresponding combine
pattern inside autovec-opt.md and removes the unused ones.

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*<optab>_fma<mode>):
Removed old combine patterns.
(*single_<optab>mult_plus<mode>): Ditto.
(*double_<optab>mult_plus<mode>): Ditto.
(*sign_zero_extend_fma): Ditto.
(*zero_sign_extend_fma): Ditto.
(*double_widen_fma<mode>): Ditto.
(*single_widen_fma<mode>): Ditto.
(*double_widen_fnma<mode>): Ditto.
(*single_widen_fnma<mode>): Ditto.
(*double_widen_fms<mode>): Ditto.
(*single_widen_fms<mode>): Ditto.
(*double_widen_fnms<mode>): Ditto.
(*single_widen_fnms<mode>): Ditto.
(*reduc_plus_scal_<mode>): Adjust name.
(*widen_reduc_plus_scal_<mode>): Adjust name.
(*dual_widen_fma<mode>): New combine pattern.
(*dual_widen_fmasu<mode>): Ditto.
(*dual_widen_fmaus<mode>): Ditto.
(*dual_fma<mode>): Ditto.
(*single_fma<mode>): Ditto.
(*dual_fnma<mode>): Ditto.
(*single_fnma<mode>): Ditto.
(*dual_fms<mode>): Ditto.
(*single_fms<mode>): Ditto.
(*dual_fnms<mode>): Ditto.
(*single_fnms<mode>): Ditto.
* config/riscv/autovec.md (fma<mode>4):
Reafctor fma pattern.
(*fma<VI:mode><P:mode>): Removed.
(fnma<mode>4): Reafctor.
(*fnma<VI:mode><P:mode>): Removed.
(*fma<VF:mode><P:mode>):  Removed.
(*fnma<VF:mode><P:mode>):  Removed.
(fms<mode>4):  Reafctor.
(*fms<VF:mode><P:mode>):  Removed.
(fnms<mode>4): Reafctor.
(*fnms<VF:mode><P:mode>): Removed.
* config/riscv/riscv-protos.h (prepare_ternary_operands):
Adjust prototype.
* config/riscv/riscv-v.cc (prepare_ternary_operands): Refactor.
* config/riscv/vector.md (*pred_mul_plus<mode>_undef): New pattern.
(*pred_mul_plus<mode>): Removed.
(*pred_mul_plus<mode>_scalar): Removed.
(*pred_mul_plus<mode>_extended_scalar): Removed.
(*pred_minus_mul<mode>_undef):  New pattern.
(*pred_minus_mul<mode>): Removed.
(*pred_minus_mul<mode>_scalar): Removed.
(*pred_minus_mul<mode>_extended_scalar): Removed.
(*pred_mul_<optab><mode>_undef):  New pattern.
(*pred_mul_<optab><mode>): Removed.
(*pred_mul_<optab><mode>_scalar): Removed.
(*pred_mul_neg_<optab><mode>_undef):  New pattern.
(*pred_mul_neg_<optab><mode>): Removed.
(*pred_mul_neg_<optab><mode>_scalar): Removed.

9 months agoRISC-V: Fix typos on comments (SVE -> RVV)
Tsukasa OI [Tue, 19 Sep 2023 02:10:31 +0000 (02:10 +0000)]
RISC-V: Fix typos on comments (SVE -> RVV)

We have the 'V' extension (RVV), not SVE from AArch64.

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins.cc
(builtin_decl, expand_builtin): Replace SVE with RVV.

9 months agoRISC-V: Add builtin .def file dependencies
Tsukasa OI [Mon, 18 Sep 2023 09:23:41 +0000 (09:23 +0000)]
RISC-V: Add builtin .def file dependencies

riscv-builtins.cc includes riscv-cmo.def and riscv-scalar-crypto.def
(making dependencies) but their dependencies must be explicitly defined at
the configuration file, t-riscv.

They were the last two .def files without correct dependency information.

gcc/ChangeLog:

* config/riscv/t-riscv: Add dependencies for riscv-builtins.cc,
riscv-cmo.def and riscv-scalar-crypto.def.

9 months agoDaily bump.
GCC Administrator [Tue, 19 Sep 2023 00:17:49 +0000 (00:17 +0000)]
Daily bump.

9 months agoRISC-V: Support VLS mode for vec_set
Pan Li [Mon, 18 Sep 2023 03:19:33 +0000 (11:19 +0800)]
RISC-V: Support VLS mode for vec_set

This patch would like to add the VLS support vec_set, both INT
and FP are included.

Give sample code as below:

typedef long long vl_t \
  __attribute__((vector_size(2 * sizeof (long long))));

vl_t init_vl (vl_t v, unsigned index, unsigned value)
{
  v[index] = value;

  return v;
}

Before this patch:
init_vl:
  addi     sp,sp,-16
  vsetivli zero,2,e64,m1,ta,ma
  vle64.v  v1,0(a1)
  vse64.v  v1,0(sp)
  slli     a4,a2,32
  srli     a2,a4,29
  add      a2,sp,a2
  slli     a3,a3,32
  srli     a3,a3,32
  sd       a3,0(a2)
  vle64.v  v1,0(sp)
  vse64.v  v1,0(a0)
  addi     sp,sp,16
  jr       ra

After this patch:
init_vl:
  vsetivli    zero,2,e64,m1,ta,ma
  vle64.v     v1,0(a1)
  slli        a3,a3,32
  srli        a3,a3,32
  addi        a5,a2,1
  vsetvli     zero,a5,e64,m1,tu,ma
  vmv.v.x     v2,a3
  vslideup.vx v1,v2,a2
  vsetivli    zero,2,e64,m1,ta,ma
  vse64.v     v1,0(a0)
  ret

Please note this patch depends the RVV SCALAR_MOVE_MERGED_OP bugfix.

gcc/ChangeLog:

* config/riscv/autovec.md: Extend to vls mode.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: New macros.
* gcc.target/riscv/rvv/autovec/vls/vec-set-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-10.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-11.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-12.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-13.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-14.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-15.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-16.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-17.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-18.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-19.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-20.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-21.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-22.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-8.c: New test.
* gcc.target/riscv/rvv/autovec/vls/vec-set-9.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
9 months agoRISC-V: Bugfix for scalar move with merged operand
Pan Li [Sun, 17 Sep 2023 07:16:47 +0000 (15:16 +0800)]
RISC-V: Bugfix for scalar move with merged operand

Given below example for VLS mode

void
test (vl_t *u)
{
  vl_t t;
  long long *p = (long long *)&t;

  p[0] = p[1] = 2;

  *u = t;
}

The vec_set will simplify the insn to vmv.s.x when index is 0, without
merged operand. That will result in some problems in DCE, aka:

1:  137[DI] = a0
2:  138[V2DI] = 134[V2DI]                              // deleted by DCE
3:  139[DI] = #2                                       // deleted by DCE
4:  140[DI] = #2                                       // deleted by DCE
5:  141[V2DI] = vec_dup:V2DI (139[DI])                 // deleted by DCE
6:  138[V2DI] = vslideup_imm (138[V2DI], 141[V2DI], 1) // deleted by DCE
7:  135[V2DI] = 138[V2DI]                              // deleted by DCE
8:  142[V2DI] = 135[V2DI]                              // deleted by DCE
9:  143[DI] = #2
10: 142[V2DI] = vec_dup:V2DI (143[DI])
11: (137[DI]) = 142[V2DI]

The higher 64 bits of 142[V2DI] is unknown here and it generated incorrect
code when store back to memory. This patch would like to fix this issue
by adding a new SCALAR_MOVE_MERGED_OP for vec_set.

Please note this patch doesn't enable VLS for vec_set, the underlying
patches will support this soon.

gcc/ChangeLog:

* config/riscv/autovec.md: Bugfix.
* config/riscv/riscv-protos.h (SCALAR_MOVE_MERGED_OP): New enum.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/scalar-move-merged-run-1.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
9 months agoMATCH: Make zero_one_valued_p non-recursive fully
Andrew Pinski [Sun, 17 Sep 2023 18:20:36 +0000 (11:20 -0700)]
MATCH: Make zero_one_valued_p non-recursive fully

So it turns out VN can't handle any kind of recursion for match. In this
case we have `b = a & -1` and we try to match a as being zero_one_valued_p
and VN returns b as being the value and we just go into an infinite loop at
this point.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note genmatch should warn (or error out) if this gets detected so I filed PR 111446
which I will be looking into next week or the week after so we don't run into
this issue again.

PR tree-optimization/111442

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Have the bit_and match not be
recursive.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111442-1.c: New test.

9 months agoMATCH: Avoid recursive zero_one_valued_p for conversions
Andrew Pinski [Sat, 16 Sep 2023 22:19:58 +0000 (15:19 -0700)]
MATCH: Avoid recursive zero_one_valued_p for conversions

So when VN finds a name which has a nop conversion, it says
both names are equivalent to each other and the valuaization
function for one will return the other. This normally does not
cause any issues as there is no recursive matches. But after
r14-4038-gb975c0dc3be285, there was one added. So we would
do an infinite recursion on the match and never finish.
This fixes the issue (and adds a comment in match.pd) by
for converts just handle one level instead of being recursive
always.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note the testcase was reduced from tree-ssa-loop-niter.cc and then
changed slightly into C rather than C++ but it still needs exceptions
turned on get the IR that VN would produce this equivalence relationship
going on. Also had to turn off early inline to force put to be inlined later.

PR tree-optimization/111435

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Don't do recursion
on converts.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111435-1.c: New test.

9 months agoc++: optimize unifying nested templated classes [PR89231]
Patrick Palka [Mon, 18 Sep 2023 18:54:45 +0000 (14:54 -0400)]
c++: optimize unifying nested templated classes [PR89231]

Since the LHS of a qualified-id is a non-deduced context, it effectively
means we can't deduce from outer template arguments of a class template
specialization.  And checking for equality between the TI_TEMPLATE of a
class specialization parm/arg already implies that the outer template
arguments are the same.  Hence recursing into outer template arguments
during unification of class specializations is redundant, so this patch
makes unify recurse only into innermost arguments.

This incidentally fixes the testcase from PR89231 because there
more_specialized_partial_inst wrongly considers the two partial
specializations to be unordered ultimately because unify for identical
parm=arg=A<Ps...>::Collect<N...> gets confused when it recurses into
parm=arg={Ps...} since Ps is outside the (innermost) level of tparms
that we're actually deducing.

PR c++/89231

gcc/cp/ChangeLog:

* pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality
test by not calling most_general_template.  Only unify the
innermost levels of template arguments.
(unify) <case CLASS_TYPE>: Only unify the innermost levels of
template arguments, and only if the template is primary.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic-partial3.C: New test.

9 months agoc++: non-dependent assignment checking [PR63198, PR18474]
Patrick Palka [Mon, 18 Sep 2023 18:47:52 +0000 (14:47 -0400)]
c++: non-dependent assignment checking [PR63198, PR18474]

This patch makes us recognize and check non-dependent simple assigments
ahead of time, like we already do for compound assignments.  This means
the templated representation of such assignments will now usually have
an implicit INDIRECT_REF (due to the reference return type), which the
-Wparentheses code needs to handle.  As a drive-by improvement, this
patch also makes maybe_convert_cond issue -Wparentheses warnings ahead
of time, and removes a seemingly unnecessary suppress_warning call in
build_x_modify_expr.

On the libstdc++ side, some tests were attempting to modify a data
member from a uninstantiated const member function, which this patch
minimally fixes by making the data member mutable.

PR c++/63198
PR c++/18474

gcc/cp/ChangeLog:

* semantics.cc (maybe_convert_cond): Look through implicit
INDIRECT_REF when deciding whether to issue a -Wparentheses
warning, and consider templated assignment expressions as well.
(finish_parenthesized_expr): Look through implicit INDIRECT_REF
when suppressing -Wparentheses warning.
* typeck.cc (build_x_modify_expr): Check simple assignments
ahead time too, not just compound assignments.  Give the second
operand of MODOP_EXPR a non-null type so that it's not considered
always instantiation-dependent.  Don't call suppress_warning.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/static_assert15.C: Expect diagnostic for
non-constant static_assert condition.
* g++.dg/expr/unary2.C: Remove xfails.
* g++.dg/template/init7.C: Make initializer type-dependent to
preserve intent of test.
* g++.dg/template/recurse3.C: Likewise for the erroneous
statement.
* g++.dg/template/non-dependent26.C: New test.
* g++.dg/warn/Wparentheses-32.C: New test.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/discard_block_engine/cons/seed_seq2.cc:
Make data member seed_seq::called mutable.
* testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq2.cc:
Likewise.
* testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq2.cc:
Likewise.
* testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq2.cc:
Likewise.
* testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq2.cc:
Likewise.
* testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq2.cc:
Likewise.
* testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq2.cc:
Likewise.

9 months agoc++: unifying identical tmpls from current inst [PR108347]
Patrick Palka [Mon, 18 Sep 2023 18:41:07 +0000 (14:41 -0400)]
c++: unifying identical tmpls from current inst [PR108347]

Here more_specialized_partial_spec wrongly considers the two partial
specializations to be unordered ultimately because unify for identical
parm=arg=A<T>::C returns failure due to C being dependent.

This patch fixes this by relaxing unify's early-exit identity test to
also accept dependent decls; we can't deduce anything further from them
anyway.  In passing this patch removes the CONST_DECL case of unify:
we should never see the CONST_DECL version of a template parameter here,
and for other CONST_DECLs (such as enumerators) it seems we can rely on
them to already have been folded to their DECL_INITIAL.

PR c++/108347

gcc/cp/ChangeLog:

* pt.cc (unify): Return unify_success for identical dependent
DECL_P 'arg' and 'parm'.
<case CONST_DECL>: Remove handling.

gcc/testsuite/ChangeLog:

* g++.dg/template/ttp41.C: New test.

9 months agoc++: always check arity before deduction
Patrick Palka [Mon, 18 Sep 2023 18:41:05 +0000 (14:41 -0400)]
c++: always check arity before deduction

This simple patch extends the r12-3271-gf1e73199569287 optimization
to happen for deduction without explicit template arguments as well.
The motivation for this is to accept testcases such as conv20.C and
ttp40.C below, which don't use explicit template arguments but for
which unnecessary template instantiation during deduction could be
avoided if we uniformly pruned overloads according to arity early.
This incidentally causes us to accept one reduced testcase from
PR c++/84075, but the underlying issue there remains at large.

As a nice side effect, this change causes the "candidate expects N
argument(s)" note during overload resolution failure to point to the
template candidate instead of the call site, which seems like an
improvement along the lines of r14-309-g14e881eb030509.

gcc/cp/ChangeLog:

* call.cc (add_template_candidate_real): Check arity even
when there are no explicit template arguments.  Combine the
two adjacent '!obj' tests into one.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/vt-57397-1.C: Expect "candidate expects ... N
argument(s)" at the declaration site instead of the call site.
* g++.dg/cpp0x/vt-57397-2.C: Likewise.
* g++.dg/overload/template5.C: Likewise.
* g++.dg/template/local6.C: Likewise.
* g++.dg/template/conv20.C: New test.
* g++.dg/template/ttp40.C: New test.

9 months agoDarwin,debug : Switch to DWARF 3 or 4 when dsymutil supports it.
Iain Sandoe [Sun, 17 Sep 2023 14:56:07 +0000 (15:56 +0100)]
Darwin,debug : Switch to DWARF 3 or 4 when dsymutil supports it.

The main reason that Darwin has been using DWARF2 only as debug is that
earlier debug linkers (dsymutil) did not support any extensions to this
so that the default "non-strict" mode used in GCC would cause tool errors.

There are two sources for dsymutil, those based off a closed source base
"dwarfutils" and those based off LLVM.

For dsymutil versions based off LLVM-7+ we can use up to DWARF-4, and for
versions based on dwarfutils 121+ we can use DWARF-3.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin-protos.h (enum darwin_external_toolchain): New.
* config/darwin.cc (DSYMUTIL_VERSION): New.
(darwin_override_options): Choose the default debug DWARF version
depending on the configured dsymutil version.

9 months agoconfigure, Darwin: Adjust handing of stdlib option.
Iain Sandoe [Sat, 16 Sep 2023 07:40:49 +0000 (08:40 +0100)]
configure, Darwin: Adjust handing of stdlib option.

The intent of the configuration choices for -stdlib is that default
setting should choose reasonable options for the target.  This should
enable -stdlib= for Darwin targets where libc++ is the default on the
system (so that it is only necessary to provide the headers).

However, it seems that there are some cases where (external) config
scripts are using -stdlib (incorrectly) to determine if the compiler
in use is GCC or clang.

In order to allow for these cases, this patch refines the setting
like so:

--with-gxx-libcxx-include-dir= is used to configure the path containing
libc++ headers; it also controls the enabling of the -stdlib option.

We are adding a special value for path:
if --with-gxx-libcxx-include-dir is 'no' we disable the stdlib option.

Otherwise if the --with-gxx-libcxx-include-dir is set we use the path
provided, and enable the stdlib option.

if --with-gxx-libcxx-include-dir is unset
We decide on the stdlib option based on the OS type and revision being
targeted.  The path is set to a fixed position relative to the compiler
install (similar logic to that used for libstdc++ headers).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* configure: Regenerate.
* configure.ac: Handle explict disable of stdlib option, set
defaults for Darwin.

9 months agoc++: optimize tsubst_template_decl for function templates
Patrick Palka [Mon, 18 Sep 2023 18:27:18 +0000 (14:27 -0400)]
c++: optimize tsubst_template_decl for function templates

r14-2655-g92d1425ca78040 made instantiate_template avoid redundantly
performing a specialization lookup when calling tsubst_decl.  This patch
applies the same optimization to the analagous tsubst_template_decl when
(partially) instantiating a function template.  This allows us to remove
an early exit test from register_specialization since we no longer try
to register the FUNCTION_DECL corresponding to a function template
partial instantiation.

gcc/cp/ChangeLog:

* pt.cc (register_specialization): Remove now-unnecessary
early exit for FUNCTION_DECL partial instantiation.
(tsubst_template_decl): Pass use_spec_table=false to
tsubst_function_decl.  Set DECL_TI_ARGS of a non-lambda
FUNCTION_DECL specialization to the full set of arguments.
Simplify register_specialization call accordingly.

gcc/testsuite/ChangeLog:

* g++.dg/template/nontype12.C: Expect two instead of three
duplicate diagnostics for A<double>::bar() specialization.

9 months agoMATCH: Add simplifications of `(a == CST) & a`
Andrew Pinski [Sat, 16 Sep 2023 03:27:26 +0000 (03:27 +0000)]
MATCH: Add simplifications of `(a == CST) & a`

`(a == CST) & a` can be either simplified to simplying `a == CST`
or 0 depending on the first bit of the CST.
This is an extension of the already pattern of `X & !X` and allows
us to remove the 2 xfails on gcc.dg/binop-notand1a.c and gcc.dg/binop-notand4a.c.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/111431

gcc/ChangeLog:

* match.pd (`(a == CST) & a`): New pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/binop-notand1a.c: Remove xfail.
* gcc.dg/binop-notand4a.c: Likewise.
* gcc.c-torture/execute/pr111431-1.c: New test.
* gcc.dg/binop-andeq1.c: New test.
* gcc.dg/binop-andeq2.c: New test.
* gcc.dg/binop-notand7.c: New test.
* gcc.dg/binop-notand7a.c: New test.

9 months agoMove 'g++.dg/abi/nvptx-[...].C' -> 'g++.target/nvptx/abi-[...].C'
Thomas Schwinge [Mon, 18 Sep 2023 14:36:24 +0000 (16:36 +0200)]
Move 'g++.dg/abi/nvptx-[...].C' -> 'g++.target/nvptx/abi-[...].C'

... instead of burying these nvptx-specific test cases within the generic ones.

gcc/testsuite/
* g++.dg/abi/nvptx-nrv1.C: Move...
* g++.target/nvptx/abi-nrv1.C: ... here.
* g++.dg/abi/nvptx-ptrmem1.C: Move...
* g++.target/nvptx/abi-ptrmem1.C: ... here.

9 months agoAdd 'g++.target/nvptx/nvptx.exp' for nvptx-specific C++ test cases
Thomas Schwinge [Mon, 18 Sep 2023 14:35:56 +0000 (16:35 +0200)]
Add 'g++.target/nvptx/nvptx.exp' for nvptx-specific C++ test cases

Like 'gcc.target/nvptx/nvptx.exp' is modeled after 'gcc.dg/dg.exp', this new
'g++.target/nvptx/nvptx.exp' is modeled after 'g++.dg/dg.exp'.

gcc/testsuite/
* g++.target/nvptx/nvptx.exp: New.

9 months agoFix up 'g++.dg/abi/nvptx-ptrmem1.C'
Thomas Schwinge [Mon, 18 Sep 2023 14:34:47 +0000 (16:34 +0200)]
Fix up 'g++.dg/abi/nvptx-ptrmem1.C'

..., which shortly after its inception in
commit 44eba92d0a0594bda5b53fcb3c8f84f164c653b6 (Subversion r231628)
"[PTX] parameters and return values" was forgotten to be updated in next day's
commit 1f0659546bcf5b95c3263cdc73149f6c2a05ebe1 (Subversion r231663)
"[PTX] more register cleanups".  Fix it up now, as obvious, for the current
state of things.

gcc/testsuite/
* g++.dg/abi/nvptx-ptrmem1.C: Fix up.

9 months agolibstdc++: Minor tweak to C++20 status docs
Jonathan Wakely [Mon, 18 Sep 2023 14:19:51 +0000 (15:19 +0100)]
libstdc++: Minor tweak to C++20 status docs

The row for P1466R3 was missing the info on when it was implemented.

libstdc++-v3/ChangeLog:

* doc/xml/manual/status_cxx2020.xml: Tweak P1466R3 status.
* doc/html/manual/status.html: Regenerate.

9 months agolibstdc++: Update C++20 and C++23 status docs
Jonathan Wakely [Sat, 6 May 2023 21:02:51 +0000 (22:02 +0100)]
libstdc++: Update C++20 and C++23 status docs

libstdc++-v3/ChangeLog:

* doc/xml/manual/configure.xml: Use conventional option name.
* doc/xml/manual/status_cxx2020.xml: Update.
* doc/xml/manual/status_cxx2023.xml: Update.
* doc/html/*: Regenerate.

9 months agoRISC-V: Remove redundant vec_duplicate pattern
Juzhe-Zhong [Mon, 18 Sep 2023 12:35:08 +0000 (20:35 +0800)]
RISC-V: Remove redundant vec_duplicate pattern

Currently, VLS and VLA patterns are different.
VLA is define_expand
VLS is define_insn_and_split

It makes no sense that they are different pattern format.
Merge them into same pattern (define_insn_and_split).
It can also be helpful for the future vv -> vx fwprop optimization.

gcc/ChangeLog:

* config/riscv/riscv-selftests.cc (run_broadcast_selftests): Adapt selftests.
* config/riscv/vector.md (@vec_duplicate<mode>): Remove.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr111313.c: Adapt test.

9 months agoRISC-V: Fix bogus FAILs of vsetvl testcases
Juzhe-Zhong [Mon, 18 Sep 2023 12:28:54 +0000 (20:28 +0800)]
RISC-V: Fix bogus FAILs of vsetvl testcases

Due the the global codes change which change the CFG cause bogus vsetvl checking FAILs.

Adapt testcases for the global codes change.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/avl_single-21.c: Adapt test.
* gcc.target/riscv/rvv/vsetvl/avl_single-26.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-39.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-41.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-6.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c: Ditto.

9 months agoRISC-V: Removed misleading comments in testcases
Lehua Ding [Mon, 18 Sep 2023 12:24:26 +0000 (20:24 +0800)]
RISC-V: Removed misleading comments in testcases

This patch removed the misleading comments in testcases since we
support fold min(int, poly) to constant by this patch
(https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629651.html).
Thereby the csrr will not appear inside the assembly code, even if there
is no support for some VLS vector patterns.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/div-1.c: Removed comments.
* gcc.target/riscv/rvv/autovec/vls/shift-3.c: Ditto.

9 months agoAArch64: Improve immediate expansion [PR105928]
Wilco Dijkstra [Wed, 13 Sep 2023 12:21:50 +0000 (13:21 +0100)]
AArch64: Improve immediate expansion [PR105928]

Support immediate expansion of immediates which can be created from 2 MOVKs
and a shifted ORR or BIC instruction.  Change aarch64_split_dimode_const_store
to apply if we save one instruction.

This reduces the number of 4-instruction immediates in SPECINT/FP by 5%.

gcc/ChangeLog:
PR target/105928
* config/aarch64/aarch64.cc (aarch64_internal_mov_immediate)
Add support for immediates using shifted ORR/BIC.
(aarch64_split_dimode_const_store): Apply if we save one instruction.
* config/aarch64/aarch64.md (<LOGICAL:optab>_<SHIFT:optab><mode>3):
Make pattern global.

gcc/testsuite:
PR target/105928
* gcc.target/aarch64/pr105928.c: Add new test.
* gcc.target/aarch64/vect-cse-codegen.c: Fix test.

9 months agoAArch64: List official cores before codenames
Wilco Dijkstra [Wed, 13 Sep 2023 12:16:14 +0000 (13:16 +0100)]
AArch64: List official cores before codenames

List official cores first so that -mcpu=native does not show a codename with
-v or in errors/warnings.

gcc/ChangeLog:
* config/aarch64/aarch64-cores.def (neoverse-n1): Place before ares.
(neoverse-v1): Place before zeus.
(neoverse-v2): Place before demeter.
* config/aarch64/aarch64-tune.md: Regenerate.

9 months agoRISC-V: Add fixed PR111255 testcase by other patch
Lehua Ding [Mon, 18 Sep 2023 12:04:07 +0000 (20:04 +0800)]
RISC-V: Add fixed PR111255 testcase by other patch

This patch add the missed PR111255 testcase which is fixed by this
committed patch (https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628922.html).

PR target/111255

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/pr111255.c: New test.

9 months agoRISC-V: Support VLS reduction
Juzhe-Zhong [Sat, 16 Sep 2023 15:01:30 +0000 (23:01 +0800)]
RISC-V: Support VLS reduction

Notice previous VLS reduction patch is missing some codes which cause multiple ICE:
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-run.c -std=c99 -O3 -ftree-vectorize --param riscv-autovec-preference=fixed-vlmax (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-runu.c -std=c99 -O3 -ftree-vectorize --param riscv-autovec-preference=fixed-vlmax (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls-vlmax/vec_set-run.c -std=c99 -O3 -ftree-vectorize --param riscv-autovec-preference=fixed-vlmax (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-1.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredsum\\.vs 22
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-10.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmax\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-10.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmaxu\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-10.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmin\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-10.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredminu\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-11.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmax\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-11.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmaxu\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-11.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmin\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-11.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredminu\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-12.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredmax\\.vs 10
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-12.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredmin\\.vs 10
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-13.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredmax\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-13.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredmin\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-14.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredmax\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-14.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredmin\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-15.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredand\\.vs 22
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-15.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredor\\.vs 22
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-15.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredxor\\.vs 22
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-16.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredand\\.vs 20
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-16.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredor\\.vs 20
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-16.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredxor\\.vs 20
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-17.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredand\\.vs 18
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-17.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredor\\.vs 18
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-17.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredxor\\.vs 18
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-18.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredand\\.vs 16
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-18.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredor\\.vs 16
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-18.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredxor\\.vs 16
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-19.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-19.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-2.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredsum\\.vs 20
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-20.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-20.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-21.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable (internal compiler error: in code_for_pred, at ./insn-opinit.h:1560)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-21.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable (test for excess errors)
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-3.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredsum\\.vs 18
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-4.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredsum\\.vs 16
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-5.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredusum\\.vs 10
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-6.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredusum\\.vs 9
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-7.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vfredusum\\.vs 8
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-8.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmax\\.vs 11
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-8.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmaxu\\.vs 11
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-8.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmin\\.vs 11
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-8.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredminu\\.vs 11
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-9.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmax\\.vs 10
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-9.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmaxu\\.vs 10
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-9.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredmin\\.vs 10
FAIL: gcc.target/riscv/rvv/autovec/vls/reduc-9.c -O3 -ftree-vectorize --param riscv-autovec-preference=scalable  scan-assembler-times vredminu\\.vs 10

Committed.

gcc/ChangeLog:

* config/riscv/autovec.md: Add VLS modes.
* config/riscv/vector-iterators.md: Ditto.
* config/riscv/vector.md: Ditto.

9 months agolibstdc++: Minor update to installation docs
Jonathan Wakely [Mon, 18 Sep 2023 11:14:15 +0000 (12:14 +0100)]
libstdc++: Minor update to installation docs

libstdc++-v3/ChangeLog:

* doc/xml/manual/intro.xml: Clarify that building libstdc++
separately from GCC is not supported.
* doc/xml/manual/prerequisites.xml: Note msgfmt prerequisite for
testing.
* doc/html/manual/setup.html: Regenerate.

9 months agoRISC-V: Fix VSETVL PASS fusion bug
Juzhe-Zhong [Mon, 18 Sep 2023 11:08:25 +0000 (19:08 +0800)]
RISC-V: Fix VSETVL PASS fusion bug

There is an obvious fusion bug that is exposed by more VLS patterns support.
After more VLS modes support, it cause following FAILs:
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c execution test
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c execution test
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c execution test
FAIL: gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c execution test

Demand 1: SEW = 64, LMUL = 1, RATIO = 64, demand SEW, demand GE_SEW.
Demand 2: SEW = 64, LMUL = 2, RATIO = 32, demand SEW, demand GE_SEW, demand RATIO.

Before this patch:
merge demand: SEW = 64, LMUL = 1, RATIO = 32, demand SEW, demand LMUL, demand GE_SEW.
It's obvious incorrect of merge LMUL which should be new LMUL = (demand 2 RATIO * greatest SEW) = M2

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (vlmul_for_greatest_sew_second_ratio): New function.
* config/riscv/riscv-vsetvl.def (DEF_SEW_LMUL_FUSE_RULE): Fix bug.

9 months agoMAINTAINERS: Add myself to write after approval
Fei Gao [Mon, 18 Sep 2023 09:27:55 +0000 (09:27 +0000)]
MAINTAINERS: Add myself to write after approval

Signed-off-by: Fei Gao <gaofei@eswincomputing.com>
ChangeLog:

* MAINTAINERS: Add myself.

9 months agotree-optimization/111294 - backwards threader PHI costing
Richard Biener [Thu, 14 Sep 2023 11:06:51 +0000 (13:06 +0200)]
tree-optimization/111294 - backwards threader PHI costing

This revives an earlier patch since the problematic code applying
extra costs to PHIs in copied blocks we couldn't make any sense of
prevents a required threading in this case.  Instead of coming up
with an artificial other costing the following simply removes the
bits.

As with all threading changes this requires a plethora of testsuite
adjustments, but only the last three are unfortunate as is the
libgomp team.c adjustment which is required to avoid a bogus -Werror
diagnostic during bootstrap.

PR tree-optimization/111294
gcc/
* tree-ssa-threadbackward.cc (back_threader_profitability::m_name):
Remove
(back_threader::find_paths_to_names): Adjust.
(back_threader::maybe_thread_block): Likewise.
(back_threader_profitability::possibly_profitable_path_p): Remove
code applying extra costs to copies PHIs.

libgomp/
* team.c (gomp_team_start): Assert alloca size to avoid false
positive alloc-size diagnostic.

gcc/testsuite/
* gcc.dg/tree-ssa/pr111294.c: New test.
* gcc.dg/tree-ssa/phi_on_compare-4.c: Adjust.
* gcc.dg/tree-ssa/pr59597.c: Likewise.
* gcc.dg/tree-ssa/pr61839_2.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-18.c: Likewise.
* g++.dg/warn/Wstringop-overflow-4.C: XFAIL subtest on ilp32.
* gcc.dg/uninit-pred-9_b.c: XFAIL subtest everywhere.
* gcc.dg/vect/vect-117.c: Make scan for not Invalid sum
conditional on lp64.

9 months agoRISC-V: Support VLS modes vec_init auto-vectorization
Juzhe-Zhong [Fri, 15 Sep 2023 03:53:08 +0000 (11:53 +0800)]
RISC-V: Support VLS modes vec_init auto-vectorization

There are multiple SLP dump FAILs in vect testsuite.
After analysis, confirm we are missing vec_init for VLS modes.
This patch is not sufficient to fix those FAILs (We need more VLS patterns will send them soon).

This patch is the prerequsite patch for fixing those SLP FAILs.

Finish the whole regression.
Ok for trunk ?

gcc/ChangeLog:

* config/riscv/autovec.md: Extend VLS modes.
* config/riscv/vector.md: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add VLS vec_init tests.
* gcc.target/riscv/rvv/autovec/vls/init-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/init-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/init-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/init-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/init-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/init-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/init-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-8.c: New test.
* gcc.target/riscv/rvv/autovec/vls/repeat-9.c: New test.

9 months agoRISC-V: Remove autovec-vls.md file and clean up VLS move modes[NFC]
Juzhe-Zhong [Mon, 18 Sep 2023 07:07:13 +0000 (15:07 +0800)]
RISC-V: Remove autovec-vls.md file and clean up VLS move modes[NFC]

We have largely supportted VLS modes. Only move patterns of VLS modes are
different from VLS patterns. The rest of them are the same.

We always extend the current VLA patterns with VLSmodes:

VI --> V_VLSI
VF --> V_VLSF

It makes no sense to have a separate file holding a very few VLS patterns
that can not be extended from the current VLA patterns.

So remove autovec-vls.md

gcc/ChangeLog:

* config/riscv/vector.md (mov<mode>): New pattern.
(*mov<mode>_mem_to_mem): Ditto.
(*mov<mode>): Ditto.
(@mov<VLS_AVL_REG:mode><P:mode>_lra): Ditto.
(*mov<VLS_AVL_REG:mode><P:mode>_lra): Ditto.
(*mov<mode>_vls): Ditto.
(movmisalign<mode>): Ditto.
(@vec_duplicate<mode>): Ditto.
* config/riscv/autovec-vls.md: Removed.

9 months agoRISC-V: Support VLS modes reduction[PR111153]
Juzhe-Zhong [Sun, 17 Sep 2023 02:05:49 +0000 (10:05 +0800)]
RISC-V: Support VLS modes reduction[PR111153]

This patch supports VLS reduction vectorization.

It can optimize the current reduction vectorization codegen with current COST model.

TYPE __attribute__ ((noinline, noclone)) \
reduc_plus_##TYPE (TYPE * __restrict a, int n) \
{ \
  TYPE r = 0; \
  for (int i = 0; i < n; ++i) \
    r += a[i]; \
  return r; \
}

  T (int32_t) \

TEST_PLUS (DEF_REDUC_PLUS)

Before this patch:

        vle32.v v2,0(a5)
        addi    a5,a5,16
        vadd.vv v1,v1,v2
        bne     a5,a4,.L4
        lui     a4,%hi(.LC0)
        lui     a5,%hi(.LC1)
        addi    a4,a4,%lo(.LC0)
        vlm.v   v0,0(a4)
        addi    a5,a5,%lo(.LC1)
        andi    a1,a1,-4
        vmv1r.v v2,v3
        vlm.v   v4,0(a5)
        vcompress.vm    v2,v1,v0
        vmv1r.v v0,v4
        vadd.vv v1,v2,v1
        vcompress.vm    v3,v1,v0
        vadd.vv v3,v3,v1
        vmv.x.s a0,v3
        sext.w  a0,a0
        beq     a3,a1,.L12

After this patch:

vle32.v v2,0(a5)
addi a5,a5,16
vadd.vv v1,v1,v2
bne a5,a4,.L4
li a5,0
andi a1,a1,-4
vmv.s.x v2,a5
vredsum.vs v1,v1,v2
vmv.x.s a0,v1
beq a3,a1,.L12

PR target/111153

gcc/ChangeLog:

* config/riscv/autovec.md: Add VLS modes.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add VLS mode reduction case.
* gcc.target/riscv/rvv/autovec/vls/reduc-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-10.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-11.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-12.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-13.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-14.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-15.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-16.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-17.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-18.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-19.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-20.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-21.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-8.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-9.c: New test.

9 months agodoc: GTY((cache)) documentation tweak
Jason Merrill [Fri, 8 Sep 2023 15:27:26 +0000 (11:27 -0400)]
doc: GTY((cache)) documentation tweak

gcc/ChangeLog:

* doc/gty.texi: Add discussion of cache vs. deletable.

9 months agoc++: overlapping subobjects tweak
Jason Merrill [Tue, 12 Sep 2023 16:15:13 +0000 (12:15 -0400)]
c++: overlapping subobjects tweak

The ABI is settling on "similar" for this rule.

gcc/cp/ChangeLog:

* class.cc (check_subobject_offset): Use similar_type_p.

9 months agoRISC-V: Remove redundant codes of VLS patterns[NFC]
Juzhe-Zhong [Mon, 18 Sep 2023 02:51:56 +0000 (10:51 +0800)]
RISC-V: Remove redundant codes of VLS patterns[NFC]

Consider those VLS patterns are the same VLA patterns.
Now extend VI -> V_VLSI and VF -> V_VLSF.
Then remove the redundant codes of VLS patterns.

gcc/ChangeLog:

* config/riscv/autovec-vls.md (<optab><mode>3): Deleted.
(copysign<mode>3): Ditto.
(xorsign<mode>3): Ditto.
(<optab><mode>2): Ditto.
* config/riscv/autovec.md: Extend VLS modes.

9 months agouse local range for one more pattern in match.pd
Jiufu Guo [Wed, 13 Sep 2023 08:12:05 +0000 (16:12 +0800)]
use local range for one more pattern in match.pd

For "get_global_range_query" SSA_NAME_RANGE_INFO can be queried.
For "get_range_query", it could get more context-aware range info.
And look at the implementation of "get_range_query",  it returns
global range if no local fun info.

ATTRIBUTE_RETURNS_NONNULL inline range_query *
get_range_query (const struct function *fun)
{
  return (fun && fun->x_range_query) ? fun->x_range_query : &global_ranges;
}

So, using "get_range_query" would cover more case.
For example, the test case of "pr111303.c".

PR middle-end/111303

gcc/ChangeLog:

* match.pd ((t * 2) / 2): Update pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr111303.c: New test.

9 months agoDaily bump.
GCC Administrator [Mon, 18 Sep 2023 00:17:30 +0000 (00:17 +0000)]
Daily bump.

9 months agoRemove xfail from gcc.dg/tree-ssa/20040204-1.c
Andrew Pinski [Sun, 17 Sep 2023 21:41:01 +0000 (21:41 +0000)]
Remove xfail from gcc.dg/tree-ssa/20040204-1.c

So the xfail was there because at one point the difference
from having logical-op-non-short-circuit set to 1 or 0 made a
difference in being able to optimizing a conditional way.
This has not been true for over 10 years in this case so
instead of keeping on adding to the xfail list, removing it
is the right thing to do.

Committed as obvious after a test on x86_64-linux-gnu.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/20040204-1.c: Remove xfail.

9 months agors6000: unnecessary clear after vctzlsbb in vec_first_match_or_eos_index
Ajit Kumar Agarwal [Sun, 17 Sep 2023 17:27:10 +0000 (12:27 -0500)]
rs6000: unnecessary clear after vctzlsbb in vec_first_match_or_eos_index

For rs6000 target we dont need zero_extend after vctzlsbb as vctzlsbb
already zero extend.

2023-09-17  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>

gcc/ChangeLog:

* config/rs6000/vsx.md (*vctzlsbb_zext_<mode>): New define_insn.

gcc/testsuite/ChangeLog:

* g++.target/powerpc/altivec-19.C: New testcase.

9 months agoDaily bump.
GCC Administrator [Sun, 17 Sep 2023 00:18:33 +0000 (00:18 +0000)]
Daily bump.

9 months agoRISC-V: Expand VLS mode to scalar mode move[PR111391]
Juzhe-Zhong [Thu, 14 Sep 2023 10:49:52 +0000 (18:49 +0800)]
RISC-V: Expand VLS mode to scalar mode move[PR111391]

This patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111391

PR target/111391

gcc/ChangeLog:

* config/riscv/autovec.md (@vec_extract<mode><vel>): Remove @.
(vec_extract<mode><vel>): Ditto.
* config/riscv/riscv-vsetvl.cc (emit_vsetvl_insn): Fix bug.
(pass_vsetvl::local_eliminate_vsetvl_insn): Fix bug.
* config/riscv/riscv.cc (riscv_legitimize_move): Expand VLS mode to scalar mode move.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/partial/slp-9.c: Adapt test.
* gcc.target/riscv/rvv/autovec/pr111391-1.c: New test.
* gcc.target/riscv/rvv/autovec/pr111391-2.c: New test.

9 months agoRISC-V: Make SHA-256, SM3 and SM4 builtins operate on uint32_t
Tsukasa OI [Thu, 7 Sep 2023 07:39:33 +0000 (07:39 +0000)]
RISC-V: Make SHA-256, SM3 and SM4 builtins operate on uint32_t

This is in parity with the LLVM commit a64b3e92c7cb ("[RISCV] Re-define
sha256, Zksed, and Zksh intrinsics to use i32 types.").

SHA-256, SM3 and SM4 instructions operate on 32-bit integers and upper
32-bits have no effects on RV64 (the output is sign-extended from the
original 32-bit value).  In that sense, making those intrinsics only
operate on uint32_t is much more natural than XLEN-bits wide integers.

This commit reforms instructions and expansions based on 32-bit
instruction handling on RV64 (such as ADDW).

Before:
   riscv_<op>_si: For RV32, fully operate on uint32_t
   riscv_<op>_di: For RV64, fully operate on uint64_t
After:
  *riscv_<op>_si: For RV32, fully operate on uint32_t
   riscv_<op>_di_extended:
                  For RV64.  Input is uint32_t and output is int64_t,
                  sign-extended from the int32_t result
                  (represents a part of <op> behavior).
   riscv_<op>_si: Common (fully operate on uint32_t).
                  On RV32, "expands" to *riscv_<op>_si.
                  On RV64, initially expands to riscv_<op>_di_extended *and*
                  extracts lower 32-bits from the int64_t result.

It also refines definitions of SHA-256, SM3 and SM4 intrinsics.

gcc/ChangeLog:

* config/riscv/crypto.md (riscv_sha256sig0_<mode>,
riscv_sha256sig1_<mode>, riscv_sha256sum0_<mode>,
riscv_sha256sum1_<mode>, riscv_sm3p0_<mode>, riscv_sm3p1_<mode>,
riscv_sm4ed_<mode>, riscv_sm4ks_<mode>): Remove and replace with
new insn/expansions.
(SHA256_OP, SM3_OP, SM4_OP): New iterators.
(sha256_op, sm3_op, sm4_op): New attributes for iteration.
(*riscv_<sha256_op>_si): New raw instruction for RV32.
(*riscv_<sm3_op>_si): Ditto.
(*riscv_<sm4_op>_si): Ditto.
(riscv_<sha256_op>_di_extended): New base instruction for RV64.
(riscv_<sm3_op>_di_extended): Ditto.
(riscv_<sm4_op>_di_extended): Ditto.
(riscv_<sha256_op>_si): New common instruction expansion.
(riscv_<sm3_op>_si): Ditto.
(riscv_<sm4_op>_si): Ditto.
* config/riscv/riscv-builtins.cc: Add availability "crypto_zknh",
"crypto_zksh" and "crypto_zksed".  Remove availability
"crypto_zksh{32,64}" and "crypto_zksed{32,64}".
* config/riscv/riscv-ftypes.def: Remove unused function type.
* config/riscv/riscv-scalar-crypto.def: Make SHA-256, SM3 and SM4
intrinsics to operate on uint32_t.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zknh-sha256.c: Moved to...
* gcc.target/riscv/zknh-sha256-64.c: ...here.  Test RV64.
* gcc.target/riscv/zknh-sha256-32.c: New test for RV32.
* gcc.target/riscv/zksh64.c: Change the type.
* gcc.target/riscv/zksed64.c: Ditto.

9 months agoRISC-V: Make bit manipulation value / round number and shift amount types for builtin...
Tsukasa OI [Wed, 6 Sep 2023 06:28:39 +0000 (06:28 +0000)]
RISC-V: Make bit manipulation value / round number and shift amount types for builtins unsigned

For bit manipulation operations, input(s) and the manipulated output are
better to be unsigned like other target-independent builtins like
__builtin_bswap32 and __builtin_popcount.

Although this is not completely compatible as before (as the type changes),
most code will run normally, even without warnings (with -Wall -Wextra).

To make consistent to the LLVM commit 599421ae36c3 ("[RISCV] Use unsigned
instead of signed types for Zk* and Zb* builtins."), round numbers and
shift amount on the scalar crypto instructions are also changed
to unsigned.

gcc/ChangeLog:

* config/riscv/riscv-builtins.cc (RISCV_ATYPE_UQI): New for
uint8_t.  (RISCV_ATYPE_UHI): New for uint16_t.
(RISCV_ATYPE_QI, RISCV_ATYPE_HI, RISCV_ATYPE_SI, RISCV_ATYPE_DI):
Removed as no longer used.
(RISCV_ATYPE_UDI): New for uint64_t.
* config/riscv/riscv-cmo.def: Make types unsigned for not working
"zicbop_cbo_prefetchi" and working bit manipulation clmul builtin
argument/return types.
* config/riscv/riscv-ftypes.def: Make bit manipulation, round
number and shift amount types unsigned.
* config/riscv/riscv-scalar-crypto.def: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zbc32.c: Make signed type to unsigned.
* gcc.target/riscv/zbc64.c: Ditto.
* gcc.target/riscv/zbkb32.c: Ditto.
* gcc.target/riscv/zbkb64.c: Ditto.
* gcc.target/riscv/zbkc32.c: Ditto.
* gcc.target/riscv/zbkc64.c: Ditto.
* gcc.target/riscv/zbkx32.c: Ditto.
* gcc.target/riscv/zbkx64.c: Ditto.
* gcc.target/riscv/zknd32.c: Ditto.
* gcc.target/riscv/zknd64.c: Ditto.
* gcc.target/riscv/zkne32.c: Ditto.
* gcc.target/riscv/zkne64.c: Ditto.
* gcc.target/riscv/zknh-sha256.c: Ditto.
* gcc.target/riscv/zknh-sha512-32.c: Ditto.
* gcc.target/riscv/zknh-sha512-64.c: Ditto.
* gcc.target/riscv/zksed32.c: Ditto.
* gcc.target/riscv/zksed64.c: Ditto.
* gcc.target/riscv/zksh32.c: Ditto.
* gcc.target/riscv/zksh64.c: Ditto.

9 months agoRISC-V: Support FP SGNJX autovec for VLS mode
Pan Li [Fri, 15 Sep 2023 12:57:20 +0000 (20:57 +0800)]
RISC-V: Support FP SGNJX autovec for VLS mode

This patch would like to allow the VLS mode autovec for the
floating-point binary operation SGNJX.

Give sample code as below:

void
test (float * restrict out, float * restrict in1, float * restrict in2)
{
  for (int i = 0; i < 128; i++)
    out[i] = in1[i] * copysignf (1.0, in2[i]);
}

Before this patch:
test:
  li      a5,128
  vsetvli zero,a5,e32,m1,ta,ma
  vle32.v v2,0(a1)
  lui     a4,%hi(.LC0)
  flw     fa5,%lo(.LC0)(a4)
  vfmv.v.f        v1,fa5
  vle32.v v3,0(a2)
  vfsgnj.vv       v1,v1,v3
  vfmul.vv        v1,v1,v2
  vse32.v v1,0(a0)
  ret

After this patch:
test:
  li      a5,128
  vsetvli zero,a5,e32,m1,ta,ma
  vle32.v v1,0(a1)
  vle32.v v2,0(a2)
  vfsgnjx.vv      v1,v1,v2
  vse32.v v1,0(a0)
  ret

This SGNJX autovec acts on function call copysignf/copysignf
in math.h too. And it depends on the option -ffast-math.

gcc/ChangeLog:

* config/riscv/autovec-vls.md (xorsign<mode>3): New pattern.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: New macro.
* gcc.target/riscv/rvv/autovec/vls/floating-point-sgnjx-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/floating-point-sgnjx-2.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
9 months agoDaily bump.
GCC Administrator [Sat, 16 Sep 2023 00:17:55 +0000 (00:17 +0000)]
Daily bump.

9 months agolibstdc++: Do not require effective target pthread for some tests
Jonathan Wakely [Fri, 15 Sep 2023 13:49:36 +0000 (14:49 +0100)]
libstdc++: Do not require effective target pthread for some tests

We can remove { dg-require-effective-target pthread } and allow these
tests non-pthread targets and conditionally adding -pthread only for
pthread targets.

Also remove the { dg-options "-std=gnu++20" } that is no longer needed.

libstdc++-v3/ChangeLog:

* testsuite/29_atomics/atomic_ref/wait_notify.cc: Do not
restrict to pthreads targets.
* testsuite/30_threads/jthread/3.cc: Likewise.
* testsuite/30_threads/semaphore/100806.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire_for.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire_posix.cc: Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from remaining tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from remaining tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/18_support/coroutines/95917.cc: Remove dg-options
-std=gnu++2a.
* testsuite/18_support/coroutines/hash.cc: Likewise.
* testsuite/18_support/coroutines/lwg3460.cc: Likewise.
* testsuite/18_support/destroying_delete.cc: Likewise.
* testsuite/18_support/source_location/1.cc: Likewise.
* testsuite/18_support/source_location/consteval.cc: Likewise.
* testsuite/18_support/source_location/version.cc: Likewise.
* testsuite/19_diagnostics/error_category/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/error_code/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/stacktrace/output.cc: Likewise.
* testsuite/26_numerics/adjacent_difference/lwg2055.cc:
Likewise.
* testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc:
Likewise.
* testsuite/28_regex/iterators/regex_iterator/lwg3719.cc:
Likewise.
* testsuite/28_regex/iterators/regex_token_iterator/lwg3719.cc:
Likewise.
* testsuite/28_regex/sub_match/compare_c++20.cc: Likewise.
* testsuite/experimental/filesystem/iterators/106201.cc:
Likewise.
* testsuite/experimental/scopeguard/exit.cc: Likewise.
* testsuite/experimental/scopeguard/uniqueres.cc: Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 30_threads tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 30_threads tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/30_threads/barrier/1.cc: Remove dg-options
-std=gnu++20.
* testsuite/30_threads/barrier/2.cc: Likewise.
* testsuite/30_threads/barrier/arrive.cc: Likewise.
* testsuite/30_threads/barrier/arrive_and_drop.cc: Likewise.
* testsuite/30_threads/barrier/arrive_and_wait.cc: Likewise.
* testsuite/30_threads/barrier/completion.cc: Likewise.
* testsuite/30_threads/condition_variable/members/clock_neg.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/members/clock_neg.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/1.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
Likewise.
* testsuite/30_threads/future/members/clock_neg.cc: Likewise.
* testsuite/30_threads/headers/stop_token/synopsis.cc: Likewise.
* testsuite/30_threads/headers/thread/types_std_c++20.cc:
Likewise.
* testsuite/30_threads/jthread/1.cc: Likewise.
* testsuite/30_threads/jthread/100612.cc: Likewise.
* testsuite/30_threads/jthread/95989.cc: Likewise.
* testsuite/30_threads/jthread/jthread.cc: Likewise.
* testsuite/30_threads/jthread/version.cc: Likewise.
* testsuite/30_threads/latch/1.cc: Likewise.
* testsuite/30_threads/latch/2.cc: Likewise.
* testsuite/30_threads/latch/3.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc:
Likewise.
* testsuite/30_threads/semaphore/1.cc: Likewise.
* testsuite/30_threads/semaphore/2.cc: Likewise.
* testsuite/30_threads/semaphore/least_max_value_neg.cc:
Likewise.
* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
* testsuite/30_threads/shared_future/members/clock_neg.cc:
Likewise.
* testsuite/30_threads/shared_lock/locking/clock_neg.cc:
Likewise.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc:
Likewise.
* testsuite/30_threads/stop_token/1.cc: Likewise.
* testsuite/30_threads/stop_token/2.cc: Likewise.
* testsuite/30_threads/stop_token/stop_callback.cc: Likewise.
* testsuite/30_threads/stop_token/stop_callback/deadlock.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/invoke.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_source.cc: Likewise.
* testsuite/30_threads/stop_token/stop_source/assign.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_token.cc: Likewise.
* testsuite/30_threads/stop_token/stop_token/stop_possible.cc:
Likewise.
* testsuite/30_threads/thread/id/operators_c++20.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc:
Likewise.
* testsuite/30_threads/unique_lock/locking/clock_neg.cc:
Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 27_io tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 27_io tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_istream/extractors_character/char/lwg2499.cc:
Remove dg-options -std=gnu++2a.
* testsuite/27_io/basic_istream/extractors_character/char/lwg2499_neg.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499_neg.cc:
Likewise.
* testsuite/27_io/basic_istringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_istringstream/str/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/str/wchar_t/2.cc:
Likewise.
* testsuite/27_io/basic_istringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_ostream/emit/1.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_character/char/deleted.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/deleted.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/str/char/3.cc: Likewise.
* testsuite/27_io/basic_ostringstream/str/wchar_t/3.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/str/char/4.cc: Likewise.
* testsuite/27_io/basic_stringbuf/str/wchar_t/4.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/97719.cc:
Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_stringstream/str/char/5.cc: Likewise.
* testsuite/27_io/basic_stringstream/str/wchar_t/5.cc.cc:
Likewise.
* testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_syncbuf/1.cc: Likewise.
* testsuite/27_io/basic_syncbuf/2.cc: Likewise.
* testsuite/27_io/basic_syncbuf/basic_ops/1.cc: Likewise.
* testsuite/27_io/basic_syncbuf/requirements/types.cc: Likewise.
* testsuite/27_io/basic_syncbuf/sync_ops/1.cc: Likewise.
* testsuite/27_io/basic_syncstream/1.cc: Likewise.
* testsuite/27_io/basic_syncstream/2.cc: Likewise.
* testsuite/27_io/basic_syncstream/basic_ops/1.cc: Likewise.
* testsuite/27_io/basic_syncstream/requirements/types.cc:
Likewise.
* testsuite/27_io/filesystem/iterators/106201.cc: Likewise.
* testsuite/27_io/filesystem/iterators/lwg3719.cc: Likewise.
* testsuite/27_io/filesystem/path/factory/u8path-depr.cc:
Likewise.
* testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc:
Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 26_numerics tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 26_numerics tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/accumulate/constexpr.cc: Remove
dg-options -std=gnu++2a.
* testsuite/26_numerics/accumulate/lwg2055.cc: Likewise.
* testsuite/26_numerics/adjacent_difference/constexpr.cc:
Likewise.
* testsuite/26_numerics/bit/bit.cast/105027.cc: Likewise.
* testsuite/26_numerics/bit/bit.cast/bit_cast.cc: Likewise.
* testsuite/26_numerics/bit/bit.cast/version.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countl_one.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc:
Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/lwg3656.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotr.cc: Likewise.
* testsuite/26_numerics/bit/header-2.cc: Likewise.
* testsuite/26_numerics/bit/header.cc: Likewise.
* testsuite/26_numerics/complex/1.cc: Likewise.
* testsuite/26_numerics/complex/2.cc: Likewise.
* testsuite/26_numerics/complex/comparison_operators/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/complex/operators/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/complex/requirements/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/complex/value_operations/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/endian/1.cc: Likewise.
* testsuite/26_numerics/endian/2.cc: Likewise.
* testsuite/26_numerics/endian/3.cc: Likewise.
* testsuite/26_numerics/exclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/inclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/inner_product/constexpr.cc: Likewise.
* testsuite/26_numerics/inner_product/lwg2055.cc: Likewise.
* testsuite/26_numerics/iota/constexpr.cc: Likewise.
* testsuite/26_numerics/lerp/1.cc: Likewise.
* testsuite/26_numerics/lerp/constexpr.cc: Likewise.
* testsuite/26_numerics/lerp/version.cc: Likewise.
* testsuite/26_numerics/midpoint/floating.cc: Likewise.
* testsuite/26_numerics/midpoint/integral.cc: Likewise.
* testsuite/26_numerics/midpoint/pointer.cc: Likewise.
* testsuite/26_numerics/midpoint/pointer_neg.cc: Likewise.
* testsuite/26_numerics/midpoint/version.cc: Likewise.
* testsuite/26_numerics/numbers/1.cc: Likewise.
* testsuite/26_numerics/numbers/2.cc: Likewise.
* testsuite/26_numerics/numbers/3.cc: Likewise.
* testsuite/26_numerics/numbers/float128.cc: Likewise.
* testsuite/26_numerics/numbers/nonfloat_neg.cc: Likewise.
* testsuite/26_numerics/partial_sum/constexpr.cc: Likewise.
* testsuite/26_numerics/partial_sum/lwg2055.cc: Likewise.
* testsuite/26_numerics/random/concept.cc: Likewise.
* testsuite/26_numerics/reduce/constexpr.cc: Likewise.
* testsuite/26_numerics/slice/compare.cc: Likewise.
* testsuite/26_numerics/transform_exclusive_scan/constexpr.cc:
Likewise.
* testsuite/26_numerics/transform_inclusive_scan/constexpr.cc:
Likewise.
* testsuite/26_numerics/transform_reduce/constexpr.cc: Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 24_iterators tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 24_iterators tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/24_iterators/aliases.cc: Remove dg-options
-std=gnu++2a.
* testsuite/24_iterators/associated_types/incrementable.traits.cc:
Likewise.
* testsuite/24_iterators/associated_types/iterator.traits.cc:
Likewise.
* testsuite/24_iterators/associated_types/readable.traits.cc:
Likewise.
* testsuite/24_iterators/back_insert_iterator/constexpr.cc:
Likewise.
* testsuite/24_iterators/back_insert_iterator/pr93884.cc:
Likewise.
* testsuite/24_iterators/bidirectional/concept.cc: Likewise.
* testsuite/24_iterators/common_iterator/1.cc: Likewise.
* testsuite/24_iterators/common_iterator/100823.cc: Likewise.
* testsuite/24_iterators/common_iterator/2.cc: Likewise.
* testsuite/24_iterators/contiguous/concept.cc: Likewise.
* testsuite/24_iterators/contiguous/tag.cc: Likewise.
* testsuite/24_iterators/counted_iterator/1.cc: Likewise.
* testsuite/24_iterators/counted_iterator/lwg3389.cc: Likewise.
* testsuite/24_iterators/counted_iterator/lwg3643.cc: Likewise.
* testsuite/24_iterators/customization_points/92894.cc:
Likewise.
* testsuite/24_iterators/customization_points/iter_move.cc:
Likewise.
* testsuite/24_iterators/customization_points/iter_swap.cc:
Likewise.
* testsuite/24_iterators/customization_points/lwg3420.cc:
Likewise.
* testsuite/24_iterators/forward/concept.cc: Likewise.
* testsuite/24_iterators/front_insert_iterator/constexpr.cc:
Likewise.
* testsuite/24_iterators/front_insert_iterator/pr93884.cc:
Likewise.
* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
Likewise.
* testsuite/24_iterators/indirect_callable/92894.cc: Likewise.
* testsuite/24_iterators/indirect_callable/projected-adl.cc:
Likewise.
* testsuite/24_iterators/indirect_callable/projected.cc:
Likewise.
* testsuite/24_iterators/input/concept.cc: Likewise.
* testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.
* testsuite/24_iterators/istream_iterator/cons/sentinel.cc:
Likewise.
* testsuite/24_iterators/istream_iterator/sentinel.cc: Likewise.
* testsuite/24_iterators/istreambuf_iterator/cons/sentinel.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/sentinel.cc:
Likewise.
* testsuite/24_iterators/move_iterator/cust.cc: Likewise.
* testsuite/24_iterators/move_iterator/dr3435.cc: Likewise.
* testsuite/24_iterators/move_iterator/input_iterator.cc:
Likewise.
* testsuite/24_iterators/move_iterator/lwg3390.cc: Likewise.
* testsuite/24_iterators/move_iterator/lwg3391.cc: Likewise.
* testsuite/24_iterators/move_iterator/move_only.cc: Likewise.
* testsuite/24_iterators/move_iterator/p2520r0.cc: Likewise.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc:
Likewise.
* testsuite/24_iterators/move_iterator/sentinel.cc: Likewise.
* testsuite/24_iterators/normal_iterator/cmp_c++20.cc: Likewise.
* testsuite/24_iterators/output/concept.cc: Likewise.
* testsuite/24_iterators/random_access/concept.cc: Likewise.
* testsuite/24_iterators/range_access/range_access_cpp20.cc:
Likewise.
* testsuite/24_iterators/range_access/range_access_cpp20_neg.cc:
Likewise.
* testsuite/24_iterators/range_operations/100768.cc: Likewise.
* testsuite/24_iterators/range_operations/advance.cc: Likewise.
* testsuite/24_iterators/range_operations/advance_overflow.cc:
Likewise.
* testsuite/24_iterators/range_operations/distance.cc: Likewise.
* testsuite/24_iterators/range_operations/lwg3392.cc: Likewise.
* testsuite/24_iterators/range_operations/next.cc: Likewise.
* testsuite/24_iterators/range_operations/prev.cc: Likewise.
* testsuite/24_iterators/reverse_iterator/cust.cc: Likewise.
* testsuite/24_iterators/reverse_iterator/dr3435.cc: Likewise.
* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc:
Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 23_containers tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 23_containers tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/array/comparison_operators/96851.cc:
Remove dg-options -std=gnu++2a.
* testsuite/23_containers/array/comparison_operators/constexpr.cc:
Likewise.
* testsuite/23_containers/array/creation/1.cc: Likewise.
* testsuite/23_containers/array/creation/110167.cc: Likewise.
* testsuite/23_containers/array/creation/2.cc: Likewise.
* testsuite/23_containers/array/creation/3_neg.cc: Likewise.
* testsuite/23_containers/array/requirements/constexpr_fill.cc:
Likewise.
* testsuite/23_containers/array/requirements/constexpr_swap.cc:
Likewise.
* testsuite/23_containers/deque/48101-3_neg.cc: Likewise.
* testsuite/23_containers/deque/erasure.cc: Likewise.
* testsuite/23_containers/deque/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/deque/operators/cmp_c++20.cc:
Likewise.
* testsuite/23_containers/forward_list/48101-3_neg.cc: Likewise.
* testsuite/23_containers/forward_list/cmp_c++20.cc: Likewise.
* testsuite/23_containers/forward_list/erasure.cc: Likewise.
* testsuite/23_containers/forward_list/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/remove_cxx20_return.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/unique_cxx20_return.cc:
Likewise.
* testsuite/23_containers/list/48101-3_neg.cc: Likewise.
* testsuite/23_containers/list/cmp_c++20.cc: Likewise.
* testsuite/23_containers/list/erasure.cc: Likewise.
* testsuite/23_containers/list/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/list/operations/remove_cxx20_return.cc:
Likewise.
* testsuite/23_containers/list/operations/unique_cxx20_return.cc:
Likewise.
* testsuite/23_containers/map/48101-3_neg.cc: Likewise.
* testsuite/23_containers/map/erasure.cc: Likewise.
* testsuite/23_containers/map/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/map/operations/contains.cc: Likewise.
* testsuite/23_containers/map/operators/cmp_c++20.cc: Likewise.
* testsuite/23_containers/multimap/48101-3_neg.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multimap/operations/contains.cc:
Likewise.
* testsuite/23_containers/multimap/operators/cmp_c++20.cc:
Likewise.
* testsuite/23_containers/multiset/48101-3_neg.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multiset/operations/contains.cc:
Likewise.
* testsuite/23_containers/multiset/operators/cmp_c++20.cc:
Likewise.
* testsuite/23_containers/priority_queue/92878_92947.cc:
Likewise.
* testsuite/23_containers/queue/92878_92947.cc: Likewise.
* testsuite/23_containers/queue/cmp_c++20.cc: Likewise.
* testsuite/23_containers/set/48101-3_neg.cc: Likewise.
* testsuite/23_containers/set/erasure.cc: Likewise.
* testsuite/23_containers/set/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/set/operations/contains.cc: Likewise.
* testsuite/23_containers/set/operators/cmp_c++20.cc: Likewise.
* testsuite/23_containers/span/1.cc: Likewise.
* testsuite/23_containers/span/101411.cc: Likewise.
* testsuite/23_containers/span/2.cc: Likewise.
* testsuite/23_containers/span/deduction.cc: Likewise.
* testsuite/23_containers/span/explicit.cc: Likewise.
* testsuite/23_containers/span/layout_compat.cc: Likewise.
* testsuite/23_containers/span/lwg3255.cc: Likewise.
* testsuite/23_containers/span/nothrow_cons.cc: Likewise.
* testsuite/23_containers/span/trivially_copyable.cc: Likewise.
* testsuite/23_containers/stack/92878_92947.cc: Likewise.
* testsuite/23_containers/stack/cmp_c++20.cc: Likewise.
* testsuite/23_containers/unordered_map/48101-3_neg.cc:
Likewise.
* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
* testsuite/23_containers/unordered_map/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_map/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_map/operations/contains.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/48101-3_neg.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/operations/contains.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/48101-3_neg.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/operations/contains.cc:
Likewise.
* testsuite/23_containers/unordered_set/48101-3_neg.cc:
Likewise.
* testsuite/23_containers/unordered_set/erasure.cc: Likewise.
* testsuite/23_containers/unordered_set/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_set/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_set/operations/contains.cc:
Likewise.
* testsuite/23_containers/vector/48101-3_neg.cc: Likewise.
* testsuite/23_containers/vector/bool/capacity/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/bool/cmp_c++20.cc: Likewise.
* testsuite/23_containers/vector/bool/cons/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/bool/element_access/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/bool/iterator_c++20.cc:
Likewise.
* testsuite/23_containers/vector/bool/modifiers/assign/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/bool/modifiers/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/bool/modifiers/swap/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/capacity/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/cmp_c++20.cc: Likewise.
* testsuite/23_containers/vector/cons/constexpr.cc: Likewise.
* testsuite/23_containers/vector/data_access/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/element_access/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/erasure.cc: Likewise.
* testsuite/23_containers/vector/modifiers/assign/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/swap/constexpr.cc:
Likewise.
* testsuite/23_containers/vector/requirements/version.cc:
Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 21_strings tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 21_strings tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string/cons/char/105995.cc: Remove
dg-options -std=gnu++20.
* testsuite/21_strings/basic_string/cons/char/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/cons/wchar_t/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/erasure.cc: Likewise.
* testsuite/21_strings/basic_string/hash/hash_char8_t.cc:
Likewise.
* testsuite/21_strings/basic_string/literals/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/swap/constexpr-wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/swap/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/ends_with/char.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/ends_with/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/ends_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/starts_with/char.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/starts_with/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/starts_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string/operators/char/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string/operators/wchar_t/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string_view/cons/char/range.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/ends_with/char.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/ends_with/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/ends_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/starts_with/char.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/starts_with/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/starts_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operators/char/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operators/wchar_t/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
Likewise.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from 20_utils tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from 20_utils tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/20_util/allocator/105975.cc: Remove dg-options
-std=gnu++2a.
* testsuite/20_util/allocator/rebind_c++20.cc: Likewise.
* testsuite/20_util/allocator/requirements/constexpr.cc:
Likewise.
* testsuite/20_util/allocator/requirements/typedefs_c++20.cc:
Likewise.
* testsuite/20_util/allocator_traits/header-2.cc: Likewise.
* testsuite/20_util/allocator_traits/header.cc: Likewise.
* testsuite/20_util/allocator_traits/members/92878_92947.cc:
Likewise.
* testsuite/20_util/any/assign/92878_92947.cc: Likewise.
* testsuite/20_util/any/cons/92878_92947.cc: Likewise.
* testsuite/20_util/assume_aligned/1.cc: Likewise.
* testsuite/20_util/assume_aligned/2_neg.cc: Likewise.
* testsuite/20_util/assume_aligned/3.cc: Likewise.
* testsuite/20_util/assume_aligned/97132.cc: Likewise.
* testsuite/20_util/bind/constexpr.cc: Likewise.
* testsuite/20_util/bitset/operations/96303.cc: Likewise.
* testsuite/20_util/common_reference/100894.cc: Likewise.
* testsuite/20_util/common_reference/requirements/alias_decl.cc:
Likewise.
* testsuite/20_util/common_reference/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/common_reference/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/duration/comparison_operators/three_way.cc:
Likewise.
* testsuite/20_util/exchange/constexpr.cc: Likewise.
* testsuite/20_util/exchange/noexcept.cc: Likewise.
* testsuite/20_util/from_chars/1_c++20_neg.cc: Likewise.
* testsuite/20_util/from_chars/compare.cc: Likewise.
* testsuite/20_util/function_objects/bind_front/1.cc: Likewise.
* testsuite/20_util/function_objects/bind_front/107784.cc:
Likewise.
* testsuite/20_util/function_objects/bind_front/111327.cc:
Likewise.
* testsuite/20_util/function_objects/bind_front/2.cc: Likewise.
* testsuite/20_util/function_objects/bind_front/97101.cc:
Likewise.
* testsuite/20_util/function_objects/bind_front/constexpr.cc:
Likewise.
* testsuite/20_util/function_objects/constexpr_searcher.cc:
Likewise.
* testsuite/20_util/function_objects/identity/1.cc: Likewise.
* testsuite/20_util/function_objects/invoke/constexpr.cc:
Likewise.
* testsuite/20_util/function_objects/mem_fn/constexpr.cc:
Likewise.
* testsuite/20_util/function_objects/not_fn/constexpr.cc:
Likewise.
* testsuite/20_util/integer_comparisons/1.cc: Likewise.
* testsuite/20_util/integer_comparisons/2.cc: Likewise.
* testsuite/20_util/integer_comparisons/equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/equal_neg.cc: Likewise.
* testsuite/20_util/integer_comparisons/greater.cc: Likewise.
* testsuite/20_util/integer_comparisons/greater_equal.cc:
Likewise.
* testsuite/20_util/integer_comparisons/greater_equal_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/greater_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/in_range.cc: Likewise.
* testsuite/20_util/integer_comparisons/in_range_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/less.cc: Likewise.
* testsuite/20_util/integer_comparisons/less_equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/less_equal_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/less_neg.cc: Likewise.
* testsuite/20_util/integer_comparisons/not_equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/not_equal_neg.cc:
Likewise.
* testsuite/20_util/is_bounded_array/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_bounded_array/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_bounded_array/value.cc: Likewise.
* testsuite/20_util/is_constant_evaluated/1.cc: Likewise.
* testsuite/20_util/is_constant_evaluated/noexcept.cc: Likewise.
* testsuite/20_util/is_constructible/92878_92947.cc: Likewise.
* testsuite/20_util/is_layout_compatible/is_corresponding_member.cc:
Likewise.
* testsuite/20_util/is_layout_compatible/value.cc: Likewise.
* testsuite/20_util/is_layout_compatible/version.cc: Likewise.
* testsuite/20_util/is_nothrow_constructible/value_c++20.cc:
Likewise.
* testsuite/20_util/is_nothrow_convertible/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_nothrow_convertible/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_nothrow_convertible/value.cc: Likewise.
* testsuite/20_util/is_pod/deprecated-2a.cc: Likewise.
* testsuite/20_util/is_pointer_interconvertible/value.cc:
Likewise.
* testsuite/20_util/is_pointer_interconvertible/version.cc:
Likewise.
* testsuite/20_util/is_pointer_interconvertible/with_class.cc:
Likewise.
* testsuite/20_util/is_unbounded_array/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_unbounded_array/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_unbounded_array/value.cc: Likewise.
* testsuite/20_util/optional/assignment/92878_92947.cc:
Likewise.
* testsuite/20_util/optional/cons/92878_92947.cc: Likewise.
* testsuite/20_util/optional/constexpr/assign.cc: Likewise.
* testsuite/20_util/optional/constexpr/cons/conv.cc: Likewise.
* testsuite/20_util/optional/constexpr/modifiers.cc: Likewise.
* testsuite/20_util/optional/constexpr/swap.cc: Likewise.
* testsuite/20_util/optional/relops/96269.cc: Likewise.
* testsuite/20_util/optional/relops/three_way.cc: Likewise.
* testsuite/20_util/pair/comparison_operators/constexpr_c++20.cc:
Likewise.
* testsuite/20_util/pair/cons/92878_92947.cc: Likewise.
* testsuite/20_util/pair/constexpr_assign.cc: Likewise.
* testsuite/20_util/pair/constexpr_swap.cc: Likewise.
* testsuite/20_util/pair/requirements/structural.cc: Likewise.
* testsuite/20_util/pointer_traits/pointer_to_constexpr.cc:
Likewise.
* testsuite/20_util/polymorphic_allocator/allocate_object.cc:
Likewise.
* testsuite/20_util/polymorphic_allocator/construct_c++2a.cc:
Likewise.
* testsuite/20_util/polymorphic_allocator/lwg3237.cc: Likewise.
* testsuite/20_util/reference_wrapper/constexpr.cc: Likewise.
* testsuite/20_util/reference_wrapper/incomplete.cc: Likewise.
* testsuite/20_util/remove_cvref/requirements/alias_decl.cc:
Likewise.
* testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/remove_cvref/value.cc: Likewise.
* testsuite/20_util/scoped_allocator/construct_pair_c++2a.cc:
Likewise.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
Likewise.
* testsuite/20_util/shared_ptr/casts/rval.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/alias-rval.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/92878_92947.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/array.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/overwrite.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/version.cc: Likewise.
* testsuite/20_util/time_point/4.cc: Likewise.
* testsuite/20_util/time_point/comparison_operators/three_way.cc:
Likewise.
* testsuite/20_util/to_address/1.cc: Likewise.
* testsuite/20_util/to_address/1_neg.cc: Likewise.
* testsuite/20_util/to_address/debug.cc: Likewise.
* testsuite/20_util/to_address/lwg3545.cc: Likewise.
* testsuite/20_util/to_chars/compare.cc: Likewise.
* testsuite/20_util/tuple/comparison_operators/three_way.cc:
Likewise.
* testsuite/20_util/tuple/cons/102270.cc: Likewise.
* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc:
Likewise.
* testsuite/20_util/tuple/constexpr_swap.cc: Likewise.
* testsuite/20_util/type_identity/requirements/alias_decl.cc:
Likewise.
* testsuite/20_util/type_identity/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/type_identity/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/typeindex/comparison_operators_c++20.cc:
Likewise.
* testsuite/20_util/unique_ptr/comparison/compare_c++20.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/92878_92947.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/for_overwrite.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/for_overwrite__neg.cc:
Likewise.
* testsuite/20_util/unique_ptr/io/lwg2948.cc: Likewise.
* testsuite/20_util/unwrap_reference/1.cc: Likewise.
* testsuite/20_util/unwrap_reference/2.cc: Likewise.
* testsuite/20_util/unwrap_reference/3.cc: Likewise.
* testsuite/20_util/uses_allocator/92878_92947.cc: Likewise.
* testsuite/20_util/uses_allocator/lwg3527.cc: Likewise.
* testsuite/20_util/uses_allocator/make_obj.cc: Likewise.
* testsuite/20_util/uses_allocator/uninitialized_construct.cc:
Likewise.
* testsuite/20_util/variant/92878_92947.cc: Likewise.
* testsuite/20_util/variant/95915.cc: Likewise.
* testsuite/20_util/variant/constexpr.cc: Likewise.
* testsuite/20_util/variant/relops/three_way.cc: Likewise.
* testsuite/20_util/variant/visit_neg.cc: Likewise.
* testsuite/20_util/variant/visit_r.cc: Likewise.
* testsuite/20_util/weak_ptr/atomic_weak_ptr.cc: Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from <compare> tests
Jonathan Wakely [Fri, 15 Sep 2023 13:05:07 +0000 (14:05 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from <compare> tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/18_support/comparisons/algorithms/fallback.cc:
Remove dg-options -std=gnu++2a.
* testsuite/18_support/comparisons/algorithms/partial_order.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/strong_order.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/strong_order_floats.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/weak_order.cc:
Likewise.
* testsuite/18_support/comparisons/categories/94565.cc:
Likewise.
* testsuite/18_support/comparisons/categories/partialord.cc:
Likewise.
* testsuite/18_support/comparisons/categories/strongord.cc:
Likewise.
* testsuite/18_support/comparisons/categories/weakord.cc:
Likewise.
* testsuite/18_support/comparisons/categories/zero_neg.cc:
Likewise.
* testsuite/18_support/comparisons/common/1.cc: Likewise.
* testsuite/18_support/comparisons/object/93479.cc: Likewise.
* testsuite/18_support/comparisons/object/lwg3530.cc: Likewise.

9 months agolibstdc++: Remove dg-options "-std=gnu++20" from <atomic> tests
Jonathan Wakely [Fri, 15 Sep 2023 13:27:56 +0000 (14:27 +0100)]
libstdc++: Remove dg-options "-std=gnu++20" from <atomic> tests

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/29_atomics/atomic/compare_exchange_padding.cc:
Remove dg-options -std=gnu++2a.
* testsuite/29_atomics/atomic/cons/value_init.cc: Likewise.
* testsuite/29_atomics/atomic/lock_free_aliases.cc: Likewise.
* testsuite/29_atomics/atomic/requirements/types_neg.cc:
Likewise.
* testsuite/29_atomics/atomic/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/100334.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/102994.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/bool.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
* testsuite/29_atomics/atomic_flag/cons/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_flag/test/explicit.cc: Likewise.
* testsuite/29_atomics/atomic_flag/test/implicit.cc: Likewise.
* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic_float/1.cc: Likewise.
* testsuite/29_atomics/atomic_float/95282.cc: Likewise.
* testsuite/29_atomics/atomic_float/requirements.cc: Likewise.
* testsuite/29_atomics/atomic_float/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_integral/cons/value_init.cc:
Likewise.
* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc:
Likewise.
* testsuite/29_atomics/atomic_ref/deduction.cc: Likewise.
* testsuite/29_atomics/atomic_ref/float.cc: Likewise.
* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
* testsuite/29_atomics/atomic_ref/requirements.cc: Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++20.cc:
Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc:
Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++2a.cc:
Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc:
Likewise.

9 months agolibstdc++: Add missing tests for std::basic_filebuf::native_handle()
Jonathan Wakely [Fri, 15 Sep 2023 23:09:53 +0000 (00:09 +0100)]
libstdc++: Add missing tests for std::basic_filebuf::native_handle()

I forgot to 'git add' these files in the commit that added the new
member function to basic_filebuf.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_filebuf/native_handle/wchar_t/1.cc: New test.

9 months agolibstdc++: Implement C++26 native handles for file streams (P1759R6)
Jonathan Wakely [Fri, 15 Sep 2023 12:43:43 +0000 (13:43 +0100)]
libstdc++: Implement C++26 native handles for file streams (P1759R6)

The new __basic_file::native_handle() function can be added for C++11
and above, because the names "native_handle" and "native_handle_type"
are already reserved since C++11. Exporting those symbols from the
shared library does no harm, even if the feature gets dropped before the
C++23 standard is final.

The new member functions of std::fstream etc. are only declared for
C++26 and so are not instantiated in src/c++11/fstream-inst.cc. Declare
them with the always_inline attribute so that no symbol definitions are
needed in the library (we can change this later when C++26 support is
less experimental).

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CHECK_FILEBUF_NATIVE_HANDLES): New
macro.
* config.h.in: Regenerate.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.32): Export new
basic_filebuf members.
* config/io/basic_file_stdio.cc (__basic_file::native_handle):
Define new function.
* config/io/basic_file_stdio.h (__basic_file::native_handle):
Declare new function.
* configure: Regenerate.
* configure.ac: Use GLIBCXX_CHECK_FILEBUF_NATIVE_HANDLES.
* include/bits/version.def (fstream_native_handles): New macro.
* include/bits/version.h: Regenerate.
* include/std/fstream (basic_filebuf::native_handle)
(basic_fstream::native_handle, basic_ifstream::native_handle)
(basic_ofstream::native_handle): New functions.
* src/c++11/Makefile.am: Move compilation of basic_file.cc,
locale_init.cc and localename.cc to here.
* src/c++11/Makefile.in: Regenerate.
* src/c++98/locale_init.cc: Moved to...
* src/c++11/locale_init.cc: ...here.
* src/c++98/localename.cc: Moved to...
* src/c++11/localename.cc: ...here.
* src/c++98/Makefile.am: Remove basic_file.cc, locale_init.cc
and localename.cc from here.
* src/c++98/Makefile.in: Regenerate.
* testsuite/27_io/basic_filebuf/native_handle/version.cc: New test.
* testsuite/27_io/basic_fstream/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_fstream/native_handle/wchar_t/1.cc: New test.
* testsuite/27_io/basic_ifstream/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_ifstream/native_handle/wchar_t/1.cc: New test.
* testsuite/27_io/basic_ofstream/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_ofstream/native_handle/wchar_t/1.cc: New test.

9 months agolibstdc++: Add log line to testsuite output
Jonathan Wakely [Thu, 14 Sep 2023 12:57:05 +0000 (13:57 +0100)]
libstdc++: Add log line to testsuite output

Write a line to the log when using a testsuite_files file.

libstdc++-v3/ChangeLog:

* testsuite/libstdc++-dg/conformance.exp: Add log line when
using testsuite_files.

9 months agolibstdc++: Simplify dejagnu directives for some tests using threads
Jonathan Wakely [Thu, 7 Sep 2023 12:56:15 +0000 (13:56 +0100)]
libstdc++: Simplify dejagnu directives for some tests using threads

Replace dg-require-effective-target directives with a target selector on
the dg-do directive.

We can also remove { dg-require-effective-target pthread } and the
associated { dg-options "-pthread" } by allowing it to run on
non-pthread targets and conditionally adding -pthread only for pthread
targets.

libstdc++-v3/ChangeLog:

* testsuite/20_util/shared_ptr/atomic/3.cc: Simplify dg
directives.
* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
Likewise.
* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/allocate.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/allocate_single.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/cons.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/cons_single.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/is_equal.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/multithreaded.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/options.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/release.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/release_single.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
Likewise.

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