Commit Graph

183146 Commits

Author SHA1 Message Date
Jakub Jelinek
accc5ba53e i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
>     rtl-optimization/98863 - tame i386 specific RPAD pass
>
> caused
>
> FAIL: gcc.c-torture/compile/20051216-1.c   -O1  (internal compiler error)
> FAIL: gcc.c-torture/compile/20051216-1.c   -O1  (test for excess errors)

The problem is that we don't revert the df flags back.
This patch fixes it by clearing DF_DEFER_INSN_RESCAN after
calling df_process_deferred_rescans, so that it doesn't leak into following
unprepared passes that expect non-deferred rescans.

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

	* config/i386/i386-features.c (remove_partial_avx_dependency): Clear
	DF_DEFER_INSN_RESCAN after calling df_process_deferred_rescans.

	* gcc.target/i386/20051216-1.c: New test.
2021-01-30 14:58:14 +01:00
Jakub Jelinek
25f303e9a2 testsuite: Fix up gomp/simd-{2,3}.c tests [PR98243]
The test (intentionally) is not gcc.dg/vect/, as it needs -fopenmp and uses
OpenMP directives other than simd and therefore can't rely on default
VECTFLAGS and so I think can't safely use vect_int effective target
either.  So, I'm just making sure it is vectorized on x86 and on aarch64 (the
latter as an example of a target that doesn't need any extra options to get
the vectorization).

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

	PR testsuite/98243
	* gcc.dg/gomp/simd-2.c: Add -msse2 on x86.  Restrict
	scan-tree-dump-times to x86 and aarch64 targets.
	* gcc.dg/gomp/simd-3.c: Likewise.
2021-01-30 10:52:57 +01:00
GCC Administrator
2900f2f2c5 Daily bump. 2021-01-30 00:16:19 +00:00
Clément Chigot
4d31df4089 internal/cpu: correctly link to getsystemcfg
Directly set getsystemcfg as //extern in internal/cpu instead of
trying to use the runtime as in Go toolchain.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287932
2021-01-29 16:12:43 -08:00
Michael Meissner
d761172d9b PR testsuite/98870: Fix IEEE 128-bit fortran test
This test started failing when I changed the mapping of IEEE 128-bit long
double built-in functions on 2021-01-28.  This patch fixes the test so it
uses the correct name.

gcc/testsuite/
2021-01-29  Michael Meissner  <meissner@linux.ibm.com>

	PR testsuite/98870
	* gcc.target/powerpc/ppc-fortran/ieee128-math.f90: Fix the
	expected result.
2021-01-29 17:44:54 -05:00
Will Schmidt
fa00e35c17 [PATCH, rs6000] Fix typo in gcc.target/pr91903.c dg-require stanza
Fix obvious typo in testcases dg-require stanza.

2021-01-29  Will Schmidt <will_schmidt@vnet.ibm.como>

gcc/testsuite/ChangeLog:
	* gcc.target/powerpc/pr91903.c: Fix dg-require stanza.
2021-01-29 16:24:47 -06:00
Vladimir N. Makarov
0202fa3d63 [PR97701] Modify test for trunk
Original test was for gcc-10.  The modified one for trunk.

gcc/testsuite/ChangeLog:

	PR target/97701
	* gcc.target/aarch64/pr97701.c: Modify.
2021-01-29 16:05:58 -05:00
David Malcolm
eb06fdd424 analyzer: consolidate conditionals in paths
This patch adds a simplification to analyzer paths for
repeated CFG edges generated from compound conditionals.
For example, it simplifies:

    |    5 |   if (a && b && c)
    |      |      ^~~~~~~~~~~~
    |      |      |  |    |
    |      |      |  |    (4) ...to here
    |      |      |  |    (5) following ‘true’ branch (when ‘c != 0’)...
    |      |      |  (2) ...to here
    |      |      |  (3) following ‘true’ branch (when ‘b != 0’)...
    |      |      (1) following ‘true’ branch (when ‘a != 0’)...
    |    6 |     __analyzer_dump_path ();
    |      |     ~~~~~~~~~~~~~~~~~~~~~~~
    |      |     |
    |      |     (6) ...to here

to:

    |    5 |   if (a && b && c)
    |      |      ^
    |      |      |
    |      |      (1) following ‘true’ branch...
    |    6 |     __analyzer_dump_path ();
    |      |     ~~~~~~~~~~~~~~~~~~~~~~~
    |      |     |
    |      |     (2) ...to here

gcc/analyzer/ChangeLog:
	* checker-path.cc (event_kind_to_string): Handle
	EK_START_CONSOLIDATED_CFG_EDGES and
	EK_END_CONSOLIDATED_CFG_EDGES.
	(start_consolidated_cfg_edges_event::get_desc): New.
	(checker_path::cfg_edge_pair_at_p): New.
	* checker-path.h (enum event_kind): Add
	EK_START_CONSOLIDATED_CFG_EDGES and
	EK_END_CONSOLIDATED_CFG_EDGES.
	(class start_consolidated_cfg_edges_event): New class.
	(class end_consolidated_cfg_edges_event): New class.
	(checker_path::delete_events): New.
	(checker_path::replace_event): New.
	(checker_path::cfg_edge_pair_at_p): New decl.
	* diagnostic-manager.cc (diagnostic_manager::prune_path): Call
	consolidate_conditions.
	(same_line_as_p): New.
	(diagnostic_manager::consolidate_conditions): New.
	* diagnostic-manager.h
	(diagnostic_manager::consolidate_conditions): New decl.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/combined-conditionals-1.c: New test.
