Commit Graph

194050 Commits

Author SHA1 Message Date
Dimitar Dimitrov 5745301983 testsuite: Add new target check for no_alignment_constraints
A few testcases were marked for avr target, which has no alignment
requirements.  But those tests in fact should filter for any
target having __BIGGEST_ALIGNMENT__=1.

A new effective target check is introduced: no_alignment_constraints.
It checks whether __BIGGEST_ALIGNMENT__ is declared as 1.

This change fixes the testsuite cases for PRU target.

It was regression-tested on x86_64-pc-linux-gnu.

The following two existing macros were considered, but they check for
subtly different target behaviour:
 1. non_strict_align
    If true, non-aligned access is permitted. But it also allows
    variables to be naturally aligned, which is not true for
    no_alignment_constraints.

 2. default_packed
    Whether structures are packed by default is not necessarily
    the same as lacking constraints for non-aggregate types.
    For example, BIGGEST_FIELD_ALIGNMENT or ADJUST_FIELD_ALIGN
    could be defined for a target as something other than
    BIGGEST_ALIGNMENT.

gcc/ChangeLog:

	* doc/sourcebuild.texi: Document new no_alignment_constraints
	effective target check.

gcc/testsuite/ChangeLog:

	* c-c++-common/Wcast-align.c: Silence warnings for targets with
	no_alignment_constraints.
	* gcc.dg/c11-align-4.c: Skip for no_alignment_constraints.
	* gcc.dg/strlenopt-10.c: Replace checks for avr with checks for
	any target with no_alignment_constraints.
	* gcc.dg/strlenopt-11.c: Ditto.
	* gcc.dg/strlenopt-13.c: Ditto.
	* lib/target-supports.exp
	(check_effective_target_no_alignment_constraints): New.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-06-28 18:45:40 +03:00
Aldy Hernandez 243b539610 Remove legacy EVRP code.
With DOM converted to ranger, there are no longer any uses of the EVRP
engine.  For that matter, we haven't used the legacy mode in quite a
while, so I think it's safe to remove any associated code.

There are some methods in vr_values which should now be private, but I
didn't bother changing them, as most of the vr_values class will be
removed when VRP1 is converted to ranger.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* Makefile.in: Remove gimple-ssa-evrp.o and gimple-ssa-evrp-analyze.o.
	* flag-types.h (enum evrp_mode): Remove.
	* params.opt: Remove --param=evrp-mode.
	* tree-vrp.cc (make_pass_early_vrp): New.
	(pass_vrp::execute): Call early VRP instance.
	* gimple-ssa-evrp-analyze.cc: Removed.
	* gimple-ssa-evrp-analyze.h: Removed.
	* gimple-ssa-evrp.cc: Removed.

gcc/testsuite/ChangeLog:

	* g++.dg/pr100774.C: Remove --param=evrp-mode.
	* gcc.dg/pr100781.c: Same.
2022-06-28 14:43:01 +02:00
Alexandre Oliva eabd44a025 Add TFLAGS to gcc's GCC_FOR_TARGET
When the GCC build runs GCC_FOR_TARGET, e.g. for selftests or for
dumping specs, it doesn't use TFLAGS in non-bootstrap scenarios.  This
patch arranges for TFLAGS to be passed from the top level down to gcc
in GCC_FOR_TARGET in this case.

Another issue related with TFLAGS fixed herein is that there's no easy
way to add a TFLAGS to GCC_FOR_TARGET when running "make gnatlib"
within the gcc directory.  Overriding all of GCC_FOR_TARGET is
somewhat cumbersome, so I'm adding TFLAGS support to gcc/Makefile.in,
getting it added to GCC_FOR_TARGET, as it would when passed down from
the top level.


for  ChangeLog

	* Makefile.tpl (HOST_EXPORTS): Add TFLAGS to GCC_FOR_TARGET.
	(EXTRA_GCC_FLAGS): Likewise.
	* Makefile.in: Rebuilt.

for  gcc/ChangeLog

	* Makefile.in (TFLAGS): New.
	(GCC_FOR_TARGET): Add TFLAGS.
	(FLAGS_TO_PASS): Pass TFLAGS down.
2022-06-28 09:41:07 -03:00
Jonathan Wakely bb1f266a7d libstdc++: Fix filesystem build for Windows
I only half remembered to use char_type instead of char for filesystem
paths, so that it works with wchar_t on Windows. This fixes the
bootstrap failure.

libstdc++-v3/ChangeLog:

	* src/filesystem/dir-common.h (_Dir_base::_At_path):
	Use char_type consistently for paths.
2022-06-28 12:58:18 +01:00
Jakub Jelinek 133d0d422e fortran, libgfortran: Avoid using libquadmath for glibc 2.26+
As mentioned by Joseph in PR105101, glibc 2.26 or later has on x86
(both -m32/-m64), powerpc64le, ia64 and mips support for
*f128 math/complex APIs plus strtof128 and strfromf128, and these APIs allow
us to avoid libquadmath for Fortran purposes on these architectures,
replace *q math/complex APIs, strtof128 instead of strtoflt128 and,
while strfromf128 unfortunately isn't a perfect replacement to
quadmath_snprintf, it can be made to work.

The advantage of this is that when configured against such glibcs
(2.26 is now almost 5 years old), we can avoid linking against an extra shared
library and the math support in glibc is maintained better than libquadmath.

We need both a compiler change (so that for glibc 2.26+ it uses *f128 APIs
instead of *q) and library change.

