platform/upstream/gcc.git
3 years agotestsuite/96147 - remove scanning for ! vect_hw_misalign
Richard Biener [Fri, 15 Jan 2021 12:49:04 +0000 (13:49 +0100)]
testsuite/96147 - remove scanning for ! vect_hw_misalign

This removes scanning that's too difficult to get correct for all
targets, leaving the correctness test for them and keeping the
vectorization capability check to vect_hw_misalign targets.

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

PR testsuite/96147
* gcc.dg/vect/slp-43.c: Remove ! vect_hw_misalign scan.

3 years agoarm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics
Christophe Lyon [Thu, 15 Oct 2020 17:13:59 +0000 (17:13 +0000)]
arm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics

This patch adds implementations for vceqq_p64, vceqz_p64 and
vceqzq_p64 intrinsics.

vceqq_p64 uses the existing vceq_p64 after splitting the input vectors
into their high and low halves.

vceqz[q] simply call the vceq and vceqq with a second argument equal
to zero.

The added (executable) testcases make sure that the poly64x2_t
variants have results with one element of all zeroes (false) and the
other element with all bits set to one (true).

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

gcc/
PR target/71233
* config/arm/arm_neon.h (vceqz_p64, vceqq_p64, vceqzq_p64): New.

gcc/testsuite/
PR target/71233
* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c: Add tests for
vceqz_p64, vceqq_p64 and vceqzq_p64.

3 years agotestsuite/96098 - remove redundant testcase
Richard Biener [Fri, 15 Jan 2021 12:31:28 +0000 (13:31 +0100)]
testsuite/96098 - remove redundant testcase

The testcase morphed in a way no longer testing what it was originally supposed to do and slightly altering it shows the original issue isn't fixed (anymore).
The limit as set as result of PR91403 (and dups) prevents the issue for larger
arrays but the testcase has

double a[128][128];

which results in a group size of "just" 512 (the limit is 4096).  Avoiding
the 'BB vectorization with gaps at the end of a load is not supported'
by altering it to do

void foo(void)
{
  b[0] = a[0][0];
  b[1] = a[1][0];
  b[2] = a[2][0];
  b[3] = a[3][127];
}

shows that costing has improved further to not account the dead loads making
the previous test inefficient.  In fact the underlying issue isn't fixed
(we do code-generate dead loads).

In fact the vector permute load is even profitable, just the excessive
code-generation issue exists (and is "fixed" by capping it a constant
boundary, just too high for this particular testcase).

The testcase now has "dups", so I'll simply remove it.

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

PR testsuite/96098
* gcc.dg/vect/bb-slp-pr68892.c: Remove.

3 years agolibatomic, libgomp, libitc: Fix bootstrap [PR70454]
Jakub Jelinek [Fri, 15 Jan 2021 12:12:59 +0000 (13:12 +0100)]
libatomic, libgomp, libitc: Fix bootstrap [PR70454]

The recent changes to error on mixing -march=i386 and -fcf-protection broke
bootstrap.  This patch changes lib{atomic,gomp,itm} configury, so that it
only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't
on by default already).  Similarly, it will not use ifuncs if -mcx16
(or -march=i686 for 32-bit) is on by default.

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

PR target/70454
libatomic/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.  Determine if try_ifunc is needed
based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.
libgomp/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
libitm/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.

3 years agoarm: Auto-vectorization for MVE: vshr
Christophe Lyon [Thu, 19 Nov 2020 16:25:48 +0000 (16:25 +0000)]
arm: Auto-vectorization for MVE: vshr

This patch enables MVE vshr instructions for auto-vectorization.  New
MVE patterns are introduced that take a vector of constants as second
operand, all constants being equal.

The existing mve_vshrq_n_<supf><mode> is kept, as it takes a single
immediate as second operand, and is used by arm_mve.h.

The vashr<mode>3 and vlshr<mode>3 expanders are moved fron neon.md to
vec-common.md, updated to rely on the normal expansion scheme to
generate shifts by immediate.

2020-12-03  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/mve.md (mve_vshrq_n_s<mode>_imm): New entry.
(mve_vshrq_n_u<mode>_imm): Likewise.
* config/arm/neon.md (vashr<mode>3, vlshr<mode>3): Move to ...
* config/arm/vec-common.md: ... here.

gcc/testsuite/
* gcc.target/arm/simd/mve-vshr.c: Add tests for vshr.

3 years agoarm: Auto-vectorization for MVE: vshl
Christophe Lyon [Mon, 16 Nov 2020 14:58:19 +0000 (14:58 +0000)]
arm: Auto-vectorization for MVE: vshl

This patch enables MVE vshlq instructions for auto-vectorization.

The existing mve_vshlq_n_<supf><mode> is kept, as it takes a single
immediate as second operand, and is used by arm_mve.h.

We move the vashl<mode>3 insn from neon.md to an expander in
vec-common.md, and the mve_vshlq_<supf><mode> insn from mve.md to
vec-common.md, adding the second alternative fron neon.md.

mve_vshlq_<supf><mode> will be used by a later patch enabling
vectorization for vshr, as a unified version of
ashl3<mode3>_[signed|unsigned] from neon.md. Keeping the use of unspec
VSHLQ enables to generate both 's' and 'u' variants.

It is not clear whether the neon_shift_[reg|imm]<q> attribute is still
suitable, since this insn is also used for MVE.

I kept the mve_vshlq_<supf><mode> naming instead of renaming it to
ashl3_<supf>_<mode> as discussed because the reference in
arm_mve_builtins.def automatically inserts the "mve_" prefix and I
didn't want to make a special case for this.

I haven't yet found why the v16qi and v8hi tests are not vectorized.
With dest[i] = a[i] << b[i] and:
  {
    int i;
    unsigned int i.24_1;
    unsigned int _2;
    int16_t * _3;
    short int _4;
    int _5;
    int16_t * _6;
    short int _7;
    int _8;
    int _9;
    int16_t * _10;
    short int _11;
    unsigned int ivtmp_42;
    unsigned int ivtmp_43;

    <bb 2> [local count: 119292720]:

    <bb 3> [local count: 954449105]:
    i.24_1 = (unsigned int) i_23;
    _2 = i.24_1 * 2;
    _3 = a_15(D) + _2;
    _4 = *_3;
    _5 = (int) _4;
    _6 = b_16(D) + _2;
    _7 = *_6;
    _8 = (int) _7;
    _9 = _5 << _8;
    _10 = dest_17(D) + _2;
    _11 = (short int) _9;
    *_10 = _11;
    i_19 = i_23 + 1;
    ivtmp_42 = ivtmp_43 - 1;
    if (ivtmp_42 != 0)
      goto <bb 5>; [87.50%]
    else
      goto <bb 4>; [12.50%]

    <bb 5> [local count: 835156386]:
    goto <bb 3>; [100.00%]

    <bb 4> [local count: 119292720]:
    return;

  }
the vectorizer says:
mve-vshl.c:37:96: note:   ==> examining statement: _5 = (int) _4;
mve-vshl.c:37:96: note:   vect_is_simple_use: operand *_3, type of def: internal
mve-vshl.c:37:96: note:   vect_is_simple_use: vectype vector(8) short int
mve-vshl.c:37:96: missed:   conversion not supported by target.
mve-vshl.c:37:96: note:   vect_is_simple_use: operand *_3, type of def: internal
mve-vshl.c:37:96: note:   vect_is_simple_use: vectype vector(8) short int
mve-vshl.c:37:96: note:   vect_is_simple_use: operand *_3, type of def: internal
mve-vshl.c:37:96: note:   vect_is_simple_use: vectype vector(8) short int
mve-vshl.c:37:117: missed:   not vectorized: relevant stmt not supported: _5 = (int) _4;
mve-vshl.c:37:96: missed:  bad operation or unsupported loop bound.
mve-vshl.c:37:96: note:  ***** Analysis failed with vector mode V8HI

2020-12-03  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/mve.md (mve_vshlq_<supf><mode>): Move to
vec-commond.md.
* config/arm/neon.md (vashl<mode>3): Delete.
* config/arm/vec-common.md (mve_vshlq_<supf><mode>): New.
(vasl<mode>3): New expander.

gcc/testsuite/
* gcc.target/arm/simd/mve-vshl.c: Add tests for vshl.