2021-01-29 15:12:24 -05:00
Vladimir N. Makarov
7f9f83ef30 [PR97701] LRA: Don't narrow class only for REG or MEM.
Reload pseudos of ALL_REGS class did not narrow class from constraint
in insn (set (pseudo) (lo_sum ...)) because lo_sum is considered an
object (OBJECT_P) although the insn is not a classic move.  To permit
narrowing we are starting to use MEM_P and REG_P instead of OBJECT_P.

gcc/ChangeLog:

	PR target/97701
	* lra-constraints.c (in_class_p): Don't narrow class only for REG
	or MEM.

gcc/testsuite/ChangeLog:

	PR target/97701
	* gcc.target/aarch64/pr97701.c: New.
2021-01-29 14:54:41 -05:00
Ian Lance Taylor
726b7aa004 libgo: update to Go1.16rc1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287493
2021-01-29 11:04:55 -08:00
Will Schmidt
91a95ad2ae [PATCH, rs6000] improve vec_ctf invalid parameter handling.
Hi,
  Per PR91903, GCC ICEs when we attempt to pass a variable
(or out of range value) into the vec_ctf() builtin.  Per
investigation, the parameter checking exists for this
builtin with the int types, but was missing for
the long long types. This problem also occurs for the
vec_cts() builtin, which is also fixed by this patch.

This patch adds the missing CODE_FOR_* entries to the
rs6000_expand_binup_builtin to cover that scenario.
This patch also updates some existing tests to remove
calls to vec_ctf() and vec_cts() that contain negative
values.

PR target/91903

2020-01-29  Will Schmidt  <will_schmidt@vnet.ibm.com>

gcc/ChangeLog:
	* config/rs6000/rs6000-call.c (rs6000_expand_binup_builtin): Add
	clauses for CODE_FOR_vsx_xvcvuxddp_scale and
	CODE_FOR_vsx_xvcvsxddp_scale to the parameter checking code.

gcc/testsuite/ChangeLog:
	* gcc.target/powerpc/pr91903.c: New test.
	* gcc.target/powerpc/builtins-1.fold.h: Update.
	* gcc.target/powerpc/builtins-2.c: Update.
2021-01-29 11:34:59 -06:00
Nathan Sidwell
83bdc9f703 c++: Fix unordered entity array [PR 98843]
A couple of module invariants are that the modules are always
allocated in ascending order and appended to the module array.  The
entity array is likewise ordered, with each module having spans in
that array in ascending order.  Prior to header-units, this was
provided by the way import declarations were encountered.  With
header-units we need to load the preprocessor state of header units
before we parse the C++, and this can lead to incorrect ordering of
the entity array.  I had made the initialization of a module's
language state a little too lazy.  This moves the allocation of entity
array spans into the initial read of a module, thus ensuring the
ordering of those spans.  We won't be looking in them until we've
loaded the language portions of that particular module, and even if we
did, we'd find NULLs there and issue a diagnostic.

	PR c++/98843
	gcc/cp/
	* module.cc (module_state_config): Add num_entities field.
	(module_state::read_entities): The entity_ary span is
	already allocated.
	(module_state::write_config): Write num_entities.
	(module_state::read_config): Read num_entities.
	(module_state::write): Set config's num_entities.
	(module_state::read_initial): Allocate the entity ary
	span here.
	(module_state::read_language): Do not set entity_lwm
	here.
	gcc/testsuite/
	* g++.dg/modules/pr98843_a.C: New.
	* g++.dg/modules/pr98843_b.H: New.
	* g++.dg/modules/pr98843_c.C: New.
2021-01-29 09:11:46 -08:00
Andrew MacLeod
2dd1f94454 tree-optimization/98866 - Compile time hog in VRP
Don't track [1, +INF] for pointer types, treat them as invariant for caching
purposes as they cannot be further refined without evaluating to UNDEFINED.

	PR tree-optimization/98866
	* gimple-range-gori.h (gori_compute:set_range_invariant): New.
	* gimple-range-gori.cc (gori_map::set_range_invariant): New.
	(gori_map::m_maybe_invariant): Rename from all_outgoing.
	(gori_map::gori_map): Rename all_outgoing to m_maybe_invariant.
	(gori_map::is_export_p): Ditto.
	(gori_map::calculate_gori): Ditto.
	(gori_compute::set_range_invariant): New.
	* gimple-range.cc (gimple_ranger::range_of_stmt): Set range
	invariant for pointers evaluating to [1, +INF].
2021-01-29 11:47:18 -05:00
Richard Biener
a7f52181a6 rtl-optimization/98863 - tame i386 specific RPAD pass
This removes analyzing DF with expensive problems which we do not
use at all and which somehow cause 5GB of memory to leak.  Instead
just do a defered rescan of added insns.

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

	PR rtl-optimization/98863
	* config/i386/i386-features.c (remove_partial_avx_dependency):
	Do not perform DF analysis.
	(pass_data_remove_partial_avx_dependency): Remove
	TODO_df_finish.
2021-01-29 17:32:19 +01:00
Jonathan Wright
ee4c4fe289 aarch64: Use RTL builtins for [su]mull_n intrinsics
Rewrite [su]mull_n Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

2021-01-19  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add [su]mull_n
	builtin generator macros.
	* config/aarch64/aarch64-simd.md (aarch64_<su>mull_n<mode>):
	Define.
	* config/aarch64/arm_neon.h (vmull_n_s16): Use RTL builtin
	instead of inline asm.
	(vmull_n_s32): Likewise.
	(vmull_n_u16): Likewise.
	(vmull_n_u32): Likewise.