The above mentioned problem with strfromf128 is that the strfrom* functions
are severely restricted versions of snprintf.  In libgfortran, we handle
!isfinite differently and just use snprintf/quadmath_snprintf for
%+-#.*{L,Q}{f,e} printing.
strfrom* doesn't allow +, -, # modifiers and it only supports .34 or
similar precision, not .* .  The L/Q etc. letters are omitted.
The + is there to force + sign at the start if it is positive.
Workaround in the patch is to add the + at the start manually for
!signbit (val).
The - (left alignment instead of right) I don't understand why we need it,
when minimum field width isn't specified (for strfrom* can't be specified),
no padding is ever added anywhere I believe.
The # is to force adding . - workaround is to search for first . or e or '\0'
character, if it is '\0', just append ., if it is e, insert . before e and
memmove the rest (which is just a few bytes, e, +/- and at most a few digits)
one byte later.
The .* case is handled by creating the format string for strfrom* by
snprintf into a temporary buffer.

As requested, this patch also switches from using __float128 type in
libgfortran to _Float128 which is equivalent on all arches that support
__float128.

The change is done in a backwards compatible change, when GCC is configured
against glibc 2.26 or newer, libgfortran.so.5 itself doesn't link against
-lquadmath nor uses any libquadmath APIs, libgfortran.a doesn't use any
libquadmath APIs either.  User programs and libraries when being linked
by gfortran driver are linked against -lgfortran and -lquadmath, but
the latter only in the --as-needed linker mode, which means it needs
to be around during linking and will be linked in if there are any
calls to math/complex functions with real(kind=16) or complex(kind=16)
in compilation units compiled by older versions of gcc, but if either
user code doesn't call those math/complex functions for the largest
supported kind, or the code is recompiled by gcc with this change in,
libquadmath won't be linked in.

2022-06-28  Jakub Jelinek  <jakub@redhat.com>

gcc/fortran/
	* gfortran.h (gfc_real_info): Add use_iec_60559 bitfield.
	* trans-types.h (gfc_real16_use_iec_60559): Declare.
	* trans-types.cc (gfc_real16_use_iec_60559): Define.
	(gfc_init_kinds): When building powerpc64le-linux libgfortran
	on glibc 2.26 to 2.31, set gfc_real16_use_iec_60559 and
	use_iec_60559.
	(gfc_build_real_type): Set gfc_real16_use_iec_60559 and use_iec_60559
	on glibc 2.26 or later.
	* trans-intrinsic.cc (gfc_build_intrinsic_lib_fndecls): Adjust
	comment.  Handle gfc_real16_use_iec_60559.
	(gfc_get_intrinsic_lib_fndecl): Handle use_iec_60559.
libgfortran/
	* configure.ac: Check for strtof128 and strfromf128.
	Check for math and complex *f128 functions.  Set
	have_iec_60559_libc_support to yes if *f128 support is around, for
	--enable-libquadmath-support default to "default" rather than yes if
	have_iec_60559_libc_support is yes.
	* acinclude.m4 (LIBGFOR_CHECK_FLOAT128): Test
	_Float128/_Complex _Float128 rather than __float128 and
	_Complex float __attribute__((mode(TC))).  If libquadmath support
	is defaulted and have_iec_60559_libc_support is yes, define and subst
	USE_IEC_60559.  Remove unused LIBGFOR_BUILD_QUAD conditional.
	* Makefile.am (kinds.h): Pass @USE_IEC_60559@ as an extra
	mk-kinds-h.sh argument.
	* mk-kinds-h.sh: Accept 4th use_iec_60559 argument.  Use
	_Float128/_Complex _Float128 types instead of __float128 and
	_Complex float __attribute__((mode(TC))), and if use_iec_60559 is yes,
	use f128 suffix instead of q and define GFC_REAL_16_USE_IEC_60559.
	* kinds-override.h: Use _Float128/_Complex _Float128 types instead of
	__float128 and _Complex float __attribute__((mode(TC))), if
	USE_IEC_60559 is defined, use f128 suffixes instead of q and
	define GFC_REAL_17_USE_IEC_60559.
	* libgfortran.h: Don't include quadmath_weak.h if USE_IEC_60559 is
	defined.
	(GFC_REAL_16_INFINITY, GFC_REAL_16_QUIET_NAN): Define
	for GFC_REAL_16_USE_IEC_60559 differently.
	* caf/single.c (convert_type): Use _Float128/_Complex _Float128
	instead of __float128 and _Complex float __attribute__((mode(TC))).
	For HAVE_GFC_REAL_10 when HAVE_GFC_REAL_16 isn't defined use
	_Complex long double instead of long double.
	* ieee/issignaling_fallback.h (ieee854_float128_shape_type): Use
	_Float128 instead of __float128.
	(__issignalingf128): Change argument type to _Float128.
	(issignaling): Use _Float128 instead of __float128 in _Generic.
	* intrinsics/cshift0.c (cshift0): Use _Float128 instead of __float128
	in a comment.  Fix a comment typo, logn double -> long double.
	* intrinsics/erfc_scaled.c (_THRESH, _M_2_SQRTPI, _INF, _ERFC, _EXP):
	Use different definitions if GFC_REAL_16_USE_IEC_60559.
	(_THRESH, _M_2_SQRTPI): Use GFC_REAL_17_LITERAL macro.
	(_ERFC, _EXP): Use different definitions if GFC_REAL_17_USE_IEC_60559.
	* intrinsics/spread_generic.c (spread, spread_scalar): Use _Float128
	instead of __float128 in a comment.  Fix a comment typo,
	logn double -> long double.
	* intrinsics/trigd.c (ENABLE_SIND, ENABLE_COSD, ENABLE_TAND): Handle
	GFC_REAL_16_USE_IEC_60559.
	* intrinsics/pack_generic.c (pack): Use _Float128 instead of
	__float128 in a comment.  Fix a comment typo, logn double ->
	long double.
	* intrinsics/unpack_generic.c (unpack1, unpack0): Likewise.
	* runtime/in_pack_generic.c (internal_pack): Likewise.
	* runtime/in_unpack_generic.c (internal_unpack): Likewise.
	* io/read.c (convert_real, convert_infnan): Handle
	GFC_REAL_16_USE_IEC_60559 and GFC_REAL_17_USE_IEC_60559.
	* io/transfer128.c (tmp1, tmp2): Don't define if libquadmath
	isn't needed.
	* io/write_float.def (gfor_strfromf128): New function.
	(DTOA2Q, FDTOA2Q): Define differently if
	GFC_REAL_16_USE_IEC_60559 or GFC_REAL_17_USE_IEC_60559.
	* m4/mtype.m4: Use different suffix if GFC_REAL_16_USE_IEC_60559
	or GFC_REAL_17_USE_IEC_60559.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* generated/bessel_r16.c: Regenerated.
	* generated/bessel_r17.c: Regenerated.
	* generated/norm2_r16.c: Regenerated.
	* generated/norm2_r17.c: Regenerated.