3 years agotree-optimization/98685 - fix placement of extern converts
Richard Biener [Fri, 15 Jan 2021 09:08:58 +0000 (10:08 +0100)]
tree-optimization/98685 - fix placement of extern converts

Avoid advancing to the next stmt when inserting at region boundary
and deal with a vector def being not the only child.

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

PR tree-optimization/98685
* tree-vect-slp.c (vect_schedule_slp_node): Refactor handling
of vector extern defs.

* gcc.dg/vect/bb-slp-pr98685.c: New testcase.

3 years agotestsuite: Fix sed script errors in complex tests
Tamar Christina [Fri, 15 Jan 2021 09:14:30 +0000 (09:14 +0000)]
testsuite: Fix sed script errors in complex tests

I ran sed script late over the tests which accidentally
introduced a syntax error in the tests.

This fixes it.

Committed under the obvious rule.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/complex/complex-mla-template.c: Fix sed.
* gcc.dg/vect/complex/complex-mls-template.c: Likewise.

3 years agocompiler: add support for reading embedcfg files
Ian Lance Taylor [Tue, 5 Jan 2021 02:37:08 +0000 (18:37 -0800)]
compiler: add support for reading embedcfg files

This is the code that parses an embedcfg file, which is a JSON file
created by the go command when it sees go:embed directives.  This code
is not yet called, and does not yet do anything.  It's being sent as a
separate CL to isolate just the JSON parsing code.

* Make-lang.in (GO_OBJS): Add go/embed.o.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281532

3 years agoDaily bump.
GCC Administrator [Fri, 15 Jan 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.

3 years agojit: remove "Alpha" warning from docs
David Malcolm [Thu, 14 Jan 2021 22:54:02 +0000 (17:54 -0500)]
jit: remove "Alpha" warning from docs

I removed the "Alpha" warning from the JIT wiki page on
2020-05-18:
  https://gcc.gnu.org/wiki/JIT?action=diff&rev1=47&rev2=48
but forgot to remove it from the documentation, which this
patch does.

gcc/jit/ChangeLog:
* docs/cp/index.rst: Remove "Alpha" warning.
* docs/index.rst: Likewise.
* docs/_build/texinfo/libgccjit.texi: Regenerate

3 years agoc++: Minor refactoring in process_init_constructor_record
Jason Merrill [Tue, 12 Jan 2021 20:57:05 +0000 (15:57 -0500)]
c++: Minor refactoring in process_init_constructor_record

This function had two different local variables for TREE_TYPE (field), one
of which shadowed a parameter, and wasn't using them consistently.

gcc/cp/ChangeLog:

* typeck2.c (process_init_constructor_record): Use fldtype
variable consistently.

3 years agoHandle fancy_abort before diagnostic initialization [PR98586]
David Malcolm [Thu, 14 Jan 2021 22:02:28 +0000 (17:02 -0500)]
Handle fancy_abort before diagnostic initialization [PR98586]

If fancy_abort is called before the diagnostic subsystem is initialized,
internal_error will crash internally in a way that prevents a useful
message reaching the user.

This can happen with libgccjit in the case of gcc_assert failures
that occur outside of the libgccjit mutex that guards the rest of
gcc's state, including global_dc (when global_dc may not be
initialized yet, or might be in use by another thread).

I tried a few approaches to fixing this as noted in PR jit/98586
e.g. using a temporary diagnostic_context and initializing it for
the call to internal_error, however the more code that runs, the
more chance there is for other errors to occur.

The best fix appears to be to simply fall back to a minimal abort
implementation that only relies on i18n, as implemented by this
patch.

gcc/ChangeLog:
PR jit/98586
* diagnostic.c (diagnostic_kind_text): Break out this array
from...
(diagnostic_build_prefix): ...here.
(fancy_abort): Detect when diagnostic_initialize has not yet been
called and fall back to a minimal implementation of printing the
ICE, rather than segfaulting in internal_error.

3 years agolibstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators
François Dumont [Thu, 14 Jan 2021 21:41:23 +0000 (22:41 +0100)]
libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators

libstdc++-v3/ChangeLog:

* testsuite/23_containers/deque/debug/98466.cc: Make it pre-C++11
compliant.

3 years agoAdd GCC_EXTRA_DIAGNOSTIC_OUTPUT environment variable for fix-it hints
David Malcolm [Thu, 14 Jan 2021 21:25:02 +0000 (16:25 -0500)]
Add GCC_EXTRA_DIAGNOSTIC_OUTPUT environment variable for fix-it hints

GCC has had the ability to emit fix-it hints in machine-readable form
since GCC 7 via -fdiagnostics-parseable-fixits and
-fdiagnostics-generate-patch.

The former emits additional specially-formatted lines to stderr; the
option and its format were directly taken from a pre-existing option
in clang.

Ideally this could be used by IDEs so that the user can select specific
fix-it hints and have the IDE apply them to the user's source code
(perhaps turning them into clickable elements, perhaps with an
"Apply All" option, etc).  Eclipse CDT has supported this option in
this way for a few years:
  https://bugs.eclipse.org/bugs/show_bug.cgi?id=497670

As a user of Emacs I would like Emacs to support such a feature.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25987 tracks supporting
GCC fix-it output in Emacs.  The discussion there identifies two issues
with the existing option:

(a) columns in the output are specified as byte-offsets within the
line (for exact compatibility with the option in clang), whereas emacs
would prefer to consume them as what GCC 11 calls "display columns".
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-column-unit

(b) injecting a command-line option into the build is a fiddly manual
step, varying between build systems.  It's far easier for the
user if Emacs simply sets an environment variable when compiling,
GCC uses this to enable the option if it recognizes the value, and
the emacs compilation buffer decodes the additional lines of output
and adds appropriate widgets.  In some ways it is a workaround for
not having a language server.  Doing it this way means that for the
various combinations of older and newer GCC and older and newer Emacs
that a sufficiently modern combination of both can automatically
support the rich fix-it UI, whereas other combinations will either
not provide the envvar, or silently ignore it, gracefully doing
nothing extra.

Hence this patch adds a new GCC_EXTRA_DIAGNOSTIC_OUTPUT environment
variable to GCC which enables output of machine-parseable fix-it hints.

GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v1 is equivalent to the existing
-fdiagnostics-parseable-fixits option.

GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v2 is the same, but changes the
column output mode to "display columns" rather than bytes, as
required by Emacs.

The discussion in that Emacs bug has some concerns about the encoding
of these lines, and, indeed, the encoding of GCC's stderr in general:
currently we emit a mixture of bytes and UTF-8; I believe we emit
filenames as bytes, diagnostic messages as UTF-8, and quote source code
in the original encoding (PR other/93067 covers converting it to UTF-8 on
output).  This patch prints octal-escaped bytes for bytes within
filenames and replacement text that aren't printable (as per
-fdiagnostics-parseable-fixits).

gcc/ChangeLog:
* diagnostic.c (diagnostic_initialize): Eliminate
parseable_fixits_p in favor of initializing extra_output_kind from
GCC_EXTRA_DIAGNOSTIC_OUTPUT.
(convert_column_unit): New function, split out from...
(diagnostic_converted_column): ...this.
(print_parseable_fixits): Add "column_unit" and "tabstop" params.
Use them to call convert_column_unit on the column values.
(diagnostic_report_diagnostic): Eliminate conditional on
parseable_fixits_p in favor of a switch statement on
extra_output_kind, passing the appropriate values to the new
params of print_parseable_fixits.
(selftest::test_print_parseable_fixits_none): Update for new
params of print_parseable_fixits.
(selftest::test_print_parseable_fixits_insert): Likewise.
(selftest::test_print_parseable_fixits_remove): Likewise.
(selftest::test_print_parseable_fixits_replace): Likewise.
(selftest::test_print_parseable_fixits_bytes_vs_display_columns):
New.
(selftest::diagnostic_c_tests): Call it.
* diagnostic.h (enum diagnostics_extra_output_kind): New.
(diagnostic_context::parseable_fixits_p): Delete field in favor
of...
(diagnostic_context::extra_output_kind): ...this new field.
* doc/invoke.texi (Environment Variables): Add
GCC_EXTRA_DIAGNOSTIC_OUTPUT.
* opts.c (common_handle_option): Update handling of
OPT_fdiagnostics_parseable_fixits for change to diagnostic_context
fields.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-show-locus-GCC_EXTRA_DIAGNOSTIC_OUTPUT-fixits-v1.c:
New file.
* gcc.dg/plugin/diagnostic-test-show-locus-GCC_EXTRA_DIAGNOSTIC_OUTPUT-fixits-v2.c:
New file.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.

