gcc.git
4 years ago[Ada] Always enable the support for 128-bit integer types on 64-bit platforms
Eric Botcazou [Thu, 27 Aug 2020 18:52:14 +0000 (20:52 +0200)]
[Ada] Always enable the support for 128-bit integer types on 64-bit platforms

gcc/ada/

* gnat1drv.adb (Adjust_Global_Switches): Rewrite again code enabling
or disabling the support for 128-bit integer types.

4 years ago[Ada] Update header of front-end files
Arnaud Charlet [Thu, 27 Aug 2020 10:28:00 +0000 (06:28 -0400)]
[Ada] Update header of front-end files

gcc/ada/

* alloc.ads, aspects.adb, aspects.ads, atree.adb, atree.ads,
casing.adb, casing.ads, csets.adb, csets.ads, debug.adb, debug.ads,
einfo.adb, einfo.ads, elists.adb, elists.ads, fname.adb, fname.ads,
gnatvsn.adb, gnatvsn.ads, hostparm.ads, indepsw-aix.adb,
indepsw-darwin.adb, indepsw-gnu.adb, indepsw.adb, indepsw.ads,
krunch.adb, krunch.ads, lib-list.adb, lib-sort.adb, lib.adb, lib.ads,
namet-sp.adb, namet-sp.ads, namet.adb, namet.ads, nlists.adb,
nlists.ads, opt.adb, opt.ads, output.adb, output.ads, rident.ads,
scans.adb, scans.ads, scil_ll.adb, scil_ll.ads, sem_aux.ads,
sem_aux.adb, sfn_scan.adb, sinfo.adb, sinfo.ads, sinput.adb,
sinput.ads, snames.adb-tmpl, snames.ads-tmpl, stand.ads,
stringt.adb, stringt.ads, table.adb, table.ads, types.adb,
types.ads, uintp.adb, uintp.ads, uname.adb, uname.ads,
urealp.adb, urealp.ads, vast.adb, vast.ads, widechar.adb,
widechar.ads: Update header.

4 years ago[Ada] Take advantage of Long_Long_Long_Integer in From_String
Arnaud Charlet [Tue, 11 Aug 2020 19:42:46 +0000 (15:42 -0400)]
[Ada] Take advantage of Long_Long_Long_Integer in From_String

gcc/ada/

* libgnat/a-nbnbin.adb (From_String): Take advantage of
Long_Long_Long_Integer.
* libgnat/s-genbig.ads, libgnat/s-genbig.adb (To_Bignum): New
function taking a Long_Long_Long_Integer.

4 years ago[Ada] Iterative patch for accessibility cleanup
Justin Squirek [Mon, 24 Aug 2020 18:17:36 +0000 (14:17 -0400)]
[Ada] Iterative patch for accessibility cleanup

gcc/ada/

* sem_util.adb (Accessibility_Call_Helper): In the selected
component case, test if a prefix is a function call and whether
the subprogram call is not being used in its entirety and use
the Innermost_Master_Scope_Depth in that case.
(Innermost_Master_Scope_Depth): Test against the node_par
instead of its identifier to avoid misattributing unnamed blocks
as not being from source.
(Function_Call_Level): Add calculation for whether a subprogram
call is initializing an object in its entirety.
(Subprogram_Call_Level): Renamed to Function_Call_Level.

4 years ago[Ada] Sync code for external properties with SPARK RM
Piotr Trojanek [Wed, 26 Aug 2020 12:20:20 +0000 (14:20 +0200)]
[Ada] Sync code for external properties with SPARK RM

gcc/ada/

* sem_prag.adb (Check_External_Properties): Rewrite to match the
SPARK RM description.

4 years ago[Ada] Fix whitespace in code for external property pragmas
Piotr Trojanek [Wed, 26 Aug 2020 11:19:13 +0000 (13:19 +0200)]
[Ada] Fix whitespace in code for external property pragmas

gcc/ada/

* contracts.adb (Check_Type_Or_Object_External_Properties):
Cleanup.

4 years ago[Ada] Fix default value for re-analysis of external property pragmas
Piotr Trojanek [Wed, 26 Aug 2020 11:18:48 +0000 (13:18 +0200)]
[Ada] Fix default value for re-analysis of external property pragmas

gcc/ada/

* sem_prag.adb (Analyze_External_Property_In_Decl_Part): Set the
output parameter Expr_Val to the (implicit) pragma argument even
when returning early.

4 years agoFix up plugin header install
Jakub Jelinek [Fri, 23 Oct 2020 08:11:41 +0000 (10:11 +0200)]
Fix up plugin header install

Jeff has noticed and I've confirmed that config/i386/i386.h header which is
installed on x86 in plugin/include/ directory newly in GCC 11 has
which breaks all plugins that include tm.h etc. because that header is not
shipped.
The following patch seems to fix that.  Unfortunately it isn't just a matter
of TM_H += t-i386 change, because the header has full path and therefore
needs to be installed in its full path.
Additionally, I've noticed that the b-header-vars generation is completely
broken, it will just throw many of the dependencies away, because it
incorrectly removed everything from first ... remaining till the last /,
while what it clearly wants to do is remove each ... till last / in the same
header path (i.e. instead of .* should have used [^     ]* and g modifier).
I've also noticed that some other headers mentioned in #include of other
headers aren't included (gomp-constants.h as dependency of omp-general.h
and various dependencies of expr.h (where omp-general.h and expr.h were
previously installed)).

2020-10-23  Jakub Jelinek  <jakub@redhat.com>

* Makefile.in (PLUGIN_HEADERS): Add gomp-constants.h and $(EXPR_H).
(s-header-vars): Accept not just spaces but also tabs between *_H name
and =.  Handle common/config/ headers similarly to config.  Don't
throw away everything from first ... to last / on the remaining
string, instead skip just ... to corresponding last / without
intervening spaces and tabs.
(install-plugin): Treat common/config headers like config headers.
* config/i386/t-i386 (TM_H): Add
$(srcdir)/common/config/i386/i386-cpuinfo.h.

4 years agostor-layout: Reject forming arrays with elt sizes not divisible by elt alignment...
Jakub Jelinek [Fri, 23 Oct 2020 08:05:17 +0000 (10:05 +0200)]
stor-layout: Reject forming arrays with elt sizes not divisible by elt alignment [PR97164]

As mentioned in the PR, since 2005 we reject if array elements are smaller
than their alignment (i.e. overaligned elements), because such arrays don't
make much sense, only their first element is guaranteed to be aligned as
user requested, but the next element can't be.
The following testcases show something we've been silent about but is
equally bad, the 2005 case is just the most common special case of that
the array element size is not divisible by the alignment.  In those arrays
too only the first element is guaranteed to be properly aligned and the
second one can't be.

This patch rejects those cases too, but keeps the existing wording for the
old common case.

Unfortunately, the patch breaks bootstrap, because libbid uses this mess
(forms arrays with 24 byte long elements with 16 byte element alignment).
I don't really see justification for that, so I've decreased the alignment
to 8 bytes instead.

2020-10-23  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/97164
gcc/
* stor-layout.c (layout_type): Also reject arrays where element size
is constant, but not a multiple of element alignment.
gcc/testsuite/
* c-c++-common/pr97164.c: New test.
* gcc.c-torture/execute/pr36093.c: Move ...
* gcc.dg/pr36093.c: ... here.  Add dg-do compile and dg-error
directives.
* gcc.c-torture/execute/pr43783.c: Move ...
* gcc.dg/pr43783.c: ... here.  Add dg-do compile, dg-options and
dg-error directives.
libgcc/config/libbid/
* bid_functions.h (UINT192): Decrease alignment to 8 bytes.

4 years agoDo not use doloop pattern with pragma Unroll
Eric Botcazou [Fri, 23 Oct 2020 07:51:46 +0000 (09:51 +0200)]
Do not use doloop pattern with pragma Unroll

This fixes the following Ada failure on 64-bit PowerPC:

-FAIL: gnat.dg/unroll4.adb scan-rtl-dump-times loop2_unroll "optimized:
loop unrolled 7 times" 2

The IVOPTS pass detects a doloop pattern and consequently discombobulates
the loop sufficiently as to make it hard for the RTL unrolling pass to
compute the best number of iterations.

gcc/ChangeLog:
* tree-ssa-loop-ivopts.c (analyze_and_mark_doloop_use): Bail out if
the loop is subject to a pragma Unroll with no specific count.

4 years agoarm: Auto-vectorization for MVE: vsub
Dennis Zhang [Fri, 23 Oct 2020 07:53:53 +0000 (08:53 +0100)]
arm: Auto-vectorization for MVE: vsub

This patch enables MVE vsub instructions for auto-vectorization.
The sub<mode>3 in vec-common.md is modified to use new mode macros
to include MVE extension for vectorization. MVE vsub insns in mve.md are
modified to use 'minus' instead of unspec expression to support
sub<mode>3. Use VDQ instead fo VALL to cover all supported modes. The
redundant sub<mode>3 insns in neon.md are then removed.

gcc/ChangeLog:

2020-10-23  Dennis Zhang  <dennis.zhang@arm.com>

* config/arm/mve.md (mve_vsubq<mode>): New entry for vsub instruction
using expression 'minus'.
(mve_vsubq_f<mode>): Use minus instead of VSUBQ_F unspec.
* config/arm/neon.md (sub<mode>3, sub<mode>3_fp16): Removed.
(neon_vsub<mode>): Use gen_sub<mode>3 instead of gen_sub<mode>3_fp16.
* config/arm/vec-common.md (sub<mode>3): Use the new mode macros
ARM_HAVE_<MODE>_ARITH. Use iterator VDQ instead of VALL.

gcc/testsuite/ChangeLog:

* gcc.target/arm/simd/mve-vsub_1.c: New test.

4 years agoLTO: check that make command works
Martin Liska [Thu, 22 Oct 2020 12:07:29 +0000 (14:07 +0200)]
LTO: check that make command works

gcc/ChangeLog:

PR lto/97524
* lto-wrapper.c (make_exists): New function.
(run_gcc): Use it to check that make is present and working
for parallel execution.

4 years agoRevert "middle-end/97521 - fix VECTOR_CST expansion"
Richard Biener [Fri, 23 Oct 2020 06:21:39 +0000 (08:21 +0200)]
Revert "middle-end/97521 - fix VECTOR_CST expansion"

2020-10-23  Richard Biener  <rguenther@suse.de>

PR middle-end/97521
* expr.c (expand_expr_real_1): Revert last change.

* gcc.target/i386/pr97521.c: Remove.
This reverts commit b960a9c83a93b58a84a7a370002990810675ac5d.

4 years agovect: Remove redundant LOOP_VINFO_FULLY_MASKED_P
Kewen Lin [Fri, 23 Oct 2020 03:47:39 +0000 (22:47 -0500)]
vect: Remove redundant LOOP_VINFO_FULLY_MASKED_P

Remove one redundant LOOP_VINFO_FULLY_MASKED_P condition check
which will be checked in vect_use_loop_mask_for_alignment_p.

gcc/ChangeLog:

* tree-vect-loop.c (vect_transform_loop): Remove the redundant
LOOP_VINFO_FULLY_MASKED_P check.

