Commit Graph

182894 Commits

Author SHA1 Message Date
Richard Sandiford 6d75168146 rtl-ssa: Fix reversed comparisons in accesses.h comment
Noticed while looking at something else that the comment above
def_lookup got the description of the comparisons the wrong way
round.

gcc/
	* rtl-ssa/accesses.h (def_lookup): Fix order of comparison results.
2021-01-13 11:43:36 +00:00
Richard Sandiford 40b371a7c2 sh: Remove match_scratch operand test
This patch fixes a regression on sh4 introduced by the rtl-ssa stuff.
The port had a pattern:

(define_insn "movsf_ie"
  [(set (match_operand:SF 0 "general_movdst_operand"
			        "=f,r,f,f,fy, f,m, r, r,m,f,y,y,rf,r,y,<,y,y")
	(match_operand:SF 1 "general_movsrc_operand"
			        " f,r,G,H,FQ,mf,f,FQ,mr,r,y,f,>,fr,y,r,y,>,y"))
   (use (reg:SI FPSCR_MODES_REG))
   (clobber (match_scratch:SI 2 "=X,X,X,X,&z, X,X, X, X,X,X,X,X, y,X,X,X,X,X"))]
  "TARGET_SH2E
   && (arith_reg_operand (operands[0], SFmode)
       || fpul_operand (operands[0], SFmode)
       || arith_reg_operand (operands[1], SFmode)
       || fpul_operand (operands[1], SFmode)
       || arith_reg_operand (operands[2], SImode))"

But recog can generate this pattern from something that matches:

  [(set (match_operand:SF 0 "general_movdst_operand")
	(match_operand:SF 1 "general_movsrc_operand")
   (use (reg:SI FPSCR_MODES_REG))]

with recog adding the (clobber (match_scratch:SI)) automatically.
recog tests the C condition before adding the clobber, so there might
not be an operands[2] to test.

Similarly, gen_movsf_ie takes only two arguments, with operand 2
being filled in automatically.  The only way to create this pattern
with a REG operands[2] before RA would be to generate it directly
from RTL.  AFAICT the only things that do this are the secondary
reload patterns, which are generated during RA and come with
pre-vetted operands.

arith_reg_operand rejects 6 specific registers:

      return (regno != T_REG && regno != PR_REG
	      && regno != FPUL_REG && regno != FPSCR_REG
	      && regno != MACH_REG && regno != MACL_REG);

The fpul_operand tests allow FPUL_REG, leaving 5 invalid registers.
However, in all alternatives of movsf_ie, either operand 0 or
operand 1 is a register that belongs r, f or y, none of which
include any of the 5 rejected registers.  This means that any
post-RA pattern would satisfy the operands[0] or operands[1]
condition without the operands[2] test being necessary.

gcc/
	* config/sh/sh.md (movsf_ie): Remove operands[2] test.
2021-01-13 11:37:18 +00:00
Samuel Thibault e9cb89b936 Hurd: Enable ifunc by default
The binutils bugs seem to have been fixed.

	gcc/
	* config.gcc [$target == *-*-gnu*]: Enable
	'default_gnu_indirect_function'.
2021-01-13 12:09:59 +01:00
Jonathan Wakely f04e7e540e libstdc++: Fix typo in ChangeLog-2020 2021-01-13 11:02:13 +00:00
Martin Liska c23aea6edc gcc-changelog: Allow modifications to old ChangeLogs without entry
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow modifications of older
	ChangeLog (or specific) files without need to make a ChangeLog
	entry.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Add new patch.
2021-01-13 11:57:14 +01:00
Samuel Thibault 2b356e689c hurd: libgcc unwinding over signal trampolines with SIGINFO
When the application sets SA_SIGINFO, the signal trampoline parameters
are different to follow POSIX.

	libgcc/
	* config/i386/gnu-unwind.h (x86_gnu_fallback_frame_state): Add the
	posix siginfo case to struct handler_args. Detect between legacy
	and siginfo from the second parameter, which is a small sigcode in
	the legacy case, and a pointer in the siginfo case.
2021-01-13 11:54:54 +01:00
Jakub Jelinek b1d1e2b54c i386, expand: Optimize also 256-bit and 512-bit permutatations as vpmovzx if possible [PR95905]
The following patch implements what I've talked about, i.e. to no longer
force operands of vec_perm_const into registers in the generic code, but let
each of the (currently 8) targets force it into registers individually,
giving the targets better control on if it does that and when and allowing
them to do something special with some particular operands.
And then defines the define_insn_and_split for the 256-bit and 512-bit
permutations into vpmovzx* (only the bw, wd and dq cases, in theory we could
add define_insn_and_split patterns also for the bd, bq and wq).

2021-01-13  Jakub Jelinek  <jakub@redhat.com>

	PR target/95905
	* optabs.c (expand_vec_perm_const): Don't force v0 and v1 into
	registers before calling targetm.vectorize.vec_perm_const, only after
	that.
	* config/i386/i386-expand.c (ix86_vectorize_vec_perm_const): Handle
	two argument permutation when one operand is zero vector and only
	after that force operands into registers.
	* config/i386/sse.md (*avx2_zero_extendv16qiv16hi2_1): New
	define_insn_and_split pattern.
	(*avx512bw_zero_extendv32qiv32hi2_1): Likewise.
	(*avx512f_zero_extendv16hiv16si2_1): Likewise.
	(*avx2_zero_extendv8hiv8si2_1): Likewise.
	(*avx512f_zero_extendv8siv8di2_1): Likewise.
	(*avx2_zero_extendv4siv4di2_1): Likewise.
	* config/mips/mips.c (mips_vectorize_vec_perm_const): Force operands
	into registers.
	* config/arm/arm.c (arm_vectorize_vec_perm_const): Likewise.
	* config/sparc/sparc.c (sparc_vectorize_vec_perm_const): Likewise.
	* config/ia64/ia64.c (ia64_vectorize_vec_perm_const): Likewise.
	* config/aarch64/aarch64.c (aarch64_vectorize_vec_perm_const): Likewise.
	* config/rs6000/rs6000.c (rs6000_vectorize_vec_perm_const): Likewise.
	* config/gcn/gcn.c (gcn_vectorize_vec_perm_const): Likewise.  Use std::swap.

	* gcc.target/i386/pr95905-2.c: Use scan-assembler-times instead of
	scan-assembler.  Add tests with zero vector as first __builtin_shuffle
	operand.
	* gcc.target/i386/pr95905-3.c: New test.
	* gcc.target/i386/pr95905-4.c: New test.
2021-01-13 11:36:38 +01:00
Martin Liska 7875e8dc83 if-to-switch: fix also virtual phis
gcc/ChangeLog:

	PR tree-optimization/98455
	* gimple-if-to-switch.cc (condition_info::record_phi_mapping):
	Record also virtual PHIs.
	(pass_if_to_switch::execute): Return TODO_cleanup_cfg only
	conditionally.

gcc/testsuite/ChangeLog:

	PR tree-optimization/98455
	* gcc.dg/tree-ssa/pr98455.c: New test.
2021-01-13 11:33:28 +01:00
Jonathan Wakely 0db5f48848 libstdc++: Remove <debug/array> from Doxygen config
This header was removed recently, so Doxygen shouldn't try to process
it.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (INPUT): Remove include/debug/array.
2021-01-13 10:29:45 +00:00
Jonathan Wakely 4c598b038d doc: Fix typos in C++ Modules documentation
gcc/ChangeLog:

	* doc/invoke.texi (C++ Modules): Fix typos.
2021-01-13 10:29:00 +00:00
Richard Biener ffd28c265e tree-optimization/98640 - fix bogus sign-extension with VN
VN tried to express a sign extension from int to long of
a trucated quantity with a plain conversion but that loses the
truncation.  Since there's no single operand doing truncate plus
sign extend (there was a proposed SEXT_EXPR to do that at some
point mapping to RTL sign_extract) don't bother to appropriately
model this with two ops (which the VN insert machinery doesn't
handle and which is unlikely to CSE fully).

2021-01-13  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98640
	* tree-ssa-sccvn.c (visit_nary_op): Do not try to
	handle plus or minus from a truncated operand to be
	sign-extended.

	* gcc.dg/torture/pr98640.c: New testcase.
2021-01-13 11:13:33 +01:00
Jakub Jelinek 5d057bfeff i386: Add define_insn_and_split patterns for btrl [PR96938]
In the following testcase we only optimize f2 and f7 to btrl, although we
should optimize that way all of the functions.  The problem is the type
demotion/narrowing (which is performed solely during the generic folding and
not later), without it we see the AND performed in SImode and match it as
btrl, but with it while the shifts are still performed in SImode, the
AND is already done in QImode or HImode low part of the shift.

2021-01-13  Jakub Jelinek  <jakub@redhat.com>

	PR target/96938
	* config/i386/i386.md (*btr<mode>_1, *btr<mode>_2): New
	define_insn_and_split patterns.
	(splitter after *btr<mode>_2): New splitter.

	* gcc.target/i386/pr96938.c: New test.
2021-01-13 10:15:13 +01:00
Martin Liska 6b70fa678b ipa: remove a dead code
gcc/ChangeLog:

	PR ipa/98652
	* cgraphunit.c (analyze_functions): Remove dead code.
2021-01-13 09:27:31 +01:00
Qian Jianhua 3f325179b3 [PATCH v2] aarch64: Add cpu cost tables for A64FX
This patch add cost tables for A64FX.

2021-01-13 Qian jianhua <qianjh@cn.fujitsu.com>

gcc/
	* config/aarch64/aarch64-cost-tables.h (a64fx_extra_costs): New.
	* config/aarch64/aarch64.c (a64fx_addrcost_table): New.
	(a64fx_regmove_cost, a64fx_vector_cost): New.
	(a64fx_tunings): Use the new added cost tables.
2021-01-13 15:22:09 +08:00
Jakub Jelinek b668a06e37 i386: Optimize _mm_unpacklo_epi8 of 0 vector as second argument or similar VEC_PERM_EXPRs into pmovzx [PR95905]
The following patch adds patterns (so far 128-bit only) for permutations
like { 0 16 1 17 2 18 3 19 4 20 5 21 6 22 7 23 } where the second
operand is CONST0_RTX CONST_VECTOR to be emitted as pmovzx.

2021-01-13  Jakub Jelinek  <jakub@redhat.com>

	PR target/95905
	* config/i386/predicates.md (pmovzx_parallel): New predicate.
	* config/i386/sse.md (*sse4_1_zero_extendv8qiv8hi2_3): New
	define_insn_and_split pattern.
	(*sse4_1_zero_extendv4hiv4si2_3): Likewise.
	(*sse4_1_zero_extendv2siv2di2_3): Likewise.

	* gcc.target/i386/pr95905-1.c: New test.
	* gcc.target/i386/pr95905-2.c: New test.
2021-01-13 08:06:25 +01:00
Julian Brown 7993fe1877 amdgcn: Remove dead code for fixed v0 register
This patch removes code to fix the v0 register in
gcn_conditional_register_usage that was missed out of the previous patch
removing the need for that:

  https://gcc.gnu.org/pipermail/gcc-patches/2019-November/534284.html

2021-01-13  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/gcn/gcn.c (gcn_conditional_register_usage): Remove dead code
	to fix v0 register.
2021-01-12 16:46:02 -08:00
Julian Brown 3df6fac008 amdgcn: Fix exec register live-on-entry to BB in md-reorg
This patch fixes a corner case in the AMD GCN md-reorg pass when the
EXEC register is live on entry to a BB, and could be clobbered by code
inserted by the pass before a use in (e.g.) a different BB.

2021-01-13  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/gcn/gcn.c (gcn_md_reorg): Fix case where EXEC reg is live
	on entry to a BB.
2021-01-12 16:46:02 -08:00
Julian Brown c8812bac8e amdgcn: Improve FP division accuracy
GCN has a reciprocal-approximation instruction but no
hardware divide. This patch adjusts the open-coded reciprocal
approximation/Newton-Raphson refinement steps to use fused multiply-add
instructions as is necessary to obtain a properly-rounded result, and
adds further refinement steps to correctly round the full division result.

The patterns in question are still guarded by a flag_reciprocal_math
condition, and do not yet support denormals.

2021-01-13  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/gcn/gcn-valu.md (recip<mode>2<exec>, recip<mode>2): Use unspec
	for reciprocal-approximation instructions.
	(div<mode>3): Use fused multiply-accumulate operations for reciprocal
	refinement and division result.
	* config/gcn/gcn.md (UNSPEC_RCP): New unspec constant.

gcc/testsuite/
	* gcc.target/gcn/fpdiv.c: New test.
2021-01-12 16:46:01 -08:00
Julian Brown abb3993e49 amdgcn: Fix subdf3 pattern
This patch fixes a typo in the subdf3 pattern that meant it had a
non-standard name and thus the compiler would emit a libcall rather than
the proper hardware instruction for DFmode subtraction.

2021-01-13  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/gcn/gcn-valu.md (subdf): Rename to...
	(subdf3): This.
2021-01-12 16:46:01 -08:00
GCC Administrator 6851dda2e7 Daily bump. 2021-01-13 00:16:36 +00:00
Paul E. Murphy cfaaa6a1ca syscall: ensure openat uses variadic libc wrapper
On powerpc64le, this caused a failure in TestUnshareUidGidMapping
due to stack corruption which resulted in a bogus execve syscall.

Use the existing c wrapper to ensure we respect the ppc abi for
variadic functions.

Fixes PR go/98610

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/282717
2021-01-12 13:21:09 -08:00
Martin Sebor 5a9cfad2de Avoid a couple more ICEs in print_mem_ref (PR c/98597).
Resolves:
PR c/98597 - ICE in -Wuninitialized printing a MEM_REF
PR c/98592 - ICE in gimple_canonical_types_compatible_p while formatting

gcc/c-family/ChangeLog:

	PR c/98597
	PR c/98592
	* c-pretty-print.c (print_mem_ref): Avoid assuming MEM_REF operand
	has pointer type.  Remove redundant code.  Avoid calling
	gimple_canonical_types_compatible_p.

gcc/testsuite/ChangeLog:

	PR c/98597
	PR c/98592
	* g++.dg/warn/Wuninitialized-13.C: New test.
	 gcc.dg/uninit-39.c: New test.

	#
2021-01-12 13:03:00 -07:00
Segher Boessenkool 728fee7a79 MAINTAINERS: Fix spacing
We indent with tabs, not spaces.  This fixes it.

2021-01-12  Segher Boessenkool  <segher@kernel.crashing.org>

	* MAINTAINERS: Fix spacing.
2021-01-12 18:41:43 +00:00
Nathan Sidwell e2aa8a5f98 libcody: Simplify configure [PR 98414, 98509]
Libcody's configurey was overly 'clever'.  That didn't play well with
GCC's structure.  This removes lots of that overengineering, using
libcpp as an example.

	libcody/
	* Makefile.in: Remove auto parallelize, swallow Makesub.in. Don't
	check compiler name here.
	* Makesub.in: Delete.
	* build-aux/config.guess: Delete.
	* build-aux/config.sub: Delete.
	* build-aux/install-sh: Delete.
	* dox.cfg.in: Delete.
	* gdbinit.in: Delete.
	* internal.hh (BuildNote): Delete.
	* fatal.cc (BuildNote): Delete.
	* config.m4: Remove unneeded fns.
	* configure.ac: Remove unneccessary checks and configures.
	* configure: Rebuilt.
	* config.h.in: Rebuilt.
2021-01-12 10:32:27 -08:00
Martin Liska 248feb2fa2 gcov: fix printf format for 32-bit hosts
gcc/ChangeLog:

	* gcov.c (source_info::debug): Fix printf format for 32-bit hosts.
2021-01-12 18:16:05 +01:00
Andrea Corallo 1aff68d54c Fix typo in function-abi.h
gcc/Changelog

2021-01-12  Andrea Corallo  <andrea.corallo@arm.com>

	* function-abi.h: Fix typo.
2021-01-12 17:58:32 +01:00
Christophe Lyon 25bef68902 arm: Add movmisalign patterns for MVE (PR target/97875)
This patch adds new movmisalign<mode>_mve_load and store patterns for
MVE to help vectorization. They are very similar to their Neon
counterparts, but use different iterators and instructions.

Indeed MVE supports less vectors modes than Neon, so we use the
MVE_VLD_ST iterator where Neon uses VQX.

Since the supported modes are different from the ones valid for
arithmetic operators, we introduce two new sets of macros:

ARM_HAVE_NEON_<MODE>_LDST
  true if Neon has vector load/store instructions for <MODE>

ARM_HAVE_<MODE>_LDST
  true if any vector extension has vector load/store instructions for <MODE>

We move the movmisalign<mode> expander from neon.md to vec-commond.md, and
replace the TARGET_NEON enabler with ARM_HAVE_<MODE>_LDST.

The patch also updates the mve-vneg.c test to scan for the better code
generation when loading and storing the vectors involved: it checks
that no 'orr' instruction is generated to cope with misalignment at
runtime.
This test was chosen among the other mve tests, but any other should
be OK. Using a plain vector copy loop (dest[i] = a[i]) is not a good
test because the compiler chooses to use memcpy.

For instance we now generate:
test_vneg_s32x4:
	vldrw.32       q3, [r1]
	vneg.s32  q3, q3
	vstrw.32       q3, [r0]
	bx      lr

instead of:
test_vneg_s32x4:
	orr     r3, r1, r0
	lsls    r3, r3, #28
	bne     .L15
	vldrw.32	q3, [r1]
	vneg.s32  q3, q3
	vstrw.32	q3, [r0]
	bx      lr
	.L15:
	push    {r4, r5}
	ldrd    r2, r3, [r1, #8]
	ldrd    r5, r4, [r1]
	rsbs    r2, r2, #0
	rsbs    r5, r5, #0
	rsbs    r4, r4, #0
	rsbs    r3, r3, #0
	strd    r5, r4, [r0]
	pop     {r4, r5}
	strd    r2, r3, [r0, #8]
	bx      lr

2021-01-12  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/97875
	gcc/
	* config/arm/arm.h (ARM_HAVE_NEON_V8QI_LDST): New macro.
	(ARM_HAVE_NEON_V16QI_LDST, ARM_HAVE_NEON_V4HI_LDST): Likewise.
	(ARM_HAVE_NEON_V8HI_LDST, ARM_HAVE_NEON_V2SI_LDST): Likewise.
	(ARM_HAVE_NEON_V4SI_LDST, ARM_HAVE_NEON_V4HF_LDST): Likewise.
	(ARM_HAVE_NEON_V8HF_LDST, ARM_HAVE_NEON_V4BF_LDST): Likewise.
	(ARM_HAVE_NEON_V8BF_LDST, ARM_HAVE_NEON_V2SF_LDST): Likewise.
	(ARM_HAVE_NEON_V4SF_LDST, ARM_HAVE_NEON_DI_LDST): Likewise.
	(ARM_HAVE_NEON_V2DI_LDST): Likewise.
	(ARM_HAVE_V8QI_LDST, ARM_HAVE_V16QI_LDST): Likewise.
	(ARM_HAVE_V4HI_LDST, ARM_HAVE_V8HI_LDST): Likewise.
	(ARM_HAVE_V2SI_LDST, ARM_HAVE_V4SI_LDST, ARM_HAVE_V4HF_LDST): Likewise.
	(ARM_HAVE_V8HF_LDST, ARM_HAVE_V4BF_LDST, ARM_HAVE_V8BF_LDST): Likewise.
	(ARM_HAVE_V2SF_LDST, ARM_HAVE_V4SF_LDST, ARM_HAVE_DI_LDST): Likewise.
	(ARM_HAVE_V2DI_LDST): Likewise.
	* config/arm/mve.md (*movmisalign<mode>_mve_store): New pattern.
	(*movmisalign<mode>_mve_load): New pattern.
	* config/arm/neon.md (movmisalign<mode>): Move to ...
	* config/arm/vec-common.md: ... here.

	PR target/97875
	gcc/testsuite/
	* gcc.target/arm/simd/mve-vneg.c: Update test.
2021-01-12 16:51:05 +00:00
Vladimir N. Makarov cf2ac1c30a [PR97969] LRA: Transform pattern `plus (plus (hard reg, const), pseudo)` after elimination
LRA can loop infinitely on targets without `reg + imm` insns.  Register elimination
on such targets can increase register pressure resulting in permanent
stack size increase and changing elimination offset.  To avoid such situation, a simple
transformation can be done to avoid register pressure increase after
generating reload insns containing eliminated hard regs.

gcc/ChangeLog:

	PR target/97969
	* lra-eliminations.c (eliminate_regs_in_insn): Add transformation
	of pattern 'plus (plus (hard reg, const), pseudo)'.

gcc/testsuite/ChangeLog:

	PR target/97969
	* gcc.target/arm/pr97969.c: New.
2021-01-12 11:27:29 -05:00
Patrick Palka e0bec6ceac c++: Fix ICE with CTAD in concept [PR98611]
This patch teaches cp_walk_subtrees to visit the template represented
by a CTAD placeholder, which would otherwise be not visited during
find_template_parameters.  The template may be a template template
parameter (as in the first testcase), or it may implicitly use the
template parameters of an enclosing class template (as in the second
testcase), and in either case we need to visit this tree to record the
template parameters used therein for later satisfaction.

gcc/cp/ChangeLog:

	PR c++/98611
	* tree.c (cp_walk_subtrees) <case TEMPLATE_TYPE_PARM>: Visit
	the template of a CTAD placeholder.

gcc/testsuite/ChangeLog:

	PR c++/98611
	* g++.dg/cpp2a/concepts-ctad1.C: New test.
	* g++.dg/cpp2a/concepts-ctad2.C: New test.
2021-01-12 09:34:41 -05:00
Richard Biener 52a170b1a1 tree-optimization/98550 - fix BB vect unrolling check
This fixes the check that disqualifies BB vectorization because of
required unrolling to match up with the later exact_div we do.  To
not disable the ability to split groups that do not match up
exactly with a choosen vector type this also introduces a soft-fail
mechanism to vect_build_slp_tree_1 which delays failing to after
the matches[] array is populated from other checks and only then
determines the split point according to the vector type.

2021-01-12  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98550
	* tree-vect-slp.c (vect_record_max_nunits): Check whether
	the group size is a multiple of the vector element count.
	(vect_build_slp_tree_1): When we need to fail because
	the vector type choosen causes unrolling do so lazily
	without affecting matches only at the end to guide group splitting.

	* g++.dg/opt/pr98550.C: New testcase.
2021-01-12 15:17:24 +01:00
Martin Liska e91910d357 options: properly compare string arguments
Similarly to 7f967bd2a7, we need to
compare string with strcmp.

gcc/ChangeLog:

	PR c++/97284
	* optc-save-gen.awk: Compare also n_target_save vars with
	strcmp.
2021-01-12 14:04:28 +01:00
Martin Liska b2230210f1 gcov: add more debugging facility
gcc/ChangeLog:

	* gcov.c (source_info::debug): New.
	(print_usage): Add --debug (-D) option.
	(process_args): Likewise.
	(generate_results): Call src->debug after
	accumulate_line_counts.
	(read_graph_file): Properly assign id for EXIT_BLOCK.
	* profile.c (branch_prob): Dump function body before it is
	instrumented.
2021-01-12 12:55:17 +01:00
Jakub Jelinek 24ea113f75 widening_mul: Fix up ICE caused by my signed multiplication overflow pattern recognition changes [PR98629]
As the testcase shows, my latest changes caused ICE on that testcase.
The problem is that arith_overflow_check_p now can change the use_stmt
argument (has a reference), so that if it succeeds (returns non-zero),
it points it to the GIMPLE_COND or EQ/NE or COND_EXPR assignment from the
TRUNC_DIV_EXPR assignment.
The problem was that it would change use_stmt also if it returned 0 in some
cases, such as multiple imm uses of the division, and in one of the callers
if arith_overflow_check_p returns 0 it looks at use_stmt again and performs
other checks, which of course assumes that use_stmt is the one passed
to arith_overflow_check_p and not e.g. NULL instead or some other unrelated
stmt.

The following patch fixes that by only changing use_stmt when we are about
to return non-zero (for the MULT_EXPR case, which is the only one with the
need to use different use_stmt).

2021-01-12  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/98629
	* tree-ssa-math-opts.c (arith_overflow_check_p): Don't update use_stmt
	unless returning non-zero.

	* gcc.c-torture/compile/pr98629.c: New test.
2021-01-12 11:04:46 +01:00
Jakub Jelinek 13d47c37a2 reassoc: Optimize in reassoc x < 0 && y < 0 to (x | y) < 0 etc. [PR95731]
We already had x != 0 && y != 0 to (x | y) != 0 and
x != -1 && y != -1 to (x & y) != -1 and
x < 32U && y < 32U to (x | y) < 32U, this patch adds signed
x < 0 && y < 0 to (x | y) < 0.  In that case, the low/high seem to be
always the same and just in_p indices whether it is >= 0 or < 0,
also, all types in the same bucket (same precision) should be type
compatible, but we can have some >= 0 and some < 0 comparison mixed,
so the patch handles that by using the right BIT_IOR_EXPR or BIT_AND_EXPR
and doing one set of < 0 or >= 0 first, then BIT_NOT_EXPR and then the other
one.  I had to move optimize_range_tests_var_bound before this optimization
because that one deals with signed a >= 0 && a < b, and limited it to the
last reassoc pass as reassoc itself can't virtually undo this optimization
yet (and not sure if vrp would be able to).

2021-01-12  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/95731
	* tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Also optimize
	x < 0 && y < 0 && z < 0 into (x | y | z) < 0 for signed x, y, z.
	(optimize_range_tests): Call optimize_range_tests_cmp_bitwise
	only after optimize_range_tests_var_bound.

	* gcc.dg/tree-ssa/pr95731.c: New test.
	* gcc.c-torture/execute/pr95731.c: New test.
2021-01-12 11:03:40 +01:00
Jakub Jelinek ff99d05f40 configure, make: Fix up --enable-link-serialization
As reported by Matthias, --enable-link-serialization=1 can currently start
two concurrent links first (e.g. gnat1 and cc1).
The problem is that make var = value values seem to work differently between
dependencies and actual rules (where it was tested).
As the language make fragments can be in different order, we can have:
ada.prev = ... magic that will become $(c.serial) under --enable-link-serialization=1
gnat1$(exe): ..... $(ada.prev)
	...
c.serial = cc1$(exe)
and while if I add echo $(ada.prev) in the gnat1 rule's command, it prints
cc1, the dependencies are actually evaluated during reading of the goal or
when.
The configure creates (and puts into Makefile) some serialization order of
the languages and in that order c always comes first, and the rest is
actually sorted the way the all_lang_makefrags are already sorted,
so just by forcing c/Make-lang.in first we achieve that X.serial variable
is always defined before some other Y.prev will use it in its goal
dependencies.

2021-01-12  Jakub Jelinek  <jakub@redhat.com>

	* configure.ac: Ensure c/Make-lang.in comes first in @all_lang_makefrags@.
	* configure: Regenerated.
2021-01-12 11:02:16 +01:00
Qian Jianhua ab96073df0 MAINTAINERS: Add myself for write after approval
ChangeLog:

2021-01-12  Qian Jianhua  <qianjh@cn.fujitsu.com>

	* MAINTAINERS (Write After Approval): Add myself
2021-01-12 15:32:43 +08:00
Marek Polacek 814299a9d4 c++: -Wmissing-field-initializers in unevaluated ctx [PR98620]
This PR wants us not to warn about missing field initializers when
the code in question takes places in decltype and similar.  Fixed
thus.

gcc/cp/ChangeLog:

	PR c++/98620
	* typeck2.c (process_init_constructor_record): Don't emit
	-Wmissing-field-initializers warnings in unevaluated contexts.

gcc/testsuite/ChangeLog:

	PR c++/98620
	* g++.dg/warn/Wmissing-field-initializers-2.C: New test.
2021-01-11 22:31:39 -05:00
liuhongt 240f0a490d Delete dead code in ix86_expand_sse_comi.
d->flag is always 0 for builtins located in
BDESC_FIRST (comi,COMI,...)
...
BDESC_END (COMI, PCMPESTR)

gcc/ChangeLog:
	PR target/98612
	* config/i386/i386-builtins.h (BUILTIN_DESC_SWAP_OPERANDS):
	Deleted.
	* config/i386/i386-expand.c (ix86_expand_sse_comi): Delete
	dead code.
2021-01-12 11:17:29 +08:00
Alexandre Oliva 640296c367 make FOR_EACH_IMM_USE_STMT safe for early exits
Use a dtor to automatically remove ITER from IMM_USE list in
FOR_EACH_IMM_USE_STMT.


for  gcc/ChangeLog

	* ssa-iterators.h (end_imm_use_stmt_traverse): Forward
	declare.
	(auto_end_imm_use_stmt_traverse): New struct.
	(FOR_EACH_IMM_USE_STMT): Use it.
	(BREAK_FROM_IMM_USE_STMT, RETURN_FROM_IMM_USE_STMT): Remove,
	along with uses...
	* gimple-ssa-strength-reduction.c: ... here, ...
	* graphite-scop-detection.c: ... here, ...
	* ipa-modref.c, ipa-pure-const.c, ipa-sra.c: ... here, ...
	* tree-predcom.c, tree-ssa-ccp.c: ... here, ...
	* tree-ssa-dce.c, tree-ssa-dse.c: ... here, ...
	* tree-ssa-loop-ivopts.c, tree-ssa-math-opts.c: ... here, ...
	* tree-ssa-phiprop.c, tree-ssa.c: ... here, ...
	* tree-vect-slp.c: ... and here, ...
	* doc/tree-ssa.texi: ... and the example here.
2021-01-11 23:37:59 -03:00
David Malcolm ab88f36072 analyzer: fix ICE merging dereferencing unknown ptrs [PR98628]
gcc/analyzer/ChangeLog:
	PR analyzer/98628
	* store.cc (binding_cluster::make_unknown_relative_to): Don't mark
	dereferenced unknown pointers as having escaped.

gcc/testsuite/ChangeLog:
	PR analyzer/98628
	* gcc.dg/analyzer/pr98628.c: New test.
2021-01-11 20:23:41 -05:00
GCC Administrator 67fbb7f0fd Daily bump. 2021-01-12 00:16:22 +00:00
Richard Sandiford a958b2fc6d aarch64: Add support for unpacked SVE ASRD
This patch adds support for both conditional and unconditional unpacked
ASRD.  This meant adding a new define_insn for the unconditional form,
instead of reusing the conditional instructions.  It also meant
extending the current conditional patterns to support merging with
any independent value, not just zero.

gcc/
	* config/aarch64/aarch64-sve.md (sdiv_pow2<mode>3): Extend from
	SVE_FULL_I to SVE_I.  Generate an UNSPEC_PRED_X.
	(*sdiv_pow2<mode>3): New pattern.
	(@cond_<sve_int_op><mode>): Extend from SVE_FULL_I to SVE_I.
	Wrap the ASRD in an UNSPEC_PRED_X.
	(*cond_<sve_int_op><mode>_2): Likewise.  Replace the UNSPEC_PRED_X
	predicate with a constant PTRUE, if it isn't already.
	(*cond_<sve_int_op><mode>_z): Replace with...
	(*cond_<sve_int_op><mode>_any): ...this new pattern.

gcc/testsuite/
	* gcc.target/aarch64/sve/asrdiv_4.c: New test.
	* gcc.target/aarch64/sve/cond_asrd_1.c: Likewise.
	* gcc.target/aarch64/sve/cond_asrd_1_run.c: Likewise.
	* gcc.target/aarch64/sve/cond_asrd_2.c: Likewise.
	* gcc.target/aarch64/sve/cond_asrd_2_run.c: Likewise.
	* gcc.target/aarch64/sve/cond_asrd_3.c: Likewise.
	* gcc.target/aarch64/sve/cond_asrd_3_run.c: Likewise.
2021-01-11 18:03:26 +00:00
Richard Sandiford 37426e0f06 aarch64: Add support for unpacked SVE conditional BIC
This patch adds support for unpacked conditional BIC.  The type suffix
could be taken from the element size or the container size, so the
patch continues to use the element size.  This is consistent with
the existing support for unconditional BIC.

gcc/
	* config/aarch64/aarch64-sve.md (*cond_bic<mode>_2): Extend from
	SVE_FULL_I to SVE_I.
	(*cond_bic<mode>_any): Likewise.

gcc/testsuite/
	* g++.target/aarch64/sve/cond_bic_1.C: New test.
	* g++.target/aarch64/sve/cond_bic_2.C: Likewise.
	* g++.target/aarch64/sve/cond_bic_3.C: Likewise.
	* g++.target/aarch64/sve/cond_bic_4.C: Likewise.
2021-01-11 18:03:25 +00:00
Richard Sandiford 7446de5a2a aarch64: Add support for unpacked SVE MULH
This patch extends the SMULH and UMULH support to unpacked vectors.
The type suffix must be taken from the element size rather than the
container size.

The main use of these patterns is to support division and modulus
by a constant.  The conditional forms would be hard to trigger from
non-ACLE code, and ACLE code needs fully-packed vectors only.

gcc/
	* config/aarch64/aarch64-sve.md (<su>mul<mode>3_highpart)
	(@aarch64_pred_<MUL_HIGHPART:optab><mode>): Extend from SVE_FULL_I
	to SVE_I.

gcc/testsuite/
	* gcc.target/aarch64/sve/mul_highpart_3.c: New test.
2021-01-11 18:03:24 +00:00
Richard Sandiford 907ea37955 aarch64: Add support for unpacked SVE ABD
This patch adds support for unpacked SVE SABD and UABD.
It also rewrites the patterns so that they match as combine
patterns without the need for REG_EQUAL notes.  Finally,
there was no pattern for merging with the second input,
which can be handled by reversing the operands.

The type suffix needs to be taken from the element size rather
than the container size.

gcc/
	* config/aarch64/aarch64-sve.md (<su>abd<mode>_3): Extend from
	SVE_FULL_I to SVE_I.
	(*aarch64_cond_<su>abd<mode>_2): Likewise.
	(*aarch64_cond_<su>abd<mode>_any): Likewise.
	(@aarch64_pred_<su>abd<mode>): Likewise.  Use UNSPEC_PRED_X
	for the max and min but not for the minus.
	(*aarch64_cond_<su>abd<mode>_3): New pattern.

gcc/testsuite/
	* g++.target/aarch64/sve/abd_1.C: New test.
	* g++.target/aarch64/sve/cond_abd_1.C: Likewise.
	* g++.target/aarch64/sve/cond_abd_2.C: Likewise.
	* g++.target/aarch64/sve/cond_abd_3.C: Likewise.
	* g++.target/aarch64/sve/cond_abd_4.C: Likewise.
2021-01-11 18:03:23 +00:00
Richard Sandiford 3f8b0bba03 aarch64: Add support for unpacked SVE ADR
This patch extends the ADR patterns to handle unpacked vectors.
They would work with both elements and containers, but since
the instructions only support .s and .d, we get more coverage
by using containers.

gcc/
	* config/aarch64/iterators.md (SVE_24I): New iterator.
	* config/aarch64/aarch64-sve.md (*aarch64_adr<mode>_shift): Extend from
	SVE_FULL_SDI to SVE_24I.  Use containers rather than elements.

gcc/testsuite/
	* gcc.target/aarch64/sve/adr_6.c: New test.
2021-01-11 18:03:23 +00:00
Richard Sandiford ab76e3db6b aarch64: Add general unpacked SVE conditional binary arithmetic
This patch adds support for conditional binary ADD, SUB, MUL, SMAX,
UMAX, SMIN, UMIN, LSL, LSR, ASR, AND, ORR and EOR.  It's not really
possible to split it up further given how the patterns are written.

Min, max and right-shift need the element size rather than the container
size.  The others would work with both, although MUL should be more
efficient when applied to elements instead of containers.

gcc/
	* config/aarch64/aarch64-sve.md (@cond_<SVE_INT_BINARY:optab><mode>)
	(*cond_<SVE_INT_BINARY:optab><mode>_2): Extend from SVE_FULL_I
	to SVE_I.
	(*cond_<SVE_INT_BINARY:optab><mode>_3): Likewise.
	(*cond_<SVE_INT_BINARY:optab><mode>_any): Likewise.
	(*cond_<SVE_INT_BINARY:optab><mode>_2_const): Likewise.
	(*cond_<SVE_INT_BINARY:optab><mode>_any_const): Likewise.

gcc/testsuite/
	* g++.target/aarch64/sve/cond_arith_1.C: New test.
	* g++.target/aarch64/sve/cond_arith_2.C: Likewise.
	* g++.target/aarch64/sve/cond_arith_3.C: Likewise.
	* g++.target/aarch64/sve/cond_arith_4.C: Likewise.
	* g++.target/aarch64/sve/cond_shift_1.C: New test.
	* g++.target/aarch64/sve/cond_shift_2.C: Likewise.
	* g++.target/aarch64/sve/cond_shift_3.C: Likewise.
	* g++.target/aarch64/sve/cond_shift_4.C: Likewise.
2021-01-11 18:03:22 +00:00
Richard Sandiford 48c7f5b881 aarch64: Add support for unpacked SVE mult, max and min
This patch makes the SVE_INT_BINARY_IMM patterns support
unpacked arithmetic, covering MUL, SMAX, SMIN, UMAX and UMIN.
For min and max, the type suffix must be taken from the element
size rather than the container size.

The XFAILs are due to PR98602.

gcc/
	* config/aarch64/aarch64-sve.md (<SVE_INT_BINARY_IMM:optab><mode>3)
	(@aarch64_pred_<SVE_INT_BINARY_IMM:optab><mode>)
	(*post_ra_<SVE_INT_BINARY_IMM:optab><mode>3): Extend from SVE_FULL_I
	to SVE_I.

gcc/testsuite/
	PR testsuite/98602
	* g++.target/aarch64/sve/max_1.C: New test.
	* g++.target/aarch64/sve/min_1.C: Likewise.
	* gcc.target/aarch64/sve/mul_2.c: Likewise.
2021-01-11 18:03:21 +00:00
Richard Sandiford b81fbfe1eb aarch64: Add support for unpacked SVE shifts
This patch adds support for unpacked SVE LSL, ASR and LSR.
For right shifts, the type suffix needs to be taken from the
element size rather than the container size.

gcc/
	* config/aarch64/aarch64-sve.md (<ASHIFT:optab><mode>3)
	(v<ASHIFT:optab><mode>3, @aarch64_pred_<optab><mode>)
	(*post_ra_v<ASHIFT:optab><mode>3): Extend from SVE_FULL_I to SVE_I.

gcc/testsuite/
	* gcc.target/aarch64/sve/shift_2.c: New test.
2021-01-11 18:03:20 +00:00
Martin Liska cbe9758ff4 Properly release symtab::m_clones.
gcc/ChangeLog:

	PR jit/98615
	* symtab-clones.h (clone_info::release): Release
	symtab::m_clones with ggc_delete as it's a GGC memory.
2021-01-11 18:15:06 +01:00