3 years agoslp: Add Tests for complex mul, mls and mla"
Tamar Christina [Thu, 14 Jan 2021 21:01:15 +0000 (21:01 +0000)]
slp: Add Tests for complex mul, mls and mla"

This adds the initial tests for the complex mul, mls and mla.
These will be enabled in the commits that add the optabs.

Committed as obvious variations of existing tests.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/complex/complex-mla-template.c: New test.
* gcc.dg/vect/complex/complex-mls-template.c: New test.
* gcc.dg/vect/complex/complex-mul-template.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-double.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-double.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-double.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c: New test.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mla-double.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mla-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mla-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mls-double.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mls-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mls-half-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mul-double.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mul-float.c: New test.
* gcc.dg/vect/complex/fast-math-complex-mul-half-float.c: New test.

3 years agoslp: Add complex operations class to share first match among all matchers
Tamar Christina [Thu, 14 Jan 2021 21:00:10 +0000 (21:00 +0000)]
slp: Add complex operations class to share first match among all matchers

This introduces a common class complex_operations_pattern which encapsulates
the complex add, mul, fma and fms pattern in such a way so that the first match
is shared.

gcc/ChangeLog:

* tree-vect-slp-patterns.c (class complex_operations_pattern,
complex_operations_pattern::matches,
complex_operations_pattern::recognize,
complex_operations_pattern::build): New.
(slp_patterns): Use it.

3 years agoslp: support complex FMS and complex FMS conjugate
Tamar Christina [Thu, 14 Jan 2021 20:59:12 +0000 (20:59 +0000)]
slp: support complex FMS and complex FMS conjugate

This adds support for FMS and FMS conjugated to the slp pattern matcher.

Example of matches:

#include <stdio.h>
#include <complex.h>

#define N 200
#define ROT
#define TYPE float
#define TYPE2 float

void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] -=  a[i] * (b[i] ROT);
    }
}

void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] -=  conjf (a[i]) * (b[i]);
    }
}

void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] -=  a[i] * conjf (b[i] ROT);
    }
}

void caxpy_sub(double complex * restrict y, double complex * restrict x, size_t N, double complex f) {
  for (size_t i = 0; i < N; ++i)
    y[i] -= x[i]* f;
}

gcc/ChangeLog:

* internal-fn.def (COMPLEX_FMS, COMPLEX_FMS_CONJ): New.
* optabs.def (cmls_optab, cmls_conj_optab): New.
* doc/md.texi: Document them.
* tree-vect-slp-patterns.c (class complex_fms_pattern,
complex_fms_pattern::matches, complex_fms_pattern::recognize,
complex_fms_pattern::build): New.

3 years agoslp: support complex FMA and complex FMA conjugate
Tamar Christina [Thu, 14 Jan 2021 20:58:12 +0000 (20:58 +0000)]
slp: support complex FMA and complex FMA conjugate

This adds support for FMA and FMA conjugated to the slp pattern matcher.

Example of instructions matched:

#include <stdio.h>
#include <complex.h>

#define N 200
#define ROT
#define TYPE float
#define TYPE2 float

void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] +=  a[i] * (b[i] ROT);
    }
}

void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] +=  conjf (a[i]) * (b[i] ROT);
    }
}

void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] +=  a[i] * conjf (b[i] ROT);
    }
}

void caxpy_add(double complex * restrict y, double complex * restrict x, size_t N, double complex f) {
  for (size_t i = 0; i < N; ++i)
    y[i] += x[i]* f;
}

gcc/ChangeLog:

* internal-fn.def (COMPLEX_FMA, COMPLEX_FMA_CONJ): New.
* optabs.def (cmla_optab, cmla_conj_optab): New.
* doc/md.texi: Document them.
* tree-vect-slp-patterns.c (vect_match_call_p,
class complex_fma_pattern, vect_slp_reset_pattern,
complex_fma_pattern::matches, complex_fma_pattern::recognize,
complex_fma_pattern::build): New.

3 years agoslp: support complex multiply and complex multiply conjugate
Tamar Christina [Thu, 14 Jan 2021 20:57:17 +0000 (20:57 +0000)]
slp: support complex multiply and complex multiply conjugate

This adds support for complex multiply and complex multiply and accumulate to
the vect pattern detector.

Example of instructions matched:

#include <stdio.h>
#include <complex.h>

#define N 200
#define ROT
#define TYPE float
#define TYPE2 float

void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] =  a[i] * (b[i] ROT);
    }
}

void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] =  conjf (a[i]) * (b[i] ROT);
    }
}

void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
{
  for (int i=0; i < N; i++)
    {
      c[i] =  a[i] * conjf (b[i] ROT);
    }
}

gcc/ChangeLog:

* internal-fn.def (COMPLEX_MUL, COMPLEX_MUL_CONJ): New.
* optabs.def (cmul_optab, cmul_conj_optab): New.
* doc/md.texi: Document them.
* tree-vect-slp-patterns.c (vect_match_call_complex_mla,
vect_normalize_conj_loc, is_eq_or_top, vect_validate_multiplication,
vect_build_combine_node, class complex_mul_pattern,
complex_mul_pattern::matches, complex_mul_pattern::recognize,
complex_mul_pattern::build): New.

3 years agoslp: Support optimizing load distribution
Tamar Christina [Thu, 14 Jan 2021 20:50:57 +0000 (20:50 +0000)]
slp: Support optimizing load distribution

This introduces a post processing step for the pattern matcher to flatten
permutes introduced by the complex multiplications patterns.

This performs a blend early such that SLP is not cancelled by the LOAD_LANES
permute.  This is a temporary workaround to the fact that loads are not CSEd
during building and is required to produce efficient code.

gcc/ChangeLog:

* tree-vect-slp.c (optimize_load_redistribution_1): New.
(optimize_load_redistribution, vect_is_slp_load_node): New.
(vect_match_slp_patterns): Use it.

3 years agoslp: elide intermediate nodes for complex add and avoid truncate
Tamar Christina [Thu, 14 Jan 2021 20:49:55 +0000 (20:49 +0000)]
slp: elide intermediate nodes for complex add and avoid truncate

This applies the same feedback received for MUL and the rest to
ADD which was already committed.  In short it elides the intermediate
nodes vec and avoids the use of truncate on the SLP child.

gcc/ChangeLog:

* tree-vect-slp-patterns.c (complex_add_pattern::build):
Elide nodes.

3 years agoanalyzer: fixes to -fdump-analyzer-json
David Malcolm [Thu, 14 Jan 2021 20:39:14 +0000 (15:39 -0500)]
analyzer: fixes to -fdump-analyzer-json

I've been implementing a PyGTK viewer for the output of
-fdump-analyzer-json, to help me debug analyzer issues:
  https://github.com/davidmalcolm/gcc-analyzer-viewer
The viewer is very much just a work in progress.

This patch adds some fields that were missing from the dump, and
fixes some mistakes I spotted whilst working on the viewer.

gcc/analyzer/ChangeLog:
* engine.cc (strongly_connected_components::to_json): New.
(worklist::to_json): New.
(exploded_graph::to_json): JSON-ify the worklist.
* exploded-graph.h (strongly_connected_components::to_json): New
decl.
(worklist::to_json): New decl.
* store.cc (store::to_json): Fix comment.
* supergraph.cc (supernode::to_json): Fix reference to
"returning_call" in comment.  Add optional "fun" to JSON.
(edge_kind_to_string): New.
(superedge::to_json): Add "kind" to JSON.

3 years agoanalyzer: const fixes [PR98679]
David Malcolm [Thu, 14 Jan 2021 20:25:27 +0000 (15:25 -0500)]
analyzer: const fixes [PR98679]

gcc/analyzer/ChangeLog:
PR analyzer/98679
* analyzer.h (region_offset::operator==): Make const.
* pending-diagnostic.h (pending_diagnostic::equal_p): Likewise.
* store.h (binding_cluster::for_each_value): Likewise.
(binding_cluster::for_each_binding): Likewise.