2022-06-28 13:14:45 +02:00
Richard Biener 8354d0abeb Speedup loop splitting SSA update
Since we never process loops with inner loops that have been split
we can delay SSA update until after the pass is done with the whole
loop, avoiding the O(function-size) work associated with it.

2022-06-28  Richard Biener  <rguenther@suse.de>

	* tree-ssa-loop-split.cc (fix_loop_bb_probability): Do not
	call update_ssa.
2022-06-28 13:13:34 +02:00
Richard Biener 07f49e855b Use mark_block_for_update properly in insert_updated_phi_nodes_for
This makes sure to use mark_block_for_update when adding a block for
rewriting in insert_updated_phi_nodes_for as otherwise stmt flags are not
initialized.

2022-06-28  Richard Biener  <rguenther@suse.de>

	* tree-into-ssa.cc (insert_updated_phi_nodes_for): Use
	mark_block_for_update.
	(update_ssa): Adjust.
2022-06-28 13:13:34 +02:00
Jonathan Wakely 198781144f libstdc++: Improve directory iterator abstractions for openat
Currently the _Dir::open_subdir function decides whether to construct a
_Dir_base with just a pathname, or a file descriptor and pathname. But
that means it is tiughtly coupled to the implementation of
_Dir_base::openat, which is what actually decides whether to use a file
descriptor or not. If the derived class passes a file descriptor and
filename, but the base class expects a full path and ignores the file
descriptor, then recursive_directory_iterator cannot recurse.

This change introduces a new type that provides the union of all the
information available to the derived class (the full pathname, as well
as a file descriptor for a directory and another pathname relative to
that directory). This allows the derived class to be agnostic to how the
base class will use that information.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir::dir_and_pathname):: Replace with
	current() returning _At_path.
	(_Dir::_Dir, _Dir::open_subdir, _Dir::do_unlink): Adjust.
	* src/filesystem/dir-common.h (_Dir_base::_At_path): New class.
	(_Dir_base::_Dir_Base, _Dir_base::openat): Use _At_path.
	* src/filesystem/dir.cc (_Dir::dir_and_pathname): Replace with
	current() returning _At_path.
	(_Dir::_Dir, _Dir::open_subdir): Adjust.
2022-06-28 12:09:20 +01:00
Jonathan Wakely 835b19936b libstdc++: Do not optimize away storing pathname if it's needed
libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir::_Dir) [!_GLIBCXX_HAVE_OPENAT]:
	Always store pathname if we don't have openat or unlinkat,
	because the full path is needed to open sub-directories and
	remove entries.
2022-06-28 12:08:35 +01:00
Xi Ruoyao 020b7d9858
loongarch: exclude LARCH_PROLOGUE_TEMP from SIBCALL_REGS [PR 106096]
The epilogue may clobber LARCH_PROLOGUE_TEMP ($r13/$t1), so it cannot be
used for sibcalls.

gcc/ChangeLog:

	PR target/106096
	* config/loongarch/loongarch.h (REG_CLASS_CONTENTS): Exclude
	$r13 from SIBCALL_REGS.
	* config/loongarch/loongarch.cc (loongarch_regno_to_class):
	Change $r13 to JIRL_REGS.

gcc/testsuite/ChangeLog:

	PR target/106096
	* g++.target/loongarch/loongarch.exp: New test support file.
	* g++.target/loongarch/pr106096.C: New test.
2022-06-28 19:03:04 +08:00
Aldy Hernandez 88417d77fe Allow all types supported by ranger in loop-ch.
This converts the ranger use in loop-ch to allow any types allowed by
the ranger infrastructure.  Since the range of a GIMPLE_COND is always an
integer we can remove the check because the only temporary is already
an int_range.

gcc/ChangeLog:

	* tree-ssa-loop-ch.cc (entry_loop_condition_is_static): Remove
	irange::supports_p.
2022-06-28 13:00:45 +02:00
Richard Biener a3ca1fc5f4 middle-end/106053 - fold_sign_changed_comparison and large bools
The following fixes a latent issue in the match.pd variant of
fold_sign_changed_comparison which replaces an unsigned integer
comparison with a signed boolean comparison of the same precision
despite the fact that we treat BOOLEAN_TYPEs as only having two
valid values.