2021-01-29 13:53:44 +00:00
Kyrylo Tkachov
9b588cfb42 aarch64: Reimplement vabdl_high* intrinsics using builtins
This patch reimplements the vabdl_high intrinsics using builtins.
It slightly cleans up the RTL pattern (the mode iterators) but nothing
interesting apart from that.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (sabdl2, uabdl2):
	Define builtins.
	* config/aarch64/aarch64-simd.md (aarch64_<sur>abdl2<mode>_3):
	Rename to...
	(aarch64_<sur>abdl2<mode>): ... This.
	(<sur>sadv16qi): Adjust use of above.
	* config/aarch64/arm_neon.h (vabdl_high_s8): Reimplement using
	builtin.
	(vabdl_high_s16): Likewise.
	(vabdl_high_s32): Likewise.
	(vabdl_high_u8): Likewise.
	(vabdl_high_u16): Likewise.
	(vabdl_high_u32): Likewise.
2021-01-29 13:49:19 +00:00
Kyrylo Tkachov
9f499a86b2 aarch64: Re-implement vabal_high* intrinsics using builtins
This patch reimplements the vabal_high* intrinsics using RTL builtins.
It's straightforward, defining new unspecs and a new pattern.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (sabal2): Define
	builtin.
	(uabal2): Likewise.
	* config/aarch64/aarch64-simd.md (aarch64_<sur>abal2<mode>): New
	pattern.
	* config/aarch64/aarch64.md (unspec): Add UNSPEC_SABAL2 and
	UNSPEC_UABAL2.
	* config/aarch64/arm_neon.h (vabal_high_s8): Reimplement using
	builtin.
	(vabal_high_s16): Likewise.
	(vabal_high_s32): Likewise.
	(vabal_high_u8): Likewise.
	(vabal_high_u16): Likewise.
	(vabal_high_u32): Likewise.
	* config/aarch64/iterators.md (ABAL2): New mode iterator.
	(sur): Handle UNSPEC_SABAL2, UNSPEC_UABAL2.
2021-01-29 13:49:19 +00:00
Kyrylo Tkachov
d5e0d1f1d2 aarch64: Reimplement vabal* intrinsics using builtins
This patch reimplements the vabal intrinsics with builtins.
The RTL pattern is cleaned up to emit the right .8b suffixes for the
inputs (though .16b is also accepted)
and iterate over the right modes. The pattern's only other use is
through the sadv16qi expander, which is adjusted.

I've verified that the codegen for sadv16qi is not worse off.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (sabal): Define
	builtin.
	(uabal): Likewise.
	* config/aarch64/aarch64-simd.md (aarch64_<sur>abal<mode>_4):
	Rename to...
	(aarch64_<sur>abal<mode>): ... This
	(<sur>sadv16qi): Adust use of the above.
	* config/aarch64/arm_neon.h (vabal_s8): Reimplement using
	builtin.
	(vabal_s16): Likewise.
	(vabal_s32): Likewise.
	(vabal_u8): Likewise.
	(vabal_u16): Likewise.
	(vabal_u32): Likewise.
2021-01-29 13:49:19 +00:00
Kyrylo Tkachov
cb995de62a aarch64: Reimplement vaddlv* intrinsics using builtins
This patch reimplements the vaddlv* intrinsics using builtins.
The vaddlv_s32 and vaddlv_u32 intrinsics actually perform a pairwise
SADDLP/UADDLP instead of a SADDLV/UADDLV but because they only use
two elements it has the same semantics.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (saddlv, uaddlv):
	Define builtins.
	* config/aarch64/aarch64-simd.md (aarch64_<su>addlv<mode>):
	Define.
	* config/aarch64/arm_neon.h (vaddlv_s8): Reimplement using
	builtin.
	(vaddlv_s16): Likewise.
	(vaddlv_u8): Likewise.
	(vaddlv_u16): Likewise.
	(vaddlvq_s8): Likewise.
	(vaddlvq_s16): Likewise.
	(vaddlvq_s32): Likewise.
	(vaddlvq_u8): Likewise.
	(vaddlvq_u16): Likewise.
	(vaddlvq_u32): Likewise.
	(vaddlv_s32): Likewise.
	(vaddlv_u32): Likewise.
	* config/aarch64/iterators.md (VDQV_L): New mode iterator.
	(unspec): Add UNSPEC_SADDLV, UNSPEC_UADDLV.
	(Vwstype): New mode attribute.
	(Vwsuf): Likewise.
	(VWIDE_S): Likewise.
	(USADDLV): New int iterator.
	(su): Handle UNSPEC_SADDLV, UNSPEC_UADDLV.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/simd/vaddlv_1.c: New test.
2021-01-29 13:49:19 +00:00
Jonathan Wright
e053f96a9f aarch64: Use RTL builtins for [su]mlsl_lane[q] intrinsics
Rewrite [su]mlsl_lane[q] Neon intrinsics to use RTL builtins rather
than inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

2021-01-28  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add [su]mlsl_lane[q]
	builtin generator macros.
	* config/aarch64/aarch64-simd.md (aarch64_vec_<su>mlsl_lane<Qlane>):
	Define.
	* config/aarch64/arm_neon.h (vmlsl_lane_s16): Use RTL builtin
	instead of inline asm.
	(vmlsl_lane_s32): Likewise.
	(vmlsl_lane_u16): Likewise.
	(vmlsl_lane_u32): Likewise.
	(vmlsl_laneq_s16): Likewise.
	(vmlsl_laneq_s32): Likewise.
	(vmlsl_laneq_u16): Likewise.
	(vmlsl_laneq_u32): Likewise.
2021-01-29 13:42:00 +00:00
Richard Biener
0833e3e1ff change unit of --param max-gcse-memory to kB
This changes it from bytes to kB since its value is limited to
2147483648.

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

	* doc/invoke.texi (--param max-gcse-memory): Document unit
	of size.
	* gcse.c (gcse_or_cprop_is_too_expensive): Adjust.
	* params.opt (--param max-gcse-memory): Adjust default and
	document unit of size.