3 years agoc++: Tweak g++.dg/template/pr98372.C.
Marek Polacek [Thu, 14 Jan 2021 19:44:59 +0000 (14:44 -0500)]
c++: Tweak g++.dg/template/pr98372.C.

This test was failing in C++11 because variable templates are only
available in C++14.

gcc/testsuite/ChangeLog:

* g++.dg/template/pr98372.C: Only run in C++14 and up.

3 years agoPR fortran/93340 - fix missed substring simplifications
Harald Anlauf [Thu, 14 Jan 2021 19:25:33 +0000 (20:25 +0100)]
PR fortran/93340 - fix missed substring simplifications

Substrings were not reduced early enough for use in initializations,
such as DATA statements.  Add an early simplification for substrings
with constant starting and ending points.

gcc/fortran/ChangeLog:

* gfortran.h (gfc_resolve_substring): Add prototype.
* primary.c (match_string_constant): Simplify substrings with
constant starting and ending points.
* resolve.c: Rename resolve_substring to gfc_resolve_substring.
(gfc_resolve_ref): Use renamed function gfc_resolve_substring.

gcc/testsuite/ChangeLog:

* substr_10.f90: New test.
* substr_9.f90: New test.

3 years agocalibrate intervals to avoid zero in futures poll test
Alexandre Oliva [Thu, 14 Jan 2021 19:12:22 +0000 (16:12 -0300)]
calibrate intervals to avoid zero in futures poll test

We get occasional failures of 30_threads/future/members/poll.cc
on some platforms whose high resolution clock doesn't have such a high
resolution; wait_for_0 ends up as 0, and then some asserts fail as
intervals measured as longer than zero are tested for less than
several times zero.

This patch adds some calibration in the iteration count to set a
measurable base time interval with some additional margin.

for  libstdc++-v3/ChangeLog

* testsuite/30_threads/future/members/poll.cc: Calibrate
iteration count.

3 years agouse sigjmp_buf for analyzer sigsetjmp tests
Alexandre Oliva [Thu, 14 Jan 2021 19:12:20 +0000 (16:12 -0300)]
use sigjmp_buf for analyzer sigsetjmp tests

The sigsetjmp analyzer tests use jmp_buf in sigsetjmp and siglongjmp
calls.  Not every system that supports sigsetjmp uses the same data
structure for setjmp and sigsetjmp, which results in type mismatches.

This patch changes the tests to use sigjmp_buf, that is the
POSIX-specific type for use with sigsetjmp and siglongjmp.

for  gcc/testsuite/ChnageLog

* gcc.dg/analyzer/sigsetjmp-5.c: Use sigjmp_buf.
* gcc.dg/analyzer/sigsetjmp-6.c: Likewise.

3 years agodeclare getpass in analyzer/sensitive-1.c test
Alexandre Oliva [Thu, 14 Jan 2021 19:12:19 +0000 (16:12 -0300)]
declare getpass in analyzer/sensitive-1.c test

The getpass function is not available on all systems; and not
necessarily declared in unistd.h, as expected by the sensitive-1
analyzer test.

Since this is a compile-only test, it doesn't really matter if the
function is defined in the system libraries.  All we need is a
declaration, to avoid warnings from calling an undeclared function.
This patch adds the declaration, in a way that is most unlikely to
conflict with any existing declaration.

for  gcc/testsuite/ChangeLog

* gcc.dg/analyzer/sensitive-1.c: Declare getpass.

3 years ago[gcn offloading] Only supported in 64-bit configurations
Thomas Schwinge [Tue, 28 Apr 2020 18:43:38 +0000 (20:43 +0200)]
[gcn offloading] Only supported in 64-bit configurations

Similar to nvptx offloading, see PR65099 "nvptx offloading: hard-coded 64-bit
assumptions".

gcc/
* config/gcn/mkoffload.c (main): Create an offload image only in
64-bit configurations.

3 years agolibstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators
François Dumont [Fri, 1 Jan 2021 16:35:56 +0000 (17:35 +0100)]
libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators

libstdc++-v3/ChangeLog:

PR libstdc++/98466
* include/bits/hashtable_policy.h (_Node_iterator_base()): Set _M_cur to nullptr.
(_Node_iterator()): Make default.
(_Node_const_iterator()): Make default.
* include/debug/macros.h (__glibcxx_check_erae_range_after): Add _M_singular
iterator checks.
* include/debug/safe_iterator.h
(_GLIBCXX_DEBUG_VERIFY_OPERANDS): Accept if both iterator are value initialized.
* include/debug/safe_local_iterator.h (_GLIBCXX_DEBUG_VERIFY_OPERANDS):
Likewise.
* include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_valid_range): Add
_M_singular checks on input iterators.
* src/c++11/debug.cc (_Safe_iterator_base::_M_can_compare): Remove _M_singular
checks.
* testsuite/23_containers/deque/debug/98466.cc: New test.
* testsuite/23_containers/unordered_map/debug/98466.cc: New test.

3 years agoPR fortran/98661 - valgrind issues with error recovery
Harald Anlauf [Thu, 14 Jan 2021 18:21:05 +0000 (19:21 +0100)]
PR fortran/98661 - valgrind issues with error recovery

During error recovery after an invalid derived type specification it was
possible to try to resolve an invalid array specification.  We now skip
this if the component has the ALLOCATABLE or POINTER attribute and the
shape is not deferred.

gcc/fortran/ChangeLog:

PR fortran/98661
* resolve.c (resolve_component): Derived type components with
ALLOCATABLE or POINTER attribute shall have a deferred shape.

gcc/testsuite/ChangeLog:

PR fortran/98661
* gfortran.dg/pr98661.f90: New test.

3 years agoRevert "PR fortran/98661 - valgrind issues with error recovery"
Harald Anlauf [Thu, 14 Jan 2021 18:17:05 +0000 (19:17 +0100)]
Revert "PR fortran/98661 - valgrind issues with error recovery"

This reverts commit d0d2becf2dfe8316c9014d962e7f77773ec5c27e.

3 years agoPR fortran/98661 - valgrind issues with error recovery
Harald Anlauf [Thu, 14 Jan 2021 18:13:16 +0000 (19:13 +0100)]
PR fortran/98661 - valgrind issues with error recovery

During error recovery after an invalid derived type specification it was
possible to try to resolve an invalid array specification.  We now skip
this if the component has the ALLOCATABLE or POINTER attribute and the
shape is not deferred.

gcc/fortran/ChangeLog:

PR fortran/98661
* resolve.c (resolve_component): Derived type components with
ALLOCATABLE or POINTER attribute shall have a deferred shape.

gcc/testsuite/ChangeLog:

PR fortran/98661
* gfortran.dg/pr98661.f90: New test.

3 years agolibgo: update hurd support
Ian Lance Taylor [Wed, 13 Jan 2021 19:54:15 +0000 (11:54 -0800)]
libgo: update hurd support

Patch from Svante Signell.

Fixes PR go/98496

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/283692

3 years ago[nvptx libgomp plugin] Build only in supported configurations
Thomas Schwinge [Mon, 30 Nov 2020 14:15:20 +0000 (15:15 +0100)]
[nvptx libgomp plugin] Build only in supported configurations

As recently again discussed in <https://gcc.gnu.org/PR97436> "[nvptx] -m32
support", nvptx offloading other than for 64-bit host has never been
implemented, tested, supported.  So we simply should buildn't the nvptx libgomp
plugin in this case.

This avoids build problems if, for example, in a (standard) bi-arch
x86_64-pc-linux-gnu '-m64'/'-m32' build, libcuda is available only in a 64-bit
variant but not in a 32-bit one, which, for example, is the case if you build
GCC against the CUDA toolkit's 'stubs/libcuda.so' (see
<https://stackoverflow.com/a/52784819>).

This amends PR65099 commit a92defdab79a1268f4b9dcf42b937e4002a4cf15 (r225560)
"[nvptx offloading] Only 64-bit configurations are currently supported" to
match the way we're doing this for the HSA/GCN plugins.