2022-06-28  Richard Biener  <rguenther@suse.de>

	PR middle-end/106053
	* match.pd ((T)a == (T)b): Avoid folding away sign
	changes in a comparison if we'd truncate to a boolean.

	* gcc.target/i386/pr106053.c: New testcase.
2022-06-28 12:00:16 +02:00
Martin Liska 6835baee71 libgomp: fix typo in mold linker detection
libgomp/ChangeLog:

	* acinclude.m4: Fix typo in mold linker detection.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2022-06-28 10:35:32 +02:00
Jonathan Wakely 30aea28bd3 libstdc++: testsuite: Guard use of C99 std::log2
This prevents the test from failing if the only thing not supported is
the text printed to the log about the size of the floating-point type.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math
	functions are available.
2022-06-28 09:29:24 +01:00
konglin1 10caa98a37 MAINTAINERS: Add myself for write after approval
ChangeLog:

	* MAINTAINERS (Write After Approval): Add myself.
2022-06-28 16:04:26 +08:00
Kewen Lin f9764ea128 rs6000: Simplify *rotl<mode>3_insert_4 by removing DImode
define_insn *rotl<mode>3_insert_4 use mode iterator GPR which
consists of SImode and conditional DImode, but the condition
of this define_insn requires the mode should be SImode.  By
further checking, it's found that the rldimi instruction can
not be used for this pattern since the required mask can not
be represented correctly.  We can have the fixed mask end 31
with rlwimi, but can not have the fixed mask end 63 with
rldimi as it has to be (63 - SH) always.

So this patch simplifies this define_insn to use SImode only.

gcc/ChangeLog:

	* config/rs6000/rs6000.md (*rotl<mode>3_insert_4): Replace mode
	iterator GPR with SImode, adjust the condition and output template,
	rename to ...
	(*rotlsi3_insert_4): ... this.
2022-06-27 21:50:26 -05:00
GCC Administrator 9d3dd21856 Daily bump. 2022-06-28 00:16:58 +00:00
Sergei Trofimovich 3b21c21f3f c++: avoid <memory> poisoning on musl [PR106102]
On musl <pthread.h> uses calloc() (via <sched.h>). <memory> includes
it indirectly and exposes use of poisoned calloc() when module code
is built:

    /build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc
        In file included from /<<NIX>>/musl-1.2.3-dev/include/pthread.h:30,
                 from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35,
                 ....
                 from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77,
                 from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24,
                 from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25,
                 from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23,
                 from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32:
    /<<NIX>>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc"
       84 | void *calloc(size_t, size_t);
          |       ^
    /<<NIX>>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc"
      124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
          |                                    ^

gcc/cp/

	PR c++/106102
	* mapper-client.cc: Include <memory> via "system.h".
	* mapper-resolver.cc: Ditto.
	* module.cc: Ditto.

libcc1/

	PR c++/106102
	* libcc1plugin.cc: Include <memory> via "system.h".
	* libcp1plugin.cc: Ditto.
2022-06-27 23:22:02 +01:00
David Malcolm 26f77c4d19 Add 'final' and 'override' in various places
gcc/cp/ChangeLog:
	* cxx-pretty-print.h: Add "final" and "override" to various vfunc
	implementations, removing redundant "virtual" as appropriate.
	* module.cc: Likewise.

gcc/ChangeLog:
	* genmatch.cc: Add "final" and "override" to various vfunc
	implementations, removing redundant "virtual" as appropriate.
	* gensupport.cc: Likewise.
	* gimple-range-cache.h: Likewise.
	* ipa-icf-gimple.h: Likewise.
	* ipa-icf.h: Likewise.
	* read-md.h: Likewise.
	* read-rtl-function.cc: Likewise.
	* tree-ssa-loop-ch.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.

gcc/lto/ChangeLog:
	* lto-dump.cc: Add "final" and "override" to various vfunc
	implementations, removing redundant "virtual" as appropriate.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:34 -04:00
David Malcolm 0a8333ade9 i386: add 'final' and 'override' to scalar_chain vfunc impls
gcc/ChangeLog:
	* config/i386/i386-features.h: Add "final" and "override" to
	scalar_chain vfunc implementations as appropriate.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:34 -04:00
David Malcolm a2f2e0ffa2 tree-switch-conversion.h: use final/override for cluster vfunc impls
gcc/ChangeLog:
	* tree-switch-conversion.h: Add "final" and "override" to cluster
	vfunc implementations as appropriate.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:33 -04:00
David Malcolm ddff65d64d expr.cc: use final/override on op_by_pieces_d vfuncs
gcc/ChangeLog:
	* expr.cc: Add "final" and "override" to op_by_pieces_d vfunc
	implementations as appropriate.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:33 -04:00
David Malcolm 894ddeacda Add 'final' and 'override' on dom_walker vfunc impls
gcc/ChangeLog:
	* compare-elim.cc: Add "final" and "override" to dom_walker vfunc
	implementations, removing redundant "virtual" as appropriate.
	* gimple-ssa-strength-reduction.cc: Likewise.
	* ipa-prop.cc: Likewise.
	* rtl-ssa/blocks.cc: Likewise.
	* tree-into-ssa.cc: Likewise.
	* tree-ssa-dom.cc: Likewise.
	* tree-ssa-math-opts.cc: Likewise.
	* tree-ssa-phiopt.cc: Likewise.
	* tree-ssa-propagate.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.
	* tree-ssa-strlen.cc: Likewise.
	* tree-ssa-uncprop.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:33 -04:00