4 years agoDaily bump.
GCC Administrator [Fri, 23 Oct 2020 00:16:30 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Ensure std::forward_as_tuple is defined
Jonathan Wakely [Thu, 22 Oct 2020 23:58:35 +0000 (00:58 +0100)]
libstdc++: Ensure std::forward_as_tuple is defined

The recent changes to reduce includes in <memory_resource> went a bit
too far, and it's possible for std::forward_as_tuple to not be defined
when used.

While doing this, I noticed the problematic calls to forward_as_tuple
were not qualified, so performed unwanted ADL.

libstdc++-v3/ChangeLog:

* include/experimental/memory_resource: Include <tuple>.
(polymorphic_allocator::construct): Qualify forward_as_tuple.
* include/std/memory_resource: Likewise.

4 years ago[RS6000] Power10 vec-splati-runnable multiple test failures
Alan Modra [Thu, 22 Oct 2020 01:33:00 +0000 (12:03 +1030)]
[RS6000] Power10 vec-splati-runnable multiple test failures

FAIL: gcc.target/powerpc/vec-splati-runnable.c 1 blank line(s) in output
FAIL: gcc.target/powerpc/vec-splati-runnable.c (test for excess errors)
Excess errors:
rs6000_emit_xxspltidp_v2df called ...

and running the test fails.  As the comment says
  /* Although the instruction says the results are not defined, it does seem
     to work, at least on Mambo.  But no guarentees!  */
So the simulator works but not real hardware.

gcc/
* config/rs6000/rs6000.c (rs6000_emit_xxspltidp_v2df): Delete
debug printf.  Remove trailing ".\n" from inform message.
Break long line.
gcc/testsuite/
* gcc.target/powerpc/vec-splati-runnable.c: Don't abort on
undefined output.

4 years agolibstdc++: Fix custom clock in test
Jonathan Wakely [Thu, 22 Oct 2020 19:28:10 +0000 (20:28 +0100)]
libstdc++: Fix custom clock in test

This test fails in C++20 mode because std::is_clock is false for the
test clock, because it doesn't define a duration member.

libstdc++-v3/ChangeLog:

* testsuite/30_threads/condition_variable/members/68519.cc:
Define recent_epoch_float_clock::duration to meet the Cpp17Clock
requirements.

4 years agotestsuite: Adjust expected results for rlwimi-2.c and vec-rlmi-rlnm.c
David Edelsohn [Thu, 22 Oct 2020 20:44:04 +0000 (16:44 -0400)]
testsuite: Adjust expected results for rlwimi-2.c and vec-rlmi-rlnm.c

Enable rlwimi-2.c and vec-rlmi-rlmn.c testcases for additional
target configurtions and update the expected results.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/rlwimi-2.c: Adjust expected results for lp64.
* gcc.target/powerpc/vec-rlmi-rlnm.c: Remove target and LP64.
Adjust xxlor expected results.

4 years agoUse precision and sign to compare types for ranges
Andrew MacLeod [Thu, 22 Oct 2020 19:39:37 +0000 (15:39 -0400)]
Use precision and sign to compare types for ranges

Updated to only use range_compatible_p in range assert sanity checks,
not for actual type cmpatibility.

* gimple-range-gori.cc (is_gimple_logical_p): Use types_compatible_p
for logical compatibility.
(logical_stmt_cache::cacheable_p): Ditto.

4 years agolibstdc++: Only include <condition_variable> in <shared_mutex> if needed
Jonathan Wakely [Thu, 22 Oct 2020 17:42:03 +0000 (18:42 +0100)]
libstdc++: Only include <condition_variable> in <shared_mutex> if needed

The <condition_variable> header is not small, so <shared_mutex> should
not include it unless it actually needs std::condition_variable, which
is only the case when we don't have pthread_rwlock_t and the POSIX
Timers option.

The <shared_mutex> header would be even smaller if we had a header for
std::condition_variable (separate from std::condition_variable_any).
That's already planned for a future change.

And <memory_resource> would be even smaller if it was possible to get
std::shared_mutex without std::shared_timed_mutex (which depends on
<chrono>). For that to be effective, the synchronized_pool_resource
would have to create its own simpler version of std::shared_lock without
the timed waiting functions. I have no plans to do that.

libstdc++-v3/ChangeLog:

* include/std/shared_mutex: Only include <condition_variable>
when pthread_rwlock_t and POSIX timers are not available.
(__cpp_lib_shared_mutex, __cpp_lib_shared_timed_mutex): Change
value to be type 'long'.
* include/std/version (__cpp_lib_shared_mutex)
(__cpp_lib_shared_timed_mutex): Likewise.

4 years agolibstdc++: Reduce header dependencies in and on <memory>
Jonathan Wakely [Thu, 22 Oct 2020 17:42:03 +0000 (18:42 +0100)]
libstdc++: Reduce header dependencies in and on <memory>

By moving std::make_obj_using_allocator and the related "utility
functions for uses-allocator construction" to a new header, we can avoid
including the whole of <memory> in <scoped_allocator> and
<memory_resource>.

In order to simplify the implementation of those utility functions they
now use concepts unconditionally. They are no longer defined if
__cpp_concepts is not defined. To simplify the code that uses those
functions I've introduced a __cpp_lib_make_obj_using_allocator feature
test macro (not specified in the standard, which might be an oversight).
That allows the code in <memory_resource> and <scoped_allocator> to
check the feature test macro to decide whether to use the new utilities,
or fall back to the C++17 code.

At the same time, this reshuffles some of the headers included by
<memory> so that they are (mostly?) self-contained. It should no longer
be necessary to include other headers before <bits/shared_ptr.h> when
other parts of the library want to use std::shared_ptr without including
the whole of <memory>.

libstdc++-v3/ChangeLog:

* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/shared_ptr.h: Include <iosfwd>.
* include/bits/shared_ptr_base.h: Include required headers here
directly, instead of in <memory>.
* include/bits/uses_allocator_args.h: New file. Move utility
functions for uses-allocator construction from <memory> to here.
Only define the utility functions when concepts are available.
(__cpp_lib_make_obj_using_allocator): Define non-standard
feature test macro.
* include/std/condition_variable: Remove unused headers.
* include/std/future: Likewise.
* include/std/memory: Remove headers that are not needed
directly, and are now inclkuded where they're needed. Include
new <bits/uses_allocator_args.h> header.
* include/std/memory_resource: Include only the necessary
headers. Use new feature test macro to detect support for the
utility functions.
* include/std/scoped_allocator: Likewise.
* include/std/version (__cpp_lib_make_obj_using_allocator):
Define.

4 years agoScope libstdc++ configuration for vxworks to all versions
Olivier Hainque [Tue, 20 Oct 2020 10:32:27 +0000 (10:32 +0000)]
Scope libstdc++ configuration for vxworks to all versions

When libstdc++ is enabled, the current high level configuration
bits should apply the same to all versions of VxWorks.  Adjust the
config triplets matching rules accordingly.

2010-10-21  Olivier Hainque  <hainque@adacore.com>

libstdc++-v3/
* crossconfig.m4: Turn vxworks matcher into vxworks*.
* configure.host: Likewise.
* configure: Regenerate.

4 years agoMaterialize clones on demand
Jan Hubicka [Thu, 22 Oct 2020 15:32:32 +0000 (17:32 +0200)]
Materialize clones on demand

this patch removes the pass to materialize all clones and instead this
is now done on demand.  The motivation is to reduce lifetime of function
bodies in ltrans that should noticeably reduce memory use for highly
parallel compilations of large programs (like Martin does) or with
partitioning reduced/disabled. For cc1 with one partition the memory use
seems to go down from 4gb to cca 1.5gb (seeing from top, so this is not
particularly accurate).

gcc/ChangeLog:

2020-10-22  Jan Hubicka  <hubicka@ucw.cz>

* cgraph.c (cgraph_node::get_untransformed_body): Perform lazy
clone materialization.
* cgraph.h (cgraph_node::materialize_clone): Declare.
(symbol_table::materialize_all_clones): Remove.
* cgraphclones.c (cgraph_materialize_clone): Turn to ...
(cgraph_node::materialize_clone): .. this one; move here
dumping from symbol_table::materialize_all_clones.
(symbol_table::materialize_all_clones): Remove.
* cgraphunit.c (mark_functions_to_output): Clear stmt references.
(cgraph_node::expand): Initialize bitmaps early;
do not call execute_all_ipa_transforms if there are no transforms.
* ipa-inline-transform.c (save_inline_function_body): Fix formating.
(inline_transform): Materialize all clones before function is modified.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call):
Materialize clone if needed.
* ipa.c (class pass_materialize_all_clones): Remove.
(make_pass_materialize_all_clones): Remove.
* passes.c (execute_all_ipa_transforms): Materialize all clones.
* passes.def: Remove pass_materialize_all_clones.
* tree-pass.h (make_pass_materialize_all_clones): Remove.
* tree-ssa-structalias.c (ipa_pta_execute): Clear refs.

4 years agoOpenMP: Fortran - support omp flush's memorder clauses
Tobias Burnus [Thu, 22 Oct 2020 15:09:22 +0000 (17:09 +0200)]
OpenMP: Fortran - support omp flush's memorder clauses

gcc/fortran/ChangeLog:

* gfortran.h (enum gfc_omp_memorder): Add.
(gfc_omp_clauses): Use it.
* openmp.c (gfc_match_omp_flush): Match memorder clauses.
* trans-openmp.c (gfc_trans_omp_flush): Handle them.
(gfc_trans_omp_directive): Update call.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/flush-1.f90: New test.
* gfortran.dg/gomp/flush-2.f90: New test.

4 years ago[PATCH, rs6000] VSX load/store rightmost element operations
Will Schmidt [Wed, 16 Sep 2020 14:43:31 +0000 (09:43 -0500)]
[PATCH, rs6000] VSX load/store rightmost element operations

Hi,
  This adds support for the VSX load/store rightmost element operations.
  This includes the instructions lxvrbx, lxvrhx, lxvrwx, lxvrdx,
  stxvrbx, stxvrhx, stxvrwx, stxvrdx; And the builtins
  vec_xl_sext() /* vector load sign extend */
  vec_xl_zext() /* vector load zero extend */
  vec_xst_trunc() /* vector store truncate */.

  Testcase results show that the instructions added with this patch show
  up at low/no optimization (-O0), with a number of those being replaced
  with other load and store instructions at higher optimization levels.
  For consistency I've left the tests at -O0.

  [v2] Refreshed per review comments.  Comments cleaned up, indentation
  corrected.