2021-01-29 14:01:21 +01:00
Richard Biener
cb52e59e33 rtl-optimization/98863 - fix PRE/CPROP memory usage check
This fixes overflow of the memory usage estimate in turn failing
to disable itself on WRF with LTO, causing a few GBs worth of
memory peak.

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

	PR rtl-optimization/98863
	* gcse.c (gcse_or_cprop_is_too_expensive): Use unsigned
	HOST_WIDE_INT for the memory estimate.
2021-01-29 14:01:21 +01:00
Richard Biener
f4e426f7bd tree-optimization/97627 - Avoid computing niters for fake edges
This avoids computing niters information for fake edges.

2021-01-29  Bin Cheng  <bin.cheng@linux.alibaba.com>
	    Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97627
	* tree-ssa-loop-niter.c (number_of_iterations_exit_assumptions):
	Do not analyze fake edges.

	* g++.dg/pr97627.C: New testcase.
2021-01-29 12:09:10 +01:00
Richard Biener
a8c455bafd rtl-optimization/98144 - tame REE memory usage
This changes the REE dataflow to change the explicit all-ones
starting solution to be implicit via a visited flag, removing
the need to initially start with fully populated bitmaps for
all basic-blocks.  That reduces peak memory use when compiling
the RTL checking enabled insn-extract.c testcase from PR98144
from 6GB to less than 2GB.

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

	PR rtl-optimization/98144
	* df.h (df_mir_bb_info): Add con_visited member.
	* df-problems.c (df_mir_alloc): Initialize con_visited,
	do not fully populate IN and OUT.
	(df_mir_reset): Likewise.
	(df_mir_confluence_0): Set con_visited.
	(df_mir_confluence_n): Properly handle implicitely
	fully populated IN and OUT as designated by con_visited
	and update con_visited accordingly.
2021-01-29 12:01:58 +01:00
Jakub Jelinek
e7429bc9d6 arm: Fix up -mcpu=iwmmxt ICEs [PR98849]
The
https://gcc.gnu.org/r11-6707-g7432f255b70811dafaf325d94036ac580891de69
https://gcc.gnu.org/r11-6708-gbfab355012ca0f5219da8beb04f2fdaf757d34b7
changes moved the vashl/vashr/vlshr expanders from neon.md to vec-common.md
and changed their condition from TARGET_NEON to ARM_HAVE_<MODE>_ARITH,
so that they apply also for TARGET_HAVE_MVE.  But, the ARM_HAVE_<MODE>_ARITH
macros are sometimes true also for TARGET_REALLY_IWMMXT, which at least
from quick skimming of former iwmmxt*.md doesn't have such instructions,
so it seems incorrect to enable them for iwmmxt.  Furthermore, even if it
had them, iwmmxt doesn't support any way to broadcast values in those
modes (vec_duplicate and vec_init optabs) and the middle end relies on
if the vector x vector shift/rotate patterns are supported it can emit
vector x scalar shift/rotate by broadcasting the shift amount to a vector.

As the TARGET_NEON vs. TARGET_REALLY_IWMMXT vs. TARGET_HAVE_MVE never seem
to be enabled together, I think we can just write it the following way.