libgomp/
PR libgomp/65099
* plugin/configfrag.ac (PLUGIN_NVPTX): Restrict to supported
configurations.
* configure: Regenerate.
* plugin/plugin-nvptx.c (nvptx_get_num_devices): Remove 64-bit
check.

3 years agolibstdc++: Define function to throw filesystem_error [PR 98471]
Jonathan Wakely [Thu, 14 Jan 2021 14:26:19 +0000 (14:26 +0000)]
libstdc++: Define function to throw filesystem_error [PR 98471]

Fix ordering problem on Windows targets where filesystem_error was used
before being defined.

libstdc++-v3/ChangeLog:

PR libstdc++/98471
* include/bits/fs_path.h (__throw_conversion_error): New
function to throw or abort on character conversion errors.
(__wstr_from_utf8): Move definition after filesystem_error has
been defined. Use __throw_conversion_error.
(path::_S_convert<_EcharT>): Use __throw_conversion_error.
(path::_S_str_convert<_CharT, _Traits, _Allocator>): Likewise.
(path::u8string): Likewise.

3 years agoRTEMS: Fix Ada build for riscv
Sebastian Huber [Thu, 14 Jan 2021 15:05:14 +0000 (16:05 +0100)]
RTEMS: Fix Ada build for riscv

gcc/ada/

PR ada/98595
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <riscv*-*-rtems*>: Use
wraplf version of Aux_Long_Long_Float.

3 years agogcov: add one more pytest
Martin Liska [Thu, 14 Jan 2021 16:08:32 +0000 (17:08 +0100)]
gcov: add one more pytest

gcc/testsuite/ChangeLog:

* g++.dg/gcov/gcov-17.C: New test.
* g++.dg/gcov/test-gcov-17.py: New test.

3 years agomklog: skip unsupported files
Martin Liska [Thu, 14 Jan 2021 16:06:08 +0000 (17:06 +0100)]
mklog: skip unsupported files

This fixes an infinite loop one could see for:
git show b87ec922c40 | ./contrib/mklog.py

contrib/ChangeLog:

* mklog.py: Fix infinite loop for unsupported files.

3 years agox86: Error on -fcf-protection with incompatible target
H.J. Lu [Thu, 14 Jan 2021 13:56:46 +0000 (05:56 -0800)]
x86: Error on -fcf-protection with incompatible target

-fcf-protection with CF_BRANCH inserts ENDBR32 at function entries.
ENDBR32 is NOP only on 64-bit processors and 32-bit TARGET_CMOV
processors.  Issue an error for -fcf-protection with CF_BRANCH when
compiling for 32-bit non-TARGET_CMOV targets.

gcc/

PR target/98667
* config/i386/i386-options.c (ix86_option_override_internal):
Issue an error for -fcf-protection with CF_BRANCH when compiling
for 32-bit non-TARGET_CMOV targets.

gcc/testsuite/

PR target/98667
* gcc.target/i386/pr98667-1.c: New file.
* gcc.target/i386/pr98667-2.c: Likewise.
* gcc.target/i386/pr98667-3.c: Likewise.

3 years agoi386: Resolve variable shadowing in i386-options.c [PR98671]
Uros Bizjak [Thu, 14 Jan 2021 15:28:27 +0000 (16:28 +0100)]
i386: Resolve variable shadowing in i386-options.c [PR98671]

Also change global variable pta_size to unsigned.

2021-01-14  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/98671
* config/i386/i386-options.c (ix86_valid_target_attribute_inner_p):
Remove declaration and initialization of shadow variable "ret".
(ix86_option_override_internal): Remove delcaration of
shadow variable "i".  Redeclare shadowed variable to unsigned.
* common/config/i386/i386-common.c (pta_size): Redeclare to unsigned.
* config/i386/i386-builtins.c (get_builtin_code_for_version):
Update for redeclaration.
* config/i386/i386.h (pta_size): Ditto.

3 years agotree-optimization/98674 - improve dependence analysis
Richard Biener [Thu, 14 Jan 2021 13:08:41 +0000 (14:08 +0100)]
tree-optimization/98674 - improve dependence analysis

This improves dependence analysis on refs that access the same
array but with different typed but same sized accesses.  That's
obviously safe for the case of types that cannot have any
access function based off them.  For the testcase this is
signed short vs. unsigned short.

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

PR tree-optimization/98674
* tree-data-ref.c (base_supports_access_fn_components_p): New.
(initialize_data_dependence_relation): For two bases without
possible access fns resort to type size equality when determining
shape compatibility.

* gcc.dg/vect/pr98674.c: New testcase.

3 years agoi386: Update PR target/95021 tests
H.J. Lu [Thu, 14 Jan 2021 14:56:17 +0000 (06:56 -0800)]
i386: Update PR target/95021 tests

Also pass -mpreferred-stack-boundary=4 -mno-stackrealign to avoid
disabling STV by:

  /* Disable STV if -mpreferred-stack-boundary={2,3} or
     -mincoming-stack-boundary={2,3} or -mstackrealign - the needed
     stack realignment will be extra cost the pass doesn't take into
     account and the pass can't realign the stack.  */
  if (ix86_preferred_stack_boundary < 128
      || ix86_incoming_stack_boundary < 128
      || opts->x_ix86_force_align_arg_pointer)
    opts->x_target_flags &= ~MASK_STV;

PR target/98676
* gcc.target/i386/pr95021-1.c: Add -mpreferred-stack-boundary=4
-mno-stackrealign.
* gcc.target/i386/pr95021-3.c: Likewise.

3 years agoarm: Replace calls to __builtin_vcge* by <=,>= in arm_neon.h [PR66791]
Prathamesh Kulkarni [Thu, 14 Jan 2021 14:28:35 +0000 (19:58 +0530)]
arm: Replace calls to __builtin_vcge* by <=,>= in arm_neon.h [PR66791]

gcc/
2021-01-14  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR target/66791
* config/arm/arm_neon.h: Replace calls to __builtin_vcge* by
<=, >= operators in vcle and vcge intrinsics respectively.
* config/arm/arm_neon_builtins.def: Remove entry for
vcge and vcgeu.

3 years agolibstdc++: Update copyright dates on new files
Jonathan Wakely [Thu, 14 Jan 2021 14:25:05 +0000 (14:25 +0000)]
libstdc++: Update copyright dates on new files

The patch adding these files was approved in 2020 but it wasn't
committed until 2021, so the copyright years were not updated along with
the years in all the existing files.

libstdc++-v3/ChangeLog:

* include/std/barrier: Update copyright years. Fix whitespace.
* include/std/version: Fix whitespace.
* testsuite/30_threads/barrier/1.cc: Update copyright years.
* 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.

3 years agoc++: Fix erroneous parm comparison logic [PR 98372]
Nathan Sidwell [Thu, 14 Jan 2021 13:15:33 +0000 (05:15 -0800)]
c++: Fix erroneous parm comparison logic [PR 98372]

I flubbed an application of De Morgan's law.  Let's just express the
logic directly and let the compiler figure it out.  This bug made it
look like pr52830 was fixed, but it is not.

PR c++/98372
gcc/cp/
* tree.c (cp_tree_equal): Correct map_context logic.
gcc/testsuite/
* g++.dg/cpp0x/constexpr-52830.C: Restore dg-ice
* g++.dg/template/pr98372.C: New.

3 years agoi386: Remove reduntand assignment in i386-options.c [PR98671]
Uros Bizjak [Thu, 14 Jan 2021 12:21:56 +0000 (13:21 +0100)]
i386: Remove reduntand assignment in i386-options.c [PR98671]

Also rename x86_prefetch_sse to ix86_prefetch_sse.

2021-01-14  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/98671
* config/i386/i386-options.c (ix86_function_specific_save):
Remove redundant assignment to opts->x_ix86_branch_cost.
* config/i386/i386.c (ix86_prefetch_sse):
Rename from x86_prefetch_sse.  Update all uses.
* config/i386/i386.h: Update for rename.
* config/i386/i386-options.h: Ditto.

3 years agoi386: Fix the pmovzx SSE4.1 define_insn_and_split patterns [PR98670]
Jakub Jelinek [Thu, 14 Jan 2021 11:55:19 +0000 (12:55 +0100)]
i386: Fix the pmovzx SSE4.1 define_insn_and_split patterns [PR98670]