gcc/ChangeLog:
* config/rs6000/altivec.h (vec_xl_zext, vec_xl_sext, vec_xst_trunc):
New defines.
* config/rs6000/rs6000-builtin.def (BU_P10V_OVERLOAD_X): New builtin
macro.
(BU_P10V_AV_X): New builtin macro.
(se_lxvrhbx, se_lxrbhx, se_lxvrwx, se_lxvrdx): Define internal names
for load and sign extend vector element.
(ze_lxvrbx, ze_lxvrhx, ze_lxvrwx, ze_lxvrdx): Define internal names
for load and zero extend vector element.
(tr_stxvrbx, tr_stxvrhx, tr_stxvrwx, tr_stxvrdx): Define internal names
for truncate and store vector element.
(se_lxvrx, ze_lxvrx, tr_stxvrx): Define internal names for overloaded
load/store rightmost element.
* config/rs6000/rs6000-call.c (altivec_builtin_types): Define the
internal monomorphs P10_BUILTIN_SE_LXVRBX, P10_BUILTIN_SE_LXVRHX,
P10_BUILTIN_SE_LXVRWX, P10_BUILTIN_SE_LXVRDX,
P10_BUILTIN_ZE_LXVRBX, P10_BUILTIN_ZE_LXVRHX, P10_BUILTIN_ZE_LXVRWX,
P10_BUILTIN_ZE_LXVRDX,
P10_BUILTIN_TR_STXVRBX, P10_BUILTIN_TR_STXVRHX, P10_BUILTIN_TR_STXVRWX,
P10_BUILTIN_TR_STXVRDX,
(altivec_expand_lxvr_builtin): New expansion for load element builtins.
(altivec_expand_stv_builtin): Update to for truncate and store builtins.
(altivec_expand_builtin): Add clases for load/store rightmost builtins.
(altivec_init_builtins): Add def_builtin entries for
__builtin_altivec_se_lxvrbx, __builtin_altivec_se_lxvrhx,
__builtin_altivec_se_lxvrwx, __builtin_altivec_se_lxvrdx,
__builtin_altivec_ze_lxvrbx, __builtin_altivec_ze_lxvrhx,
__builtin_altivec_ze_lxvrwx, __builtin_altivec_ze_lxvrdx,
__builtin_altivec_tr_stxvrbx, __builtin_altivec_tr_stxvrhx,
__builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrdx,
__builtin_vec_se_lxvrx, __builtin_vec_ze_lxvrx, __builtin_vec_tr_stxvrx.
* config/rs6000/vsx.md (vsx_lxvr<wd>x, vsx_stxvr<wd>x, vsx_stxvr<wd>x):
New define_insn entries.
* doc/extend.texi:  Add documentation for vsx_xl_sext, vsx_xl_zext,
and vec_xst_trunc.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/vsx-load-element-extend-char.c: New test.
* gcc.target/powerpc/vsx-load-element-extend-int.c: New test.
* gcc.target/powerpc/vsx-load-element-extend-longlong.c: New test.
* gcc.target/powerpc/vsx-load-element-extend-short.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-char.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-int.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-longlong.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-short.c: New test.

4 years ago[PATCH, rs6000] int128 sign extention instructions (partial prereq)
Will Schmidt [Thu, 17 Sep 2020 22:17:15 +0000 (17:17 -0500)]
[PATCH, rs6000] int128 sign extention instructions (partial prereq)

Hi
  This is a sub-set of the 128-bit sign extension support patch series
  that will be fully implemented in a subsequent patch from Carl.
  This is a necessary pre-requisite for the vector-load/store rightmost
  element patch that follows in this thread.

  [v2] Refreshed and touched up per review comments.
  - updated set_attr entries.  removed superfluous set_attr entries.
  - moved define_insn and define_expand entries to vsx.md.

gcc/ChangeLog:
* config/rs6000/vsx.md (enum unspec): Add
UNSPEC_EXTENDDITI2 and UNSPEC_MTVSRD_DITI_W1 entries.
(mtvsrdd_diti_w1, extendditi2_vector): New define_insns.
(extendditi2): New define_expand.

4 years ago[Ada] Enable the support of 128-bit integer types by default
Eric Botcazou [Fri, 21 Aug 2020 09:22:52 +0000 (11:22 +0200)]
[Ada] Enable the support of 128-bit integer types by default

gcc/ada/

* Makefile.rtl (GNATRTL_128BIT_PAIRS): Add i-cexten.ads.
* debug.adb (d.H): Document new usage.
* doc/gnat_rm/representation_clauses_and_pragmas.rst (Size Clauses):
Document new limit on 64-bit platforms.
(Component_Size Clauses): Likewise.
(Pragma Pack for Arrays): Likewise.
(Pragma Pack for Records): Likewise.
(Record Representation Clauses): Likewise.
* gnat_rm.texi: Regenerate.
* gnat1drv.adb (Adjust_Global_Switches): Rewrite code enabling or
disabling the support for 128-bit integer types.
* switch-c.adb (Scan_Front_End_Switches): Do not deal with e128.
* usage.adb (Write_Switch_Char): Do not print -gnate128 switch.
* libgnat/i-cexten__128.ads: New file.

gcc/testsuite/

* ada/acats/run_all.sh: Define and substitute target_{max,min}_int.
* ada/acats/support/macro.dfs: Parameterize {MAX,MIN}_INT.
* gnat.dg/assert1.adb: Adjust conditionally to 128-bit integer types.
* gnat.dg/size_clause1.adb: Do not expect a warning for LP64 targets.
* gnat.dg/warn11.adb: Likewise.
* gnat.dg/specs/rep_clause5.ads (Array_2_Type): Add alignment clause.

4 years ago[Ada] ACATS 4.1H - B853001 - missed errors for renamed limited
Javier Miranda [Tue, 25 Aug 2020 19:08:22 +0000 (15:08 -0400)]
[Ada] ACATS 4.1H - B853001 - missed errors for renamed limited

gcc/ada/

* einfo.ads (Has_Limited_View): New synthesized attribute.
* einfo.adb (Has_Limited_View): New synthesized attribute.
(Set_Limited_View): Complete assertion.
* sem_ch10.ads (Is_Visible_Through_Renamings): Make this routine
public to invoke it from Find_Expanded_Name and avoid reporting
spurious errors on renamings of limited-with packages.
(Load_Needed_Body): Moved to have this spec alphabetically
ordered.
* sem_ch10.adb (Is_Visible_Through_Renamings): Moved to library
level.
(Is_Limited_Withed_Unit): New subprogram.
* sem_ch3.adb (Access_Type_Declaration): Adding protection to
avoid reading attribute Entity() when not available.
* sem_ch8.adb (Analyze_Package_Renaming): Report error on
renamed package not visible through context clauses.
(Find_Expanded_Name): Report error on renamed package not
visible through context clauses; handle special case where the
prefix is a renaming of a (now visible) shadow package.

4 years ago[Ada] CUDA: discover runtime types instead of hard-coding
Ghjuvan Lacambre [Tue, 25 Aug 2020 10:16:24 +0000 (12:16 +0200)]
[Ada] CUDA: discover runtime types instead of hard-coding

gcc/ada/

* exp_prag.adb (Get_Launch_Kernel_Arg_Type): New function.
(Build_Shared_Memory_Declaration): Use
Get_Launch_Kernel_Arg_Type.
(Build_Stream_Declaration): Use Get_Launch_Kernel_Arg_Type.
* rtsfind.ads: Remove RO_IC_Unsigned_Long_Long.

4 years ago[Ada] Add more annotations and assertions in the runtime
Arnaud Charlet [Thu, 3 Sep 2020 09:33:39 +0000 (05:33 -0400)]
[Ada] Add more annotations and assertions in the runtime

gcc/ada/

* libgnat/s-imenne.adb, libgnat/s-imgrea.adb: Add assertions.

4 years ago[Ada] Update annotations for codepeer analysis on GNAT runtime
Arnaud Charlet [Tue, 25 Aug 2020 06:35:00 +0000 (02:35 -0400)]
[Ada] Update annotations for codepeer analysis on GNAT runtime

gcc/ada/

* libgnat/s-imgrea.adb (Set_Image_Real): Update annotations.

4 years ago[Ada] AI12-0211: Consistency of inherited nonoverridable aspects
Steve Baird [Thu, 6 Aug 2020 18:09:50 +0000 (11:09 -0700)]
[Ada] AI12-0211: Consistency of inherited nonoverridable aspects

gcc/ada/

* aspects.ads: Introduce the subtype Nonoverridable_Aspect_Id,
whose Static_Predicate reflects the list of nonoverridable
aspects given in Ada RM 13.1.1(18.7).
* sem_util.ads, sem_util.adb: Add two new visible subprograms,
Check_Inherited_Nonoverridable_Aspects and Is_Confirming. The
former is used to check the consistency of inherited
nonoverridable aspects from multiple sources. The latter
indicates whether two aspect specifications for a nonoverridable
aspect are confirming. Because of compatibility concerns in
compiling QGen, Is_Confirming always returns True if
Relaxed_RM_Semantics (i.e., -gnatd.M) is specified.
* sem_ch3.adb (Derived_Type_Declaration): Call new
Check_Inherited_Nonoverridable_Aspects procedure if interface
list is non-empty.
* sem_ch9.adb (Check_Interfaces): Call new
Check_Inherited_Nonoverridable_Aspects procedure if interface
list is non-empty.
* sem_ch13.adb (Analyze_Aspect_Specifications): When an explicit
aspect specification overrides an inherited nonoverridable
aspect, check that the explicit specification is confirming.

4 years ago[Ada] Update the head comment of Check_Compile_Time_Size
Eric Botcazou [Mon, 24 Aug 2020 22:31:31 +0000 (00:31 +0200)]
[Ada] Update the head comment of Check_Compile_Time_Size

gcc/ada/

* freeze.ads (Check_Compile_Time_Size): Adjust size limit.

4 years ago[Ada] Allow use of debug routines when output is going elsewhere
Richard Kenner [Mon, 24 Aug 2020 13:09:49 +0000 (09:09 -0400)]
[Ada] Allow use of debug routines when output is going elsewhere

gcc/ada/

* sprint.adb (pg, po, ps): Use {Push,Pop}_Output.
* treepr.adb (pl, pn): Likewise.

4 years ago[Ada] Minor fix in GNAT RM
Eric Botcazou [Mon, 24 Aug 2020 20:26:54 +0000 (22:26 +0200)]
[Ada] Minor fix in GNAT RM

gcc/ada/

* doc/gnat_rm/implementation_advice.rst: Minor fix.
* gnat_rm.texi: Regenerate.

4 years ago[Ada] Implement AI12-0280's interactions with container aggregates
Steve Baird [Wed, 19 Aug 2020 00:38:21 +0000 (17:38 -0700)]
[Ada] Implement AI12-0280's interactions with container aggregates

gcc/ada/

* sem_util.adb (Is_Container_Aggregate): A new local predicates
which indicates whether a given expression is a container
aggregate. The implementation of this function is incomplete; in
the unusual case of a record aggregate (i.e., not a container
aggregate) of a type whose Aggregate aspect is specified, the
function will incorrectly return True.
(Immediate_Context_Implies_Is_Potentially_Unevaluated): Improve
handling of aggregate components.
(Is_Repeatedly_Evaluated): Test for container aggregate
components along with existing test for array aggregate
components.

4 years ago[Ada] Get rid of useless if-then-else in Exp_Fixd.Fpt_Value
Eric Botcazou [Mon, 24 Aug 2020 16:07:45 +0000 (18:07 +0200)]
[Ada] Get rid of useless if-then-else in Exp_Fixd.Fpt_Value

gcc/ada/

* exp_fixd.adb (Fpt_Value): Fold if-then-else with identical arms.

4 years ago[Ada] Ada_2020 AI12-0250: Iterator filters in Iterated_Element_Assocations
Ed Schonberg [Sun, 23 Aug 2020 19:01:15 +0000 (15:01 -0400)]
[Ada] Ada_2020 AI12-0250: Iterator filters in Iterated_Element_Assocations