David Malcolm 725793af78 Add 'final' and 'override' to opt_pass vfunc impls
gcc/ChangeLog:
	* adjust-alignment.cc: Add "final" and "override" to opt_pass
	vfunc implementations, removing redundant "virtual" as
	appropriate.
	* asan.cc: Likewise.
	* auto-inc-dec.cc: Likewise.
	* auto-profile.cc: Likewise.
	* bb-reorder.cc: Likewise.
	* cfgcleanup.cc: Likewise.
	* cfgexpand.cc: Likewise.
	* cfgrtl.cc: Likewise.
	* cgraphbuild.cc: Likewise.
	* combine-stack-adj.cc: Likewise.
	* combine.cc: Likewise.
	* compare-elim.cc: Likewise.
	* config/i386/i386-features.cc: Likewise.
	* coroutine-passes.cc: Likewise.
	* cprop.cc: Likewise.
	* cse.cc: Likewise.
	* dce.cc: Likewise.
	* df-core.cc: Likewise.
	* dse.cc: Likewise.
	* dwarf2cfi.cc: Likewise.
	* early-remat.cc: Likewise.
	* except.cc: Likewise.
	* final.cc: Likewise.
	* function.cc: Likewise.
	* fwprop.cc: Likewise.
	* gcse.cc: Likewise.
	* gimple-harden-conditionals.cc: Likewise.
	* gimple-if-to-switch.cc: Likewise.
	* gimple-isel.cc: Likewise.
	* gimple-laddress.cc: Likewise.
	* gimple-loop-interchange.cc: Likewise.
	* gimple-loop-jam.cc: Likewise.
	* gimple-loop-versioning.cc: Likewise.
	* gimple-low.cc: Likewise.
	* gimple-ssa-backprop.cc: Likewise.
	* gimple-ssa-evrp.cc: Likewise.
	* gimple-ssa-isolate-paths.cc: Likewise.
	* gimple-ssa-nonnull-compare.cc: Likewise.
	* gimple-ssa-split-paths.cc: Likewise.
	* gimple-ssa-store-merging.cc: Likewise.
	* gimple-ssa-strength-reduction.cc: Likewise.
	* gimple-ssa-warn-access.cc: Likewise.
	* gimple-ssa-warn-alloca.cc: Likewise.
	* gimple-ssa-warn-restrict.cc: Likewise.
	* gimple-warn-recursion.cc: Likewise.
	* graphite.cc: Likewise.
	* ifcvt.cc: Likewise.
	* init-regs.cc: Likewise.
	* ipa-comdats.cc: Likewise.
	* ipa-cp.cc: Likewise.
	* ipa-devirt.cc: Likewise.
	* ipa-fnsummary.cc: Likewise.
	* ipa-free-lang-data.cc: Likewise.
	* ipa-icf.cc: Likewise.
	* ipa-inline.cc: Likewise.
	* ipa-modref.cc: Likewise.
	* ipa-profile.cc: Likewise.
	* ipa-pure-const.cc: Likewise.
	* ipa-reference.cc: Likewise.
	* ipa-split.cc: Likewise.
	* ipa-sra.cc: Likewise.
	* ipa-visibility.cc: Likewise.
	* ipa.cc: Likewise.
	* ira.cc: Likewise.
	* jump.cc: Likewise.
	* loop-init.cc: Likewise.
	* lower-subreg.cc: Likewise.
	* mode-switching.cc: Likewise.
	* modulo-sched.cc: Likewise.
	* multiple_target.cc: Likewise.
	* omp-expand.cc: Likewise.
	* omp-low.cc: Likewise.
	* omp-oacc-kernels-decompose.cc: Likewise.
	* omp-oacc-neuter-broadcast.cc: Likewise.
	* omp-offload.cc: Likewise.
	* omp-simd-clone.cc: Likewise.
	* passes.cc: Likewise.
	* postreload-gcse.cc: Likewise.
	* postreload.cc: Likewise.
	* predict.cc: Likewise.
	* recog.cc: Likewise.
	* ree.cc: Likewise.
	* reg-stack.cc: Likewise.
	* regcprop.cc: Likewise.
	* reginfo.cc: Likewise.
	* regrename.cc: Likewise.
	* reorg.cc: Likewise.
	* sancov.cc: Likewise.
	* sanopt.cc: Likewise.
	* sched-rgn.cc: Likewise.
	* stack-ptr-mod.cc: Likewise.
	* store-motion.cc: Likewise.
	* tracer.cc: Likewise.
	* trans-mem.cc: Likewise.
	* tree-call-cdce.cc: Likewise.
	* tree-cfg.cc: Likewise.
	* tree-cfgcleanup.cc: Likewise.
	* tree-complex.cc: Likewise.
	* tree-eh.cc: Likewise.
	* tree-emutls.cc: Likewise.
	* tree-if-conv.cc: Likewise.
	* tree-into-ssa.cc: Likewise.
	* tree-loop-distribution.cc: Likewise.
	* tree-nrv.cc: Likewise.
	* tree-object-size.cc: Likewise.
	* tree-parloops.cc: Likewise.
	* tree-predcom.cc: Likewise.
	* tree-profile.cc: Likewise.
	* tree-sra.cc: Likewise.
	* tree-ssa-ccp.cc: Likewise.
	* tree-ssa-copy.cc: Likewise.
	* tree-ssa-dce.cc: Likewise.
	* tree-ssa-dom.cc: Likewise.
	* tree-ssa-dse.cc: Likewise.
	* tree-ssa-forwprop.cc: Likewise.
	* tree-ssa-ifcombine.cc: Likewise.
	* tree-ssa-loop-ch.cc: Likewise.
	* tree-ssa-loop-im.cc: Likewise.
	* tree-ssa-loop-ivcanon.cc: Likewise.
	* tree-ssa-loop-prefetch.cc: Likewise.
	* tree-ssa-loop-split.cc: Likewise.
	* tree-ssa-loop-unswitch.cc: Likewise.
	* tree-ssa-loop.cc: Likewise.
	* tree-ssa-math-opts.cc: Likewise.
	* tree-ssa-phiopt.cc: Likewise.
	* tree-ssa-phiprop.cc: Likewise.
	* tree-ssa-pre.cc: Likewise.
	* tree-ssa-reassoc.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.
	* tree-ssa-sink.cc: Likewise.
	* tree-ssa-strlen.cc: Likewise.
	* tree-ssa-structalias.cc: Likewise.
	* tree-ssa-uncprop.cc: Likewise.
	* tree-ssa-uninit.cc: Likewise.
	* tree-ssanames.cc: Likewise.
	* tree-stdarg.cc: Likewise.
	* tree-switch-conversion.cc: Likewise.
	* tree-tailcall.cc: Likewise.
	* tree-vect-generic.cc: Likewise.
	* tree-vectorizer.cc: Likewise.
	* tree-vrp.cc: Likewise.
	* tsan.cc: Likewise.
	* ubsan.cc: Likewise.
	* var-tracking.cc: Likewise.
	* vtable-verify.cc: Likewise.
	* web.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:33 -04:00