I've made two mistakes in the *sse4_1_zero_extend* define_insn_and_split
patterns.  One is that when it uses vector_operand, it should use Bm rather
than m constraint, and the other one is that because it is a post-reload
splitter it needs isa attribute to select which alternatives are valid for
which ISAs.  Sorry for messing this up.

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

PR target/98670
* config/i386/sse.md (*sse4_1_zero_extendv8qiv8hi2_3,
*sse4_1_zero_extendv4hiv4si2_3, *sse4_1_zero_extendv2siv2di2_3):
Use Bm instead of m for non-avx.  Add isa attribute.

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

3 years agomatch.pd: Optimize ~(X >> Y) to ~X >> Y if ~X can be simplified [PR96688]
Jakub Jelinek [Thu, 14 Jan 2021 11:50:33 +0000 (12:50 +0100)]
match.pd: Optimize ~(X >> Y) to ~X >> Y if ~X can be simplified [PR96688]

This patch optimizes two GIMPLE operations into just one.
As mentioned in the PR, there is some risk this might create more expensive
constants, but sometimes it will make them on the other side less expensive,
it really depends on the exact value.
And if it is an important issue, we should do it in md or during expansion.

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

PR tree-optimization/96688
* match.pd (~(X >> Y) -> ~X >> Y): New simplification if
~X can be simplified.

* gcc.dg/tree-ssa/pr96688.c: New test.
* gcc.dg/tree-ssa/reassoc-37.c: Adjust scan-tree-dump regex.
* gcc.target/i386/pr66821.c: Likewise.

3 years agovect: Account for unused IFN_LOAD_LANES results
Richard Sandiford [Thu, 14 Jan 2021 11:36:25 +0000 (11:36 +0000)]
vect: Account for unused IFN_LOAD_LANES results

At the moment, if we use only one vector of an LD4 result,
we'll treat the LD4 as having the cost of a single load.
But all 4 loads and any associated permutes take place
regardless of which results are actually used.

This patch therefore counts the cost of unused LOAD_LANES
results against the first statement in a group.  An alternative
would be to multiply the ncopies of the first stmt by the group
size and treat other stmts in the group as having zero cost,
but I thought that might be more surprising when reading dumps.

gcc/
* tree-vect-stmts.c (vect_model_load_cost): Account for unused
IFN_LOAD_LANES results.

gcc/testsuite/
* gcc.target/aarch64/sve/cost_model_11.c: New test.
* gcc.target/aarch64/sve/mask_struct_load_5.c: Use
-fno-vect-cost-model.

3 years agoaarch64: Reimplememnt vmovn/vmovl intrinsics with builtins instead
Kyrylo Tkachov [Wed, 13 Jan 2021 12:48:57 +0000 (12:48 +0000)]
aarch64: Reimplememnt vmovn/vmovl intrinsics with builtins instead

Turns out __builtin_convertvector is not as good a fit for the widening
and narrowing intrinsics as I had hoped.
During the veclower phase we lower most of it to bitfield operations and
hope DCE cleans it back up into
vector pack/unpack and extend operations. I received reports that in
more complex cases GCC fails to do that
and we're left with many vector extract operations that clutter the
output.

I think veclower can be improved on that front, but for GCC 10 I'd like
to just implement these builtins
with a good old RTL builtin rather than inline asm.

gcc/
* config/aarch64/aarch64-simd.md (aarch64_<su>xtl<mode>):
Define.
(aarch64_xtn<mode>): Likewise.
* config/aarch64/aarch64-simd-builtins.def (sxtl, uxtl, xtn):
Define
builtins.
* config/aarch64/arm_neon.h (vmovl_s8): Reimplement using
builtin.
(vmovl_s16): Likewise.
(vmovl_s32): Likewise.
(vmovl_u8): Likewise.
(vmovl_u16): Likewise.
(vmovl_u32): Likewise.
(vmovn_s16): Likewise.
(vmovn_s32): Likewise.
(vmovn_s64): Likewise.
(vmovn_u16): Likewise.
(vmovn_u32): Likewise.
(vmovn_u64): Likewise.

3 years agoaarch64: reimplement vqmovn_high* intrinsics using builtins
Kyrylo Tkachov [Wed, 13 Jan 2021 12:14:30 +0000 (12:14 +0000)]
aarch64: reimplement vqmovn_high* intrinsics using builtins

This patch reimplements the saturating-truncate-and-insert-into-high
intrinsics using the appropriate RTL codes and builtins.

gcc/
* config/aarch64/aarch64-simd.md (aarch64_<su>qxtn2<mode>_le):
Define.
(aarch64_<su>qxtn2<mode>_be): Likewise.
(aarch64_<su>qxtn2<mode>): Likewise.
* config/aarch64/aarch64-simd-builtins.def (sqxtn2, uqxtn2):
Define builtins.
* config/aarch64/iterators.md (SAT_TRUNC): Define code_iterator.
(su): Handle ss_truncate and us_truncate.
* config/aarch64/arm_neon.h (vqmovn_high_s16): Reimplement using
builtin.
(vqmovn_high_s32): Likewise.
(vqmovn_high_s64): Likewise.
(vqmovn_high_u16): Likewise.
(vqmovn_high_u32): Likewise.
(vqmovn_high_u64): Likewise.

gcc/testsuite/
* gcc.target/aarch64/narrow_high-intrinsics.c: Update uqxtn2 and
sqxtn2 scan-assembler-times.

3 years agoaarch64: Reimplement vmovn_high_* intrinsics using builtins
Kyrylo Tkachov [Tue, 12 Jan 2021 10:07:19 +0000 (10:07 +0000)]
aarch64: Reimplement vmovn_high_* intrinsics using builtins

The vmovn_high* intrinsics are supposed to map to XTN2 instructions that
narrow their source vector and instert it into the top half of the destination vector.
This patch reimplements them away from inline assembly to an RTL builtin
that performs a vec_concat with a truncate.

gcc/
* config/aarch64/aarch64-simd.md (aarch64_xtn2<mode>_le):
Define.
(aarch64_xtn2<mode>_be): Likewise.
(aarch64_xtn2<mode>): Likewise.
* config/aarch64/aarch64-simd-builtins.def (xtn2): Define
builtins.
* config/aarch64/arm_neon.h (vmovn_high_s16): Reimplement using
builtins.
(vmovn_high_s32): Likewise.
(vmovn_high_s64): Likewise.
(vmovn_high_u16): Likewise.
(vmovn_high_u32): Likewise.
(vmovn_high_u64): Likewise.

gcc/testsuite/
* gcc.target/aarch64/narrow_high-intrinsics.c: Adjust
scan-assembler-times for xtn2.

3 years agoDaily bump.
GCC Administrator [Thu, 14 Jan 2021 00:16:24 +0000 (00:16 +0000)]
Daily bump.

3 years agoor1k: Fixup exception header data encodings
Stafford Horne [Sun, 22 Mar 2020 01:13:22 +0000 (10:13 +0900)]
or1k: Fixup exception header data encodings

While running glibc tests several *-textrel tests failed showing that
relocations remained against read only sections.  It turned out this was
related to exception headers data encoding being wrong.

By default pointer encoding will always use the DW_EH_PE_absptr format.

This patch uses format DW_EH_PE_pcrel and DW_EH_PE_sdata4.  Optionally
DW_EH_PE_indirect is included for global symbols.  This eliminates the
relocations.

gcc/ChangeLog:

* config/or1k/or1k.h (ASM_PREFERRED_EH_DATA_FORMAT): New macro.

3 years agoor1k: Add note to indicate execstack
Stafford Horne [Sun, 22 Mar 2020 01:11:21 +0000 (10:11 +0900)]
or1k: Add note to indicate execstack

Define TARGET_ASM_FILE_END as file_end_indicate_exec_stack to allow
generation of the ".note.GNU-stack" section note.  This allows binutils
to properly set PT_GNU_STACK in the program header.

This fixes a glibc execstack testsuite test failure found while working
on the OpenRISC glibc port.

gcc/ChangeLog:

* config/or1k/linux.h (TARGET_ASM_FILE_END): Define macro.

3 years agoor1k: Support for softfloat to emulate hw exceptions
Stafford Horne [Fri, 24 Jan 2020 12:30:31 +0000 (21:30 +0900)]
or1k: Support for softfloat to emulate hw exceptions