gcc/ada/

* par-ch4.adb (P_Iterated_Component_Association): If the
construct includes an iterator filter it corresponds to an
Iterated_Element_Association, so build the proper node for it.
* exp_aggr.adb (Expand_Container_Aggregate, Aggregate_Size): If
the component is an Iterated_Element_Association, treat it as
having a non-static size.

4 years ago[Ada] Fix parser not detecting casing issues in keywords
Ghjuvan Lacambre [Thu, 20 Aug 2020 15:17:39 +0000 (17:17 +0200)]
[Ada] Fix parser not detecting casing issues in keywords

gcc/ada/

* scng.adb (Scan): Check if any letter of the token is
uppercase.

4 years ago[Ada] Wrong accessibility for conversion to named access
Justin Squirek [Sun, 23 Aug 2020 17:38:16 +0000 (13:38 -0400)]
[Ada] Wrong accessibility for conversion to named access

gcc/ada/

* sem_util.adb (Accessibility_Level_Helper): Conversions to
named access types get the level associated with the named
access type.

4 years ago[Ada] Adjust documentation for Has_Constrained_Partial_View flag
Eric Botcazou [Fri, 21 Aug 2020 13:49:13 +0000 (15:49 +0200)]
[Ada] Adjust documentation for Has_Constrained_Partial_View flag

gcc/ada/

* einfo.ads (Has_Constrained_Partial_View): Add "base type" marker.

4 years ago[Ada] AI12-0095 Formal types and Constrained Partial Views
Gary Dismukes [Thu, 20 Aug 2020 23:14:43 +0000 (19:14 -0400)]
[Ada] AI12-0095 Formal types and Constrained Partial Views

gcc/ada/

* einfo.adb (Has_Constrained_Partial_View): Apply Base_Type to Id.
* sem_res.adb (Resolve_Actuals.Check_Aliased_Parameter): Remove
"not Is_Generic_Type" test and call
Object_Type_Has_Constrained_Partial_View instead of
Has_Constrained_Partial_View. Improve related error message to
say "does not statically match" instead of just "does not
match".

4 years ago[Ada] Implement AI12-0030: Stream attribute availability
Steve Baird [Tue, 18 Aug 2020 20:51:37 +0000 (13:51 -0700)]
[Ada] Implement AI12-0030: Stream attribute availability

gcc/ada/

* sem_util.ads, sem_util.adb: Declare and implement a new
predicate, Derivation_Too_Early_To_Inherit.  This function
indicates whether a given derived type fails to inherit a given
streaming-related attribute from its parent type because the
declaration of the derived type precedes the corresponding
attribute_definition_clause of the parent.
* exp_tss.adb (Find_Inherited_TSS): Call
Derivation_Too_Early_To_Inherit instead of unconditionally
assuming that a parent type's streaming attribute is available
for inheritance by an immediate descendant type.
* sem_attr.adb (Stream_Attribute_Available): Call
Derivation_Too_Early_To_Inherit instead of unconditionally
assuming that a parent type's streaming attribute is available
for inheritance by an immediate descendant type.
* exp_attr.adb (Default_Streaming_Unavailable): A new predicate;
given a type, indicates whether predefined (as opposed to
user-defined) streaming operations for the type should be
implemented by raising Program_Error.
(Expand_N_Attribute_Reference): For each of the 4
streaming-related attributes (i.e., Read, Write, Input, Output),
after determining that no user-defined implementation is
available (including a Stream_Convert pragma), call
Default_Streaming_Unavailable; if that call returns True, then
implement the streaming operation as "raise Program_Error;".

4 years ago[Ada] Fix bogus error on conversion from Float to 128-bit unsigned
Eric Botcazou [Wed, 19 Aug 2020 19:54:21 +0000 (21:54 +0200)]
[Ada] Fix bogus error on conversion from Float to 128-bit unsigned

gcc/ada/

* checks.adb (Apply_Float_Conversion_Check): Saturate the bounds
of the check to those of the base type of the expression.

4 years ago[Ada] Reimplementation of accessibility checking
Justin Squirek [Mon, 10 Aug 2020 16:05:07 +0000 (12:05 -0400)]
[Ada] Reimplementation of accessibility checking

gcc/ada/

* checks.adb (Apply_Accessibility_Check): Modify condition to
avoid flawed optimization and use Get_Accessibility over
Extra_Accessibility.
* exp_attr.adb: Remove inclusion of Exp_Ch2.adb.
* exp_ch2.adb, exp_ch2.ads (Param_Entity): Moved to sem_util.
* exp_ch3.ads (Init_Proc_Level_Formal): New function.
* exp_ch3.adb (Build_Init_Procedure): Add extra accessibility
formal for init procs when the associated type is a limited
record.
(Build_Initialization_Call): Add condition to handle propagation
of the new extra accessibility paramter actual needed for init
procs.
(Init_Proc_Level_Formal): Created to fetch a the extra
accessibility parameter associated with init procs if one
exists.
* exp_ch4.adb (Build_Attribute_Reference): Modify static check
to be dynamic.
* exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Move logic
used to expand conditional expressions used as actuals for
anonymous access formals.
(Expand_Call_Helper): Remove extranious accessibility
calculation logic.
* exp_util.adb: Remove inclusion of Exp_Ch2.adb.
* par-ch3.adb (P_Array_Type_Definition): Properly set
Aliased_Present on access definitions
* sem_attr.adb (Resolve_Attribute): Replace instances for
Object_Access_Level with Static_Accessibility_Level.
* sem_ch13.adb (Storage_Pool): Replace instances for
Object_Access_Level with Static_Accessibility_Level.
* sem_ch6.adb (Check_Return_Construct_Accessibility): Replace
instances for Object_Access_Level with
Static_Accessibility_Level.
* sem_ch9.adb (Analyze_Requeue): Replace instances for
Object_Access_Level with Static_Accessibility_Level.
* sem_res.adb (Check_Aliased_Parameter,
Check_Allocator_Discrim_Accessibility, Valid_Conversion):
Replace instances for Object_Access_Level with
Static_Accessibility_Level.
* sem_util.adb, sem_util.ads (Accessibility_Level_Helper):
Created to centralize calculation of accessibility levels.
(Build_Component_Subtype): Replace instances for
Object_Access_Level with Static_Accessibility_Level.
(Defining_Entity): Add extra parameter to dictate whether an
error is raised or empty is return in the case of an irrelevant
N.
(Dynamic_Accessibility_Level): Rewritten to use
Accessibility_Level_Helper.
(Is_View_Conversion): Check membership against Etype to capture
nodes like explicit dereferences which have types but are not
expanded names or identifers.
(Object_Access_LeveL): Removed.
(Param_Entity): Moved from sem_util.
(Static_Accessibility_Level): Created as a replacement to
Object_Access_Level, it also uses Accessibility_Level_Helper for
its implementation.
* snames.ads-tmpl: Added new name for extra accessibility
parameter in init procs.

4 years ago[Ada] Refactor appending to possibly empty lists
Piotr Trojanek [Tue, 18 Aug 2020 09:49:35 +0000 (11:49 +0200)]
[Ada] Refactor appending to possibly empty lists

gcc/ada/

* exp_prag.adb (Expand_Pragma_Contract_Cases,
Expand_Pragma_Loop_Variant): Reuse Append_New_To.
* sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Fix typo.
(Analyze_Pre_Post_Condition): Refactor repeated calls to
Defining_Entity.

4 years ago[Ada] Minor fixes in GNAT RM
Eric Botcazou [Tue, 18 Aug 2020 14:04:09 +0000 (16:04 +0200)]
[Ada] Minor fixes in GNAT RM

gcc/ada/

* doc/gnat_rm/implementation_defined_characteristics.rst: Minor
fixes.
* gnat_rm.texi: Regenerate.

4 years ago[Ada] Reduce scope of local variables for detecting extra WITH clauses
Piotr Trojanek [Tue, 11 Aug 2020 20:08:10 +0000 (22:08 +0200)]
[Ada] Reduce scope of local variables for detecting extra WITH clauses

gcc/ada/

* sem_warn.adb (Check_Unused_Withs): Move local variables from
to a nested procedure; Lunit is passed as a parameter to
Check_System_Aux and its type is refined from Node_Id to
Entity_Id; Cnode is now a constant.

4 years ago[Ada] Add No_Implicit_Task_Allocations and No_Implicit_PO_Allocations to Jorvik
Patrick Bernardi [Mon, 17 Aug 2020 19:32:01 +0000 (15:32 -0400)]
[Ada] Add No_Implicit_Task_Allocations and No_Implicit_PO_Allocations to Jorvik

gcc/ada/

* libgnat/s-rident.ads (Profile_Info): Use a common profile
definition for Jorvik and GNAT Extended Ravenscar, using the
GNAT Extended Ravenscar definition.

4 years ago[Ada] Build support units for 128-bit integer types on 64-bit platforms
Eric Botcazou [Sat, 15 Aug 2020 23:38:30 +0000 (01:38 +0200)]
[Ada] Build support units for 128-bit integer types on 64-bit platforms

gcc/ada/

* Makefile.rtl (64-bit platforms): Add GNATRTL_128BIT_PAIRS to
the LIBGNAT_TARGET_PAIRS list and also GNATRTL_128BIT_OBJS to
the EXTRA_GNATRTL_NONTASKING_OBJS list.

4 years ago[Ada] Fix error message for import aspect
Ghjuvan Lacambre [Fri, 14 Aug 2020 09:34:06 +0000 (11:34 +0200)]
[Ada] Fix error message for import aspect

gcc/ada/

* sem_prag.adb (Process_Convention,
Process_Import_Or_Interface): Fix error message.

4 years ago[Ada] Fix transformation of Suppress aspect into pragma
Ghjuvan Lacambre [Thu, 13 Aug 2020 08:36:08 +0000 (10:36 +0200)]
[Ada] Fix transformation of Suppress aspect into pragma

gcc/ada/

* sem_ch13.adb (Make_Aitem_Pragma): Turn into function. This
removes a side-effect on the Aitem variable.
(Analyze_Aspect_Specifications): Handle Suppress and Unsuppress
aspects differently from the Linker_Section aspect.
(Ceck_Aspect_At_Freeze_Point): Don't expect Suppress/Unsuppress
to be delayed anymore.

4 years ago[Ada] Ada_2020: ongoing work for aggregates for bounded containers
Ed Schonberg [Thu, 13 Aug 2020 14:38:26 +0000 (10:38 -0400)]
[Ada] Ada_2020: ongoing work for aggregates for bounded containers

gcc/ada/

* sem_aggr.adb: (Resolve_Container_Aggregate): For an indexed
container, verify that expressions and component associations
are not both present.
* exp_aggr.adb: Code reorganization, additional comments.
(Expand_Container_Aggregate): Use Aggregate_Size for Iterated_
Component_Associations for indexed aggregates. If present, the
default value of the formal in the constructor function is used
when the size of the aggregate cannot be determined statically.

4 years ago[Ada] Fix oversight in Eval_Attribute for Bit_Position
Eric Botcazou [Thu, 13 Aug 2020 16:19:49 +0000 (18:19 +0200)]
[Ada] Fix oversight in Eval_Attribute for Bit_Position

gcc/ada/