Ian Lance Taylor 6ce49a6e69 libbacktrace: replace fgrep with grep in configure script
Patch by Xi Ruoyao.

	* configure.ac: Use grep instead of fgrep.
	* configure, Makefile.in: Regenerate.
2022-06-27 13:00:01 -07:00
Marek Polacek 508231d544 c++: Add fixed test [PR89197]
Fixed since bug 97899 was fixed.

	PR c++/89197

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/initlist130.C: New test.
2022-06-27 14:55:53 -04:00
Ian Lance Taylor 5f6b649403 compiler: don't use sink as parameter in method expression thunk
Also fix a couple of cases where the error led to a later compiler crash.

Test case is https://go.dev/cl/414336.

Fixes golang/go#52871

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414354
2022-06-27 09:53:22 -07:00
Ian Lance Taylor 722750a44a compiler: always initialize mpfr in integer import
Test case is https://go.dev/cl/413980.

Fixes golang/go#52862

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413981
2022-06-27 09:50:39 -07:00
Andrew Stubbs a1f8a3860f amdgcn: test global constructors
The tests are disabled for historical reasons only.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_global_constructor):
	Remove amdgcn.
2022-06-27 15:11:29 +01:00
Jakub Jelinek 00063459f6 testsuite: Fix up pr106070.c test [PR106070]
The test FAILs on 32-bit targets, because when unsigned long
is 32-bit, (unsigned long) -1 isn't 0xffffffffffffffff.
The options to fix this would be either using -1UL, or switch
to unsigned long long and using -1ULL, I chose the latter because
the test then FAILs in r13-1242 even on 32-bit targets.
And while at it, some deobfuscation and formatting tweaks.

2022-06-27  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/106070
	* gcc.dg/torture/pr106070.c: Use unsigned long long instead of
	unsigned long and -1ULL instead of 0xffffffffffffffff, deobcuscate
	and improve formatting.
2022-06-27 15:36:14 +02:00
Alexandre Oliva 01e094f82d libstdc++: testsuite: use cmath long double overloads
In case we need to supplement the C standard library with additional
definitions for float and long double, the declarations expected to be
in the C headers may not be there.  Rely on the cmath overloads
instead.


for  libstdc++-v3/ChangeLog

	* testsuite/20_util/to_chars/long_double.cc: Use cmath
	long double overloads for nexttoward and ldexp.
2022-06-27 10:34:19 -03:00
Alexandre Oliva 8fce31f69b libstdc++: testsuite: require cmath for exp simd
simd_math.h assumes declarations for many C99 functions to be present,
that libstdc++ doesn't add to target systems that don't have them in
the C library.

Add the C99 math requirement to tests for simd features, so that they
don't fail because of limitations of the target C library.


for  libstdc++-v3/ChangeLog

	* testsuite/experimental/simd/standard_abi_usable.cc: Require
	cmath support.
	* testsuite/experimental/simd/standard_abi_usable_2.cc:
	Likewise.
2022-06-27 10:34:19 -03:00
Alexandre Oliva 3e3744d37e libstdc++: testsuite: complex proj requirements
The template version of complex::proj returns its argument without
testing for infinities, and that's all we have when neither C99
complex nor C99 math functions are available, and it seems too hard to
do better without isinf and copysign.

I suppose just calling them and expecting users will supply
specializations as needed has been ruled out, and so has refraining
from defining it when it can't be implemented correctly.

It's pointless to run the proj.cc test under these circumstances, so
arrange for it to be skipped.  In an unusual way, after trying to
introduce dg-require tests for ccomplex-or-cmath, and found their
results to be misleading due to variations across -std=* versions.


for  libstdc++-v3/ChangeLog

	* testsuite/26_numerics/complex/proj.cc: Skip test in the
	circumstances in which the implementation of proj is known to
	be broken.
