Jakub Jelinek [Fri, 15 Oct 2021 15:19:54 +0000 (17:19 +0200)]
openmp: Improve testsuite/libgomp.c/affinity-1.c testcase
I've noticed that while I have added hopefully sufficient test coverage
for the case where one uses simple number or !number as p-interval,
I haven't added any coverage for number:len:stride or number:len.
This patch adds that.
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.c/affinity-1.c (struct places): Change name field
type from char [50] to const char *.
(places_array): Add a testcase for simplified syntax place followed
by length or length and stride.
John David Anglin [Fri, 15 Oct 2021 14:50:30 +0000 (14:50 +0000)]
Consistently use "rG" constraint for copy instruction in move patterns
2021-10-15 John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog:
* config/pa/pa.md: Consistently use "rG" constraint for copy
instruction in move patterns.
Jakub Jelinek [Fri, 15 Oct 2021 14:35:57 +0000 (16:35 +0200)]
openmp: Handle OpenMP 5.1 simplified OMP_PLACES syntax
In addition to adding ll_caches and numa_domain abstract names
to OMP_PLACES syntax, OpenMP 5.1 also added one syntax simplification:
https://github.com/OpenMP/spec/issues/2080
https://github.com/OpenMP/spec/pull/2081
in particular that in the grammar place non-terminal is now
not only { res-list } but also res (i.e. a non-negative integer),
which stands as a shortcut for { res }
So, one can specify OMP_PLACES=0,4,8,12 with the meaning
OMP_PLACES={0},{4},{8},{12} or OMP_PLACES=0:4 instead of OMP_PLACES={0}:4
or OMP_PLACES={0},{1},{2},{3} etc.
This patch implements that.
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* env.c (parse_one_place): Handle non-negative-number the same
as { non-negative-number }. Reject even !number:1 and
!number:1:stride or !place:1 or !place:1:stride instead of just
length other than 1.
* libgomp.texi (OpenMP 5.1): Document OMP_PLACES syntax extensions
and OMP_NUM_TEAMS/OMP_TEAMS_THREAD_LIMIT and
omp_{set_num,get_max}_teams/omp_{s,g}et_teams_thread_limit features
as implemented.
* testsuite/libgomp.c/affinity-1.c: Add a test for the 5.1 place
simplified syntax.
Jakub Jelinek [Fri, 15 Oct 2021 14:28:34 +0000 (16:28 +0200)]
openmp: Fix up strtoul and strtoull uses in libgomp
Yesterday when working on numa_domains, I've noticed because of a bug
in my patch a hang on a large NUMA machine. I've fixed the bug, but
also discovered that the hang was a result of making wrong assumptions
about strtoul/strtoull. All the uses were for portability setting
errno = 0 before the calls and treating non-zero errno after the call
as invalid input, but for the case where there are no valid digits at
all strtoul may set errno to EINVAL, but doesn't have to and with
glibc doesn't do that. So, this patch goes through all the strtoul calls
and next to errno != 0 checks adds also endptr == startptr check.
Haven't done it in places where we immediately reject strtoul returning 0
the same as we reject errno != 0, because strtoul must return 0 in the
case where it sets endptr to the start pointer. In some spots the code
was using errno = 0; x = strtoul (p, &p, 10); if (errno) { /*invalid*/ }
and those spots had to be changed to
errno = 0; x = strtoul (p, &end, 10); if (errno || end == p) { /*invalid*/ }
p = end;
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* env.c (parse_schedule): For strtoul or strtoull calls which don't
clearly reject return value 0 as invalid handle the case where end
pointer is the same as first argument as invalid.
(parse_unsigned_long_1): Likewise.
(parse_one_place): Likewise.
(parse_places_var): Likewise.
(parse_stacksize): Likewise.
(parse_spincount): Likewise.
(parse_affinity): Likewise.
(parse_gomp_openacc_dim): Likewise. Avoid strict aliasing violation.
Make code valid C89.
* config/linux/affinity.c (gomp_affinity_find_last_cache_level):
For strtoul calls which don't clearly reject return value 0 as
invalid handle the case where end pointer is the same as first
argument as invalid.
(gomp_affinity_init_level_1): Likewise.
(gomp_affinity_init_numa_domains): Likewise.
* config/rtems/proc.c (parse_thread_pools): Likewise.
Jakub Jelinek [Fri, 15 Oct 2021 14:25:25 +0000 (16:25 +0200)]
openmp: Fix up handling of OMP_PLACES=threads(1)
When writing the places-*.c tests, I've noticed that we mishandle threads
abstract name with specified num-places if num-places isn't a multiple of
number of hw threads in a core. It then happily ignores the maximum count
and overwrites for the remaining hw threads in a core further places that
haven't been allocated.
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* config/linux/affinity.c (gomp_affinity_init_level_1): For level 1
after creating count places clean up and return immediately.
* testsuite/libgomp.c/places-6.c: New test.
* testsuite/libgomp.c/places-7.c: New test.
* testsuite/libgomp.c/places-8.c: New test.
* testsuite/libgomp.c/places-9.c: New test.
* testsuite/libgomp.c/places-10.c: New test.
Andrew Stubbs [Wed, 13 Oct 2021 10:53:42 +0000 (11:53 +0100)]
amdgcn: fix up offload debug linking with LLVM 13
Between LLVM 9 and LLVM 13 the attribute works differently in several ways,
and this needs to be allowed for in GCC and mkoffload independently.
This patch fixes up mkoffload when debug info is enabled, which is made more
complicated because the configure tests checks whether the attribute option
is accepted silently, but does not check if the assembler actually sets the
ELF flags for that attribute, and mkoffload needs to mimick that behaviour
exactly. The patch therefore removes some of the conditionals.
gcc/ChangeLog:
* config/gcn/gcn-hsa.h (S_FIJI): Set unconditionally.
(S_900): Likewise.
(S_906): Likewise.
* config/gcn/gcn.c: Hard code SRAM ECC settings for old architectures.
* config/gcn/mkoffload.c (ELFABIVERSION_AMDGPU_HSA): Rename to ...
(ELFABIVERSION_AMDGPU_HSA_V3): ... this.
(ELFABIVERSION_AMDGPU_HSA_V4): New.
(SET_SRAM_ECC_UNSUPPORTED): New.
(copy_early_debug_info): Create elf flags to match the other objects.
(main): Just let the attribute flags pass through.
Stefan Schulze Frielinghaus [Fri, 15 Oct 2021 11:52:49 +0000 (13:52 +0200)]
tree-optimization/102752: Fix determining precission of reduction_var
While determining the precission of reduction_var an SSA_NAME instead of
its TREE_TYPE is used. Streamlined with other TREE_TYPE (reduction_var)
uses.
gcc/ChangeLog:
* tree-loop-distribution.c (reduction_var_overflows_first):
Pass the type of reduction_var as first argument as it is also
done for the load type.
(loop_distribution::transform_reduction_loop): Add missing
TREE_TYPE while determining precission of reduction_var.
Aldy Hernandez [Fri, 15 Oct 2021 10:53:32 +0000 (12:53 +0200)]
Make signness explicit in tree-ssa/pr102736.c
This test is failing on ppc64* due to different default signness for
chars.
Tested on x86-64 Linux and ppc64le Linux.
PR testsuite/pr102751
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr102736.c: Make sign explicit.
Jakub Jelinek [Fri, 15 Oct 2021 10:16:50 +0000 (12:16 +0200)]
openmp: Add support for OMP_PLACES=numa_domains
This adds support for numa_domains abstract name in OMP_PLACES, also new
in OpenMP 5.1.
Way to test this is
OMP_PLACES=numa_domains OMP_DISPLAY_ENV=true LD_PRELOAD=.libs/libgomp.so.1 /bin/true
and see what it prints on OMP_PLACES line.
For non-NUMA machines it should print a single place that covers all CPUs,
for NUMA machine one place for each NUMA node with corresponding CPUs.
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* env.c (parse_places_var): Handle numa_domains as level 5.
* config/linux/affinity.c (gomp_affinity_init_numa_domains): New
function.
(gomp_affinity_init_level): Use it instead of
gomp_affinity_init_level_1 for level == 5.
* testsuite/libgomp.c/places-5.c: New test.
Jakub Jelinek [Fri, 15 Oct 2021 10:06:51 +0000 (12:06 +0200)]
openmp: Add support for OMP_PLACES=ll_caches
This patch implements support for ll_caches abstract name in OMP_PLACES,
which stands for places where logical cpus in each place share the last
level cache.
This seems to work fine for me on x86 and kernel sources show that it is
in common code, but on some machines on CompileFarm the files I'm using,
i.e.
/sys/devices/system/cpu/cpuN/cache/indexN/level
/sys/devices/system/cpu/cpuN/cache/indexN/shared_cpu_list
don't exist, is that because they have too old kernel and newer kernels
are fine or should I implement some fallback methods (which)?
E.g. on gcc112.fsffrance.org I see just shared_cpu_map and not shared_cpu_list
(with shared_cpu_map being harder to parse) and on another box I didn't even
see the cache subdirectories.
Way to test this is
OMP_PLACES=ll_caches OMP_DISPLAY_ENV=true LD_PRELOAD=.libs/libgomp.so.1 /bin/true
and see what it prints on OMP_PLACES line.
2021-10-15 Jakub Jelinek <jakub@redhat.com>
* env.c (parse_places_var): Handle ll_caches as level 4.
* config/linux/affinity.c (gomp_affinity_find_last_cache_level): New
function.
(gomp_affinity_init_level_1): Handle level 4 as logical cpus sharing
last level cache.
(gomp_affinity_init_level): Likewise.
* testsuite/libgomp.c/places-1.c: New test.
* testsuite/libgomp.c/places-2.c: New test.
* testsuite/libgomp.c/places-3.c: New test.
* testsuite/libgomp.c/places-4.c: New test.
Richard Biener [Fri, 10 Sep 2021 09:25:21 +0000 (11:25 +0200)]
Always default to DWARF2_DEBUG if not specified, warn about deprecated STABS
This makes defaults.h choose DWARF2_DEBUG if PREFERRED_DEBUGGING_TYPE
is not specified by the target and errors out if DWARF DWARF is not supported.
It also makes us warn when STABS is enabled but not the preferred
debugging type and removes the corresponding diagnostic from the Ada frontend.
The warnings are pruned from the testsuite output via prune_gcc_output.
The following target configurations now explicitely default to STABS:
pdp11-*-* pdp11 is a.out, dwarf support is difficult
hppa[12]*-*-hpux10* does not support DWARF
hppa[12]*-*-hpux11* likewise
note that the hppa configs have been deprecated.
Targets with DWARF support will now see
> ./cc1 -quiet t.c -gstabs
t.c: warning: STABS debugging information is obsolete and not supported anymore
that is, -gstabs will still generate STABS but use will be diagnosed
on targets where DWARF is available.
I have built all targets from contrib/config-list.mk to make sure we
don't run into the #error and the following makes the STABS usage
explicit for pdp11 and hppa with SOM.
This completes the series of deprecating STABS for GCC 12.
2021-09-21 Richard Biener <rguenther@suse.de>
gcc/
* defaults.h (PREFERRED_DEBUGGING_TYPE): Choose DWARF2_DEBUG
when not set.
* toplev.c (process_options): Warn when STABS debugging is
enabled but not the preferred format.
* config/pa/som.h (PREFERRED_DEBUGGING_TYPE): Define to
DBX_DEBUG.
* config/pdp11/pdp11.h (PREFERRED_DEBUGGING_TYPE): Likewise.
gcc/ada/
* gcc-interface/misc.c (gnat_post_options): Do not warn
about DBX_DEBUG use here.
gcc/testsuite/
* lib/prune.exp: Prune STABS obsoletion message.
Richard Biener [Fri, 15 Oct 2021 06:52:08 +0000 (08:52 +0200)]
c/102763 - fix ICE with invalid input to GIMPLE FE
This fixes an ICE for the failure to verify we're dereferencing a
pointer before throwing that at build_simple_mem_ref.
2021-10-15 Richard Biener <rguenther@suse.de>
PR c/102763
gcc/c/
* gimple-parser.c
(c_parser_gimple_postfix_expression_after_primary): Check
for a pointer do be dereferenced by ->.
gcc/testsuite/
* gcc.dg/gimplefe-error-12.c: New testcase.
Richard Biener [Fri, 15 Oct 2021 06:41:57 +0000 (08:41 +0200)]
ipa/102762 - fix ICE with invalid __builtin_va_arg_pack () use
We have to be careful to not break the argument space calculation.
If there's not enough arguments just do not append any.
2021-10-15 Richard Biener <rguenther@suse.de>
PR ipa/102762
* tree-inline.c (copy_bb): Avoid underflowing nargs.
* gcc.dg/torture/pr102762.c: New testcase.
Hongyu Wang [Mon, 30 Aug 2021 07:18:35 +0000 (15:18 +0800)]
AVX512FP16: Enhance vector shuffle builtins
Support HFmode vector shuffle by creating HImode subreg when
expanding permutation expr.
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_vec_perm): Convert
HFmode input operand to HImode.
(ix86_vectorize_vec_perm_const): Likewise.
* config/i386/sse.md (*avx512bw_permvar_truncv16siv16hi_1_hf):
New define_insn.
(*avx512f_permvar_truncv8siv8hi_1_hf):
Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-builtin_shuffle-1.c: New test.
* gcc.target/i386/avx512fp16-pr101846.c: Ditto.
* gcc.target/i386/avx512fp16-pr94680.c: Ditto.
Richard Biener [Mon, 11 Oct 2021 12:08:52 +0000 (14:08 +0200)]
middle-end/102682 - avoid invalid subreg on the LHS
The following avoids generating
(insn 6 5 7 2 (set (subreg:OI (concatn/v:TI [
(reg:DI 92 [ buffer ])
(reg:DI 93 [ buffer+8 ])
]) 0)
(subreg:OI (reg/v:V8SI 85 [ __x ]) 0)) "t.ii":76:21 74 {*movoi_internal_avx}
(nil))
via store_bit_field_1 when we try to store excess data into
a register allocated temporary. The case was supposed to
/* Use the subreg machinery either to narrow OP0 to the required
words...
but the check ensured only an register-aligned but not a large
enough piece. The following adds such missed check which ends up
decomposing the set to
(insn 6 5 7 (set (subreg:DI (reg/v:TI 84 [ buffer ]) 0)
(subreg:DI (reg/v:V8SI 85 [ __x ]) 0)) "t.ii":76:21 -1
(nil))
(insn 7 6 0 (set (subreg:DI (reg/v:TI 84 [ buffer ]) 8)
(subreg:DI (reg/v:V8SI 85 [ __x ]) 8)) "t.ii":76:21 -1
(nil))
2021-10-11 Richard Biener <rguenther@suse.de>
PR middle-end/102682
* expmed.c (store_bit_field_1): Ensure a LHS subreg would
not create a paradoxical subreg.
Hongyu Wang [Fri, 15 Oct 2021 02:58:16 +0000 (10:58 +0800)]
AVX512FP16: Fix ICE for 2 v4hf vector concat
For V4HFmode, doing vector concat like
__builtin_shufflevector (a, b, {0, 1, 2, 3, 4, 5, 6, 7})
could trigger ICE since it is not handled in ix86_vector_init ().
Handle HFmode like HImode to avoid such ICE.
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_vector_init):
For half_vector concat for HFmode, handle them like HImode.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-v4hf-concat.c: New test.
Hongyu Wang [Fri, 15 Oct 2021 02:23:38 +0000 (10:23 +0800)]
AVX512FP16: Fix testcase for complex intrinsic
-march=cascadelake which contains -mavx512vl produces unmatched scan
for vf[c]maddcsh test, so add -mno-avx512vl to vf[c]maddcsh-1a.c.
Also add scan for vblendmps to vf[c]maddcph tests to check correctness.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-vfcmaddcph-1a.c: Add scan for
vblendmps.
* gcc.target/i386/avx512fp16-vfmaddcph-1a.c: Likewise.
* gcc.target/i386/avx512fp16vl-vfcmaddcph-1a.c: Likewise.
* gcc.target/i386/avx512fp16vl-vfmaddcph-1a.c: Likewise.
* gcc.target/i386/avx512fp16-vfmaddcsh-1a.c: Add -mno-avx512vl.
* gcc.target/i386/avx512fp16-vfcmaddcsh-1a.c: Likewise.
Jason Merrill [Thu, 14 Oct 2021 02:04:53 +0000 (22:04 -0400)]
c++: instantiate less for constant folding
I've been experimenting with a change to make all inline functions
implicitly constexpr; this revealed that we are instantiating too
aggressively for speculative constant evaluation, leading to ordering
difficulties with e.g. is_a_helper<cgraph_node*>::test. This patch tries to
avoid such instantiation until we actually need the function definition to
determine whether a call is constant, by limiting the initial instantiation
of all used functions to manifestly-constant-evaluated expressions, and
checking whether the function arguments are constant before instantiating
the function.
This change resulted in a change in the diagnostics for a few library tests
due to instantiating the function with the static_assert later (during
constant evaluation) than we did before (during instantiation of the
intermediate function).
gcc/cp/ChangeLog:
* constexpr.c (cxx_bind_parameters_in_call): Replace
new_call parameter with fun.
(cxx_eval_call_expression): Call it before instantiation.
(cxx_eval_outermost_constant_expr): Only instantiate fns
when manifestly_const_eval.
* typeck2.c (check_narrowing): This context is manifestly
constant-evaluated.
libstdc++-v3/ChangeLog:
* testsuite/20_util/integer_comparisons/greater_equal_neg.cc:
* testsuite/20_util/integer_comparisons/greater_neg.cc:
* testsuite/20_util/integer_comparisons/less_equal_neg.cc:
Adjust expected message.
* testsuite/lib/prune.exp: Prune 'in constexpr expansion'.
gcc/testsuite/ChangeLog:
* g++.dg/ext/vla22.C: Don't expect a narrowing error.
* g++.dg/cpp0x/constexpr-inst1.C: New test.
Andrew MacLeod [Fri, 15 Oct 2021 00:32:53 +0000 (20:32 -0400)]
Add target int128 to testcase.
gcc/testsuite
* gcc.dg/pr102738.c: Add target int128.
GCC Administrator [Fri, 15 Oct 2021 00:17:02 +0000 (00:17 +0000)]
Daily bump.
Aldy Hernandez [Thu, 14 Oct 2021 13:01:49 +0000 (15:01 +0200)]
Add ability to use full resolving path solver in the backward threader.
The path solver runs in two modes: a quick mode which assumes any unknown
SSA names are VARYING, and a fully resolving mode using the ranger.
The backward threader currently uses the quick mode, because the fully
resolving mode was not available initially. Since we now have the ability
in the solver (used by the hybrid threader), I thought it'd be useful to
have the knob for when the time comes.
Note that enabling the fully resolving mode will require some experimenting,
as enabling it would likely render other jump threading passes irrelevant
(VRP threading comes to mind).
There should be no functional changes as the resolver is set to false.
Tested on x86-64 Linux.
gcc/ChangeLog:
* tree-ssa-threadbackward.c (class back_threader): Add m_resolve.
(back_threader::back_threader): Same.
(back_threader::resolve_phi): Try to solve without looking back if
possible.
(back_threader::find_paths_to_names): Same.
(try_thread_blocks): Pass resolve argument to back threader.
(pass_early_thread_jumps::execute): Same.
Aldy Hernandez [Thu, 14 Oct 2021 14:15:04 +0000 (16:15 +0200)]
Cleanup --params for backward threader.
The new backward threader makes some of the --param knobs used to
control it questionable at best or no longer applicable at worst.
The fsm-maximum-phi-arguments param is unused and can be removed.
The max-fsm-thread-length param is block based which is a bit redundant,
since we already restrict paths based on instruction estimates.
The max-fsm-thread-paths restricts the total number of threadable paths
in a function. We probably don't need this. Besides, the forward
threader has no such restriction.
Tested on x86-64 Linux.
gcc/ChangeLog:
* doc/invoke.texi: Remove max-fsm-thread-length,
max-fsm-thread-paths, and fsm-maximum-phi-arguments.
* params.opt: Same.
* tree-ssa-threadbackward.c (back_threader::back_threader): Remove
argument.
(back_threader_registry::back_threader_registry): Same.
(back_threader_profitability::profitable_path_p): Remove
param_max_fsm_thread-length.
(back_threader_registry::register_path): Remove
m_max_allowable_paths.
Aldy Hernandez [Thu, 14 Oct 2021 14:14:34 +0000 (16:14 +0200)]
Minor cleanups to backward threader.
Tested on x86-64 Linux.
gcc/ChangeLog:
* tree-ssa-threadbackward.c (class back_threader): Make m_imports
an auto_bitmap.
(back_threader::~back_threader): Do not release m_path.
Jonathan Wakely [Thu, 14 Oct 2021 19:37:38 +0000 (20:37 +0100)]
libstdc++: Simplify variant access functions
libstdc++-v3/ChangeLog:
* include/std/variant (__variant::__get(in_place_index_t<N>, U&&)):
Rename to __get_n and remove first argument. Replace pair of
overloads with a single function using 'if constexpr'.
(__variant::__get(Variant&&)): Adjust to use __get_n.
Jonathan Wakely [Thu, 14 Oct 2021 12:58:02 +0000 (13:58 +0100)]
libstdc++: Make filesystem::path(path&&) always noexcept
Since r12-4065 std::basic_string is always nothrow-move-constructible,
so filesystem::path is too.
That also means that path::_S_convert(T) is noexcept when returning its
argument, because T is either a basci_string or basic_string_view, and
will be moved into the return value.
libstdc++-v3/ChangeLog:
* include/bits/fs_path.h (path(path&&)): Make unconditionally
noexcept.
(path::_S_convert(T)): Add condtional noexcept.
Joseph Myers [Thu, 14 Oct 2021 20:56:29 +0000 (20:56 +0000)]
c-family: Support DFP printf/scanf formats for C2X
When I enabled various decimal floating-point features for C2X /
stopped them being diagnosed with -pedantic for C2X, I missed the
format checking support. The DFP printf and scanf formats are
included in C2X. Thus, adjust the data for those formats so that they
are no longer diagnosed with -std=c2x -Wformat -pedantic.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c-family/
* c-format.c (printf_length_specs, scanf_length_specs)
(print_char_table, scan_char_table): Support DFP formats for C2X.
* c-format.h (TEX_D32, TEX_D64, TEX_D128): Remove.
(T2X_D32, T2X_D64, T2X_D128): New macros.
gcc/testsuite/
* gcc.dg/format/c11-dfp-printf-1.c,
gcc.dg/format/c11-dfp-scanf-1.c, gcc.dg/format/c2x-dfp-printf-1.c,
gcc.dg/format/c2x-dfp-scanf-1.c: New tests.
Raphael Moreira Zinsly [Tue, 5 Oct 2021 18:32:52 +0000 (15:32 -0300)]
libgcc: Add a backchain fallback to _Unwind_Backtrace() on PowerPC
Without dwarf2 unwind tables available _Unwind_Backtrace() is not
able to return the full backtrace.
This patch adds a fallback function on powerpc to get the backtrace
by doing a backchain, this code was originally at glibc.
libgcc/ChangeLog:
* config/rs6000/linux-unwind.h (struct rt_sigframe): Move it to
outside of get_regs() in order to use it in another function, this
is done twice: for __powerpc64__ and for !__powerpc64__.
(struct trace_arg): New struct.
(struct layout): New struct.
(ppc_backchain_fallback): New function.
* unwind.inc (_Unwind_Backtrace): Look for _URC_NORMAL_STOP code
state and call MD_BACKCHAIN_FALLBACK.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/unwind-backchain.c: New test.
Harald Anlauf [Thu, 14 Oct 2021 18:19:50 +0000 (20:19 +0200)]
Fortran: generate error message for negative elements in SHAPE array
gcc/fortran/ChangeLog:
PR fortran/102717
* simplify.c (gfc_simplify_reshape): Replace assert by error
message for negative elements in SHAPE array.
gcc/testsuite/ChangeLog:
PR fortran/102717
* gfortran.dg/reshape_shape_2.f90: New test.
Harald Anlauf [Thu, 14 Oct 2021 18:18:14 +0000 (20:18 +0200)]
Fortran: fix order of checks for the SHAPE intrinsic
gcc/fortran/ChangeLog:
PR fortran/102716
* check.c (gfc_check_shape): Reorder checks so that invalid KIND
arguments can be detected.
gcc/testsuite/ChangeLog:
PR fortran/102716
* gfortran.dg/shape_10.f90: New test.
Andrew MacLeod [Thu, 14 Oct 2021 14:43:58 +0000 (10:43 -0400)]
Simplification for right shift.
When the first operand of a signed right shift is zero or negative one, the
RHS doesn't matter and the shift can be converted to a copy.
PR tree-optimization/102738
gcc/
* vr-values.c (simplify_using_ranges::simplify): Handle RSHIFT_EXPR.
gcc/testsuite
* gcc.dg/pr102738.c: New.
Kwok Cheung Yeung [Thu, 14 Oct 2021 16:29:13 +0000 (09:29 -0700)]
openmp: Mark declare variant directive in documentation as supported in Fortran
2021-10-14 Kwok Cheung Yeung <kcy@codesourcery.com>
libgomp/
* libgomp.texi (OpenMP 5.0): Update entry for declare variant
directive.
Luís Ferreira [Thu, 14 Oct 2021 16:24:51 +0000 (12:24 -0400)]
libiberty: d-demangle: Add test case for function literals
libiberty/ChangeLog:
* testsuite/d-demangle-expected: Add test case for function literals.
Luís Ferreira [Thu, 14 Oct 2021 16:22:57 +0000 (12:22 -0400)]
libiberty: d-demangle: add test cases for simple special mangles
libiberty/ChangeLog:
* testsuite/d-demangle-expected: Add test cases for simple special
mangles.
Kwok Cheung Yeung [Thu, 14 Oct 2021 14:57:12 +0000 (07:57 -0700)]
openmp, fortran: Add support for OpenMP declare variant directive in Fortran
2021-10-14 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/c-family/
* c-omp.c (c_omp_check_context_selector): Rename to
omp_check_context_selector and move to omp-general.c.
(c_omp_mark_declare_variant): Rename to omp_mark_declare_variant and
move to omp-general.c.
gcc/c/
* c-parser.c (c_finish_omp_declare_variant): Change call from
c_omp_check_context_selector to omp_check_context_selector. Change
call from c_omp_mark_declare_variant to omp_mark_declare_variant.
gcc/cp/
* decl.c (omp_declare_variant_finalize_one): Change call from
c_omp_mark_declare_variant to omp_mark_declare_variant.
* parser.c (cp_finish_omp_declare_variant): Change call from
c_omp_check_context_selector to omp_check_context_selector.
gcc/fortran/
* gfortran.h (enum gfc_statement): Add ST_OMP_DECLARE_VARIANT.
(enum gfc_omp_trait_property_kind): New.
(struct gfc_omp_trait_property): New.
(gfc_get_omp_trait_property): New macro.
(struct gfc_omp_selector): New.
(gfc_get_omp_selector): New macro.
(struct gfc_omp_set_selector): New.
(gfc_get_omp_set_selector): New macro.
(struct gfc_omp_declare_variant): New.
(gfc_get_omp_declare_variant): New macro.
(struct gfc_namespace): Add omp_declare_variant field.
(gfc_free_omp_declare_variant_list): New prototype.
* match.h (gfc_match_omp_declare_variant): New prototype.
* openmp.c (gfc_free_omp_trait_property_list): New.
(gfc_free_omp_selector_list): New.
(gfc_free_omp_set_selector_list): New.
(gfc_free_omp_declare_variant_list): New.
(gfc_match_omp_clauses): Add extra optional argument. Handle end of
clauses for context selectors.
(omp_construct_selectors, omp_device_selectors,
omp_implementation_selectors, omp_user_selectors): New.
(gfc_match_omp_context_selector): New.
(gfc_match_omp_context_selector_specification): New.
(gfc_match_omp_declare_variant): New.
* parse.c: Include tree-core.h and omp-general.h.
(decode_omp_directive): Handle 'declare variant'.
(case_omp_decl): Include ST_OMP_DECLARE_VARIANT.
(gfc_ascii_statement): Handle ST_OMP_DECLARE_VARIANT.
(gfc_parse_file): Initialize omp_requires_mask.
* symbol.c (gfc_free_namespace): Call
gfc_free_omp_declare_variant_list.
* trans-decl.c (gfc_get_extern_function_decl): Call
gfc_trans_omp_declare_variant.
(gfc_create_function_decl): Call gfc_trans_omp_declare_variant.
* trans-openmp.c (gfc_trans_omp_declare_variant): New.
* trans-stmt.h (gfc_trans_omp_declare_variant): New prototype.
gcc/
* omp-general.c (omp_check_context_selector): Move from c-omp.c.
(omp_mark_declare_variant): Move from c-omp.c.
(omp_context_name_list_prop): Update for Fortran strings.
* omp-general.h (omp_check_context_selector): New prototype.
(omp_mark_declare_variant): New prototype.
gcc/testsuite/
* gfortran.dg/gomp/declare-variant-1.f90: New test.
* gfortran.dg/gomp/declare-variant-10.f90: New test.
* gfortran.dg/gomp/declare-variant-11.f90: New test.
* gfortran.dg/gomp/declare-variant-12.f90: New test.
* gfortran.dg/gomp/declare-variant-13.f90: New test.
* gfortran.dg/gomp/declare-variant-14.f90: New test.
* gfortran.dg/gomp/declare-variant-15.f90: New test.
* gfortran.dg/gomp/declare-variant-16.f90: New test.
* gfortran.dg/gomp/declare-variant-17.f90: New test.
* gfortran.dg/gomp/declare-variant-18.f90: New test.
* gfortran.dg/gomp/declare-variant-19.f90: New test.
* gfortran.dg/gomp/declare-variant-2.f90: New test.
* gfortran.dg/gomp/declare-variant-2a.f90: New test.
* gfortran.dg/gomp/declare-variant-3.f90: New test.
* gfortran.dg/gomp/declare-variant-4.f90: New test.
* gfortran.dg/gomp/declare-variant-5.f90: New test.
* gfortran.dg/gomp/declare-variant-6.f90: New test.
* gfortran.dg/gomp/declare-variant-7.f90: New test.
* gfortran.dg/gomp/declare-variant-8.f90: New test.
* gfortran.dg/gomp/declare-variant-9.f90: New test.
libgomp/
* testsuite/libgomp.fortran/declare-variant-1.f90: New test.
Richard Sandiford [Thu, 14 Oct 2021 15:35:42 +0000 (16:35 +0100)]
rs6000: Fix memory leak in rs6000_density_test
rs6000_density_test has an early exit test between a call
to get_loop_body and the corresponding free. This would
lead to a memory leak if the early exit is taken.
gcc/
* config/rs6000/rs6000.c (rs6000_density_test): Move early
exit test further up the function.
Richard Sandiford [Thu, 14 Oct 2021 15:35:41 +0000 (16:35 +0100)]
arm: Remove add_stmt_cost hook
The arm implementation of add_stmt_cost was added alongside
arm_builtin_vectorization_cost. At that time it was necessary
to override the latter when overriding the former, since
default_add_stmt_cost didn't indirect through the
builtin_vectorization_cost target hook:
int stmt_cost = default_builtin_vectorization_cost (kind, vectype,
misalign);
That was fixed by:
| 2014-06-06 Bingfeng Mei <bmei@broadcom.com>
|
| * targhooks.c (default_add_stmt_cost): Call target specific
| hook instead of default one.
so the arm definition of add_stmt_cost is now equivalent
to the default.
gcc/
* config/arm/arm.c (arm_add_stmt_cost): Delete.
(TARGET_VECTORIZE_ADD_STMT_COST): Delete.
Martin Jambor [Thu, 14 Oct 2021 15:00:35 +0000 (17:00 +0200)]
Add forgotten documentation of param ipa-cp-recursive-freq-factor
Martin Liška has noticed that I forgot to document the recently added
parameter in the invoke.texi documentation. This patch fixes it.
Tested by running make info and make pdf and examining the output.
gcc/ChangeLog:
2021-10-14 Martin Jambor <mjambor@suse.cz>
* doc/invoke.texi (Optimize Options): Add entry for
ipa-cp-recursive-freq-factor.
Jeff Law [Thu, 14 Oct 2021 14:49:05 +0000 (10:49 -0400)]
Fix mips testsuite fallout from vectorizer changes
gcc/testsuite
* gcc.target/mips/msa-insert-split.c: Turn off vectorizer.
Jonathan Wakely [Thu, 14 Oct 2021 12:20:57 +0000 (13:20 +0100)]
libstdc++: Fix brainwrong in path::_S_convert(T) [PR102743]
This function was supposed to check whether the parameter's value type
is the same as path::value_type, and therefore needs no conversion.
Instead it checks whether the parameter is the same as its own value
type, which is never true. This means we incorrectly return a string
view for the case where T is path::string_type, instead of just
returning the string itself. The only place that happens is
path::_S_convert_loc for Windows, where we call _S_convert with a
std::wstring rvalue.
This fixes the condition in _S_convert(T).
libstdc++-v3/ChangeLog:
PR libstdc++/102743
* include/bits/fs_path.h (path::_S_convert(T)): Fix condition
for returning the same string unchanged.
Jonathan Wakely [Wed, 6 Oct 2021 19:03:50 +0000 (20:03 +0100)]
libstdc++: Use more descriptive feature test macro
The out-of-class definitions of the static constants are redundant if
the __cpp_inline_variables feature is supported, so use that macro to
decide whether to define them or not.
libstdc++-v3/ChangeLog:
* include/bits/regex.h: Check __cpp_inline_variables instead of
__cplusplus.
Tamar Christina [Thu, 14 Oct 2021 14:07:14 +0000 (15:07 +0100)]
sve: optimize add reduction patterns
The following loop does a conditional reduction using an add:
#include <stdint.h>
int32_t f (int32_t *restrict array, int len, int min)
{
int32_t iSum = 0;
for (int i=0; i<len; i++) {
if (array[i] >= min)
iSum += array[i];
}
return iSum;
}
for this we currently generate:
mov z1.b, #0
mov z2.s, w2
mov z3.d, z1.d
ptrue p2.b, all
ld1w z0.s, p0/z, [x0, x3, lsl 2]
cmpge p1.s, p2/z, z0.s, z2.s
add x3, x3, x4
sel z0.s, p1, z0.s, z3.s
add z1.s, p0/m, z1.s, z0.s
whilelo p0.s, w3, w1
where the SEL is unneeded as it's selecting between 0 or a value. This can be
optimized to just doing the conditional add on p1 instead of p0. After this
patch we generate:
mov z2.s, w2
mov z0.b, #0
ptrue p1.b, all
ld1w z1.s, p0/z, [x0, x3, lsl 2]
cmpge p0.s, p0/z, z1.s, z2.s
add x3, x3, x4
add z0.s, p0/m, z0.s, z1.s
whilelo p0.s, w3, w1
and so we drop the SEL and the 0 move.
gcc/ChangeLog:
* match.pd: New rule.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/sve/pred-cond-reduc.c: New test.
Jan Hubicka [Thu, 14 Oct 2021 13:48:01 +0000 (15:48 +0200)]
Fix ICE in insert_access.
gcc/ChangeLog:
PR ipa/102557
* ipa-modref-tree.h (modref_access_node::update2):
Also check that parm_offset is unchanged.
(modref_ref_node::insert_access): Fix updating of
parameter.
Aldy Hernandez [Thu, 14 Oct 2021 13:00:46 +0000 (15:00 +0200)]
Add FIXME note to backward threader.
There's a limitation in the path discovery bits in the backward
threader that I ran into recently and I'd like to document it so we
don't lose track of it.
Basically we stop looking if we find a threadable path through a PHI,
without taking into account that there could be multiple
paths through a PHI that resolve the path. For example:
x_5 = PHI <10(4), 20(5), ...>
if (x_5 > 5)
I don't remember how we ended up skipping this, but it could existing
behavior from the old bits. It probably skipped multiple threads
through a PHI since the generic copier couldn't re-using existing
threading paths anyhow.
Documenting for later fixing.
gcc/ChangeLog:
* tree-ssa-threadbackward.c (back_threader::resolve_phi): Add
FIXME note.
Jeff Law [Thu, 14 Oct 2021 13:41:57 +0000 (09:41 -0400)]
Fix predcom-3.c on arc-elf after vectorizer changes
gcc/testsuite
* gcc.dg/tree-ssa/predcom-3.c: Disable vectorizer.
Richard Biener [Thu, 14 Oct 2021 07:00:25 +0000 (09:00 +0200)]
tree-optimization/102659 - really avoid undef overflow in if-conversion
This plugs the remaining hole of POINTER_PLUS_EXPR with undefined
overflow. Unfortunately we have to go through some lengths to
not put invariant conversions into the loop body since that confuses
the vectorizers gather/scatter discovery which relies on identifying
an invariant component of plus and minus expressions. We can
emit those in the loop preheader but then we have to accept that
being non-empty when looking for the LOOP_VECTORIZED internal
function call in the vectorizer.
2021-10-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/102659
* tree-if-conv.c (if_convertible_gimple_assign_stmt_p): Also
rewrite pointer typed undefined overflow operations.
(predicate_statements): Likewise. Make sure to emit invariant
conversions in the preheader.
* tree-vectorizer.c (vect_loop_vectorized_call): Look through
non-empty preheaders.
* tree-data-ref.c (dr_analyze_indices): Strip useless
conversions to the MEM_REF base type.
Martin Liska [Tue, 12 Oct 2021 12:31:50 +0000 (14:31 +0200)]
Eliminate AUTODETECT_VALUE usage in options.
gcc/ChangeLog:
* common.opt: Stop using AUTODETECT_VALUE
and use EnabledBy where possible.
* opts.c: Enable OPT_fvar_tracking with optimize >= 1.
* toplev.c (AUTODETECT_VALUE): Remove macro.
(process_options): Simplify by using EnabledBy and
OPT_fvar_tracking. Use OPTION_SET_P macro instead of
AUTODETECT_VALUE.
Jonathan Wright [Thu, 14 Oct 2021 09:39:32 +0000 (10:39 +0100)]
aarch64: Fix pointer parameter type in LD1 Neon intrinsics
The pointer parameter to load a vector of signed values should itself
be a signed type. This patch fixes two instances of this unsigned-
signed implicit conversion in arm_neon.h.
gcc/ChangeLog:
2021-10-14 Jonathan Wright <jonathan.wright@arm.com>
* config/aarch64/arm_neon.h (vld1_s8_x3): Use signed type for
pointer parameter.
(vld1_s32_x3): Likewise.
Aldy Hernandez [Thu, 14 Oct 2021 08:28:39 +0000 (10:28 +0200)]
Do not call range_on_path_entry for SSAs defined within the path
In the path solver, when requesting the range of an SSA for which we
know nothing, we ask the ranger for the range incoming to the path.
We do this by asking for all the incoming ranges to the path entry
block and unioning them.
The problem here is that we're asking for a range on path entry for an
SSA which *is* defined in the path, but for which we know nothing
about:
some_global.1_2 = some_global;
_3 = (char) some_global.1_2;
This request is causing us to ask for range_on_edge of _3 on the
incoming edges to the path. This is a bit of nonsensical request
because _3 isn't live on entry to the path, so ranger correctly
returns UNDEFINED. The proper thing is to avoid asking this in the
first place.
I have added a relevant assert, since it doesn't make sense to call
range_on_path_entry for SSAs defined within the path.
Tested on x86-64 Linux.
PR tree-optimization/102736
gcc/ChangeLog:
PR tree-optimization/102736
* gimple-range-path.cc (path_range_query::range_on_path_entry):
Assert that the requested range is defined outside the path.
(path_range_query::ssa_range_in_phi): Do not call
range_on_path_entry for SSA names that are defined within the
path.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr102736.c: New test.
Iain Sandoe [Sun, 28 Mar 2021 19:50:09 +0000 (20:50 +0100)]
Darwin: Update quotes in driver warning messages.
This adds some missing quotes around options and option argument
terms in warning messages. Avoid contractions in warning
messages.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config/darwin-driver.c (darwin_find_version_from_kernel):
Quote internal identifiers and avoid contractions in
warnings.
(darwin_default_min_version): Likewise.
(darwin_driver_init): Likewise.
Martin Jambor [Thu, 14 Oct 2021 12:02:49 +0000 (14:02 +0200)]
ipa-cp: Propagation boost for recursion generated values
Recursive call graph edges, even when they are hot and important for
the compiled program, can never have frequency bigger than one, even
when the actual time savings in the next recursion call are not
realized just once but depend on the depth of recursion. The current
IPA-CP effect propagation code did not take that into account and just
used the frequency, thus severely underestimating the effect.
This patch artificially boosts values taking part in such calls. If a
value feeds into itself through a recursive call, the frequency of the
edge is multiplied by a parameter with default value of 6, basically
assuming that the recursion will take place 6 times. This value can
of course be subject to change.
Moreover, values which do not feed into themselves but which were
generated for a self-recursive call with an arithmetic
pass-function (aka the 548.exchange "hack" which however is generally
applicable for recursive functions which count the recursion depth in
a parameter) have the edge frequency multiplied as many times as there
are generated values in the chain. In essence, we will assume they
are all useful.
This patch partially fixes the current situation when we fail to
optimize 548.exchange with PGO. In the benchmark one recursive edge
count overwhelmingly dominates all other counts in the program and so
we fail to perform the first cloning (for the nonrecursive entry call)
because it looks totally insignificant.
gcc/ChangeLog:
2021-07-16 Martin Jambor <mjambor@suse.cz>
* params.opt (ipa-cp-recursive-freq-factor): New.
* ipa-cp.c (ipcp_value): Switch to inline initialization. New members
scc_no, self_recursion_generated_level, same_scc and
self_recursion_generated_p.
(ipcp_lattice::add_value): Replaced parameter unlimited with
same_lat_gen_level, usit it determine limit of values and store it to
the value.
(ipcp_lattice<valtype>::print): Dump the new fileds.
(allocate_and_init_ipcp_value): Take same_lat_gen_level as a new
parameter and store it to the new value.
(self_recursively_generated_p): Removed.
(propagate_vals_across_arith_jfunc): Use self_recursion_generated_p
instead of self_recursively_generated_p, store self generation level
to such values.
(value_topo_info<valtype>::add_val): Set scc_no.
(value_topo_info<valtype>::propagate_effects): Multiply frequencies of
recursively feeding values and self generated values by appropriate
new factors.
Richard Sandiford [Wed, 13 Oct 2021 18:32:36 +0000 (19:32 +0100)]
aarch64: Remove redundant flag_vect_cost_model test
The aarch64 version of add_stmt_cost has a redundant test
of flag_vect_cost_model. The current structure was based
on the contemporaneous definition of default_add_stmt_cost,
but g:
d6d1127249564146429009e0682f25bd58d7a791 later removed
the flag_vect_cost_model test from the default version.
gcc/
* config/aarch64/aarch64.c (aarch64_add_stmt_cost): Remove
redundant test for flag_vect_cost_model.
Aldy Hernandez [Wed, 13 Oct 2021 08:04:39 +0000 (10:04 +0200)]
Add debug helpers for auto_bitmap.
Using debug() on an auto_bitmap from gdb doesn't work because the
implicit conversion from auto_bitmap to bitmap_head doesn't work
from within a debugging session. This patch adds the convenience
functions for auto_bitmap.
gcc/ChangeLog:
* bitmap.c (debug): New overloaded function for auto_bitmaps.
* bitmap.h (debug): Same.
Jonathan Wakely [Wed, 13 Oct 2021 23:33:49 +0000 (00:33 +0100)]
libstdc++: Fix test for feature test macro
libstdc++-v3/ChangeLog:
* testsuite/20_util/is_layout_compatible/version.cc: Check
correct macro.
Jonathan Wakely [Wed, 13 Oct 2021 21:32:28 +0000 (22:32 +0100)]
libstdc++: Add missing constexpr to std::optional (P2231R1)
This implements the changes in P2231R1 which make std::optional fully
constexpr in C++20.
libstdc++-v3/ChangeLog:
* include/bits/stl_construct.h (_Construct): Use
std::construct_at when constant evaluated.
* include/std/optional (_Storage, _Optional_payload, optional):
Add constexpr as specified by P2231R1.
* include/std/version (__cpp_lib_optional): Update value for
C++20.
* testsuite/20_util/optional/requirements.cc: Check feature test
macro.
* testsuite/20_util/optional/constexpr/assign.cc: New test.
* testsuite/20_util/optional/constexpr/cons/conv.cc: New test.
* testsuite/20_util/optional/constexpr/modifiers.cc: New test.
* testsuite/20_util/optional/constexpr/swap.cc: New test.
* testsuite/20_util/optional/version.cc: New test.
Alexandre Oliva [Thu, 14 Oct 2021 04:49:44 +0000 (01:49 -0300)]
[Ada] reenable ada83 library unit renaming error
for gcc/ada/ChangeLog
* par-ch10.adb (P_Compilation_Unit): Reenable ada83 library
unit renaming test and error.
Hongyu Wang [Thu, 23 Sep 2021 05:52:16 +0000 (13:52 +0800)]
AVX512FP16: Adjust builtin for mask complex fma
Current mask/mask3 implementation for complex fma contains
duplicated parameter in macro, which may cause error at -O0.
Refactor macro implementation to builtins to avoid potential
error.
For round intrinsic with NO_ROUND as input, ix86_erase_embedded_rounding
erases embedded_rounding upspec but could break other emit_insn in
expanders. Skip those expanders with multiple emit_insn for this
function and check rounding in expander with subst.
gcc/ChangeLog:
* config/i386/avx512fp16intrin.h (_mm512_mask_fcmadd_pch):
Adjust builtin call.
(_mm512_mask3_fcmadd_pch): Likewise.
(_mm512_mask_fmadd_pch): Likewise
(_mm512_mask3_fmadd_pch): Likewise
(_mm512_mask_fcmadd_round_pch): Likewise
(_mm512_mask3_fcmadd_round_pch): Likewise
(_mm512_mask_fmadd_round_pch): Likewise
(_mm512_mask3_fmadd_round_pch): Likewise
(_mm_mask_fcmadd_sch): Likewise
(_mm_mask3_fcmadd_sch): Likewise
(_mm_mask_fmadd_sch): Likewise
(_mm_mask3_fmadd_sch): Likewise
(_mm_mask_fcmadd_round_sch): Likewise
(_mm_mask3_fcmadd_round_sch): Likewise
(_mm_mask_fmadd_round_sch): Likewise
(_mm_mask3_fmadd_round_sch): Likewise
(_mm_fcmadd_round_sch): Likewise
* config/i386/avx512fp16vlintrin.h (_mm_mask_fmadd_pch):
Adjust builtin call.
(_mm_mask3_fmadd_pch): Likewise
(_mm256_mask_fmadd_pch): Likewise
(_mm256_mask3_fmadd_pch): Likewise
(_mm_mask_fcmadd_pch): Likewise
(_mm_mask3_fcmadd_pch): Likewise
(_mm256_mask_fcmadd_pch): Likewise
(_mm256_mask3_fcmadd_pch): Likewise
* config/i386/i386-builtin.def: Add mask3 builtin for complex
fma, and adjust mask_builtin to corresponding expander.
* config/i386/i386-expand.c (ix86_expand_round_builtin):
Skip eraseing embedded rounding for expanders that emits
multiple insns.
* config/i386/sse.md (complexmove): New mode_attr.
(<avx512>_fmaddc_<mode>_mask1<round_expand_name>): New expander.
(<avx512>_fcmaddc_<mode>_mask1<round_expand_name>): Likewise.
(avx512fp16_fmaddcsh_v8hf_mask1<round_expand_name>): Likewise.
(avx512fp16_fcmaddcsh_v8hf_mask1<round_expand_name>): Likewise.
(avx512fp16_fcmaddcsh_v8hf_mask3<round_expand_name>): Likewise.
(avx512fp16_fmaddcsh_v8hf_mask3<round_expand_name>): Likewise.
* config/i386/subst.md (round_embedded_complex): New subst.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx-1.c: Add new mask3 builtins.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-23.c: Ditto.
* gcc.target/i386/avx512fp16-vfcmaddcsh-1a.c: Add scanning for
mask/mask3 intrinsic.
* gcc.target/i386/avx512fp16-vfmaddcsh-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfcmaddcsh-1c.c: New test for
-mavx512vl.
* gcc.target/i386/avx512fp16-vfmaddcsh-1c.c: Ditto.
liuhongt [Wed, 13 Oct 2021 02:05:58 +0000 (10:05 +0800)]
Adjust testcase for O2 vectorization[Wuninitialized]
It looks like it's just the the location of the warning that's off,
the warning itself is still issued but it's swallowed by the
dg-prune-output directive.
Since the test was added to verify the fix for an ICE without
vectorization I think disabling vectorization should be fine.
Ideally, we would understand why the location is wrong so let's keep
this bug open and add a comment to the test referencing this bug.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wuninitialized-13.C: Add -fno-tree-vectorize.
John David Anglin [Thu, 14 Oct 2021 00:57:32 +0000 (00:57 +0000)]
Fix TARGET_SOFT_FLOAT patterns in pa.md
2021-10-13 John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog:
* config/pa/pa.md (cbranchsf4): Disable if TARGET_SOFT_FLOAT.
(cbranchdf4): Likewise.
Add missing move patterns for TARGET_SOFT_FLOAT.
GCC Administrator [Thu, 14 Oct 2021 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Wed, 13 Oct 2021 20:32:14 +0000 (21:32 +0100)]
libstdc++: Fix regression in memory use when constructing paths
The changes in r12-4381 were intended to reduce memory usage, but
replacing the __contiguous constant in __string_from_range with the new
__is_contiguous variable template caused a regression. The old code
checked is_pointer_v<decltype(std::__niter_base(__first))> but he new
code just checks is_pointer_v<_InputIterator>. This means that we no
longer recognise basic_string::iterator and vector::iterator as
contiguous, and so return a temporary basic_string instead of a
basic_string_view. This only affects C++17 mode, because the
std::contiguous_iterator concept is used in C++20 which gives the right
answer for __normal_iterator (and more types as well).
The fix is to specialize the new __is_contiguous variable template so it
is true for __normal_iterator<T*, C> specializations. The new partial
specializations are defined for C++20 too, because it should be cheaper
to match the partial specialization than to check whether the
std::contiguous_iterator concept is satisfied.
libstdc++-v3/ChangeLog:
* include/bits/fs_path.h (__detail::__is_contiguous): Add
partial specializations for pointers and __normal_iterator.
Jonathan Wakely [Wed, 13 Oct 2021 21:31:51 +0000 (22:31 +0100)]
libstdc++: Rename files with the wrong extensions
libstdc++-v3/ChangeLog:
* testsuite/27_io/filesystem/path/construct/102592.C: Moved to...
* testsuite/27_io/filesystem/path/construct/102592.cc: ...here.
* testsuite/28_regex/match_results/102667.C: Moved to...
* testsuite/28_regex/match_results/102667.cc: ...here.
Jonathan Wakely [Wed, 13 Oct 2021 16:19:57 +0000 (17:19 +0100)]
libstdc++: Refactor filesystem::path encoding conversions
Adjust the __detail::__effective_range overloads so they always return a
string or string view using std::char_traits, because we don't care
about the traits of an incoming string.
Use std::contiguous_iterator in the __effective_range(const Source&)
overload, to allow returning a basic_string_view in more cases. For the
non-contiguous casecl in both __effective_range and __string_from_range,
return a std::string instead of std::u8string when the value type of the
range is char8_t. These changes avoid unnecessary basic_string
temporaries.
Also simplify __string_from_range(Iter, Iter) to not need
std::__to_address for the contiguous case.
Combine the _S_convert(string_type) and _S_convert(const T&) overloads
into a single _S_convert(T) function which also avoids the dangling
view problem of PR 102592 (should that recur somehow).
libstdc++-v3/ChangeLog:
* include/bits/fs_path.h (__detail::__is_contiguous): New
variable template to identify contiguous iterators.
(__detail::__unified_char8_t): New alias template to decide when
to treat char8_t as char without encoding conversion.
(__detail::__effective_range(const basic_string<C,T>&)): Use
std::char_traits<C> for returned string view.
(__detail::__effective_range(const basic_string_view<C,T>&)):
Likewise.
(__detail::__effective_range(const Source&)): Use
__is_contiguous to detect mode cases of contiguous iterators.
Use __unified_char8_t to return a std::string instead of
std::u8string.
Jonathan Wakely [Wed, 13 Oct 2021 16:02:59 +0000 (17:02 +0100)]
libstdc++: Fix dangling string_view in filesystem::path [PR102592]
When creating a path from a pair of non-contiguous iterators we pass the
iterators to _S_convert(Iter, Iter). That function passes the iterators
to __string_from_range to get a contiguous sequence of characters, and
then calls _S_convert(const C*, const C*) to perform the encoding
conversions. If the value type, C, is char8_t, then no conversion is
needed and the _S_convert<char8_t>(const char8_t*, const char8_t*)
specialization casts the pointer to const char* and returns a
std::string_view that refs to the char8_t sequence. However, that
sequence is owned by the std::u8string rvalue returned by
__string_from_range, which goes out of scope when _S_convert(Iter, Iter)
returns. That means the std::string_view is dangling and we get
undefined behaviour when parsing it as a path.
The same problem does not exist for the path members taking a "Source"
argument, because those functions all convert a non-contiguous range
into a basic_string<C> immediately, using __effective_range(__source).
That means that the rvalue string returned by that function is still in
scope for the full expression, so the string_view does not dangle.
The solution for the buggy functions is to do the same thing, and call
__string_from_range immediately, so that the returned rvalue is still in
scope for the lifetime of the string_view returned by _S_convert. To
avoid reintroducing the same problem, remove the _S_convert(Iter, Iter)
overload that calls __string_from_range and returns a dangling view.
libstdc++-v3/ChangeLog:
PR libstdc++/102592
* include/bits/fs_path.h (path::path(Iter, Iter, format))
(path::append(Iter, Iter), path::concat(Iter, Iter)): Call
__string_from_range directly, instead of two-argument overload
of _S_convert.
(path::_S_convert(Iter, Iter)): Remove.
* testsuite/27_io/filesystem/path/construct/102592.C: New test.
Roger Sayle [Wed, 13 Oct 2021 18:49:47 +0000 (19:49 +0100)]
x86_64: Some SUBREG related optimization tweaks to i386 backend.
This patch contains two SUBREG-related optimization enabling tweaks to
the x86 backend.
The first change, to ix86_expand_vector_extract, cures the strange
-march=cascadelake related non-determinism that affected my new test
cases last week. Extracting a QImode or HImode element from an SSE
vector performs a zero-extension to SImode, which is currently
represented as:
(set (subreg:SI (reg:QI target)) (zero_extend:SI (...))
Unfortunately, the semantics of this RTL doesn't quite match what was
intended. A set of a paradoxical subreg allows the high-bits to take
an arbitrary value (hence the non-determinism). A more correct
representation should be:
(set (reg:SI temp) (zero_extend:SI (...))
(set (reg:QI target) (subreg:QI (reg:SI temp))
Optionally with the SUBREG rtx annotated as SUBREG_PROMOTED_VAR_P to
indicate that value is already zero-extended in the SUBREG_REG.
The second change is very similar, which is why I've included it in
this patch, where currently the early RTL optimizers can produce:
(set (reg:V?? hardreg) (subreg ...))
where this instruction may require a spill/reload from memory when
the modes aren't tieable. Alas the presence of the hard register
prevents combine/gcse etc. optimizing this away, or reusing the result
which would increase the lifetime of the hard register before reload.
The solution is to treat vector hard registers the same way as the
x86 backend handles scalar hard registers, and only allow sets from
pseudos before register allocation, which is achieved by checking
ix86_hardreg_mov_ok. Hence the above instruction is expanded and
maintained as:
(set (reg:V?? pseudo) (subreg ...))
(set (reg:V?? hardreg) (reg:V?? pseudo))
which allows the RTL optimizers freedom to optimize the SUBREG.
2021-10-13 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/i386/i386-expand.c (ix86_expand_vector_move): Use a
pseudo intermediate when moving a SUBREG into a hard register,
by checking ix86_hardreg_mov_ok.
(ix86_expand_vector_extract): Store zero-extended SImode
intermediate in a pseudo, then set target using a SUBREG_PROMOTED
annotated subreg.
* config/i386/sse.md (mov<VMOVE>_internal): Prevent CSE creating
complex (SUBREG) sets of (vector) hard registers before reload, by
checking ix86_hardreg_mov_ok.
Indu Bhagat [Wed, 13 Oct 2021 17:01:38 +0000 (10:01 -0700)]
ctfc: remove redundant comma in enumerator list
This also helps get rid of warning
ctfc.h:215:18: warning: comma at end of enumerator list [-Wpedantic]
CTF_DTU_D_SLICE,
gcc/ChangeLog:
* ctfc.h (enum ctf_dtu_d_union_enum): Remove redundant comma.
Indu Bhagat [Wed, 13 Oct 2021 16:58:46 +0000 (09:58 -0700)]
dwarf2ctf: fix typo in comment
gcc/ChangeLog:
* dwarf2ctf.c (gen_ctf_array_type): Fix typo in comment.
Martin Sebor [Wed, 13 Oct 2021 16:31:37 +0000 (10:31 -0600)]
Check to see if null pointer is dereferenceable [PR102630].
Resolves:
PR middle-end/102630 - Spurious -Warray-bounds with named address space
gcc/ChangeLog:
PR middle-end/102630
* pointer-query.cc (compute_objsize_r): Handle named address spaces.
gcc/testsuite/ChangeLog:
PR middle-end/102630
* gcc.target/i386/addr-space-2.c: Add -Wall.
* gcc.target/i386/addr-space-3.c: New test.
Iain Sandoe [Wed, 6 Oct 2021 13:58:33 +0000 (14:58 +0100)]
collect2: Fix missing cleanups.
The code that checks to see if objects have LTO content via
simple-object was not releasing resources, fixed thus.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* collect2.c (is_lto_object_file): Release simple-object
resources, close files.
Andre Vieira [Wed, 13 Oct 2021 15:42:47 +0000 (16:42 +0100)]
[arm] Fix MVE addressing modes for VLDR[BHW] and VSTR[BHW]
The way we were previously dealing with addressing modes for MVE was preventing
the use of pre, post and offset addressing modes for the normal loads and
stores, including widening and narrowing. This patch fixes that and
adds tests to ensure we are capable of using all the available addressing
modes.
gcc/ChangeLog:
2021-10-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/arm/arm.c (thumb2_legitimate_address_p): Use VALID_MVE_MODE
when checking mve addressing modes.
(mve_vector_mem_operand): Fix the way we handle pre, post and offset
addressing modes.
(arm_print_operand): Fix printing of POST_ and PRE_MODIFY.
* config/arm/mve.md: Use mve_memory_operand predicate everywhere where
there is a single Ux constraint.
gcc/testsuite/ChangeLog:
2021-10-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc.target/arm/mve/mve.exp: Make it test main directory.
* gcc.target/arm/mve/mve_load_memory_modes.c: New test.
* gcc.target/arm/mve/mve_store_memory_modes.c: New test.
John David Anglin [Wed, 13 Oct 2021 15:36:45 +0000 (15:36 +0000)]
Add support for 32-bit hppa targets in muldi3 expander
2021-10-13 John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog:
* config/pa/pa.md (muldi3): Add support for inlining 64-bit
multiplication on 32-bit PA 1.1 and 2.0 targets.
Martin Liska [Thu, 9 Sep 2021 11:02:24 +0000 (13:02 +0200)]
gcov: make profile merging smarter
Support merging of profiles that are built from a different .o files
but belong to the same source file. Moreover, a checksum is verified
during profile merging and so we can safely combine such profile.
PR gcov-profile/90364
gcc/ChangeLog:
* coverage.c (build_info): Emit checksum to the global variable.
(build_info_type): Add new field for checksum.
(coverage_obj_finish): Pass object_checksum.
(coverage_init): Use 0 as checksum for .gcno files.
* gcov-dump.c (dump_gcov_file): Dump also new checksum field.
* gcov.c (read_graph_file): Read also checksum.
* doc/invoke.texi: Document the behaviour change.
libgcc/ChangeLog:
* libgcov-driver.c (merge_one_data): Skip timestamp and verify
checksums.
(write_one_data): Write also checksum.
* libgcov-util.c (read_gcda_file): Read also checksum field.
* libgcov.h (struct gcov_info): Add new field.
Richard Biener [Wed, 13 Oct 2021 11:42:22 +0000 (13:42 +0200)]
Add GSI_LAST_NEW_STMT iterator update
Currently when adding a sequence before there's no way to get the
iterator placed at the last added stmt which results in convoluted
code in the if-conversion usecase. The following adds
GSI_LAST_NEW_STMT and corrects one obvious mistake in
execute_update_addresses_taken as well as tries to avoid the
just filed PR102726 by biasing the enum values to be outside of
the boolean 0/1 range.
2021-10-13 Richard Biener <rguenther@suse.de>
* gimple-iterator.h (gsi_iterator_update): Add GSI_LAST_NEW_STMT,
start at integer value 2.
* gimple-iterator.c (gsi_insert_seq_nodes_before): Update
the iterator for GSI_LAST_NEW_STMT.
(gsi_insert_seq_nodes_after): Likewise.
* tree-if-conv.c (predicate_statements): Use GSI_LAST_NEW_STMT.
* tree-ssa.c (execute_update_addresses_taken): Correct bogus
arguments to gsi_replace.
Martin Liska [Tue, 12 Oct 2021 14:05:49 +0000 (16:05 +0200)]
Fix handling of flag_rename_registers by a target.
PR target/102688
gcc/ChangeLog:
* common.opt: Use EnabledBy instead of detection in
finish_options and process_options.
* opts.c (finish_options): Remove handling of
x_flag_unroll_all_loops.
* toplev.c (process_options): Likewise for flag_web and
flag_rename_registers.
Richard Biener [Mon, 11 Oct 2021 10:27:10 +0000 (12:27 +0200)]
tree-optimization/102659 - avoid undefined overflow after if-conversion
The following makes sure to rewrite arithmetic with undefined behavior
on overflow to a well-defined variant when moving them to be always
executed as part of doing if-conversion for loop vectorization.
2021-10-11 Richard Biener <rguenther@suse.de>
PR tree-optimization/102659
* tree-if-conv.c (need_to_rewrite_undefined): New flag.
(if_convertible_gimple_assign_stmt_p): Mark the loop for
rewrite when stmts with undefined behavior on integer
overflow appear.
(combine_blocks): Predicate also when we need to rewrite stmts.
(predicate_statements): Rewrite affected stmts to something
with well-defined behavior on overflow.
(tree_if_conversion): Initialize need_to_rewrite_undefined.
* gcc.dg/torture/pr69760.c: Adjust the testcase.
* gcc.target/i386/avx2-vect-mask-store-move1.c: Expect to move
the conversions to unsigned as well.
Tobias Burnus [Wed, 13 Oct 2021 09:53:30 +0000 (11:53 +0200)]
Fortran: dump-parse-tree.c fixes for OpenMP
gcc/fortran/ChangeLog:
* dump-parse-tree.c (show_omp_clauses): Handle ancestor modifier,
avoid ICE for GFC_OMP_ATOMIC_SWAP.
* gfortran.h (gfc_omp_clauses): Change 'anecestor' into a bitfield.
Jonathan Wakely [Wed, 13 Oct 2021 09:35:44 +0000 (10:35 +0100)]
libstdc++: Ensure language linkage of std::__terminate()
This is needed because people still find it necessary to do:
extern "C" {
#include <stdlib.h>
}
libstdc++-v3/ChangeLog:
* include/bits/c++config (__terminate): Add extern "C++".
Richard Biener [Wed, 13 Oct 2021 07:13:36 +0000 (09:13 +0200)]
ipa/102714 - IPA SRA eliding volatile
The following fixes the volatileness check of IPA SRA which was
looking at the innermost reference when checking TREE_THIS_VOLATILE
but the reference to check is the outermost one.
2021-10-13 Richard Biener <rguenther@suse.de>
PR ipa/102714
* ipa-sra.c (ptr_parm_has_nonarg_uses): Fix volatileness
check.
* gcc.dg/ipa/pr102714.c: New testcase.
Jose E. Marchesi [Wed, 13 Oct 2021 08:07:37 +0000 (10:07 +0200)]
dwarf2ctf: fix typo in comment
gcc/ChangeLog:
* dwarf2ctf.c: Fix typo in comment.
Kewen Lin [Wed, 13 Oct 2021 05:20:45 +0000 (00:20 -0500)]
rs6000/test: Adjust test cases due to O2 vect [PR102658]
Commit r12-4240 enables vectorization at O2, this patch is to
adjust some test cases for rs6000 port accordingly.
It simply adds -fno-tree-vectorize to retain original test points.
gcc/testsuite/ChangeLog:
PR testsuite/102658
* gcc.target/powerpc/dform-1.c: Adjust as vectorization enabled at O2.
* gcc.target/powerpc/dform-2.c: Likewise.
* gcc.target/powerpc/pr80510-2.c: Likewise.
GCC Administrator [Wed, 13 Oct 2021 00:16:22 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Tue, 12 Oct 2021 23:40:17 +0000 (23:40 +0000)]
c-family: Support format checking C2X %b, %B formats
C2X adds a %b printf format to print integers in binary (analogous to
%x, including %#b printing a leading 0b on nonzero integers), with
recommended practice for a corresponding %B (where %#B uses 0B instead
of 0b) where that doesn't conflict with existing implementation
extensions. See N2630 for details (accepted for C2X, not yet in the
latest working draft). There is also a scanf %b format.
Add corresponding format checking support (%b accepted by -std=c2x
-Wformat -pedantic, %B considered an extension to be diagnosed with
-Wformat -pedantic). glibc support for the printf formats has been
proposed at
<https://sourceware.org/pipermail/libc-alpha/2021-October/131764.html>
(scanf support to be done in a separate patch).
Note that this does not add any support for these formats to the code
for bounding the amount of output produces by a printf function,
although that would also be useful.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c-family/
* c-format.c (print_char_table): Add %b and %B formats.
(scan_char_table): Add %b format.
* c-format.h (T2X_UI, T2X_UL, T2X_ULL, T2X_US, T2X_UC, T2X_ST)
(T2X_UPD, T2X_UIM): New macros.
gcc/testsuite/
* gcc.dg/format/c11-printf-1.c, gcc.dg/format/c11-scanf-1.c,
gcc.dg/format/c2x-printf-1.c, gcc.dg/format/c2x-scanf-1.c,
gcc.dg/format/ext-9.c, gcc.dg/format/ext-10.c: New tests.
Bill Schmidt [Tue, 12 Oct 2021 22:37:16 +0000 (17:37 -0500)]
rs6000: Fix vec_cpsgn parameter order (PR101985)
The vec_cpsgn built-in function API differs in argument order from the
copysign<mode>3 convention. Currently that pattern is incorrctly used to
implement vec_cpsgn. Fix that by reversing the operand order of the
builtin while leaving the existing pattern in place to implement copysignf
for vector modes.
Part of the fix when using the new built-in support requires an adjustment
to a pending patch that replaces much of altivec.h with an automatically
generated file.
Also fix a bug in the new built-in overload infrastructure where we were
using the VSX form of the VEC_COPYSIGN built-in when we should default to
the VMX form.
2021-10-12 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/101985
* config/rs6000/altivec.h (vec_cpsgn): Swap operand order.
* config/rs6000/rs6000-overload.def (VEC_COPYSIGN): Use SKIP to
avoid generating an automatic #define of vec_cpsgn. Use the
correct built-in for V4SFmode that doesn't depend on VSX.
gcc/testsuite/
PR target/101985
* gcc.target/powerpc/pr101985-1.c: New.
* gcc.target/powerpc/pr101985-2.c: New.
Eric Gallager [Tue, 12 Oct 2021 20:55:21 +0000 (16:55 -0400)]
Mark certain subdirectories as missing TAGS targets.
The subdirectories in question are libcody,
libdecnumber, c++tools, libgcc, and libobjc.
This is progress towards allowing "make tags" to
work from the top-level directory; a few additional
changes may also be necessary, though.
ChangeLog:
* Makefile.def: Mark libcody, libdecnumber,
c++tools, libgcc, and libobjc as missing TAGS
targets.
* Makefile.in: Regenerate.
Uros Bizjak [Tue, 12 Oct 2021 16:20:38 +0000 (18:20 +0200)]
i386: Improve workaround for PR82524 LRA limitation [PR85730]
As explained in PR82524, LRA is not able to reload strict_low_part inout
operand with matched input operand. The patch introduces a workaround,
where we allow LRA to generate an instruction with non-matched input operand
which is split post reload to an instruction that inserts non-matched input
operand to an inout operand and the instruction that uses matched operand.
The generated code improves from:
movsbl %dil, %edx
movl %edi, %eax
sall $3, %edx
movb %dl, %al
to:
movl %edi, %eax
movb %dil, %al
salb $3, %al
which is still not optimal, but the code is one instruction shorter and
does not use a temporary register.
2021-10-12 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/85730
PR target/82524
* config/i386/i386.md (*add<mode>_1_slp): Rewrite as
define_insn_and_split pattern. Add alternative 1 and split it
post reload to insert operand 1 into the low part of operand 0.
(*sub<mode>_1_slp): Ditto.
(*and<mode>_1_slp): Ditto.
(*<any_or:code><mode>_1_slp): Ditto.
(*ashl<mode>3_1_slp): Ditto.
(*<any_shiftrt:insn><mode>3_1_slp): Ditto.
(*<any_rotate:insn><mode>3_1_slp): Ditto.
(*neg<mode>_1_slp): New insn_and_split pattern.
(*one_cmpl<mode>_1_slp): Ditto.
gcc/testsuite/
PR target/85730
PR target/82524
* gcc.target/i386/pr85730.c: New test.
David Edelsohn [Tue, 12 Oct 2021 15:48:05 +0000 (11:48 -0400)]
doc: Update MinGW and mingw-64 download links.
gcc/ChangeLog:
* doc/install.texi: Update MinGW and mingw-64 Binaries
download links.
Jonathan Wakely [Tue, 12 Oct 2021 14:39:18 +0000 (15:39 +0100)]
libstdc++: Fix test that fails for C++20
Also restore the test for 'a < a' that was removed by r12-2537 because
it is ill-formed. We still want to test operator< for tuple, we just
need to not use std::nullptr_t in that tuple type.
libstdc++-v3/ChangeLog:
* testsuite/20_util/tuple/comparison_operators/overloaded.cc:
Restore test for operator<.
* testsuite/20_util/tuple/comparison_operators/overloaded2.cc:
Adjust expected errors for C++20.
Jonathan Wakely [Tue, 12 Oct 2021 14:09:50 +0000 (15:09 +0100)]
libstdc++: Fix move construction of std::tuple with array elements [PR101960]
The r12-3022 commit only fixed the case where an array is the last
element of the tuple. This fixes the other cases too. We can just define
the move constructor as defaulted, which does the right thing. Changing
the move constructor to be trivial would be an ABI break, but since the
last base class still has a non-trivial move constructor, defining the
derived ones as defaulted doesn't change anything.
libstdc++-v3/ChangeLog:
PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Define as
defauled.
* testsuite/20_util/tuple/cons/101960.cc: Check tuples with
array elements before the last element.
Jonathan Wakely [Wed, 29 Sep 2021 20:19:36 +0000 (21:19 +0100)]
libstdc++: Improve diagnostics for misuses of output iterators
This adds deleted overloads so that the errors for invalid uses of
std::advance and std::distance are easier to understand (see for example
PR 102181).
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator_base_funcs.h (__advance): Add
deleted overload to improve diagnostics.
(__distance): Likewise.
Daniel Le Duc Khoi Nguyen [Tue, 12 Oct 2021 14:52:35 +0000 (10:52 -0400)]
doc: Fix typos in alloc_size documentation
gcc/
* doc/extend.texi (Common Variable Attributes): Fix typos in
alloc_size documentation.
Luís Ferreira [Tue, 12 Oct 2021 14:40:20 +0000 (10:40 -0400)]
[PATCH v2] libiberty: d-demangle: remove parenthesis where it is not needed
libiberty/
* d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis
around lhs and rhs of assignments.
Julian Brown [Fri, 24 Sep 2021 11:18:40 +0000 (04:18 -0700)]
libgomp: Release device lock on cbuf error path
This patch releases the device lock on a sanity-checking error path in
transfer combining (cbuf) handling in libgomp:target.c. This shouldn't
happen when handling well-formed mapping clauses, but erroneous clauses
can currently cause a hang if the condition triggers.
2021-12-10 Julian Brown <julian@codesourcery.com>
libgomp/
* target.c (gomp_copy_host2dev): Release device lock on cbuf
error path.
Richard Biener [Tue, 12 Oct 2021 11:49:39 +0000 (13:49 +0200)]
tree-optimization/102696 - fix SLP discovery for failed BIT_FIELD_REF
This fixes a forgotten adjustment of matches[] when we fail SLP
discovery.
2021-10-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/102696
* tree-vect-slp.c (vect_build_slp_tree_2): Properly mark
the tree fatally failed when we reject a BIT_FIELD_REF.
* g++.dg/vect/pr102696.cc: New testcase.
Richard Biener [Tue, 12 Oct 2021 11:42:08 +0000 (13:42 +0200)]
tree-optimization/102572 - fix gathers with invariant mask
This fixes the vector def gathering for invariant masks which
failed to pass in the desired vector type resulting in a non-mask
type to be generate.
2021-10-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/102572
* tree-vect-stmts.c (vect_build_gather_load_calls): When
gathering the vectorized defs for the mask pass in the
desired mask vector type so invariants will be handled
correctly.
* g++.dg/vect/pr102572.cc: New testcase.
Tamar Christina [Tue, 12 Oct 2021 10:34:06 +0000 (11:34 +0100)]
sve: combine inverted masks into NOTs
The following example
void f10(double * restrict z, double * restrict w, double * restrict x,
double * restrict y, int n)
{
for (int i = 0; i < n; i++) {
z[i] = (w[i] > 0) ? x[i] + w[i] : y[i] - w[i];
}
}
generates currently:
ld1d z1.d, p1/z, [x1, x5, lsl 3]
fcmgt p2.d, p1/z, z1.d, #0.0
fcmgt p0.d, p3/z, z1.d, #0.0
ld1d z2.d, p2/z, [x2, x5, lsl 3]
bic p0.b, p3/z, p1.b, p0.b
ld1d z0.d, p0/z, [x3, x5, lsl 3]
where a BIC is generated between p1 and p0 where a NOT would be better here
since we won't require the use of p3 and opens the pattern up to being CSEd.
After this patch using a 2 -> 2 split we generate:
ld1d z1.d, p0/z, [x1, x5, lsl 3]
fcmgt p2.d, p0/z, z1.d, #0.0
not p1.b, p0/z, p2.b
The additional scratch is needed such that we can CSE the two operations. If
both statements wrote to the same register then CSE won't be able to CSE the
values if there are other statements in between that use the register.
A second pattern is needed to capture the nor case as combine will match the
longest sequence first. So without this pattern we end up de-optimizing nor
and instead emit two nots. I did not find a better way to do this.
gcc/ChangeLog:
* config/aarch64/aarch64-sve.md (*fcm<cmp_op><mode>_bic_combine,
*fcm<cmp_op><mode>_nor_combine, *fcmuo<mode>_bic_combine,
*fcmuo<mode>_nor_combine): New.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/sve/pred-not-gen-1.c: New test.
* gcc.target/aarch64/sve/pred-not-gen-2.c: New test.
* gcc.target/aarch64/sve/pred-not-gen-3.c: New test.
* gcc.target/aarch64/sve/pred-not-gen-4.c: New test.
Eric Botcazou [Tue, 12 Oct 2021 09:20:42 +0000 (11:20 +0200)]
Fix PR target/102588
We need a 32-byte wide integer mode (OImode) in order to handle structure
returns in the 64-bit ABI.
gcc/
PR target/102588
* config/sparc/sparc-modes.def (OI): New integer mode.
Tobias Burnus [Tue, 12 Oct 2021 08:54:18 +0000 (10:54 +0200)]
Fortran version of libgomp.c-c++-common/icv-{3,4}.c
This adds the Fortran testsuite coverage of
omp_{get_max,set_num}_threads and omp_{s,g}et_teams_thread_limit
libgomp/
* testsuite/libgomp.fortran/icv-3.f90: New.
* testsuite/libgomp.fortran/icv-4.f90: New.
Tobias Burnus [Tue, 12 Oct 2021 07:56:08 +0000 (09:56 +0200)]
Fortran: Various CLASS + assumed-rank fixed [PR102541]
Starting point was PR102541, were a previous patch caused an invalid
e->ref access for class. When testing, it turned out that for
CLASS to CLASS the code was never executed - additionally, issues
appeared for optional and a bogus error for -fcheck=all. In particular:
There were a bunch of issues related to optional CLASS, can have the
'attr.dummy' set in CLASS_DATA (sym) - but sometimes also in 'sym'!?!
Additionally, gfc_variable_attr could return pointer = 1 for nonpointers
when the expr is no longer "var" but "var%_data".
PR fortran/102541
gcc/fortran/ChangeLog:
* check.c (gfc_check_present): Handle optional CLASS.
* interface.c (gfc_compare_actual_formal): Likewise.
* trans-array.c (gfc_trans_g77_array): Likewise.
* trans-decl.c (gfc_build_dummy_array_decl): Likewise.
* trans-types.c (gfc_sym_type): Likewise.
* primary.c (gfc_variable_attr): Fixes for dummy and
pointer when 'class%_data' is passed.
* trans-expr.c (set_dtype_for_unallocated, gfc_conv_procedure_call):
For assumed-rank dummy, fix setting rank for dealloc/notassoc actual
and setting ubound to -1 for assumed-size actuals.
gcc/testsuite/ChangeLog:
* gfortran.dg/assumed_rank_24.f90: New test.
Jakub Jelinek [Tue, 12 Oct 2021 07:37:25 +0000 (09:37 +0200)]
openmp: Avoid calling clear_type_padding_in_mask in the common case where there can't be any padding
We can use the clear_padding_type_may_have_padding_p function, which
is conservative for e.g. RECORD_TYPE/UNION_TYPE, but for the floating and
complex floating types is accurate. clear_type_padding_in_mask is
more expensive because we need to allocate memory, fill it, call the function
which itself is more expensive and then analyze the memory, so for the
common case of float/double atomics or even long double on most targets
we can avoid that.
2021-10-12 Jakub Jelinek <jakub@redhat.com>
gcc/
* gimple-fold.h (clear_padding_type_may_have_padding_p): Declare.
* gimple-fold.c (clear_padding_type_may_have_padding_p): No longer
static.
gcc/c-family/
* c-omp.c (c_finish_omp_atomic): Use
clear_padding_type_may_have_padding_p.
Jakub Jelinek [Tue, 12 Oct 2021 07:35:43 +0000 (09:35 +0200)]
openmp: Add documentation for omp_{get_max, set_num}_threads and omp_{s, g}et_teams_thread_limit
This patch adds documentation for these new OpenMP 5.1 APIs as well as
two new environment variables - OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT.
2021-10-12 Jakub Jelinek <jakub@redhat.com>
* libgomp.texi (omp_get_max_teams, omp_get_teams_thread_limit,
omp_set_num_teams, omp_set_teams_thread_limit, OMP_NUM_TEAMS,
OMP_TEAMS_THREAD_LIMIT): Document.
Jakub Jelinek [Tue, 12 Oct 2021 07:34:38 +0000 (09:34 +0200)]
openmp: Fix up warnings on libgomp.info build
When building libgomp documentation, I see
makeinfo --split-size=5000000 -I ../../../libgomp/../gcc/doc/include -I ../../../libgomp -o libgomp.info ../../../libgomp/libgomp.texi
../../../libgomp/libgomp.texi:503: warning: node next `omp_get_default_device' in menu `omp_get_device_num' and in sectioning `omp_get_dynamic' differ
../../../libgomp/libgomp.texi:528: warning: node prev `omp_get_dynamic' in menu `omp_get_device_num' and in sectioning `omp_get_default_device' differ
../../../libgomp/libgomp.texi:560: warning: node next `omp_get_initial_device' in menu `omp_get_level' and in sectioning `omp_get_device_num' differ
../../../libgomp/libgomp.texi:587: warning: node next `omp_get_device_num' in menu `omp_get_dynamic' and in sectioning `omp_get_level' differ
../../../libgomp/libgomp.texi:587: warning: node prev `omp_get_device_num' in menu `omp_get_default_device' and in sectioning `omp_get_initial_device' differ
../../../libgomp/libgomp.texi:615: warning: node prev `omp_get_level' in menu `omp_get_initial_device' and in sectioning `omp_get_device_num' differ
warnings. This patch fixes those.
2021-10-12 Jakub Jelinek <jakub@redhat.com>
* libgomp.texi (omp_get_device_num): Move @node before omp_get_dynamic
to avoid makeinfo warnings.