This allows the openrisc softfloat implementation to set exceptions.
This also sets the correct tininess after rounding value to be
consistent with hardware and simulator implementations.

libgcc/ChangeLog:

* config/or1k/sfp-machine.h (FP_RND_NEAREST, FP_RND_ZERO,
FP_RND_PINF, FP_RND_MINF, FP_RND_MASK, FP_EX_OVERFLOW,
FP_EX_UNDERFLOW, FP_EX_INEXACT, FP_EX_INVALID, FP_EX_DIVZERO,
FP_EX_ALL): New constant macros.
(_FP_DECL_EX, FP_ROUNDMODE, FP_INIT_ROUNDMODE,
FP_HANDLE_EXCEPTIONS): New macros.
(_FP_TININESS_AFTER_ROUNDING): Change to 1.

3 years agoor1k: Add builtin define to detect hard float
Stafford Horne [Fri, 24 Jan 2020 12:31:00 +0000 (21:31 +0900)]
or1k: Add builtin define to detect hard float

This is used in libgcc and now glibc to detect when hardware floating
point operations are supported by the target.

gcc/ChangeLog:

* config/or1k/or1k.h (TARGET_CPU_CPP_BUILTINS): Add builtin
  define for __or1k_hard_float__.

3 years agoor1k: Implement profile hook calling _mcount
Stafford Horne [Mon, 14 Oct 2019 06:14:20 +0000 (15:14 +0900)]
or1k: Implement profile hook calling _mcount

Defining this to not abort as found when working on running tests in
the glibc test suite.

We implement this with a call to _mcount with no arguments.  The required
return address's will be pulled from the stack.  Passing the LR (r9) as
an argument had problems as sometimes r9 is clobbered by the GOT logic
in the prologue before the call to _mcount.

gcc/ChangeLog:

* config/or1k/or1k.h (NO_PROFILE_COUNTERS): Define as 1.
(PROFILE_HOOK): Define to call _mcount.
(FUNCTION_PROFILER): Change from abort to no-op.

3 years agoc++: Failure to lookup using-decl name [PR98231]
Marek Polacek [Wed, 13 Jan 2021 16:09:14 +0000 (11:09 -0500)]
c++: Failure to lookup using-decl name [PR98231]

In r11-4690 we removed the call to finish_nonmember_using_decl in
tsubst_expr/DECL_EXPR in the USING_DECL block.  This was done not
to perform name lookup twice for a non-dependent using-decl, which
sounds sensible.

However, finish_nonmember_using_decl also pushes the decl's bindings
which we still have to do so that we can find the USING_DECL's name
later.  In this case, we've got a USING_DECL N::operator<<  that we are
tsubstituting.  We already looked it up while parsing the template
"foo", and lookup_using_decl stashed the OVERLOAD it found into
USING_DECL_DECLS.  Now we just have to update the IDENTIFIER_BINDING of
the identifier for operator<< with the overload the name is bound to.

I didn't want to export push_local_binding so I've introduced a new
wrapper.

gcc/cp/ChangeLog:

PR c++/98231
* name-lookup.c (push_using_decl_bindings): New.
* name-lookup.h (push_using_decl_bindings): Declare.
* pt.c (tsubst_expr): Call push_using_decl_bindings.

gcc/testsuite/ChangeLog:

PR c++/98231
* g++.dg/lookup/using63.C: New test.

3 years agomatch.pd: Fold (~X | C) ^ D into (X | C) ^ (~D ^ C) if (~D ^ C) can be simplified...
Jakub Jelinek [Wed, 13 Jan 2021 18:54:49 +0000 (19:54 +0100)]
match.pd: Fold (~X | C) ^ D into (X | C) ^ (~D ^ C) if (~D ^ C) can be simplified [PR96691]

These simplifications are only simplifications if the (~D ^ C) or (D ^ C)
expressions fold into gimple vals, but in that case they decrease number of
operations by 1.

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

PR tree-optimization/96691
* match.pd ((~X | C) ^ D -> (X | C) ^ (~D ^ C),
(~X & C) ^ D -> (X & C) ^ (D ^ C)): New simplifications if
(~D ^ C) or (D ^ C) can be simplified.

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

3 years agogcc-changelog: Support multiline parentheses wrapping
Martin Liska [Wed, 13 Jan 2021 15:54:02 +0000 (16:54 +0100)]
gcc-changelog: Support multiline parentheses wrapping

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Support wrapping of functions
in parentheses that can take multiple lines.
* gcc-changelog/test_email.py: Add tests for it.
* gcc-changelog/test_patches.txt: Add 2 patches.

3 years agotree-optimization/92645 - avoid harmful early BIT_FIELD_REF canonicalization
Richard Biener [Wed, 13 Jan 2021 12:48:31 +0000 (13:48 +0100)]
tree-optimization/92645 - avoid harmful early BIT_FIELD_REF canonicalization

This avoids canonicalizing BIT_FIELD_REF <T1> (a, <sz>, 0) to
(T1)a on integer typed a.  This confuses the vectorizer SLP matching.

With this delayed to after vector lowering the testcase in PR92645
from Skia is now finally optimized to reasonable assembly.

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

PR tree-optimization/92645
* match.pd (BIT_FIELD_REF to conversion): Delay canonicalization
until after vector lowering.

* gcc.target/i386/pr92645-7.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-54.c: Adjust.
* gcc.dg/pr69047.c: Likewise.

3 years agomklog: support define_insn_and_split format
Martin Liska [Wed, 13 Jan 2021 13:33:43 +0000 (14:33 +0100)]
mklog: support define_insn_and_split format

contrib/ChangeLog:

* mklog.py: Parse also define_insn_and_split and similar
directives in .md files.
* test_mklog.py: Test.

3 years agoc++: Fix cp_build_function_call_vec [PR 98626]
Nathan Sidwell [Wed, 13 Jan 2021 13:13:12 +0000 (05:13 -0800)]
c++: Fix cp_build_function_call_vec [PR 98626]

I misunderstood the cp_build_function_call_vec API, thinking a NULL
vector was an acceptable way of passing no arguments.  You need to
pass a vector of no elements.

PR c++/98626
gcc/cp/
* module.cc (module_add_import_initializers):  Pass a
zero-element argument vector.

3 years agoaarch64: Add support for unpacked SVE MLS and MSB
Richard Sandiford [Wed, 13 Jan 2021 13:00:13 +0000 (13:00 +0000)]
aarch64: Add support for unpacked SVE MLS and MSB

This patch extends the MLS/MSB patterns to support unpacked
integer vectors.  The type suffix could be either the element
size or the container size, but using the element size should
be more efficient.

gcc/
* config/aarch64/aarch64-sve.md (fnma<mode>4): Extend from SVE_FULL_I
to SVE_I.
(@aarch64_pred_fnma<mode>, cond_fnma<mode>, *cond_fnma<mode>_2)
(*cond_fnma<mode>_4, *cond_fnma<mode>_any): Likewise.

gcc/testsuite/
* gcc.target/aarch64/sve/mls_2.c: New test.
* g++.target/aarch64/sve/cond_mls_1.C: Likewise.
* g++.target/aarch64/sve/cond_mls_2.C: Likewise.
* g++.target/aarch64/sve/cond_mls_3.C: Likewise.
* g++.target/aarch64/sve/cond_mls_4.C: Likewise.
* g++.target/aarch64/sve/cond_mls_5.C: Likewise.

3 years agoaarch64: Add support for unpacked SVE MLA and MAD
Richard Sandiford [Wed, 13 Jan 2021 13:00:12 +0000 (13:00 +0000)]
aarch64: Add support for unpacked SVE MLA and MAD

This patch extends the MLA/MAD patterns to support unpacked
integer vectors.  The type suffix could be either the element
size or the container size, but using the element size should
be more efficient.

gcc/
* config/aarch64/aarch64-sve.md (fma<mode>4): Extend from SVE_FULL_I
to SVE_I.
(@aarch64_pred_fma<mode>, cond_fma<mode>, *cond_fma<mode>_2)
(*cond_fma<mode>_4, *cond_fma<mode>_any): Likewise.