2022-06-27 10:34:18 -03:00
Alexandre Oliva 0a3bb459e5 testsuite: pthread: call sched_yield for non-preemptive targets
Systems without preemptive multi-threading require sched_yield calls
to be placed at points in which a context switch might be needed to
enable the test to complete.


for  gcc/testsuite/ChangeLog

	* gcc.dg/atomic/c11-atomic-exec-4.c: Call sched_yield.
	* gcc.dg/atomic/c11-atomic-exec-5.c: Likewise.
	* gcc.dg/atomic/pr80640-2.c: Likewise.
	* gcc.dg/atomic/pr80640.c: Likewise.
	* gcc.dg/atomic/pr81316.c: Likewise.
	* gcc.dg/di-sync-multithread.c: Likewise.
2022-06-27 10:34:17 -03:00
Alexandre Oliva 486893b1d3 libstdc++: check for openat with dirfd in std::filesystem
In the recent patch to check for openat, I missed an occurrence of
dirfd in std::filesystem.


for  libstdc++-v3/ChangeLog

	* src/c++17/fs_dir.cc (dir_and_pathname): Use dirfd if
	_GLIBCXX_HAVE_OPENAT.
2022-06-27 10:34:16 -03:00
Alexandre Oliva ca35ebaec8 libstdc++: testsuite: conditionalize another symlink test
In the recent patch that introduced NO_SYMLINKS, I missed one of the
testcases that created symlinks.


for  libstdc++-v3/ChangeLog

	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc
	(test06): Don't create symlinks when NO_SYMLINKS is defined.
2022-06-27 10:34:15 -03:00
Alexandre Oliva 250b95a994 libstdc++: xfail experimental/net tests on rtems
Some net/timer/waitable tests fail on rtems because poll() is not
available.

The above, as well as net/internet/resolver/ops tests and
net/timer/waitable/cons.cc, will fail early at runtime unless mkfifo
is enabled in the RTEMS configuration, because the io_context ctor
throws when pipe() fails.

However, even enabling pipes and adjusting the net_ts link command to
use --gc-sections for -lbsd as recommended, both
net/internet/resolver/ops still fail at runtime.


for  libstdc++-v3/ChangeLog

	* testsuite/lib/dg-options.exp (add_options_for_net_ts):
	Add -Wl,--gc-sections for RTEMS targets.
	* testsuite/experimental/net/timer/waitable/dest.cc: Link-time
	xfail on RTEMS.
	* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Execution-time xfail on RTEMS.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc:
	Likewise.
2022-06-27 10:34:14 -03:00
Andrew Stubbs b06a282921 amdgcn: remove obsolete assembler workarounds
This nonsense is no longer required, now that the minimum supported
assembler version is LLVM 13.0.1.

gcc/ChangeLog:

	* config/gcn/gcn.md (*movbi): Remove assembler bug workarounds.
	(jump): Likewise.
	(movdi_symbol_save_scc): Likewise.
2022-06-27 13:47:45 +01:00
Jonathan Wakely c10a7546cf libstdc++: testsuite: Add missing <string> header
libstdc++-v3/ChangeLog:

	* testsuite/ext/mt_allocator/22309_thread.cc: Include <string>.
2022-06-27 11:08:17 +01:00
Joel Brobecker 30a8f67295 libstdc++: testsuite: avoid predicable mkstemp
We have noticed that, on RTEMS, a small number of testscases are
failing because two calls to this method return the same filename.
This happens for instance in 27_io/filesystem/operations/copy_file.cc
where it does:

  auto from = __gnu_test::nonexistent_path();
  auto to = __gnu_test::nonexistent_path();

We tracked this issue down to the fact that the implementation of
mkstemp on that system appears to use a very predictable algorithm
for chosing the name of the temporary file, where the same filename
appears to be tried in the same order, regardless of past calls.
So, as long as the file gets deleted after a call to mkstemp (something
we do here in our nonexistent_path method), the next call to mkstemps
ends up returning the same filename, causing the collision we se above.

This commit enhances the __gnu_test::nonexistent_path method to
introduce in the filename being returned a counter which gets
incremented at every call of this method.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_fs.h (__gnu_test::nonexistent_path):
	Always include a counter in the filename returned.
2022-06-27 11:08:17 +01:00
Jonathan Wakely a364488f7a libstdc++: Make std::move_only_function never valueless in std::variant
This is not suitable to backport, as it affects the ABI of std::variant
and so isn't appropriate for a release branch.

libstdc++-v3/ChangeLog:

	* include/bits/move_only_function.h (_Never_valueless_alt):
	Define partial specialization for std::move_only_function.
2022-06-27 11:08:16 +01:00
Jonathan Wakely da55353e95 libstdc++: Simplify std::variant construction using variable templates
libstdc++-v3/ChangeLog:

	* include/std/variant (_Build_FUN::_S_fun): Define fallback case
	as deleted.
	(__accepted_index, _Extra_visit_slot_needed): Replace class
	templates with variable templates.
2022-06-27 11:08:16 +01:00
Jonathan Wakely 6177f60d91 libstdc++: Simplify fs::path construction using variable template
libstdc++-v3/ChangeLog:

	* include/bits/fs_path.h (__is_path_iter_src): Replace class
	template with variable template.
2022-06-27 11:08:16 +01:00
Jonathan Wakely 48099f7daf libstdc++: Invert relationship between std::is_clock and std::is_clock_v
This redefines std::is_clock in terms of std::is_clock_v, instead of the
other way around. This avoids instantiatng the class template for code
that only uses the variable template.

