Commit Graph

182858 Commits

Author SHA1 Message Date
Richard Biener
2ea6f4a377 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.
2021-01-15 11:26:57 +01:00
Tamar Christina
c4eec1efae 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.
2021-01-15 09:14:30 +00:00
Ian Lance Taylor
b0ccd3922f 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
2021-01-14 17:28:37 -08:00
GCC Administrator
5fff80fd79 Daily bump. 2021-01-15 00:16:28 +00:00
David Malcolm
b95d97f1a5 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
2021-01-14 17:58:53 -05:00
Jason Merrill
f1fc27b6c5 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.
2021-01-14 17:17:17 -05:00
David Malcolm
387f6c15d3 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.
2021-01-14 17:02:28 -05:00
François Dumont
02e7af1122 libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators
libstdc++-v3/ChangeLog:

	* testsuite/23_containers/deque/debug/98466.cc: Make it pre-C++11
	compliant.
2021-01-14 22:43:26 +01:00
David Malcolm
f109605585 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.
2021-01-14 16:28:38 -05:00
Tamar Christina
59832db9a7 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.
2021-01-14 21:01:15 +00:00
Tamar Christina
b50df1e749 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.
2021-01-14 21:00:10 +00:00
Tamar Christina
478e571a3e 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.
2021-01-14 20:59:12 +00:00
Tamar Christina
31fac31800 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.
2021-01-14 20:58:12 +00:00
Tamar Christina
e09173d84d 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.
2021-01-14 20:57:17 +00:00
Tamar Christina
500600c784 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.
2021-01-14 20:54:31 +00:00
Tamar Christina
fe70119531 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.
2021-01-14 20:49:55 +00:00
David Malcolm
dea4a32b24 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.
2021-01-14 15:39:14 -05:00
David Malcolm
8a18261afd 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.
2021-01-14 15:25:27 -05:00
Marek Polacek
f6ffd449e0 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.
2021-01-14 14:46:18 -05:00
Harald Anlauf
bdd1b1f555 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.
2021-01-14 20:25:33 +01:00
Alexandre Oliva
3651c1b5c9 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.
2021-01-14 16:12:22 -03:00
Alexandre Oliva
6541fcadc8 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.
2021-01-14 16:12:20 -03:00
Alexandre Oliva
088e46b8d4 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.
2021-01-14 16:12:19 -03:00
Thomas Schwinge
505caa7295 [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.
2021-01-14 20:06:50 +01:00
François Dumont
05a30af3f2 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.
2021-01-14 19:23:54 +01:00
Harald Anlauf
9e1e6e6310 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.
2021-01-14 19:21:05 +01:00
Harald Anlauf
c1a2cf8805 Revert "PR fortran/98661 - valgrind issues with error recovery"
This reverts commit d0d2becf2d.
2021-01-14 19:17:05 +01:00
Harald Anlauf
d0d2becf2d 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.
2021-01-14 19:13:16 +01:00
Ian Lance Taylor
9ac3e2feb3 libgo: update hurd support
Patch from Svante Signell.

Fixes PR go/98496

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/283692
2021-01-14 09:57:04 -08:00
Thomas Schwinge
6106dfb9f7 [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 a92defdab7 (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.
2021-01-14 18:48:00 +01:00
Jonathan Wakely
57a4f5e4ea 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.
2021-01-14 16:26:30 +00:00
Sebastian Huber
aa3d33dccb 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.
2021-01-14 17:10:44 +01:00
Martin Liska
7624c58c6b 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.
2021-01-14 17:08:32 +01:00
Martin Liska
236d6a33ca mklog: skip unsupported files
This fixes an infinite loop one could see for:
git show b87ec922c4 | ./contrib/mklog.py

contrib/ChangeLog:

	* mklog.py: Fix infinite loop for unsupported files.
2021-01-14 17:06:08 +01:00
H.J. Lu
77d372abec 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.
2021-01-14 07:42:47 -08:00
Uros Bizjak
5ebdd53534 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.
2021-01-14 16:29:21 +01:00
Richard Biener
2182274f51 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.
2021-01-14 16:14:01 +01:00
H.J. Lu
a512079ef4 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.
2021-01-14 07:05:33 -08:00
Prathamesh Kulkarni
a802a2ef5f 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.
2021-01-14 19:59:03 +05:30
Jonathan Wakely
194a9d67be 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.
2021-01-14 14:25:10 +00:00
Nathan Sidwell
d61d2a5f3c 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.
2021-01-14 05:31:07 -08:00
Uros Bizjak
08a4adcf2b 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.
2021-01-14 13:23:13 +01:00
Jakub Jelinek
0efdc7b31c 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.
2021-01-14 12:56:18 +01:00
Jakub Jelinek
8f8762a2e8 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.
2021-01-14 12:50:33 +01:00
Richard Sandiford
e45c41988b 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.
2021-01-14 11:36:25 +00:00
Kyrylo Tkachov
48f8d1d48f 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.
2021-01-14 08:36:19 +00:00
Kyrylo Tkachov
52cd1cd1b6 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.
2021-01-14 08:36:19 +00:00
Kyrylo Tkachov
c7f1ff01a2 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.
2021-01-14 08:36:19 +00:00
GCC Administrator
be0851b8e9 Daily bump. 2021-01-14 00:16:24 +00:00
Stafford Horne
e40fdcc4f4 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.
2021-01-14 08:45:01 +09:00