Note, seems iwmmxt actually does support vector x scalar shifts, but doesn't
really enable the optabs that would tell the middle-end code that it does
(and neon and mve don't seem to support those).  I'll defer that to anybody
that cares about iwmmxt (if any).

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

	PR target/98849
	* config/arm/vec-common.md (mve_vshlq_<supf><mode>,
	vashl<mode>3, vashr<mode>3, vlshr<mode>3): Add
	&& !TARGET_REALLY_IWMMXT to conditions.

	* gcc.c-torture/compile/pr98849.c: New test.
2021-01-29 11:54:22 +01:00
Jakub Jelinek
9c445c07cd expand: Fix up find_bb_boundaries [PR98331]
When expansion emits some control flow insns etc. inside of a former GIMPLE
basic block, find_bb_boundaries needs to split it into multiple basic
blocks.
The code needs to ignore debug insns in decisions how many splits to do or
where in between some non-debug insns the split should be done, but it can
decide where to put debug insns if they can be kept and otherwise throws
them away (they can't stay outside of basic blocks).
On the following testcase, we end up in the bb from expander with
control flow insn
debug insns
barrier
some other insn
(the some other insn is effectively dead after __builtin_unreachable and
we'll optimize that out later).
Without debug insns, we'd do the split when encountering some other insn
and split after PREV_INSN (some other insn), i.e. after barrier (and the
splitting code then moves the barrier in between basic blocks).
But if there are debug insns, we actually split before the first debug insn
that appeared after the control flow insn, so after control flow insn,
and get a basic block that starts with debug insns and then has a barrier
in the middle that nothing moves it out of the bb.  This leads to ICEs and
even if it wouldn't, different behavior from -g0.
The reason for treating debug insns that way is a different case, e.g.
control flow insn
debug insns
some other insn
or even
control flow insn
barrier
debug insns
some other insn
where splitting before the first such debug insn allows us to keep them
while otherwise we would have to drop them on the floor, and in those
situations we behave the same with -g0 and -g.

So, the following patch fixes it by resetting debug_insn not just when
splitting the blocks (it is set only after seeing a control flow insn and
before splitting for it if needed), but also when seeing a barrier,
which effectively means we always throw away debug insns after a control
flow insn and before following barrier if any, but there is no way around
that, control flow insn must be the last in the bb (BB_END) and BARRIER
after it, debug insns aren't allowed outside of bb.
We still handle the other cases fine (when there is no barrier or when
debug insns appear only after the barrier).

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

	PR debug/98331
	* cfgbuild.c (find_bb_boundaries): Reset debug_insn when seeing
	a BARRIER.

	* gcc.dg/pr98331.c: New test.
2021-01-29 10:30:09 +01:00
Xionghu Luo
280a59d921 testsuite: Run vec_insert case on P8 and P9 with option specified
Move run_test and TEST_VEC_INSERT_ALL to header file for share usage.

gcc/testsuite/ChangeLog:

2021-01-29  Xionghu Luo  <luoxhu@linux.ibm.com>

	* gcc.target/powerpc/pr79251.p8.c: Move TEST_VEC_INSERT_ALL
	to ...
	* gcc.target/powerpc/pr79251.h: ...this.
	* gcc.target/powerpc/pr79251.p9.c: Likewise.
	* gcc.target/powerpc/pr79251-run.c: Move run_test to pr79251.h.
	Rename to...
	* gcc.target/powerpc/pr79251-run.p8.c: ...this.
	* gcc.target/powerpc/pr79251-run.p9.c: New test.
2021-01-29 01:33:09 -06:00
Marek Polacek
f8f5388c9e c++: Fix infinite looping with invalid operator [PR96137]
My r11-86 adjusted cp_parser_class_name to do

-  scope = parser->scope;
+  scope = parser->scope ? parser->scope : parser->context->object_type;
   if (scope == error_mark_node)
     return error_mark_node;

but that caused endless looping in cp_parser_type_specifier_seq (the
while (true) loop) in this invalid test, because we never set a parser
error, therefore cp_parser_type_specifier returned error_mark_node
instead of NULL_TREE, and we never issued the "expected type-specifier"
error.

At first I thought I'd just add cp_parser_simulate_error right before
the return, but that regresses crash81.C -- we'd emit multiple errors
for "T::X".  So the next best thing seemed to revert to pre-r11-86
behavior: return early when parser->scope is bad, otherwise proceed to
get the parser error.

gcc/cp/ChangeLog:

	PR c++/96137
	* parser.c (cp_parser_class_name): If parser->scope is
	error_mark_node, return it, otherwise continue.

gcc/testsuite/ChangeLog:

	PR c++/96137
	* g++.dg/parse/error63.C: New test.
2021-01-28 23:29:35 -05:00
GCC Administrator
85d04a2ecb Daily bump. 2021-01-29 00:16:21 +00:00
Ian Lance Taylor
e6bce7fe17 gccgo driver: always act as though -g is passed
The go1 compiler always turns on debugging, to support Go stack traces
and functions like runtime.Callers.  With the recent switch to turn on
DWARF 5 by default, this caused failures with some versions of gas,
such as 2.35.1, because the assembly code would assume DWARF 5 but the
driver would not pass --gdwarf-5 to gas.  gas would then give an
error: "file number less than one".

This change avoids that problem by having the gccgo driver spec add a
-g option to the command line if no other -g option is present.  The
newly added -g option is passed to the assembler as --gdwarf-5.

	* gospec.c (lang_specific_driver): Add -g if no debugging options
	were passed.
2021-01-28 15:54:03 -08:00
Jakub Jelinek
850a8ec54c c++: Fix -Weffc++ in templates [PR98841]
We emit a bogus warning on the following testcase, suggesting that the
operator should return *this even when it does that already.
The problem is that normally cp_build_indirect_ref_1 ensures that *this
is folded as current_class_ref, but in templates (if return type is
non-dependent, otherwise check_return_expr doesn't check it) it didn't
go through cp_build_indirect_ref_1, but just built another INDIRECT_REF.
Which means it then doesn't compare pointer-equal to current_class_ref.

The following patch fixes it by doing in build_x_indirect_ref for
*this what cp_build_indirect_ref_1 would do.

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

	PR c++/98841
	* typeck.c (build_x_indirect_ref): For *this, return current_class_ref.

	* g++.dg/warn/effc5.C: New test.
2021-01-29 00:39:00 +01:00
Marek Polacek
513ee7d2cd tree: Don't reuse types if TYPE_USER_ALIGN differ [PR94775]
A year ago I submitted this patch:

~~
Here we trip on the TYPE_USER_ALIGN (t) assert in strip_typedefs: it
gets "const d[0]" with TYPE_USER_ALIGN=0 but the result built by
build_cplus_array_type is "const char[0]" with TYPE_USER_ALIGN=1.

When we strip_typedefs the element of the array "const d", we see it's
a typedef_variant_p, so we look at its DECL_ORIGINAL_TYPE, which is
char, but we need to add the const qualifier, so we call
cp_build_qualified_type -> build_qualified_type
where get_qualified_type checks to see if we already have such a type
by walking the variants list, which in this case is:

  char -> c -> const char -> const char -> d -> const d

Because check_base_type only checks TYPE_ALIGN and not TYPE_USER_ALIGN,
we choose the first const char, which has TYPE_USER_ALIGN set.  If the
element type of an array has TYPE_USER_ALIGN, the array type gets it too.

So we can make check_base_type stricter.  I was afraid that it might make
us reuse types less often, but measuring showed that we build the same
amount of types with and without the patch, while bootstrapping.
~~

However, the patch broke a few tests on STRICT_ALIGNMENT platforms and
had to be reverted.  This is another try.  The original patch is kept
unchanged, but I added the finalize_type_size hunk that ought to fix the
STRICT_ALIGNMENT issues.

The problem is that finalize_type_size can clear TYPE_USER_ALIGN on the
main variant of a type, but doesn't clear it on any of the variants.
Then we end up with types which share the same TYPE_MAIN_VARIANT, but
their TYPE_CANONICAL differs and then the usual "canonical types differ
for identical types" follows.

I've created alignas19.C to exercise this scenario.  What happens is:
- when parsing the class S we create a type S in xref_tag,
- we see alignas(8) so common_handle_aligned_attribute sets T_U_A in S,
- we parse the member function fn and build_memfn_type creates a copy
  of S to add const; this variant has T_U_A set,
- we finish_struct S which calls layout_class_type -> finish_record_type
  -> finalize_size_type where we reset T_U_A in S (but const S keeps it),
- finish_non_static_data_member for arr calls maybe_dummy_object with
  type = S,
- maybe_dummy_object calls same_type_ignoring_top_level_qualifiers_p
  to check if S and TREE_TYPE (current_class_ref), which is const S,
  are the same,
- same_type_ignoring_top_level_qualifiers_p creates cv-unqualified
  versions of the passed types.  Previously we'd use our main variant
  S when stripping "const S" of const, but since the T_U_A flags don't
  match (check_base_type), we create a new variant S'.  Then we crash in
  comptypes because S and S' have the same TYPE_MAIN_VARIANT but
  different TYPE_CANONICALs.

With my patch we'll clear T_U_A for S's variants too, and then instead
of S' we'll just use S.

gcc/ChangeLog:

	PR c++/94775
	* stor-layout.c (finalize_type_size): If we reset TYPE_USER_ALIGN in
	the main variant, maybe reset it in its variants too.
	* tree.c (check_base_type): Return true only if TYPE_USER_ALIGN match.
	(check_aligned_type): Check if TYPE_USER_ALIGN match.

gcc/testsuite/ChangeLog:

	PR c++/94775
	* g++.dg/cpp0x/alignas19.C: New test.
	* g++.dg/warn/Warray-bounds15.C: New test.
2021-01-28 16:21:50 -05:00
Jonathan Wakely
a054608c9c libstdc++: Fix copyright dates for simd headers and tests
libstdc++-v3/ChangeLog:

	* include/experimental/bits/numeric_traits.h: Update copyright
	dates.
	* include/experimental/bits/simd.h: Likewise.
	* include/experimental/bits/simd_builtin.h: Likewise.
	* include/experimental/bits/simd_converter.h: Likewise.
	* include/experimental/bits/simd_detail.h: Likewise.
	* include/experimental/bits/simd_fixed_size.h: Likewise.
	* include/experimental/bits/simd_math.h: Likewise.
	* include/experimental/bits/simd_neon.h: Likewise.
	* include/experimental/bits/simd_ppc.h: Likewise.
	* include/experimental/bits/simd_scalar.h: Likewise.
	* include/experimental/bits/simd_x86.h: Likewise.
	* include/experimental/bits/simd_x86_conversions.h: Likewise.
	* include/experimental/simd: Likewise.
	* testsuite/experimental/simd/*: Likewise.
2021-01-28 18:13:03 +00:00
Christophe Lyon
31a0ab9213 arm: Adjust cost of vector of constant zero
Neon vector comparisons have a dedicated version when comparing with
constant zero: it means its cost is free.

Adjust the cost in arm_rtx_costs_internal accordingly, for Neon only,
since MVE does not support this.

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

	gcc/
	PR target/98730
	* config/arm/arm.c (arm_rtx_costs_internal): Adjust cost of vector
	of constant zero for comparisons.

	gcc/testsuite/
	PR target/98730
	* gcc.target/arm/simd/vceqzq_p64.c: Update expected result.
2021-01-28 17:55:45 +00:00
David Edelsohn
e28bd09498 testsuite: Fix up a testcase to find the right ISO_Fortran_binding.h.
gcc/testsuite/ChangeLog:

	* gfortran.dg/ISO_Fortran_binding_18.c: Include
	../../../libgfortran/ISO_Fortran_binding.h rather than
	ISO_Fortran_binding.h.
2021-01-28 12:44:30 -05:00
Michael Meissner
e11e5d3889 Map long double built-ins correctly with IEEE 128-bit long double.
The PowerPC has two different 128-bit long double types, one that uses a pair
of doubles to get more mantissa range, and the other using the IEEE 128-bit
754R binary floating point format.  The pair of doubles has been used as the
traditional format, and we are in the process of moving to allow an
implementation to switch to using IEEE 128-bit floating point.  The GLIBC and
LIBSTDC++ libraries have been modified to have functions using the two
different formats in their libraries with different names.

This patch goes through all of the built-in functions that either take long
double arguments or return long double, and changes the name from the
traditional name to the IEEE 128-bit name.  The minimum GLIBC version to
support IEEE 128-bit floating point is 2.32.

The names changed are:

    *	<name>l is usually mapped to __<name>ieee128;
    *	<extra>printf is mapped to __<extra>printfieee128; (and)
    *	<extra>scanf is mapped to __isoc99_<extra>scanfieee128.

A few functions have different mappings:

    *	dreml		=> __remainderieee128;
    *	gammal		=> __lgammaieee128;
    *	gammal_r	=> __lgammaieee128_r;
    *	lgammal_r	=> __lgammaieee128_r;
    *	nexttoward	=> __nexttoward_to_ieee128;
    *	nexttowardf	=> __nexttowardf_to_ieee128;
    *	nexttowardl	=> __nexttowardl_to_ieee128;
    *	pow10l		=> __exp10ieee128;
    *	scalbl		=> __scalbieee128;
    *	significandl	=> __significandieee128; (and)
    *	sincosl		=> __sincosieee128.

gcc/
2021-01-28  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): Add
	support for mapping built-in function names for long double
	built-in functions if long double is IEEE 128-bit.

gcc/testsuite/
2021-01-28  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/float128-longdouble-math.c: New test.
	* gcc.target/powerpc/float128-longdouble-stdio.c: New test.
	* gcc.target/powerpc/float128-math.c: Adjust test for new name
	being generated.  Add support for running test on power10.  Add
	support for running if long double defaults to 64-bits.
2021-01-28 11:30:46 -05:00
Jakub Jelinek
6bb207b468 c++: Fix up handling of register ... asm ("...") vars in templates [PR33661, PR98847]
As the testcase shows, for vars appearing in templates, we don't attach
the asm spec string to the pattern decls, nor pass it back to cp_finish_decl
during instantiation.

The following patch does that.

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

	PR c++/33661
	PR c++/98847
	* decl.c (cp_finish_decl): For register vars with asmspec in templates
	call set_user_assembler_name and set DECL_HARD_REGISTER.
	* pt.c (tsubst_expr): When instantiating DECL_HARD_REGISTER vars,
	pass asmspec_tree to cp_finish_decl.

	* g++.target/i386/pr98847.C: New test.
2021-01-28 16:13:11 +01:00
Jonathan Wright
8a8e515c2b aarch64: Use RTL builtins for [su]mlsl_n intrinsics
Rewrite [su]mlsl_n Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

2021-01-27  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add [su]mlsl_n
	builtin generator macros.
	* config/aarch64/aarch64-simd.md (aarch64_<su>mlsl_n<mode>):
	Define.
	* config/aarch64/arm_neon.h (vmlsl_n_s16): Use RTL builtin
	instead of inline asm.
	(vmlsl_n_s32): Likewise.
	(vmlsl_n_u16): Likewise.
	(vmlsl_n_u32): Likewise.
2021-01-28 14:18:17 +00:00
Kyrylo Tkachov
ff119f340e aarch64: Fix gcc.target/aarch64/narrow_high-intrinsics.c testism
Pushing to fix recently-updated assembly generation

gcc/testsuite/

	* gcc.target/aarch64/narrow_high-intrinsics.c: Fix shrn2 scan.
2021-01-28 14:10:29 +00:00
Jonathan Wright
87301e3956 aarch64: Use RTL builtins for [su]mlal_n intrinsics
Rewrite [su]mlal_n Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

2021-01-26  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add [su]mlal_n
	builtin generator macros.
	* config/aarch64/aarch64-simd.md (aarch64_<su>mlal_n<mode>):
	Define.
	* config/aarch64/arm_neon.h (vmlal_n_s16): Use RTL builtin
	instead of inline asm.
	(vmlal_n_s32): Likewise.
	(vmlal_n_u16): Likewise.
	(vmlal_n_u32): Likewise.
2021-01-28 13:12:52 +00:00
Nathan Sidwell
af66f4f1b0 c++: header unit template alias merging [PR 98770]
Typedefs are streamed by streaming the underlying type, and then
recreating the typedef.  But this breaks checking a duplicate is the
same as the original when it is a template alias -- we end up checking
a template alias (eg __void_t) against the underlying type (void).
And those are not the same template alias.  This stops pretendig that
the underlying type is the typedef for that checking and tells
is_matching_decl 'you have a typedef', so it knows what to do.  (We do
not want to recreate the typedef of the duplicate, because that whole
set of nodes is going to go away.)

	PR c++/98770
	gcc/cp/
	* module.cc (trees_out::decl_value): Swap is_typedef & TYPE_NAME
	check order.
	(trees_in::decl_value): Do typedef frobbing only when installing
	a new typedef, adjust is_matching_decl call.  Swap is_typedef
	& TYPE_NAME check.
	(trees_in::is_matching_decl): Add is_typedef parm. Adjust variable
	names and deal with typedef checking.
	gcc/testsuite/
	* g++.dg/modules/pr98770_a.C: New.
	* g++.dg/modules/pr98770_b.C: New.
2021-01-28 04:55:02 -08:00
Kyrylo Tkachov
d61ca09ec9 aarch64: Reimplement vshrn_high_n* intrinsics using builtins
This patch reimplements the vshrn_high_n* intrinsics that generate the
SHRN2 instruction.
It is a vec_concat of the narrowing shift with the bottom part of the
destination register, so we need a little-endian and a big-endian version and an expander to
pick between them.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (shrn2): Define
	builtin.
	* config/aarch64/aarch64-simd.md (aarch64_shrn2<mode>_insn_le):
	Define.
	(aarch64_shrn2<mode>_insn_be): Likewise.
	(aarch64_shrn2<mode>): Likewise.
	* config/aarch64/arm_neon.h (vshrn_high_n_s16): Reimlplement
	using builtins.
	(vshrn_high_n_s32): Likewise.
	(vshrn_high_n_s64): Likewise.
	(vshrn_high_n_u16): Likewise.
	(vshrn_high_n_u32): Likewise.
	(vshrn_high_n_u64): Likewise.
2021-01-28 11:43:06 +00:00
Kyrylo Tkachov
fdb904a182 aarch64: Reimplement vshrn_n* intrinsics using builtins
This patch reimplements the vshrn_n* intrinsics to use RTL builtins.
These perform a narrowing right shift.

Although the intrinsic generates the half-width mode (e.g. V8HI ->
V8QI), the new pattern generates a full 128-bit mode (V8HI -> V16QI) by representing the
fill-with-zeroes semantics of the SHRN instruction. The narrower (V8QI) result is extracted with a
lowpart subreg.
I found this allows the RTL optimisers to do a better job at optimising
redundant moves away in frequently-occurring SHRN+SRHN2 pairs, like in:
uint8x16_t
foo (uint16x8_t in1, uint16x8_t in2)
{
  uint8x8_t tmp = vshrn_n_u16 (in2, 7);
  uint8x16_t tmp2 = vshrn_high_n_u16 (tmp, in1, 4);
  return tmp2;
}

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (shrn): Define
	builtin.
	* config/aarch64/aarch64-simd.md (aarch64_shrn<mode>_insn_le):
	Define.
	(aarch64_shrn<mode>_insn_be): Likewise.
	(aarch64_shrn<mode>): Likewise.
	* config/aarch64/arm_neon.h (vshrn_n_s16): Reimplement using
	builtins.
	(vshrn_n_s32): Likewise.
	(vshrn_n_s64): Likewise.
	(vshrn_n_u16): Likewise.
	(vshrn_n_u32): Likewise.
	(vshrn_n_u64): Likewise.
	* config/aarch64/iterators.md (vn_mode): New mode attribute.
2021-01-28 11:42:20 +00:00
Eric Botcazou
f7a6d314e7 Fix LTO bootstrap on Windows
The latest fix introduced a comparison of executables and this cannot
directly work on Windows because they are timestamped.  Moreover nobody
sets $(exeext) at top level, at least on MinGW, so you get weird behavior
because some tools add the implicit .exe suffix and others do not.

contrib/
	PR lto/85574
	* compare-lto: Deal with PE-COFF executables specifically.
2021-01-28 11:33:53 +01:00
Harald Anlauf
33a7a93218 PR fortran/86470 - ICE with OpenMP, class(*) allocatable
gfc_call_malloc should malloc an area of size 1 if no size given.

gcc/fortran/ChangeLog:

	PR fortran/86470
	* trans.c (gfc_call_malloc): Allocate area of size 1 if passed
	size is NULL (as documented).

gcc/testsuite/ChangeLog:

	PR fortran/86470
	* gfortran.dg/gomp/pr86470.f90: New test.
2021-01-28 10:13:46 +01:00
Jakub Jelinek
c392d040f6 c++: Some C++20 and C++23 option help fixes
I've noticed we still refer to C++20 as draft standard, and there is a pasto
in C++23 description.

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

	* c.opt (-std=c++2a, -std=c++20, -std=gnu++2a, -std=gnu++20): Remove
	draft from description.
	(-std=c++2b): Fix a pasto, 2020 -> 2023.
2021-01-28 10:00:52 +01:00
Richard Biener
a523add327 rtl-optimization/80960 - avoid creating garbage RTL in DSE
The following avoids repeatedly turning VALUE RTXen into
sth useful and re-applying a constant offset through get_addr
via DSE check_mem_read_rtx.  Instead perform this once for
all stores to be visited in check_mem_read_rtx.  This avoids
allocating 1.6GB of garbage PLUS RTXen on the PR80960
testcase, fixing the memory usage regression from old GCC.

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

	PR rtl-optimization/80960
	* dse.c (check_mem_read_rtx): Call get_addr on the
	offsetted address.
2021-01-28 09:14:46 +01:00
Xionghu Luo
fbe37371cf rs6000: Fix vec insert ilp32 ICE and test failures [PR98799]
UNSPEC_SI_FROM_SF is not supported when TARGET_DIRECT_MOVE_64BIT
is false for -m32, don't generate VIEW_CONVERT_EXPR(ARRAY_REF) for
variable vector insert.  Remove rs6000_expand_vector_set_var helper
function, adjust the p8 and p9 definitions position and make them
static.

The previous commit r11-6858 missed check m32, This patch is tested pass
on P7BE{m32,m64}/P8BE{m32,m64}/P8LE/P9LE with
RUNTESTFLAGS="--target_board =unix'{-m32,-m64}'" for BE targets.

gcc/ChangeLog:

2021-01-27  Xionghu Luo  <luoxhu@linux.ibm.com>
	    David Edelsohn  <dje.gcc@gmail.com>

	PR target/98799
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	Don't generate VIEW_CONVERT_EXPR for fcode ALTIVEC_BUILTIN_VEC_INSERT
	when -m32.
	* config/rs6000/rs6000-protos.h (rs6000_expand_vector_set_var):
	Delete.
	* config/rs6000/rs6000.c (rs6000_expand_vector_set): Remove the
	wrapper call rs6000_expand_vector_set_var for cleanup.  Call
	rs6000_expand_vector_set_var_p9 and rs6000_expand_vector_set_var_p8
	directly.
	(rs6000_expand_vector_set_var): Delete.
	(rs6000_expand_vector_set_var_p9): Make static.
	(rs6000_expand_vector_set_var_p8): Make static.

gcc/testsuite/ChangeLog:

2021-01-27  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR target/98827
	* gcc.target/powerpc/fold-vec-insert-char-p8.c: Adjust ilp32.
	* gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-double.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise.
	* gcc.target/powerpc/pr79251.p8.c: Likewise.
	* gcc.target/powerpc/pr79251.p9.c: Likewise.
	* gcc.target/powerpc/vsx-builtin-7.c: Likewise.
	* gcc.target/powerpc/pr79251-run.c: Build and run with vsx
	option.
2021-01-27 21:34:08 -06:00
Xing GUO
f76d0d8645 RISC-V: Fix -march option parsing when extension exists.
This patch fixes -march option parsing when `p` extension exists,
e.g., -march=rv64imafdcp should produce

.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_p"

rather than

.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c_p"

gcc/ChangeLog:

	* common/config/riscv/riscv-common.c
	(riscv_subset_list::parsing_subset_version): Fix -march option parsing
	when `p` extension exists.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/attribute-18.c: New test.
2021-01-28 11:25:50 +08:00
GCC Administrator
aa69f0a820 Daily bump. 2021-01-28 00:16:56 +00:00