libstdc++-v3/ChangeLog:

	* include/bits/chrono.h (is_clock_v): Define to false.
	(is_clock_v<T>): Define partial specialization for true cases.
	(is_clock): Define in terms of is_clock_v.
2022-06-27 11:08:16 +01:00
Tom de Vries 153689603f [gdb/build] Fix gdbserver build with -fsanitize=thread
When building gdbserver with -fsanitize=thread (added to CFLAGS/CXXFLAGS) we
run into:
...
ld: ../libiberty/libiberty.a(safe-ctype.o): warning: relocation against \
  `__tsan_init' in read-only section `.text'
ld: ../libiberty/libiberty.a(safe-ctype.o): relocation R_X86_64_PC32 \
  against symbol `__tsan_init' can not be used when making a shared object; \
  recompile with -fPIC
ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libinproctrace.so] Error 1
...
which looks similar to what is described in commit 78e49486944 ("[gdb/build]
Fix gdbserver build with -fsanitize=address").

The gdbserver component builds a shared library libinproctrace.so, which uses
libiberty and therefore requires the pic variant.  The gdbserver Makefile is
setup to use this variant, if available, but it's not there.

Fix this by listing gdbserver in the toplevel configure alongside libcc1, as a
component that needs the libiberty pic variant, setting:
...
extra_host_libiberty_configure_flags=--enable-shared
...

Tested on x86_64-linux.

ChangeLog:

2022-06-27  Tom de Vries  <tdevries@suse.de>

	* configure.ac: Build libiberty pic variant for gdbserver.
	* configure: Regenerate.
2022-06-27 10:52:23 +02:00
Martin Liska 2669cae081 lto-plugin: make claim_file_handler thread-safe
lto-plugin/ChangeLog:

	* lto-plugin.c (plugin_lock): New lock.
	(claim_file_handler): Use mutex for critical section.
	(onload): Initialize mutex.
	* configure.ac: Check for pthread.h.
	* configure: Regenerate.
	* config.h.in: Regenerate.
2022-06-27 10:12:08 +02:00
Roger Sayle 64d4f27a0c Implement __imag__ of float _Complex using shufps on x86_64.
This patch is a follow-up improvement to my recent patch for
PR rtl-optimization/7061.  That patch added the test case
gcc.target/i386/pr7061-2.c:

float im(float _Complex a) { return __imag__ a; }

For which GCC on x86_64 currently generates:

        movq    %xmm0, %rax
        shrq    $32, %rax
        movd    %eax, %xmm0
        ret

but with this patch we now generate (the same as LLVM):

        shufps  $85, %xmm0, %xmm0
        ret

This is achieved by providing a define_insn_and_split that allows
truncated lshiftrt:DI by 32 to be performed on either SSE or general
regs, where if the register allocator prefers to use SSE, we split
to a shufps_v4si, or if not, we use a regular shrq.

2022-06-27  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR rtl-optimization/7061
	* config/i386/i386.md (*highpartdisi2): New define_insn_and_split.

gcc/testsuite/ChangeLog
	PR rtl-optimization/7061
	* gcc.target/i386/pr7061-2.c: Update to look for shufps.
2022-06-27 07:47:40 +01:00
Roger Sayle f3f73e86ec [PATCH] PR tree-optimization/94026: Simplify (X>>8)&6 != 0 as X&1536 != 0.
This patch implements the missed optimization described in PR 94026,
where a the shift can be eliminated from the sequence of a shift,
followed by a bit-wise AND followed by an equality/inequality test.
Specifically, ((X << C1) & C2) cmp C3 into (X & (C2 >> C1)) cmp (C3 >> C1)
and likewise ((X >> C1) & C2) cmp C3 into (X & (C2 << C1)) cmp (C3 << C1)
where cmp is == or !=, and C1, C2 and C3 are integer constants.
The example in the subject line is taken from the hot function
self_atari from the Go program Leela (in SPEC CPU 2017).

2022-06-27  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR tree-optimization/94026
	* match.pd (((X << C1) & C2) eq/ne C3): New simplification.
	(((X >> C1) & C2) eq/ne C3): Likewise.

gcc/testsuite/ChangeLog
	PR tree-optimization/94026
	* gcc.dg/pr94026.c: New test case.
2022-06-27 07:44:49 +01:00
Prathamesh Kulkarni 2ae7895416 Emit asmname if set for decl with -fdump-statistics-asmname.
gcc/ChangeLog:

	* statistics.cc: Include tree.h.
	(get_function_name): New function.
	(statistics_fini_pass_2): Call get_function_name instead of
	current_function_name.
	(statistics_counter_event): Call get_function_name instead of
	function_name.
	(statistics_histogram_event): Likewise.
2022-06-27 11:55:45 +05:30
Takayuki 'January June' Suwa 773dffc50f xtensa: Optimize integer constant addition that is between -32896 and 32639
Such constants are often subject to the constant synthesis:

    int test(int a) {
      return a - 31999;
    }

    test:
	movi	a3, 1
	addmi	a3, a3, -0x7d00
	add	a2, a2, a3
	ret

This patch optimizes such case as follows:

    test:
	addi	a2, a2, 1
	addmi	a2, a2, -0x7d00
	ret

gcc/ChangeLog:

	* config/xtensa/xtensa.md:
	Suppress unnecessary emitting nop insn in the split patterns for
	integer/FP constant synthesis, and add new peephole2 pattern that
	folds such synthesized additions.
2022-06-26 20:40:42 -07:00