gcc/testsuite/
* gcc.target/aarch64/sve/mla_2.c: New test.
* g++.target/aarch64/sve/cond_mla_1.C: Likewise.
* g++.target/aarch64/sve/cond_mla_2.C: Likewise.
* g++.target/aarch64/sve/cond_mla_3.C: Likewise.
* g++.target/aarch64/sve/cond_mla_4.C: Likewise.
* g++.target/aarch64/sve/cond_mla_5.C: Likewise.

3 years agotree-optimization/92645 - improve SLP with existing vectors
Richard Biener [Wed, 13 Jan 2021 11:40:01 +0000 (12:40 +0100)]
tree-optimization/92645 - improve SLP with existing vectors

This improves SLP discovery in the face of existing vectors allowing
punning of the vector shape (or even punning from an integer type).
For punning from integer types this does not yet handle lane zero
extraction being represented as conversion rather than BIT_FIELD_REF.

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

PR tree-optimization/92645
* tree-vect-slp.c (vect_build_slp_tree_1): Relax supported
BIT_FIELD_REF argument.
(vect_build_slp_tree_2): Record the desired vector type
on the external vector def.
(vectorizable_slp_permutation): Handle required punning
of existing vector defs.

* gcc.target/i386/pr92645-6.c: New testcase.

3 years agoaarch64: Tighten condition on sve/sel* tests
Richard Sandiford [Wed, 13 Jan 2021 11:49:45 +0000 (11:49 +0000)]
aarch64: Tighten condition on sve/sel* tests

Noticed while testing on a different machine that the sve/sel_*.c
tests require .variant_pcs support but don't test for it.
.variant_pcs post-dates SVE so there shouldn't be a need to test
for both.

gcc/testsuite/
* gcc.target/aarch64/sve/sel_1.c: Require aarch64_variant_pcs.
* gcc.target/aarch64/sve/sel_2.c: Likewise.
* gcc.target/aarch64/sve/sel_3.c: Likewise.

3 years agortl-ssa: Fix reversed comparisons in accesses.h comment
Richard Sandiford [Wed, 13 Jan 2021 11:43:36 +0000 (11:43 +0000)]
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.

3 years agosh: Remove match_scratch operand test
Richard Sandiford [Wed, 13 Jan 2021 11:37:18 +0000 (11:37 +0000)]
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.

3 years agoHurd: Enable ifunc by default
Samuel Thibault [Sun, 8 Nov 2020 22:52:51 +0000 (23:52 +0100)]
Hurd: Enable ifunc by default

The binutils bugs seem to have been fixed.

gcc/
* config.gcc [$target == *-*-gnu*]: Enable
'default_gnu_indirect_function'.

3 years agolibstdc++: Fix typo in ChangeLog-2020
Jonathan Wakely [Wed, 13 Jan 2021 11:01:58 +0000 (11:01 +0000)]
libstdc++: Fix typo in ChangeLog-2020

3 years agogcc-changelog: Allow modifications to old ChangeLogs without entry
Martin Liska [Wed, 13 Jan 2021 10:55:29 +0000 (11:55 +0100)]
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.

3 years agohurd: libgcc unwinding over signal trampolines with SIGINFO
Samuel Thibault [Mon, 21 Dec 2020 14:36:30 +0000 (15:36 +0100)]
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.

3 years agoi386, expand: Optimize also 256-bit and 512-bit permutatations as vpmovzx if possible...
Jakub Jelinek [Wed, 13 Jan 2021 10:28:48 +0000 (11:28 +0100)]
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.

3 years agoif-to-switch: fix also virtual phis
Martin Liska [Tue, 12 Jan 2021 12:40:44 +0000 (13:40 +0100)]
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.

3 years agolibstdc++: Remove <debug/array> from Doxygen config
Jonathan Wakely [Wed, 13 Jan 2021 10:27:52 +0000 (10:27 +0000)]
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.

3 years agodoc: Fix typos in C++ Modules documentation
Jonathan Wakely [Sat, 9 Jan 2021 14:31:48 +0000 (14:31 +0000)]
doc: Fix typos in C++ Modules documentation

gcc/ChangeLog:

* doc/invoke.texi (C++ Modules): Fix typos.

3 years agotree-optimization/98640 - fix bogus sign-extension with VN
Richard Biener [Wed, 13 Jan 2021 08:43:52 +0000 (09:43 +0100)]
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.

3 years agoi386: Add define_insn_and_split patterns for btrl [PR96938]
Jakub Jelinek [Wed, 13 Jan 2021 09:15:13 +0000 (10:15 +0100)]
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.

3 years agoipa: remove a dead code
Martin Liska [Wed, 13 Jan 2021 08:25:31 +0000 (09:25 +0100)]
ipa: remove a dead code

gcc/ChangeLog:

PR ipa/98652
* cgraphunit.c (analyze_functions): Remove dead code.

3 years ago[PATCH v2] aarch64: Add cpu cost tables for A64FX
Qian Jianhua [Wed, 13 Jan 2021 07:22:09 +0000 (15:22 +0800)]
[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.

3 years agoi386: Optimize _mm_unpacklo_epi8 of 0 vector as second argument or similar VEC_PERM_E...
Jakub Jelinek [Wed, 13 Jan 2021 07:02:54 +0000 (08:02 +0100)]
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.

3 years agoamdgcn: Remove dead code for fixed v0 register
Julian Brown [Wed, 25 Nov 2020 00:42:55 +0000 (16:42 -0800)]
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.

3 years agoamdgcn: Fix exec register live-on-entry to BB in md-reorg
Julian Brown [Fri, 6 Nov 2020 22:53:29 +0000 (14:53 -0800)]
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.

3 years agoamdgcn: Improve FP division accuracy
Julian Brown [Mon, 30 Nov 2020 19:10:04 +0000 (11:10 -0800)]
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.

3 years agoamdgcn: Fix subdf3 pattern
Julian Brown [Mon, 30 Nov 2020 20:01:37 +0000 (12:01 -0800)]
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.

3 years agoDaily bump.
GCC Administrator [Wed, 13 Jan 2021 00:16:36 +0000 (00:16 +0000)]
Daily bump.

3 years agosyscall: ensure openat uses variadic libc wrapper
Paul E. Murphy [Fri, 8 Jan 2021 21:43:54 +0000 (15:43 -0600)]
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

3 years agoAvoid a couple more ICEs in print_mem_ref (PR c/98597).
Martin Sebor [Tue, 12 Jan 2021 19:58:27 +0000 (12:58 -0700)]
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.

#

3 years agoMAINTAINERS: Fix spacing
Segher Boessenkool [Tue, 12 Jan 2021 18:39:10 +0000 (18:39 +0000)]
MAINTAINERS: Fix spacing

We indent with tabs, not spaces.  This fixes it.

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

* MAINTAINERS: Fix spacing.

3 years agolibcody: Simplify configure [PR 98414, 98509]
Nathan Sidwell [Mon, 11 Jan 2021 16:50:21 +0000 (08:50 -0800)]
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.

3 years agogcov: fix printf format for 32-bit hosts
Martin Liska [Tue, 12 Jan 2021 17:16:05 +0000 (18:16 +0100)]
gcov: fix printf format for 32-bit hosts

gcc/ChangeLog:

* gcov.c (source_info::debug): Fix printf format for 32-bit hosts.

3 years agoFix typo in function-abi.h
Andrea Corallo [Tue, 12 Jan 2021 16:52:52 +0000 (17:52 +0100)]
Fix typo in function-abi.h

gcc/Changelog

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

* function-abi.h: Fix typo.

3 years agoarm: Add movmisalign patterns for MVE (PR target/97875)
Christophe Lyon [Tue, 12 Jan 2021 16:47:27 +0000 (16:47 +0000)]
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.

3 years ago[PR97969] LRA: Transform pattern `plus (plus (hard reg, const), pseudo)` after elimin...
Vladimir N. Makarov [Tue, 12 Jan 2021 16:26:15 +0000 (11:26 -0500)]
[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.

3 years agoc++: Fix ICE with CTAD in concept [PR98611]
Patrick Palka [Tue, 12 Jan 2021 14:34:41 +0000 (09:34 -0500)]
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.

3 years agotree-optimization/98550 - fix BB vect unrolling check
Richard Biener [Tue, 12 Jan 2021 10:17:33 +0000 (11:17 +0100)]
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.