* sem_attr.adb (Eval_Attribute): Fix oversight for Bit_Position.

4 years ago[Ada] AI12-0307: uniform resolution rules for aggregates
Ed Schonberg [Wed, 12 Aug 2020 21:30:29 +0000 (17:30 -0400)]
[Ada] AI12-0307: uniform resolution rules for aggregates

gcc/ada/

* sem_util.ads, sem_util.adb (Check_Ambiguous_Aggregate): When a
subprogram call is found to be ambiguous, check whether
ambiguity is caused by an aggregate actual.  and indicate that
it should carry a type qualification.
* sem_ch4.adb (Traverse_Hoonyms, Try_Primitive_Operation): Call
it.
* sem_res.adb (Report_Ambiguous_Argument): Call it.

4 years ago[Ada] Cleanup repeated code in checks for unused WITH clauses
Piotr Trojanek [Tue, 11 Aug 2020 14:14:19 +0000 (16:14 +0200)]
[Ada] Cleanup repeated code in checks for unused WITH clauses

gcc/ada/

* sem_warn.adb (Check_One_Unit): Avoid repeated calls by using a
local variable Lunit; remove local constant Eitem, which was
identical to Lunit.

4 years agouse wraplf for low-precision elementary functions on x86*-vxworks too
Alexandre Oliva [Thu, 22 Oct 2020 11:57:33 +0000 (08:57 -0300)]
use wraplf for low-precision elementary functions on x86*-vxworks too

The earlier patch that introduced the wraplf variants missed the
x86*-vxworks* ports.  This fixes them.

for  gcc/ada/ChangeLog

* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <x86*-vxworks*>: Select
nolibm and wraplf variants like other vxworks ports.

4 years agoenable sincos optimization on mingw-w64
Alexandre Oliva [Thu, 22 Oct 2020 11:54:16 +0000 (08:54 -0300)]
enable sincos optimization on mingw-w64

The sincos transformation does not take place on all platforms,
because the libc_has_function target hook disables it by default.

Current mingw-w64's math library supports sincos, sincosl and sincosf,
in 32- and 64-bit modes.  I suppose this has been this way for long.

This patch enables the sincos optimization on this platform.

for  gcc/ChangeLog

* config/i386/mingw-w64.h (TARGET_LIBC_HAS_FUNCTION): Enable
sincos optimization.

4 years agoc++: Handle RANGE_EXPR index in init_subob_ctx [PR97328]
Patrick Palka [Thu, 22 Oct 2020 11:40:40 +0000 (07:40 -0400)]
c++: Handle RANGE_EXPR index in init_subob_ctx [PR97328]

In the testcase below, we're ICEing during constexpr evaluation of the
CONSTRUCTOR {.data={{}, [1 ... 7]={}}} of type 'vector'.  The interesting
thing about this CONSTRUCTOR is that it has a RANGE_EXPR index for an
element initializer which doesn't satisfy reduced_constant_expression_p
(because the field 't' is uninitialized).

This is a problem because init_subob_ctx currently punts on setting up a
sub-aggregate initialization context when given a RANGE_EXPR index, so
we later trip over the asserts in verify_ctor_sanity when recursing into
cxx_eval_bare_aggregate on this element initializer.

Fix this by making init_subob_ctx set up an appropriate initialization
context when supplied a RANGE_EXPR index.

gcc/cp/ChangeLog:

PR c++/97328
* constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
indexes, instead build a sub-aggregate initialization context
with no subobject.

gcc/testsuite/ChangeLog:

PR c++/97328
* g++.dg/cpp2a/constexpr-init19.C: New test.
* g++.dg/cpp2a/constexpr-init20.C: New test.

4 years agoc++: constexpr evaluation and bare EMPTY_CLASS_EXPR [PR96575]
Patrick Palka [Thu, 22 Oct 2020 11:33:58 +0000 (07:33 -0400)]
c++: constexpr evaluation and bare EMPTY_CLASS_EXPR [PR96575]

In the testcase below, folding of the initializer for 'ret' inside the
instantiated f<lambda>::lambda ends up yielding an initializer for which
potential_constant_expression returns false.  This causes finish_function
to mark the lambda as non-constexpr, which ultimately causes us to reject
'f(g)' as a call to a non-constexpr function.

The initializer for 'ret' inside f<lambda>::lambda, prior to folding, is
the CALL_EXPR

  <lambda(S)>::operator() (&cb, ({}, <<< Unknown tree: empty_class_expr >>>;))

where the second argument is a COMPOUND_EXPR whose second operand is an
EMPTY_CLASS_EXPR that was formed by build_class_a.  cp_fully_fold_init
is able to only partially fold this initializer: it gets rid of the
side-effectless COMPOUND_EXPR to obtain

  <lambda(S)>::operator() (&cb, <<< Unknown tree: empty_class_expr >>>)

as the final initializer for 'ret'.  This initializer no longer satifies
potential_constant_expression due to the bare EMPTY_CLASS_EXPR which is
not wrapped in a COMPOUND_EXPR.

(cp_fully_fold_init first tries maybe_constant_value on the original
CALL_EXPR, but constexpr evaluation punts upon seeing
__builtin_is_constant_evaluated, since manifestly_const_eval is false.)

To fix this, it seems we could either make cp_fold preserve the
COMPOUND_EXPR trees produced by build_call_a, or we could improve
the constexpr machinery to treat EMPTY_CLASS_EXPR trees as first-class
citizens.  Assuming it's safe to continue folding away these
COMPOUND_EXPRs, the second approach seems cleaner, so this patch
implements the second approach.

gcc/cp/ChangeLog:

PR c++/96575
* constexpr.c (cxx_eval_constant_expression)
<case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
(potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
second operand.
<case EMPTY_CLASS_EXPR>: Return true instead of false.

gcc/testsuite/ChangeLog:

PR c++/96575
* g++.dg/cpp1z/constexpr-96575.C: New test.

4 years agoc++: Check DECL_TEMPLATE_PARM_P in duplicate_decls [PR97511]
Patrick Palka [Thu, 22 Oct 2020 11:27:55 +0000 (07:27 -0400)]
c++: Check DECL_TEMPLATE_PARM_P in duplicate_decls [PR97511]

This makes duplicate_decls differentiate a TYPE_DECL for an alias
template from a TYPE_DECL for one of its template parameters.  The
recently added assert in template_parm_to_arg revealed this latent issue
because merging of the two TYPE_DECLs cleared the DECL_TEMPLATE_PARM_P
flag.

With this patch, we now also correctly diagnose the name shadowing in
the below testcase (as required by [temp.local]/6).

gcc/cp/ChangeLog:

PR c++/97511
* decl.c (duplicate_decls): Return NULL_TREE if
DECL_TEMPLATE_PARM_P differ.

gcc/testsuite/ChangeLog:

PR c++/97511
* g++.dg/template/shadow3.C: New test.

4 years ago[RS6000] VSX_MM_SUFFIX
Alan Modra [Thu, 22 Oct 2020 00:15:53 +0000 (10:45 +1030)]
[RS6000] VSX_MM_SUFFIX

gcc.target/powerpc/vsx_mask-count-runnable.c and others
Assembler messages:
Error: unrecognized opcode: `vcntmb<VSX_MM_SUFFIX>'

* config/rs6000/vsx.md (vec_cntmb_<mode>, vec_extract_<mode>),
(vec_expand_<mode>): Replace <VSX_MM_SUFFIX> with <wd>.

4 years agoRefactor vect_analyze_slp_instance a bit
Richard Biener [Thu, 22 Oct 2020 10:57:25 +0000 (12:57 +0200)]
Refactor vect_analyze_slp_instance a bit

In preparation for a larger change this refactors vect_analyze_slp_instance
so it doesn't need to know a vector type early.

2020-10-22  Richard Biener  <rguenther@suse.de>

* tree-vect-slp.c (vect_analyze_slp_instance): Refactor so
computing a vector type early is not needed, for store group
splitting compute a new vector type based on the desired
group size.

4 years agomiddle-end/97521 - fix VECTOR_CST expansion
Richard Biener [Thu, 22 Oct 2020 07:29:47 +0000 (09:29 +0200)]
middle-end/97521 - fix VECTOR_CST expansion

This fixes expansion of VECTOR_BOOLEAN_TYPE_P VECTOR_CSTs which
when using an integer mode are not always "mask-mode" but may
be using an integer mode when there's no supported vector mode.

The patch makes sure to only go the mask-mode expansion if
the elements do not line up to cover the full integer mode
(when they do and the mode was an actual mask-mode there's
no actual difference in both expansions).

2020-10-22  Richard Biener  <rguenther@suse.de>

PR middle-end/97521
* expr.c (expand_expr_real_1): Be more careful when
expanding a VECTOR_BOOLEAN_TYPE_P VECTOR_CSTs.

* gcc.target/i386/pr97521.c: New testcase.

4 years agoipa-modref-tree.c: fix selftest leaks
David Malcolm [Thu, 22 Oct 2020 10:44:27 +0000 (06:44 -0400)]
ipa-modref-tree.c: fix selftest leaks

"make selftest-valgrind" was reporting:

40 bytes in 1 blocks are definitely lost in loss record 25 of 735
   at 0x483AE7D: operator new(unsigned long) (vg_replace_malloc.c:344)
   by 0xFA0CEA: selftest::test_insert_search_collapse() (ipa-modref-tree.c:40)
   by 0xFA2F9B: selftest::ipa_modref_tree_c_tests() (ipa-modref-tree.c:164)
   by 0x256E3AB: selftest::run_tests() (selftest-run-tests.c:93)
   by 0x1366A8B: toplev::run_self_tests() (toplev.c:2385)
   by 0x1366C47: toplev::main(int, char**) (toplev.c:2467)
   by 0x263203F: main (main.c:39)

40 bytes in 1 blocks are definitely lost in loss record 26 of 735
   at 0x483AE7D: operator new(unsigned long) (vg_replace_malloc.c:344)
   by 0xFA264A: selftest::test_merge() (ipa-modref-tree.c:123)
   by 0xFA2FA0: selftest::ipa_modref_tree_c_tests() (ipa-modref-tree.c:165)
   by 0x256E3AB: selftest::run_tests() (selftest-run-tests.c:93)
   by 0x1366A8B: toplev::run_self_tests() (toplev.c:2385)
   by 0x1366C47: toplev::main(int, char**) (toplev.c:2467)
   by 0x263203F: main (main.c:39)

40 bytes in 1 blocks are definitely lost in loss record 27 of 735
   at 0x483AE7D: operator new(unsigned long) (vg_replace_malloc.c:344)
   by 0xFA279E: selftest::test_merge() (ipa-modref-tree.c:130)
   by 0xFA2FA0: selftest::ipa_modref_tree_c_tests() (ipa-modref-tree.c:165)
   by 0x256E3AB: selftest::run_tests() (selftest-run-tests.c:93)
   by 0x1366A8B: toplev::run_self_tests() (toplev.c:2385)
   by 0x1366C47: toplev::main(int, char**) (toplev.c:2467)
   by 0x263203F: main (main.c:39)

With this patch, the output is clean.

gcc/ChangeLog:
* ipa-modref-tree.c (selftest::test_insert_search_collapse): Fix
leak.
(selftest::test_merge): Fix leaks.

4 years agoFix PR97502
Andreas Krebbel [Thu, 22 Oct 2020 10:24:22 +0000 (12:24 +0200)]
Fix PR97502

The S/390 backend does not define vec_cmp expanders so far. We relied
solely on expanding vcond.  With commit 502d63b6d various testcases
started to ICE now.

This patch just adds the missing expanders to prevent the ICE.
However, there are still a couple of performance-related testcase
regressions with the vcond lowering which have to be fixed
independently.

gcc/ChangeLog:

PR target/97502
* config/s390/vector.md ("vec_cmp<VI_HW:mode><VI_HW:mode>")
("vec_cmpu<VI_HW:mode><VI_HW:mode>"): New expanders.

gcc/testsuite/ChangeLog:

* gcc.dg/pr97502.c: New test.

4 years agoFix PR97439
Andreas Krebbel [Thu, 22 Oct 2020 10:24:22 +0000 (12:24 +0200)]
Fix PR97439

decimal_real_maxval misses to set the sign flag in the REAL_VALUE_TYPE.

gcc/ChangeLog:

PR rtl-optimization/97439
* dfp.c (decimal_real_maxval): Set the sign flag in the
generated number.

gcc/testsuite/ChangeLog:

* gcc.dg/dfp/pr97439.c: New test.

4 years agoanalyzer: fix ICE when handling callback exceeds enode limit [PR97514]
David Malcolm [Thu, 22 Oct 2020 10:16:28 +0000 (06:16 -0400)]
analyzer: fix ICE when handling callback exceeds enode limit [PR97514]

gcc/analyzer/ChangeLog:
PR analyzer/97514
* engine.cc (exploded_graph::add_function_entry): Handle failure
to create an enode, rather than asserting.

gcc/testsuite/ChangeLog:
PR analyzer/97514
* gcc.dg/analyzer/pr97514.c: New test.

4 years agoanalyzer: add some C++ test coverage
David Malcolm [Thu, 22 Oct 2020 10:15:08 +0000 (06:15 -0400)]
analyzer: add some C++ test coverage

gcc/testsuite/ChangeLog:
* g++.dg/analyzer/ctor-dtor-1.C: New test.
* g++.dg/analyzer/dyncast-1.C: New test.
* g++.dg/analyzer/vfunc-1.C: New test.

4 years agoanalyzer: fix ICE on dtor [PR97489]
David Malcolm [Thu, 22 Oct 2020 10:12:31 +0000 (06:12 -0400)]
analyzer: fix ICE on dtor [PR97489]

gcc/analyzer/ChangeLog:
PR analyzer/97489
* engine.cc (exploded_graph::add_function_entry): Assert that we
have a function body.
(exploded_graph::on_escaped_function): Reject fndecls that don't
have a function body.

gcc/testsuite/ChangeLog:
PR analyzer/97489
* g++.dg/analyzer/pr97489.C: New test.

4 years agoDaily bump.
GCC Administrator [Thu, 22 Oct 2020 08:28:22 +0000 (08:28 +0000)]
Daily bump.

4 years agoImplement no_stack_protector attribute.
Martin Liska [Fri, 15 May 2020 12:42:12 +0000 (14:42 +0200)]
Implement no_stack_protector attribute.

gcc/ChangeLog:

2020-05-18  Martin Liska  <mliska@suse.cz>

PR c/94722
* cfgexpand.c (stack_protect_decl_phase):
Guard with lookup_attribute("no_stack_protector") at
various places.
(expand_used_vars): Likewise here.
* doc/extend.texi: Document no_stack_protector attribute.

gcc/ada/ChangeLog:

2020-05-18  Martin Liska  <mliska@suse.cz>

PR c/94722
* gcc-interface/utils.c (handle_no_stack_protect_attribute):
New.
(handle_stack_protect_attribute): Add error message for a
no_stack_protector function.

gcc/c-family/ChangeLog:

2020-05-18  Martin Liska  <mliska@suse.cz>

PR c/94722
* c-attribs.c (handle_no_stack_protect_function_attribute): New.
(handle_stack_protect_attribute): Add error message for a
no_stack_protector function.

gcc/testsuite/ChangeLog:

2020-05-18  Martin Liska  <mliska@suse.cz>

PR c/94722
* g++.dg/no-stack-protector-attr-2.C: New test.
* g++.dg/no-stack-protector-attr-3.C: New test.
* g++.dg/no-stack-protector-attr.C: New test.

4 years agoCome up with stack_protector enum.
Martin Liska [Fri, 15 May 2020 12:51:24 +0000 (14:51 +0200)]
Come up with stack_protector enum.

gcc/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

* cfgexpand.c: Move the enum to ...
* coretypes.h (enum stack_protector): ... here.
* function.c (assign_parm_adjust_stack_rtl): Use the stack_protector
enum.

gcc/c-family/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

* c-cppbuiltin.c (c_cpp_builtins): Use the stack_protector enum.

4 years agoRISC-V: Extend syntax for the multilib-generator
Kito Cheng [Tue, 28 Jul 2020 02:29:49 +0000 (10:29 +0800)]
RISC-V: Extend syntax for the multilib-generator

 - Support expansion operator (*) in the multilib config string.

 - Motivation of this patch is reduce the complexity when we deal multilib with
   sub-extension, expand the combinations by hand would be very painful and
   error prone, no one deserve to experience this[1] again!

[1] https://github.com/sifive/freedom-tools/blob/f4d7facafb27d16125768c90ff1790c674e4be7a/Makefile#L348

gcc/ChangeLog:

* config/riscv/multilib-generator: Add TODO, import itertools
and functools.reduce.
Handle expantion operator.
(LONG_EXT_PREFIXES): New.
(arch_canonicalize): Update comment and improve python3
debuggability/compatibility.
(add_underline_prefix): New.
(_expand_combination): Ditto.
(unique): Ditto.
(expand_combination): Ditto.

4 years agophiopt: Optimize x ? __builtin_clz (x) : 32 in GIMPLE fallout [PR97503]
Jakub Jelinek [Thu, 22 Oct 2020 07:34:28 +0000 (09:34 +0200)]
phiopt: Optimize x ? __builtin_clz (x) : 32 in GIMPLE fallout [PR97503]

> this broke sparc-sun-solaris2.11 bootstrap
>
> /vol/gcc/src/hg/master/local/gcc/tree-ssa-phiopt.c: In function 'bool cond_removal_in_popcount_clz_ctz_pattern(basic_block, basic_block, edge, edge, gimple*, tree, tree)':
> /vol/gcc/src/hg/master/local/gcc/tree-ssa-phiopt.c:1858:27: error: variable 'mode' set but not used [-Werror=unused-but-set-variable]
>  1858 |           scalar_int_mode mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
>       |                           ^~~~
>
>
> and doubtlessly several other targets that use the defaults.h definition of
>
> #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0

Ugh, seems many of those macros do not evaluate the first argument.
This got broken by the change to direct_internal_fn_supported_p, previously
it used mode also in the optab test.

2020-10-22  Jakub Jelinek  <jakub@redhat.com>

* tree-ssa-phiopt.c (cond_removal_in_popcount_clz_ctz_pattern):
For CLZ and CTZ tests, use type temporary instead of mode.

4 years agoopenmp: Add test for OMP_TARGET_OFFLOAD=mandatory for cases where it must not fail
Jakub Jelinek [Thu, 22 Oct 2020 07:33:17 +0000 (09:33 +0200)]
openmp: Add test for OMP_TARGET_OFFLOAD=mandatory for cases where it must not fail

2020-10-22  Jakub Jelinek  <jakub@redhat.com>

* testsuite/libgomp.c/target-41.c: New test.

4 years agox86: Allow configuring with --with-arch_64=x86-64-v[234]
Jakub Jelinek [Thu, 22 Oct 2020 07:32:08 +0000 (09:32 +0200)]
x86: Allow configuring with --with-arch_64=x86-64-v[234]

> +  {"x86-64", PROCESSOR_K8, CPU_K8, PTA_X86_64_BASELINE, 0, P_NONE},
> +  {"x86-64-v2", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V2 | PTA_NO_TUNE,
> +   0, P_NONE},
> +  {"x86-64-v3", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V3 | PTA_NO_TUNE,
> +   0, P_NONE},
> +  {"x86-64-v4", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V4 | PTA_NO_TUNE,
> +   0, P_NONE},
>    {"eden-x2", PROCESSOR_K8, CPU_K8,
>      PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR,
>      0, P_NONE},

I have noticed that one can't configure gcc to default to these.

I've also found various other 32-bit or 64-bit -march= arguments for which
it wasn't possible to configure gcc to default to those.

The x86-64-v* the patch only allows in --with-arch_64=, because otherwise
it fails build miserably - as
./xgcc -B ./ -S -march=x86-64-v2 -m32 test.c
cc1: error: ‘x86-64-v2’ architecture level is only defined for the x86-64 psABI
when building 32-bit multilibs.  Even if multilibs are disallowed, I think
the compiler still supports -m32 and so --with-arch_64= seems to be the only
option in which we can support that.

2020-10-22  Jakub Jelinek  <jakub@redhat.com>

* config.gcc (x86_archs): Add samuel-2, nehemiah, c7 and esther.
(x86_64_archs): Add eden-x2, nano, nano-1000, nano-2000, nano-3000,
nano-x2, eden-x4, nano-x4, x86-64-v2, x86-64-v3 and x86-64-v4.
(i[34567]86-*-* | x86_64-*-*): Only allow x86-64-v* as argument
to --with-arch_64=.

4 years agoopenmp: Change omp_get_initial_device () to match OpenMP 5.1 requirements
Jakub Jelinek [Thu, 22 Oct 2020 07:31:01 +0000 (09:31 +0200)]
openmp: Change omp_get_initial_device () to match OpenMP 5.1 requirements

> Therefore, I think until omp_get_initial_device () value is changed, we

The following so far untested patch implements that change.

OpenMP 4.5 said for omp_get_initial_device:
The value of the device number is implementation defined. If it is between 0 and one less than
omp_get_num_devices() then it is valid for use with all device constructs and routines; if it is
outside that range, then it is only valid for use with the device memory routines and not in the
device clause.
and OpenMP 5.0 similarly, but OpenMP 5.1 says:
The value of the device number is the value returned by the omp_get_num_devices routine.

As the new value is compatible with what has been required earlier, I think
we can change it already now.

2020-10-22  Jakub Jelinek  <jakub@redhat.com>

* icv.c (omp_get_initial_device): Remove including corresponding
ialias.
* icv-device.c (omp_get_initial_device): New function.  Return
gomp_get_num_devices ().  Add ialias.
* target.c (resolve_device): Don't fail with
OMP_TARGET_OFFLOAD=mandatory if device_id is equal to
gomp_get_num_devices ().
(omp_target_alloc, omp_target_free, omp_target_is_present,
omp_target_memcpy, omp_target_memcpy_rect, omp_target_associate_ptr,
omp_target_disassociate_ptr, omp_pause_resource): Use
gomp_get_num_devices () instead of GOMP_DEVICE_HOST_FALLBACK on the
first use in the functions, in uses dominated by the
gomp_get_num_devices call use num_devices_openmp instead.
* libgomp.texi (omp_get_initial_device): Document.
* config/gcn/icv-device.c (omp_get_initial_device): New function.
Add ialias.
* config/nvptx/icv-device.c (omp_get_initial_device): Likewise.
* testsuite/libgomp.c/target-40.c: New test.

4 years agoUse Aux_Long_Float for all real types on LynxOS
Alexandre Oliva [Thu, 22 Oct 2020 05:32:13 +0000 (02:32 -0300)]
Use Aux_Long_Float for all real types on LynxOS

Its libc does not offer *f or *l elementary functions, so rely on the
C double ones only.

for  gcc/ada/ChangeLog

* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <lynxos178>: Rely on
Aux_Long_Float for all real types.

4 years agovxworks float EFs not precise enough -> use long float
Alexandre Oliva [Thu, 22 Oct 2020 05:32:10 +0000 (02:32 -0300)]
vxworks float EFs not precise enough -> use long float

Some acats-4 tests that check the precision of Float elementary
functions fail with vxworks 7.2's implementations of single-precision
math functions.

This patch arranges for us to bypass the single-precision functions,
and use the Aux_Long_Float implementation, based on the double-typed
calls from the C library, for Float and Short_Float.

for  gcc/ada/ChangeLog

* Makefile.rtl (LIBGNAT_TARGET_PAIRS): Use Long Float-based
variant of Aux_Short_Float and Aux_Float on vxworks targets.
* libgnat/a-nashfl__wraplf.ads: New.
* libgnat/a-nuaufl__wraplf.ads: New.

4 years agoUse Aux_Long_Long_Float wraplf for sparc*-sun-solaris too
Rainer Orth [Thu, 22 Oct 2020 05:32:06 +0000 (02:32 -0300)]
Use Aux_Long_Long_Float wraplf for sparc*-sun-solaris too

Like aarch64-* and ppc*-linux-gnu, sparc*-sun-solaris has
Long_Long_Float mapped to double rather than long double, so the
intrinsics in the default version of a-nallfl.ads have mismatching
types.  Adopt the wraplf workaround for it as well.

for  gcc/ada/ChangeLog

* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <sparc*-sun-solaris>:
Use wraplf version of a-nallfl.

4 years agoaarch64-* and ppc*-linux-gnu long long float/long double mismatch
Alexandre Oliva [Thu, 22 Oct 2020 05:32:04 +0000 (02:32 -0300)]
aarch64-* and ppc*-linux-gnu long long float/long double mismatch

Some platforms have failed to build because long long float is mapped
to double rather than long double, and then the attempts to import
intrinsics for long double in Aux_Long_Long_Float raise warnings
turned into errors.

This patch is a work around for the mismatch, arranging for
Aux_Long_Long_Float to map to Aux_Long_Float.

for  gcc/ada/ChangeLog

* Makefile.rtl (LIBGNAT_TARGET_PAIRS): Use
a-nallfl__wraplf.ads on aarch64-* and ppc*-linux-gnu targets.
* libgnat/a-nallfl__wraplf.ads: New.

4 years agosyscall: only compile ptrace varargs shim on Linux
Nikhil Benesch [Sun, 18 Oct 2020 19:28:54 +0000 (19:28 +0000)]
syscall: only compile ptrace varargs shim on Linux

Only compile the __go_ptrace varargs shim on Linux to avoid compilation
failures on some other platforms. The C ptrace function is not entirely
portable (e.g., NetBSD has `int data` instead of `void* data`), and so
far Linux is the only platform that needs the varargs shim.

Additionally, make the types in the ptrace and raw_ptrace function
declarations match. This makes it more clear that the only difference
between the two is that calls via the former are allowed to block while
calls via the latter are not.

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

4 years agoFree stale summaries in ipa-pure-const
Jan Hubicka [Thu, 22 Oct 2020 04:34:48 +0000 (06:34 +0200)]
Free stale summaries in ipa-pure-const

* ipa-pure-const.c (funct_state_summary_t::insert): Free stale
summaries.

4 years agoMove nested function info out of cgraph_node
Jan Hubicka [Thu, 22 Oct 2020 04:33:34 +0000 (06:33 +0200)]
Move nested function info out of cgraph_node

this patch moves nested function information out of symbol table (to a summary).
This saves memory (especially at WPA time) and also makes nested function
support more contained.

gcc/ChangeLog:

2020-10-22  Jan Hubicka  <hubicka@ucw.cz>

* cgraph.c: Include tree-nested.h
(cgraph_node::create): Call maybe_record_nested_function.
(cgraph_node::remove): Do not remove function from nested function
infos.
(cgraph_node::dump): Update.
(cgraph_node::unnest): Move to tree-nested.c
(cgraph_node::verify_node): Update.
(cgraph_c_finalize): Call nested_function_info::release.
* cgraph.h (struct symtab_node): Remove nested function info.
* cgraphclones.c (cgraph_node::create_clone): Do not clone nested
function info.
* cgraphunit.c (cgraph_node::analyze): Update.
(cgraph_node::expand): Do not worry about nested functions; they are
lowered.
(symbol_table::finalize_compilation_unit): Call
nested_function_info::release.
* gimplify.c: Include tree-nested.h
(unshare_body): Update.
(unvisit_body): Update.
* omp-offload.c (omp_discover_implicit_declare_target): Update.
* tree-nested.c: Include alloc-pool.h, tree-nested.h, symbol-summary.h
(nested_function_sum): New static variable.
(nested_function_info::get): New member function.
(nested_function_info::get_create): New member function.
(unnest_function): New function.
(nested_function_info::~nested_function_info): New member function.
(nested_function_info::release): New function.
(maybe_record_nested_function): New function.
(lookup_element_for_decl): Update.
(check_for_nested_with_variably_modified): Update.
(create_nesting_tree): Update.
(unnest_nesting_tree_1): Update.
(gimplify_all_functions): Update.
(lower_nested_functions): Update.
* tree-nested.h (class nested_function_info): New class.
(maybe_record_nested_function): Declare.
(unnest_function): Declare.
(first_nested_function): New inline function.
(next_nested_function): New inline function.
(nested_function_origin): New inline function.

gcc/ada/ChangeLog:

2020-10-22  Jan Hubicka  <hubicka@ucw.cz>

* gcc-interface/trans.c: Include tree-nested.h
(walk_nesting_tree): Update for new nested function info.

gcc/c-family/ChangeLog:

2020-10-22  Jan Hubicka  <hubicka@ucw.cz>

* c-gimplify.c: Include tree-nested.h
(c_genericize): Update for new nested function info.

gcc/d/ChangeLog:

2020-10-22  Jan Hubicka  <hubicka@ucw.cz>

* decl.cc: Include tree-nested.h
(get_symbol_decl): Update for new nested function info.

4 years agoSimplify vec_select of a subreg of X to just a vec_select of X.
liuhongt [Tue, 13 Oct 2020 07:35:29 +0000 (15:35 +0800)]
Simplify vec_select of a subreg of X to just a vec_select of X.

gcc/ChangeLog
PR rtl-optimization/97249
* simplify-rtx.c (simplify_binary_operation_1): Simplify
vec_select of a subreg of X to a vec_select of X.

gcc/testsuite/ChangeLog

* gcc.target/i386/pr97249-1.c: New test.

4 years agoRefactor implementation of *_bcst{_1,_2,_3} patterns.
liuhongt [Sat, 26 Sep 2020 07:34:23 +0000 (15:34 +0800)]
Refactor implementation of *_bcst{_1,_2,_3} patterns.

Add new predicate bcst_mem_operand and corresponding constraint "Br"
to merge "$(pattern)_bcst{_1,_2,_3}" into "$(pattern)", also delete
those separate "*_bcst{_1,_2,_3}" patterns.

gcc/ChangeLog:

PR target/87767
* config/i386/constraints.md ("Br"): New special memory
constraint.
* config/i386/i386-expand.c (ix86_binary_operator_ok): Both
source operand cannot be in memory or bcst_memory_operand.
* config/i386/i386.c (ix86_print_operand): Print bcst_mem_operand.
* config/i386/i386.h (VALID_BCST_MODE_P): New.
* config/i386/predicates.md (bcst_mem_operand): New predicate
for AVX512 embedding broadcast memory operand.
(bcst_vector_operand): New predicate, vector_operand or
bcst_mem_operand.
* config/i386/sse.md
(*<plusminus_insn><mode>3<mask_name><round_name>): Extend
predicate and constraints to handle bcst_mem_operand.
(*mul<mode>3<mask_name><round_name>): Ditto.
(<sse>_div<mode>3<mask_name><round_name>): Ditto.
(<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>):
Ditto.
(<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>):
Ditto.
(<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>):
Ditto.
(<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>):
Ditto.
(*<plusminus_insn><mode>3): Ditto.
(avx512dq_mul<mode>3<mask_name>): Ditto.
(*<sse4_1_avx2>_mul<mode>3<mask_name>): Ditto.
(*andnot<mode>3): Ditto.
(<mask_codefor><code><mode>3<mask_name>): Ditto.
(*sub<mode>3<mask_name>_bcst): Removed.
(*add<mode>3<mask_name>_bcst): Ditto.
(*mul<mode>3<mask_name>_bcst): Ditto.
(*<avx512>_div<mode>3<mask_name>_bcst): Ditto.
(*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1):
Ditto.
(*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_2):
Ditto.
(*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_3):
Ditto.
(*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1):
Ditto.
(*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_2):
Ditto.
(*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_3):
Ditto.
(*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1):
Ditto.
(*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_2):
Ditto.
(*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_3):
Ditto.
(*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1):
Ditto.
(*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_2):
Ditto.
(*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_3):
Ditto.
(*sub<mode>3_bcst): Ditto.
(*add<mode>3_bcst): Ditto.
(*avx512dq_mul<mode>3<mask_name>_bcst): Ditto.
(*avx512f_mul<mode>3<mask_name>_bcst): Ditto.
(*andnot<mode>3_bcst): Ditto.
(*<code><mode>3_bcst): Ditto.
* config/i386/subst.md (bcst_round_constraint): New subst
attribute.
(bcst_round_nimm_predicate): Ditto.
(bcst_mask_prefix3): Ditto.
(bcst_mask_prefix4): Ditto.

4 years agoExtend special_memory_constraint.
liuhongt [Sat, 26 Sep 2020 07:08:32 +0000 (15:08 +0800)]
Extend special_memory_constraint.

For operand with special_memory_constraint, there could be a wrapper
for memory_operand. Extract mem for operand for conditional judgement
like MEM_P, also for record_address_regs.

gcc/ChangeLog:

PR target/87767
* ira-costs.c (record_operand_costs): Extract memory operand
from recog_data.operand[i] for record_address_regs.
(record_reg_classes): Extract memory operand from OP for
conditional judgement MEM_P.
* ira.c (ira_setup_alts): Ditto.
* lra-constraints.c (extract_mem_from_operand): New function.
(satisfies_memory_constraint_p): Extract memory operand from
OP for decompose_mem_address, return false when there's no
memory operand inside OP.
(process_alt_operands): Remove MEM_P (op) since it would be
judged in satisfies_memory_constraint_p.
* recog.c (asm_operand_ok): Extract memory operand from OP for
judgement of memory_operand (OP, VOIDmode).
(constrain_operands): Don't unwrapper unary operator when
there's memory operand inside.
* rtl.h (extract_mem_from_operand): New decl.

4 years agoarm: Auto-vectorization for MVE: vmin/vmax
Dennis Zhang [Thu, 22 Oct 2020 00:27:31 +0000 (01:27 +0100)]
arm: Auto-vectorization for MVE: vmin/vmax

This patch enables MVE vmin/vmax instructions for auto-vectorization.
MVE target is included in expander smin<mode>3, umin<mode>3, smax<mode>3
and umax<mode>3 for vectorization. Related insns for vmin/vmax in mve.md
are modified to use smin, umin, smax and umax expressions instead of
unspec to support the expanders.

gcc/ChangeLog:

2020-10-22  Dennis Zhang  <dennis.zhang@arm.com>

* config/arm/mve.md (mve_vmaxq_<supf><mode>): Replace with ...
(mve_vmaxq_s<mode>, mve_vmaxq_u<mode>): ... these new insns to
use smax/umax instead of VMAXQ.
(mve_vminq_<supf><mode>): Replace with ...
(mve_vminq_s<mode>, mve_vminq_u<mode>): ... these new insns to
use smin/umin instead of VMINQ.
(mve_vmaxnmq_f<mode>): Use smax instead of VMAXNMQ_F.
(mve_vminnmq_f<mode>): Use smin instead of VMINNMQ_F.
* config/arm/vec-common.md (smin<mode>3): Use the new mode macros
ARM_HAVE_<MODE>_ARITH.
(umin<mode>3, smax<mode>3, umax<mode>3): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/arm/simd/mve-vminmax_1.c: New test.

4 years agoHandle a_2= &b properly in range calculations.
Andrew MacLeod [Thu, 22 Oct 2020 00:11:16 +0000 (20:11 -0400)]
Handle a_2= &b properly in range calculations.

when processing assignments, we were using the type of b instead of type
of &b when computing a range.  This was usually filtered out by FRE.
turning it off exposed it.

gcc/
PR tree-optimization/97520
* gimple-range.cc (range_of_non_trivial_assignment): Handle x = &a
by returning a non-zero range.
gcc/testsuite/
* gcc.dg/pr97520.c: New.

4 years agoarm: Auto-vectorization for MVE: vmul
Dennis Zhang [Thu, 22 Oct 2020 00:09:33 +0000 (01:09 +0100)]
arm: Auto-vectorization for MVE: vmul

This patch enables MVE vmul instructions for auto-vectorization.
It includes MVE in expander mul<mode>3 to enable vectorization for MVE.
Related MVE vmul insns are modified to support the expander by using
expression 'mult' instead of unspec.
The mul<mode>3 for vectorization in vec-common.md uses mode iterator
VDQWH instead of VALLW to cover all supported modes.
The macros ARM_HAVE_NEON_<MODE>_ARITH are used to select supported
modes for different targets.
The redundant mul<mode>3 in neon.md is removed.

gcc/ChangeLog:

2020-10-22  Dennis Zhang  <dennis.zhang@arm.com>

* config/arm/mve.md (mve_vmulq<mode>): New entry for vmul instruction
using expression 'mult'.
(mve_vmulq_f<mode>): Use mult instead of VMULQ_F.
* config/arm/neon.md (mul<mode>3): Removed.
* config/arm/vec-common.md (mul<mode>3): Use the new mode macros
ARM_HAVE_<MODE>_ARITH. Use mode iterator VDQWH instead of VALLW.

gcc/testsuite/ChangeLog:

* gcc.target/arm/simd/mve-vmul_1.c: New test.

4 years agoCheck for undefined before not returning a constant value
Andrew MacLeod [Wed, 21 Oct 2020 23:55:28 +0000 (19:55 -0400)]
Check for undefined before not returning a constant value

Don't return UNDEFINED for a range in an unreachable block if the global
value evaluates to a constant.  Return that constant instead.

PR tree-optimization/97515
* value-query.cc (range_query::value_of_expr): If the result is
UNDEFINED, check to see if the global value is a constant.
(range_query::value_on_edge): Ditto.

4 years agosyscall: import upstream code for BSD sockets and sysctls
Nikhil Benesch [Sat, 10 Oct 2020 00:06:36 +0000 (00:06 +0000)]
syscall: import upstream code for BSD sockets and sysctls

Import some missing upstream code for BSD sockets and sysctls and
adapt it for gccgo.

Updates golang/go#38538.

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

4 years agoStrenghten bound for bulitin_constant_p hint.
Jan Hubicka [Wed, 21 Oct 2020 23:42:11 +0000 (01:42 +0200)]
Strenghten bound for bulitin_constant_p hint.

this patch makes builtin_constant_p hint to combine with other loop hints
we already support.

gcc/ChangeLog:

2020-10-22  Jan Hubicka  <hubicka@ucw.cz>

PR ipa/97445
* ipa-inline.c (inline_insns_single): Add hint2 parameter.
(inline_insns_auto): Add hint2 parameter.
(can_inline_edge_by_limits_p): Update.
(want_inline_small_function_p): Update.
(wrapper_heuristics_may_apply): Update.

4 years agotestsuite: Enable p9-lxvx-stxvx testcases and fold-vec-extract
David Edelsohn [Wed, 21 Oct 2020 16:24:00 +0000 (12:24 -0400)]
testsuite: Enable p9-lxvx-stxvx testcases and fold-vec-extract

This patch enables the p9-lxvx-stxvx testcases with appropriate
requirements.  It also adjusts the expected matching instructions
in the fold-vec-extract testcases for BE.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/fold-vec-extract-float.p9.c: rldicl and
subfic only for target LE.
* gcc.target/powerpc/fold-vec-extract-longlong.p9.c: xori only
for target LE.  Adjust mfvsrd and add mfvsrld for BE.
* gcc.target/powerpc/fold-vec-extract-short.p9.c: vextuhrx for LE.
vextuhlx for BE.
* gcc.target/powerpc/p9-lxvx-stxvx-1.c: Remove target.
* gcc.target/powerpc/p9-lxvx-stxvx-2.c: Remove target.
* gcc.target/powerpc/p9-lxvx-stxvx-3.c: Remove target. Require
float128

4 years agolibstdc++: Simplify std::shared_ptr construction from std::weak_ptr
Jonathan Wakely [Wed, 21 Oct 2020 20:13:41 +0000 (21:13 +0100)]
libstdc++: Simplify std::shared_ptr construction from std::weak_ptr

The _M_add_ref_lock() and _M_add_ref_lock_nothrow() members of
_Sp_counted_base are very similar, except that the former throws an
exception when the use count is zero and the latter returns false. The
former (and its callers) can be implemented in terms of the latter.
This results in a small reduction in code size, because throwing an
exception now only happens in one place.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr.h (shared_ptr(const weak_ptr&, nothrow_t)):
Add noexcept.
* include/bits/shared_ptr_base.h (_Sp_counted_base::_M_add_ref_lock):
Remove specializations and just call _M_add_ref_lock_nothrow.
(__shared_count, __shared_ptr): Use nullptr for null pointer
constants.
(__shared_count(const __weak_count&)): Use _M_add_ref_lock_nothrow
instead of _M_add_ref_lock.
(__shared_count(const __weak_count&, nothrow_t)): Add noexcept.
(__shared_ptr::operator bool()): Add noexcept.
(__shared_ptr(const __weak_ptr&, nothrow_t)): Add noexcept.

4 years agors6000: MMA type causes an ICE in ranger pass due to incompatible types
Richard Biener [Wed, 21 Oct 2020 19:28:45 +0000 (14:28 -0500)]
rs6000: MMA type causes an ICE in ranger pass due to incompatible types

PR97360 shows a problem in how we create our PXI and POI modes that cause
an ICE in the ranger pass.  The problem seems to be that the extra call
to build_distinct_type_copy() also creates new TYPE_{MIN,MAX}_VALUEs that
are not compatible/the same as the base type itself.  The simple "fix" is
to actually remove the unneeded build_distinct_type_copy(), since according
to richi, the types returned from make_unsigned_type() are already distinct.

gcc/

2020-10-21  Richard Biener  <rguenther@suse.de>

PR target/97360
* config/rs6000/rs6000-call.c (rs6000_init_builtins): Remove call to
build_distinct_type_copy().

gcc/testsuite/

2020-10-21  Martin Liska  <mliska@suse.cz>

PR target/97360
* gcc.target/powerpc/pr97360.c: New test.

Co-authored-by: Andrew MacLeod <amacleod@redhat.com>
Co-authored-by: Martin Liska <mliska@suse.cz>
4 years agoInline functions with builtin_constant_p more agressively.
Jan Hubicka [Wed, 21 Oct 2020 18:00:22 +0000 (20:00 +0200)]
Inline functions with builtin_constant_p more agressively.

This patch implements heuristics that increases inline limits (by the hints
mechanism) for inline functions that use builtin_constant_p on parameter. Those
are very likely intended to be always inlined and simplify after inlining.

The PR is about a function that we used to inline with
 --param inline-insns-single=200 but with new default of 70 for -O2 we no longer
do so.  Hints are currently configured to bump the bound up twice, so we
get limit of 140 that is still not enough to inline the particular testcase
but it should help in general.  I can implement a stronger bump if that seems
useful (maybe it is). The example is bit operation written as a decision chain
with 64 conditions.
This blows up the limit on number of conditions we track per funtion (which is
30) and thus the size/time estimates are not working that well.

gcc/ChangeLog:

PR ipa/97445
* ipa-fnsummary.c (ipa_dump_hints): Add INLINE_HINT_builtin_constant_p.
(ipa_fn_summary::~ipa_fn_summary): Free builtin_constant_p_parms.
(ipa_fn_summary_t::duplicate): Duplicate builtin_constant_p_parms.
(ipa_dump_fn_summary): Dump builtin_constant_p_parms.
(add_builtin_constant_p_parm): New function
(set_cond_stmt_execution_predicate): Update builtin_constant_p_parms.
(ipa_call_context::estimate_size_and_time): Set
INLINE_HINT_builtin_constant_p..
(ipa_merge_fn_summary_after_inlining): Merge builtin_constant_p_parms.
(inline_read_section): Read builtin_constant_p_parms.
(ipa_fn_summary_write): Write builtin_constant_p_parms.
* ipa-fnsummary.h (enum ipa_hints_vals): Add
INLINE_HINT_builtin_constant_p.
* ipa-inline.c (want_inline_small_function_p): Use
INLINE_HINT_builtin_constant_p.
(edge_badness): Use INLINE_HINT_builtin_constant_p.

gcc/testsuite/ChangeLog:

PR ipa/97445
* gcc.dg/ipa/inlinehint-5.c: New test.

4 years agoRemove interfering default #undefs from vx-common.h
Douglas Rupp [Mon, 2 Dec 2019 17:17:18 +0000 (09:17 -0800)]
Remove interfering default #undefs from vx-common.h

undef'ing LIB_SPEC and especially LINK_SPEC here is unneccesary and
inteferes with the definition of LINK_SPEC for the bi-arch'd ppc*-vx7r2
target which uses the linux64 LINK_SPEC

2020-10-21  Douglas Rupp  <rupp@adacore.com>

gcc/
* config/vx-common.h (LINK_SPEC, LIB_SPEC): Remove #undef.