platform/upstream/gcc.git
3 years agoaarch64: Reimplement vshrn_high_n* intrinsics using builtins
Kyrylo Tkachov [Mon, 25 Jan 2021 09:50:54 +0000 (09:50 +0000)]
aarch64: Reimplement vshrn_high_n* intrinsics using builtins

This patch reimplements the vshrn_high_n* intrinsics that generate the
SHRN2 instruction.
It is a vec_concat of the narrowing shift with the bottom part of the
destination register, so we need a little-endian and a big-endian version and an expander to
pick between them.

gcc/ChangeLog:

* config/aarch64/aarch64-simd-builtins.def (shrn2): Define
builtin.
* config/aarch64/aarch64-simd.md (aarch64_shrn2<mode>_insn_le):
Define.
(aarch64_shrn2<mode>_insn_be): Likewise.
(aarch64_shrn2<mode>): Likewise.
* config/aarch64/arm_neon.h (vshrn_high_n_s16): Reimlplement
using builtins.
(vshrn_high_n_s32): Likewise.
(vshrn_high_n_s64): Likewise.
(vshrn_high_n_u16): Likewise.
(vshrn_high_n_u32): Likewise.
(vshrn_high_n_u64): Likewise.

3 years agoaarch64: Reimplement vshrn_n* intrinsics using builtins
Kyrylo Tkachov [Fri, 22 Jan 2021 14:16:30 +0000 (14:16 +0000)]
aarch64: Reimplement vshrn_n* intrinsics using builtins

This patch reimplements the vshrn_n* intrinsics to use RTL builtins.
These perform a narrowing right shift.

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

gcc/ChangeLog:

* config/aarch64/aarch64-simd-builtins.def (shrn): Define
builtin.
* config/aarch64/aarch64-simd.md (aarch64_shrn<mode>_insn_le):
Define.
(aarch64_shrn<mode>_insn_be): Likewise.
(aarch64_shrn<mode>): Likewise.
* config/aarch64/arm_neon.h (vshrn_n_s16): Reimplement using
builtins.
(vshrn_n_s32): Likewise.
(vshrn_n_s64): Likewise.
(vshrn_n_u16): Likewise.
(vshrn_n_u32): Likewise.
(vshrn_n_u64): Likewise.
* config/aarch64/iterators.md (vn_mode): New mode attribute.

3 years agoFix LTO bootstrap on Windows
Eric Botcazou [Thu, 28 Jan 2021 10:31:35 +0000 (11:31 +0100)]
Fix LTO bootstrap on Windows

The latest fix introduced a comparison of executables and this cannot
directly work on Windows because they are timestamped.  Moreover nobody
sets $(exeext) at top level, at least on MinGW, so you get weird behavior
because some tools add the implicit .exe suffix and others do not.

contrib/
PR lto/85574
* compare-lto: Deal with PE-COFF executables specifically.

3 years agoPR fortran/86470 - ICE with OpenMP, class(*) allocatable
Harald Anlauf [Thu, 28 Jan 2021 09:13:46 +0000 (10:13 +0100)]
PR fortran/86470 - ICE with OpenMP, class(*) allocatable

gfc_call_malloc should malloc an area of size 1 if no size given.

gcc/fortran/ChangeLog:

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

gcc/testsuite/ChangeLog:

PR fortran/86470
* gfortran.dg/gomp/pr86470.f90: New test.

3 years agoc++: Some C++20 and C++23 option help fixes
Jakub Jelinek [Thu, 28 Jan 2021 09:00:52 +0000 (10:00 +0100)]
c++: Some C++20 and C++23 option help fixes

I've noticed we still refer to C++20 as draft standard, and there is a pasto
in C++23 description.

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

* c.opt (-std=c++2a, -std=c++20, -std=gnu++2a, -std=gnu++20): Remove
draft from description.
(-std=c++2b): Fix a pasto, 2020 -> 2023.

3 years agortl-optimization/80960 - avoid creating garbage RTL in DSE
Richard Biener [Wed, 27 Jan 2021 14:35:52 +0000 (15:35 +0100)]
rtl-optimization/80960 - avoid creating garbage RTL in DSE

The following avoids repeatedly turning VALUE RTXen into
sth useful and re-applying a constant offset through get_addr
via DSE check_mem_read_rtx.  Instead perform this once for
all stores to be visited in check_mem_read_rtx.  This avoids
allocating 1.6GB of garbage PLUS RTXen on the PR80960
testcase, fixing the memory usage regression from old GCC.

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

PR rtl-optimization/80960
* dse.c (check_mem_read_rtx): Call get_addr on the
offsetted address.

3 years agors6000: Fix vec insert ilp32 ICE and test failures [PR98799]
Xionghu Luo [Thu, 28 Jan 2021 02:24:03 +0000 (20:24 -0600)]
rs6000: Fix vec insert ilp32 ICE and test failures [PR98799]

UNSPEC_SI_FROM_SF is not supported when TARGET_DIRECT_MOVE_64BIT
is false for -m32, don't generate VIEW_CONVERT_EXPR(ARRAY_REF) for
variable vector insert.  Remove rs6000_expand_vector_set_var helper
function, adjust the p8 and p9 definitions position and make them
static.

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

gcc/ChangeLog:

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

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

gcc/testsuite/ChangeLog:

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

PR target/98827
* gcc.target/powerpc/fold-vec-insert-char-p8.c: Adjust ilp32.
* gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-double.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise.
* gcc.target/powerpc/pr79251.p8.c: Likewise.
* gcc.target/powerpc/pr79251.p9.c: Likewise.
* gcc.target/powerpc/vsx-builtin-7.c: Likewise.
* gcc.target/powerpc/pr79251-run.c: Build and run with vsx
option.

3 years agoRISC-V: Fix -march option parsing when extension exists.
Xing GUO [Thu, 28 Jan 2021 03:22:40 +0000 (11:22 +0800)]
RISC-V: Fix -march option parsing when  extension exists.

This patch fixes -march option parsing when `p` extension exists,
e.g., -march=rv64imafdcp should produce

.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_p"

rather than

.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c_p"

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

* gcc.target/riscv/attribute-18.c: New test.

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

3 years agoFix strides for C descriptors with stride > 2.
Harris Snyder [Wed, 27 Jan 2021 21:54:04 +0000 (22:54 +0100)]
Fix strides for C descriptors with stride > 2.

libgfortran/ChangeLog:

* runtime/ISO_Fortran_binding.c (CFI_establish): fixed
strides for rank >2 arrays.

gcc/testsuite/ChangeLog:

* gfortran.dg/ISO_Fortran_binding_18.c: New test.
* gfortran.dg/ISO_Fortran_binding_18.f90: New test.

3 years ago[PR97684] IRA: Recalculate pseudo classes if we added new pseduos since last calculat...
Vladimir N. Makarov [Wed, 27 Jan 2021 19:53:28 +0000 (14:53 -0500)]
[PR97684] IRA: Recalculate pseudo classes if we added new pseduos since last calculation before updating equiv regs

update_equiv_regs can use reg classes of pseudos and they are set up in
register pressure sensitive scheduling and loop invariant motion and in
live range shrinking.  This info can become obsolete if we add new pseudos
since the last set up.  Recalculate it again if the new pseudos were
added.

gcc/ChangeLog:

PR rtl-optimization/97684
* ira.c (ira): Call ira_set_pseudo_classes before
update_equiv_regs when it is necessary.

gcc/testsuite/ChangeLog:

PR rtl-optimization/97684
* gcc.target/i386/pr97684.c: New.

3 years agoc++: Dependent using enum [PR97874]
Jason Merrill [Wed, 27 Jan 2021 05:51:01 +0000 (00:51 -0500)]
c++: Dependent using enum [PR97874]

The handling of dependent scopes and unsuitable scopes in lookup_using_decl
was a bit convoluted; I tweaked it for a while and then eventually
reorganized much of the function to hopefully be clearer.  Along the way I
noticed a couple of ways we were mishandling inherited constructors.

The local binding for a dependent using is the USING_DECL.

Implement instantiation of a dependent USING_DECL at function scope.

gcc/cp/ChangeLog:

PR c++/97874
* name-lookup.c (lookup_using_decl): Clean up handling
of dependency and inherited constructors.
(finish_nonmember_using_decl): Handle DECL_DEPENDENT_P.
* pt.c (tsubst_expr): Handle DECL_DEPENDENT_P.

gcc/testsuite/ChangeLog:

PR c++/97874
* g++.dg/lookup/using4.C: No error in C++20.
* g++.dg/cpp0x/decltype37.C: Adjust message.
* g++.dg/template/crash75.C: Adjust message.
* g++.dg/template/crash76.C: Adjust message.
* g++.dg/cpp0x/inh-ctor36.C: New test.
* g++.dg/cpp1z/inh-ctor39.C: New test.
* g++.dg/cpp2a/using-enum-7.C: New test.

3 years agoaarch64: Fix up *aarch64_bfxilsi_uxtw [PR98853]
Jakub Jelinek [Wed, 27 Jan 2021 19:35:21 +0000 (20:35 +0100)]
aarch64: Fix up *aarch64_bfxilsi_uxtw [PR98853]

The https://gcc.gnu.org/legacy-ml/gcc-patches/2018-07/msg01895.html
patch that introduced this pattern claimed:
Would generate:

combine_balanced_int:
        bfxil   w0, w1, 0, 16
        uxtw    x0, w0
        ret

But with this patch generates:

combine_balanced_int:
        bfxil   w0, w1, 0, 16
        ret
and it is indeed what it should generate, but it doesn't do that,
it emits bfxil  x0, x1, 0, 16
instead which doesn't zero extend from 32 to 64 bits, but preserves
the bits from the destination register.

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

PR target/98853
* config/aarch64/aarch64.md (*aarch64_bfxilsi_uxtw): Use
%w0, %w1 and %2 instead of %0, %1 and %2.

* gcc.c-torture/execute/pr98853-1.c: New test.
* gcc.c-torture/execute/pr98853-2.c: New test.

3 years agoCombine patterns for p10 load-cmpi fusion
Aaron Sawdey [Mon, 28 Sep 2020 16:15:46 +0000 (11:15 -0500)]
Combine patterns for p10 load-cmpi fusion

This patch adds the first batch of patterns to support p10 fusion. These
will allow combine to create a single insn for a pair of instructions
that power10 can fuse and execute. These particular fusion pairs have the
requirement that only cr0 can be used when fusing a load with a compare
immediate of -1/0/1 (if signed) or 0/1 (if unsigned), so we want combine
to put that requirement in, and if it doesn't work out the splitter
can change it back into 2 insns so scheduling can move them apart.

The patterns are generated by a script genfusion.pl and live in new file
fusion.md. This script will be expanded to generate more patterns for
fusion.

This also adds option -mpower10-fusion which defaults on for power10 and
will gate all these fusion patterns. In addition I have added an
undocumented option -mpower10-fusion-ld-cmpi (which may be removed later)
that just controls the load+compare-immediate patterns. I have made
these default on for power10 but they are not disallowed for earlier
processors because it is still valid code. This allows us to test the
correctness of fusion code generation by turning it on explicitly.

gcc/ChangeLog:

* config/rs6000/genfusion.pl: New script to generate
define_insn_and_split patterns so combine can arrange fused
instructions next to each other.
* config/rs6000/fusion.md: New file, generated fused instruction
patterns for combine.
* config/rs6000/predicates.md (const_m1_to_1_operand): New predicate.
(non_update_memory_operand): New predicate.
* config/rs6000/rs6000-cpus.def: Add OPTION_MASK_P10_FUSION and
OPTION_MASK_P10_FUSION_LD_CMPI to ISA_3_1_MASKS_SERVER and
POWERPC_MASKS.
* config/rs6000/rs6000-protos.h (address_is_non_pfx_d_or_x): Add
prototype.
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Automatically set OPTION_MASK_P10_FUSION and
OPTION_MASK_P10_FUSION_LD_CMPI if target is power10.
(rs600_opt_masks): Allow -mpower10-fusion
in function attributes.
(address_is_non_pfx_d_or_x): New function.
* config/rs6000/rs6000.h: Add MASK_P10_FUSION.
* config/rs6000/rs6000.md: Include fusion.md.
* config/rs6000/rs6000.opt: Add -mpower10-fusion
and -mpower10-fusion-ld-cmpi.
* config/rs6000/t-rs6000: Add dependencies involving fusion.md.

3 years agolibstdc++: Regenerate libstdc++ HTML docs
Jonathan Wakely [Wed, 27 Jan 2021 17:52:27 +0000 (17:52 +0000)]
libstdc++: Regenerate libstdc++ HTML docs

libstdc++-v3/ChangeLog:

* doc/xml/manual/status_cxx2017.xml: Replace invalid entity.
* doc/html/*: Regenerate.

3 years agoaarch64: Use RTL builtins for [su]mlal intrinsics
Jonathan Wright [Tue, 26 Jan 2021 22:32:08 +0000 (22:32 +0000)]
aarch64: Use RTL builtins for [su]mlal intrinsics

Rewrite [su]mlal Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

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

* config/aarch64/aarch64-simd-builtins.def: Add [su]mlal
builtin generator macros.
* config/aarch64/aarch64-simd.md (*aarch64_<su>mlal<mode>):
Rename to...
(aarch64_<su>mlal<mode>): This.
* config/aarch64/arm_neon.h (vmlal_s8): Use RTL builtin
instead of inline asm.
(vmlal_s16): Likewise.
(vmlal_s32): Likewise.
(vmlal_u8): Likewise.
(vmlal_u16): Likewise.
(vmlal_u32): Likewise.

3 years agolibstdc++: Use printf to print control characters
Jonathan Wakely [Thu, 21 Jan 2021 13:15:42 +0000 (13:15 +0000)]
libstdc++: Use printf to print control characters

Bash and GNU echo do not interpret backslash escapes by default, so use
printf when printing \n or \t in strings.

libstdc++-v3/ChangeLog:

* testsuite/experimental/simd/generate_makefile.sh: Use printf
instead of echo when printing escape characters.

3 years agolibstdc++: Add simd testsuite
Matthias Kretz [Thu, 21 Jan 2021 11:50:32 +0000 (11:50 +0000)]
libstdc++: Add simd testsuite

Add a new check-simd target to the testsuite. The new target creates a
subdirectory, generates the necessary Makefiles, and spawns submakes to
build and run the tests. Running this testsuite with defaults on my
machine takes half of the time the dejagnu testsuite required to only
determine whether to run tests. Since the simd testsuite integrated in
dejagnu increased the time of the whole libstdc++ testsuite by ~100%
this approach is a compromise for speed while not sacrificing coverage
too much. Since the test driver is invoked individually per test
executable from a Makefile, make's jobserver (-j) trivially parallelizes
testing.

Testing different flags and with simulator (or remote execution) is
possible. E.g. `make check-simd DRIVEROPTS=-q
target_list="unix{-m64,-m32}{-march=sandybridge,-march=skylake-avx512}{,-
ffast-math}"`
runs the testsuite 8 times in different subdirectories, using 8
different combinations of compiler flags, only outputs failing tests
(-q), and prints all summaries at the end. It skips most ABI tags by
default unless --run-expensive is passed to DRIVEROPTS or
GCC_TEST_RUN_EXPENSIVE is not empty.

To use a simulator, the CHECK_SIMD_CONFIG variable needs to point to a
shell script which calls `define_target <name> <flags> <simulator>` and
set target_list as needed. E.g.:
case "$target_triplet" in
x86_64-*)
  target_list="unix{-march=sandybridge,-march=skylake-avx512}
  ;;
powerpc64le-*)
  define_target power8 "-static -mcpu=power8" "/usr/bin/qemu-ppc64le -cpu
power8"
  define_target power9 -mcpu=power9 "$HOME/bin/run_on_gcc135"
  target_list="power8 power9{,-ffast-math}"
  ;;
esac

libstdc++-v3/ChangeLog:

* scripts/check_simd: New file. This script is called from the
the check-simd target. It determines a set of compiler flags and
simulator setups for calling generate_makefile.sh and passes the
information back to the check-simd target, which recurses to the
generated Makefiles.
* scripts/create_testsuite_files: Remove files below simd/tests/
from testsuite_files and place them in testsuite_files_simd.
* testsuite/Makefile.am: Add testsuite_files_simd. Add
check-simd target.
* testsuite/Makefile.in: Regenerate.
* testsuite/experimental/simd/driver.sh: New file. This script
compiles and runs a given simd test, logging its output and
status. It uses the timeout command to implement compile and
test timeouts.
* testsuite/experimental/simd/generate_makefile.sh: New file.
This script generates a Makefile which uses driver.sh to compile
and run the tests and collect the logs into a single log file.
* testsuite/experimental/simd/tests/abs.cc: New file. Tests
abs(simd).
* testsuite/experimental/simd/tests/algorithms.cc: New file.
Tests min/max(simd, simd).
* testsuite/experimental/simd/tests/bits/conversions.h: New
file. Contains functions to support tests involving conversions.
* testsuite/experimental/simd/tests/bits/make_vec.h: New file.
Support functions make_mask and make_vec.
* testsuite/experimental/simd/tests/bits/mathreference.h: New
file. Support functions to supply precomputed math function
reference data.
* testsuite/experimental/simd/tests/bits/metahelpers.h: New
file. Support code for SFINAE testing.
* testsuite/experimental/simd/tests/bits/simd_view.h: New file.
* testsuite/experimental/simd/tests/bits/test_values.h: New
file. Test functions to easily drive a test with simd objects
initialized from a given list of values and a range of random
values.
* testsuite/experimental/simd/tests/bits/ulp.h: New file.
Support code to determine the ULP distance of simd objects.
* testsuite/experimental/simd/tests/bits/verify.h: New file.
Test framework for COMPARE'ing simd objects and instantiating
the test templates with value_type and ABI tag.
* testsuite/experimental/simd/tests/broadcast.cc: New file. Test
simd broadcasts.
* testsuite/experimental/simd/tests/casts.cc: New file. Test
simd casts.
* testsuite/experimental/simd/tests/fpclassify.cc: New file.
Test floating-point classification functions.
* testsuite/experimental/simd/tests/frexp.cc: New file. Test
frexp(simd).
* testsuite/experimental/simd/tests/generator.cc: New file. Test
simd generator constructor.
* testsuite/experimental/simd/tests/hypot3_fma.cc: New file.
Test 3-arg hypot(simd,simd,simd) and fma(simd,simd,sim).
* testsuite/experimental/simd/tests/integer_operators.cc: New
file. Test integer operators.
* testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc:
New file. Test ldexp(simd), scalbn(simd), scalbln(simd), and
modf(simd).
* testsuite/experimental/simd/tests/loadstore.cc: New file. Test
(converting) simd loads and stores.
* testsuite/experimental/simd/tests/logarithm.cc: New file. Test
log*(simd).
* testsuite/experimental/simd/tests/mask_broadcast.cc: New file.
Test simd_mask broadcasts.
* testsuite/experimental/simd/tests/mask_conversions.cc: New
file. Test simd_mask conversions.
* testsuite/experimental/simd/tests/mask_implicit_cvt.cc: New
file. Test simd_mask implicit conversions.
* testsuite/experimental/simd/tests/mask_loadstore.cc: New file.
Test simd_mask loads and stores.
* testsuite/experimental/simd/tests/mask_operator_cvt.cc: New
file. Test simd_mask operators convert as specified.
* testsuite/experimental/simd/tests/mask_operators.cc: New file.
Test simd_mask compares, subscripts, and negation.
* testsuite/experimental/simd/tests/mask_reductions.cc: New
file. Test simd_mask reductions.
* testsuite/experimental/simd/tests/math_1arg.cc: New file. Test
1-arg math functions on simd.
* testsuite/experimental/simd/tests/math_2arg.cc: New file. Test
2-arg math functions on simd.
* testsuite/experimental/simd/tests/operator_cvt.cc: New file.
Test implicit conversions on simd binary operators behave as
specified.
* testsuite/experimental/simd/tests/operators.cc: New file. Test
simd compares, subscripts, not, unary minus, plus, minus,
multiplies, divides, increment, and decrement.
* testsuite/experimental/simd/tests/reductions.cc: New file.
Test reduce(simd).
* testsuite/experimental/simd/tests/remqo.cc: New file. Test
remqo(simd).
* testsuite/experimental/simd/tests/simd.cc: New file. Basic
sanity checks of simd types.
* testsuite/experimental/simd/tests/sincos.cc: New file. Test
sin(simd) and cos(simd).
* testsuite/experimental/simd/tests/split_concat.cc: New file.
Test split(simd) and concat(simd, simd).
* testsuite/experimental/simd/tests/splits.cc: New file. Test
split(simd_mask).
* testsuite/experimental/simd/tests/trigonometric.cc: New file.
Test remaining trigonometric functions on simd.
* testsuite/experimental/simd/tests/trunc_ceil_floor.cc: New
file. Test trunc(simd), ceil(simd), and floor(simd).
* testsuite/experimental/simd/tests/where.cc: New file. Test
masked operations using where.

3 years agolibstdc++: Add std::experimental::simd from the Parallelism TS 2
Matthias Kretz [Thu, 21 Jan 2021 11:45:15 +0000 (11:45 +0000)]
libstdc++: Add std::experimental::simd from the Parallelism TS 2

Adds <experimental/simd>.

This implements the simd and simd_mask class templates via
[[gnu::vector_size(N)]] data members. It implements overloads for all of
<cmath> for simd. Explicit vectorization of the <cmath> functions is not
finished.

The majority of functions are marked as [[gnu::always_inline]] to enable
quasi-ODR-conforming linking of TUs with different -m flags.
Performance optimization was done for x86_64.  ARM, Aarch64, and POWER
rely on the compiler to recognize reduction, conversion, and shuffle
patterns.

Besides verification using many different machine flages, the code was
also verified with different fast-math flags.

libstdc++-v3/ChangeLog:

* doc/xml/manual/status_cxx2017.xml: Add implementation status
of the Parallelism TS 2. Document implementation-defined types
and behavior.
* include/Makefile.am: Add new headers.
* include/Makefile.in: Regenerate.
* include/experimental/simd: New file. New header for
Parallelism TS 2.
* include/experimental/bits/numeric_traits.h: New file.
Implementation of P1841R1 using internal naming. Addition of
missing IEC559 functionality query.
* include/experimental/bits/simd.h: New file. Definition of the
public simd interfaces and general implementation helpers.
* include/experimental/bits/simd_builtin.h: New file.
Implementation of the _VecBuiltin simd_abi.
* include/experimental/bits/simd_converter.h: New file. Generic
simd conversions.
* include/experimental/bits/simd_detail.h: New file. Internal
macros for the simd implementation.
* include/experimental/bits/simd_fixed_size.h: New file. Simd
fixed_size ABI specific implementations.
* include/experimental/bits/simd_math.h: New file. Math
overloads for simd.
* include/experimental/bits/simd_neon.h: New file. Simd NEON
specific implementations.
* include/experimental/bits/simd_ppc.h: New file. Implement bit
shifts to avoid invalid results for integral types smaller than
int.
* include/experimental/bits/simd_scalar.h: New file. Simd scalar
ABI specific implementations.
* include/experimental/bits/simd_x86.h: New file. Simd x86
specific implementations.
* include/experimental/bits/simd_x86_conversions.h: New file.
x86 specific conversion optimizations. The conversion patterns
work around missing conversion patterns in the compiler and
should be removed as soon as PR85048 is resolved.
* testsuite/experimental/simd/standard_abi_usable.cc: New file.
Test that all (not all fixed_size<N>, though) standard simd and
simd_mask types are usable.
* testsuite/experimental/simd/standard_abi_usable_2.cc: New
file. As above but with -ffast-math.
* testsuite/libstdc++-dg/conformance.exp: Don't build simd tests
from the standard test loop. Instead use
check_vect_support_and_set_flags to build simd tests with the
relevant machine flags.

3 years agotree-optimization/98854 - avoid some PHI BB vectorization
Richard Biener [Wed, 27 Jan 2021 14:20:58 +0000 (15:20 +0100)]
tree-optimization/98854 - avoid some PHI BB vectorization

This avoids cases of PHI node vectorization that just causes us
to insert vector CTORs inside loops for values only required
outside of the loop.

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

PR tree-optimization/98854
* tree-vect-slp.c (vect_build_slp_tree_2): Also build
PHIs from scalars when the number of CTORs matches the
number of children.

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

3 years agoaarch64: Use RTL builtins for integer mls_n intrinsics
Jonathan Wright [Fri, 15 Jan 2021 15:48:59 +0000 (15:48 +0000)]
aarch64: Use RTL builtins for integer mls_n intrinsics

Rewrite integer mls_n Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

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

* config/aarch64/aarch64-simd-builtins.def: Add mls_n builtin
generator macro.
* config/aarch64/aarch64-simd.md (*aarch64_mls_elt_merge<mode>):
Rename to...
(aarch64_mls_n<mode>): This.
* config/aarch64/arm_neon.h (vmls_n_s16): Use RTL builtin
instead of asm.
(vmls_n_s32): Likewise.
(vmls_n_u16): Likewise.
(vmls_n_u32): Likewise.
(vmlsq_n_s16): Likewise.
(vmlsq_n_s32): Likewise.
(vmlsq_n_u16): Likewise.
(vmlsq_n_u32): Likewise.

3 years agoaarch64: Use RTL builtins for integer mls intrinsics
Jonathan Wright [Mon, 11 Jan 2021 17:52:45 +0000 (17:52 +0000)]
aarch64: Use RTL builtins for integer mls intrinsics

Rewrite integer mls Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/Changelog:

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

* config/aarch64/aarch64-simd-builtins.def: Add mls builtin
generator macro.
* config/aarch64/arm_neon.h (vmls_s8): Use RTL builtin rather
than asm.
(vmls_s16): Likewise.
(vmls_s32): Likewise.
(vmls_u8): Likewise.
(vmls_u16): Likewise.
(vmls_u32): Likewise.
(vmlsq_s8): Likewise.
(vmlsq_s16): Likewise.
(vmlsq_s32): Likewise.
(vmlsq_u8): Likewise.
(vmlsq_u16): Likewise.
(vmlsq_u32): Likewise.

3 years agolibstdc++: Optimize std::string_view::find [PR 66414]
Jonathan Wakely [Wed, 27 Jan 2021 13:21:52 +0000 (13:21 +0000)]
libstdc++: Optimize std::string_view::find [PR 66414]

This reuses the code from std::string::find, which was improved by
r244225, but string_view was not changed to match.

libstdc++-v3/ChangeLog:

PR libstdc++/66414
* include/bits/string_view.tcc
(basic_string_view::find(const CharT*, size_type, size_type)):
Optimize.

3 years agoaarch64: Use RTL builtins for integer mla_n intrinsics
Jonathan Wright [Fri, 15 Jan 2021 15:10:53 +0000 (15:10 +0000)]
aarch64: Use RTL builtins for integer mla_n intrinsics

Rewrite integer mla_n Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

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

* config/aarch64/aarch64-simd-builtins.def: Add mla_n builtin
generator macro.
* config/aarch64/aarch64-simd.md (*aarch64_mla_elt_merge<mode>):
Rename to...
(aarch64_mla_n<mode>): This.
* config/aarch64/arm_neon.h (vmla_n_s16): Use RTL builtin
instead of asm.
(vmla_n_s32): Likewise.
(vmla_n_u16): Likewise.
(vmla_n_u32): Likewise.
(vmlaq_n_s16): Likewise.
(vmlaq_n_s32): Likewise.
(vmlaq_n_u16): Likewise.
(vmlaq_n_u32): Likewise.

3 years agolibstdc++: Add string contains member functions for C++2b
Paul Fee [Wed, 27 Jan 2021 12:11:28 +0000 (12:11 +0000)]
libstdc++: Add string contains member functions for C++2b

This implements WG21 P1679R3, adding contains member functions to
basic_string_view and basic_string.

libstdc++-v3/ChangeLog:

* include/bits/basic_string.h (basic_string::contains): New
member functions.
* include/std/string_view (basic_string_view::contains):
Likewise.
* include/std/version (__cpp_lib_string_contains): Define.
* testsuite/21_strings/basic_string/operations/starts_with/char/1.cc:
Remove trailing whitespace.
* testsuite/21_strings/basic_string/operations/starts_with/wchar_t/1.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/contains/char/1.cc: New test.
* testsuite/21_strings/basic_string/operations/contains/wchar_t/1.cc: New test.
* testsuite/21_strings/basic_string_view/operations/contains/char/1.cc: New test.
* testsuite/21_strings/basic_string_view/operations/contains/char/2.cc: New test.
* testsuite/21_strings/basic_string_view/operations/contains/wchar_t/1.cc: New test.

3 years agoFortran: Fix ICE due to elemental procedure pointers [PR93924/5].
Paul Thomas [Wed, 27 Jan 2021 11:34:02 +0000 (11:34 +0000)]
Fortran: Fix ICE due to elemental procedure pointers [PR93924/5].

2021-01-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/93924
PR fortran/93925
* trans-expr.c (gfc_conv_procedure_call): Suppress the call to
gfc_conv_intrinsic_to_class for unlimited polymorphic procedure
pointers.
(gfc_trans_assignment_1): Similarly suppress class assignment
for class valued procedure pointers.

gcc/testsuite/
PR fortran/93924
PR fortran/93925
* gfortran.dg/proc_ptr_52.f90 : New test.

3 years agolibgcc, i386: Add .note.GNU-stack sections to the ms sse/avx sav/res
Jakub Jelinek [Wed, 27 Jan 2021 10:49:23 +0000 (11:49 +0100)]
libgcc, i386: Add .note.GNU-stack sections to the ms sse/avx sav/res

On Linux, GCC emits .note.GNU-stack sections when compiling code to mark
the code as not needing or needing executable stack, missing section means
unknown.  But assembly files need to be marked manually.  We already
mark various *.S files in libgcc manually, but the
avx_resms64f.o
avx_resms64fx.o
avx_resms64.o
avx_resms64x.o
avx_savms64f.o
avx_savms64.o
sse_resms64f.o
sse_resms64fx.o
sse_resms64.o
sse_resms64x.o
sse_savms64f.o
sse_savms64.o
files aren't marked, so when something links it in, it will require
executable stack.  Nothing in the assembly requires executable stack though.

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

* config/i386/savms64.h: Add .note.GNU-stack section on Linux.
* config/i386/savms64f.h: Likewise.
* config/i386/resms64.h: Likewise.
* config/i386/resms64f.h: Likewise.
* config/i386/resms64x.h: Likewise.
* config/i386/resms64fx.h: Likewise.

3 years agoFix ICE for [PR target/98833].
liuhongt [Wed, 27 Jan 2021 05:22:36 +0000 (13:22 +0800)]
Fix ICE for [PR target/98833].

And replace __builtin_ia32_pcmpeqb128 with operator == in libcpp.

gcc/ChangeLog:

PR target/98833
* config/i386/sse.md (sse2_gt<mode>3): Drop !TARGET_XOP in condition.
(*sse2_eq<mode>3): Ditto.

gcc/testsuite/ChangeLog:

PR target/98833
* gcc.target/i386/pr98833.c: New test.

libcpp/

PR target/98833
* lex.c (search_line_sse2): Replace builtins with == operator.

3 years agotestsuite: Fix TBAA in {sse,avx}*and*p[sd]*.c tests
Jakub Jelinek [Wed, 27 Jan 2021 09:21:03 +0000 (10:21 +0100)]
testsuite: Fix TBAA in {sse,avx}*and*p[sd]*.c tests

This patch drops the no-strict-aliasing hack in m128-check.h and instead
ensures the tests read objects with the right dynamic type.

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

* gcc.target/i386/m128-check.h (CHECK_EXP): Remove
optimize ("no-strict-aliasing") attribute.
* gcc.target/i386/sse-andnps-1.c (TEST): Copy e into float[4]
array to avoid violating TBAA.
* gcc.target/i386/sse2-andpd-1.c (TEST): Copy e.d into double[2]
array to avoid violating TBAA.
* gcc.target/i386/sse-andps-1.c (TEST): Copy e.f into float[4]
array to avoid violating TBAA.
* gcc.target/i386/sse2-andnpd-1.c (TEST): Copy e into double[2]
array to avoid violating TBAA.

3 years agoFortran: Fix ICE due to elemental procedure pointers [PR98472].
Paul Thomas [Wed, 27 Jan 2021 09:12:16 +0000 (09:12 +0000)]
Fortran: Fix ICE due to elemental procedure pointers [PR98472].

2021-01-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/98472
* trans-array.c (gfc_conv_expr_descriptor): Include elemental
procedure pointers in the assert under the comment 'elemental
function' and eliminate the second, spurious assert.

gcc/testsuite/
PR fortran/98472
* gfortran.dg/elemental_function_5.f90 : New test.

3 years agoRename PROP_trees to PROP_gimple
Jakub Jelinek [Wed, 27 Jan 2021 09:10:04 +0000 (10:10 +0100)]
Rename PROP_trees to PROP_gimple

PROP_trees actually means GIMPLE IL, rather than GENERIC, so better
not to confuse users.

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

* tree-pass.h (PROP_trees): Rename to ...
(PROP_gimple): ... this.
* cfgexpand.c (pass_data_expand): Replace PROP_trees with PROP_gimple.
* passes.c (execute_function_dump, execute_function_todo,
execute_one_ipa_transform_pass, execute_one_pass): Likewise.
* varpool.c (ctor_for_folding): Likewise.

3 years agovarpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]
Jakub Jelinek [Wed, 27 Jan 2021 09:08:46 +0000 (10:08 +0100)]
varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

In 4.8 and earlier we used to fold the following to 0 during GENERIC folding,
but we don't do that anymore because ctor_for_folding etc. has been turned into a
GIMPLE centric API, but as the testcase shows, it is invoked even during
GENERIC folding and there the automatic vars still should have meaningful
initializers.  I've verified that the C++ FE drops TREE_READONLY on
automatic vars with const qualified types if they require non-constant
(runtime) initialization.

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

PR tree-optimization/97260
* varpool.c: Include tree-pass.h.
(ctor_for_folding): In GENERIC return DECL_INITIAL for TREE_READONLY
non-TREE_SIDE_EFFECTS automatic variables.

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

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

3 years agoc++: Add support for -std=c++23
Paul Fee [Mon, 25 Jan 2021 01:18:30 +0000 (01:18 +0000)]
c++: Add support for -std=c++23

Derived from the changes that added C++2a support in 2017.
r8-3237-g026a79f70cf33f836ea5275eda72d4870a3041e5

No C++23 features are added here.
Use of -std=c++23 sets __cplusplus to 202100L.

$ g++ -std=c++23 -dM -E -x c++ - < /dev/null | grep cplusplus
 #define __cplusplus 202100L

gcc/
* doc/cpp.texi (__cplusplus): Document value for -std=c++23
or -std=gnu++23.
* doc/invoke.texi: Document -std=c++23 and -std=gnu++23.
* dwarf2out.c (highest_c_language): Recognise C++20 and C++23.
(gen_compile_unit_die): Recognise C++23.

gcc/c-family/
* c-common.h (cxx_dialect): Add cxx23 as a dialect.
* c.opt: Add options for -std=c++23, std=c++2b, -std=gnu++23
and -std=gnu++2b
* c-opts.c (set_std_cxx23): New.
(c_common_handle_option): Set options when -std=c++23 is enabled.
(c_common_post_options): Adjust comments.
(set_std_cxx20): Likewise.

gcc/testsuite/
* lib/target-supports.exp (check_effective_target_c++2a):
Check for C++2a or C++23.
(check_effective_target_c++20_down): New.
(check_effective_target_c++23_only): New.
(check_effective_target_c++23): New.
* g++.dg/cpp23/cplusplus.C: New.

libcpp/
* include/cpplib.h (c_lang): Add CXX23 and GNUCXX23.
* init.c (lang_defaults): Add rows for CXX23 and GNUCXX23.
(cpp_init_builtins): Set __cplusplus to 202100L for C++23.

3 years agoc++: Invisible refs are not restrict [PR97474]
Jason Merrill [Tue, 26 Jan 2021 21:04:24 +0000 (16:04 -0500)]
c++: Invisible refs are not restrict [PR97474]

In this testcase, we refer to the a parameter through a reference in its own
member, which we asserted couldn't happen by marking the parameter as
'restrict'.  This assumption could also be broken if the address escapes
from the constructor.

gcc/cp/ChangeLog:

PR c++/97474
* call.c (type_passed_as): Don't mark invisiref restrict.

gcc/testsuite/ChangeLog:

PR c++/97474
* g++.dg/torture/pr97474.C: New test.

3 years agoc++: constexpr and empty fields [PR97566]
Jason Merrill [Sun, 24 Jan 2021 05:55:49 +0000 (00:55 -0500)]
c++: constexpr and empty fields [PR97566]

In the discussion of PR98463, Jakub pointed out that in C++17 and up,
cxx_fold_indirect_ref_1 could use the field we build for an empty base.  I
tried implementing that, but it broke one of the tuple tests, so I did some
more digging.

To start with, I generalized the PR98463 patch to handle the case where we
do have a field, for an empty base or [[no_unique_address]] member.  This is
enough also for the no-field case because the member of the empty base must
itself be an empty field; if it weren't, the base would not be empty.

I looked for related PRs and found 97566, which was also fixed by the patch.
After some poking around to figure out why, I noticed that the testcase had
been breaking because E, though an empty class, has an ABI nvsize of one
byte, and we were giving the [[no_unique_address]] FIELD_DECL that
DECL_SIZE, whereas in build_base_field_1 empty base fields always get
DECL_SIZE zero, and various places were relying on that to recognize empty
fields.  So I adjusted both the size and the checking.  When I adjusted
check_bases I wondered if we were correctly handling bases with only empty
data members, but it appears we do.

I'm deferring the cxx_fold_indirect_ref_1 change until stage 1, as I don't
think it actually fixes anything.

gcc/cp/ChangeLog:

PR c++/97566
PR c++/98463
* class.c (layout_class_type): An empty field gets size 0.
(is_empty_field): New.
(check_bases): Check it.
* cp-tree.h (is_empty_field): Declare it.
* constexpr.c (cxx_eval_store_expression): Check it.
(cx_check_missing_mem_inits): Likewise.
* init.c (perform_member_init): Likewise.
* typeck2.c (process_init_constructor_record): Likewise.

gcc/testsuite/ChangeLog:

PR c++/97566
* g++.dg/cpp2a/no_unique_address10.C: New test.
* g++.dg/cpp2a/no_unique_address9.C: New test.

3 years agotestsuite: Fix TBAA in sse*and*p[sd]*.c tests
Jakub Jelinek [Tue, 26 Jan 2021 19:02:29 +0000 (20:02 +0100)]
testsuite: Fix TBAA in sse*and*p[sd]*.c tests

This patch drops the no-strict-aliasing hack in m128-check.h and instead
ensures the tests read objects with the right dynamic type.

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

* gcc.target/powerpc/m128-check.h (CHECK_EXP): Remove
optimize ("no-strict-aliasing") attribute.
* gcc.target/powerpc/sse-andnps-1.c (TEST): Copy e into float[4]
array to avoid violating TBAA.
* gcc.target/powerpc/sse2-andpd-1.c (TEST): Copy e.d into double[2]
array to avoid violating TBAA.
* gcc.target/powerpc/sse-andps-1.c (TEST): Copy e.f into float[4]
array to avoid violating TBAA.
* gcc.target/powerpc/sse2-andnpd-1.c (TEST): Copy e into double[2]
array to avoid violating TBAA.

3 years agoFix PR ada/98228
Eric Botcazou [Tue, 26 Jan 2021 17:54:26 +0000 (18:54 +0100)]
Fix PR ada/98228

This is the profiled bootstrap failure for s390x/Linux on the mainline,
which has been introduced by the modref pass but actually exposing an
existing issue in the maybe_pad_type function that is visible on s390x.

The issue is too weak a test for the addressability of the inner component.

gcc/ada/
    Marius Hillenbrand  <mhillen@linux.ibm.com>

PR ada/98228
* gcc-interface/utils.c (maybe_pad_type): Test the size of the new
packable type instead of its alignment for addressability's sake.

3 years agodwarf2asm: Fix bootstrap on powerpc*-*-* [PR98839]
Jakub Jelinek [Tue, 26 Jan 2021 17:13:07 +0000 (18:13 +0100)]
dwarf2asm: Fix bootstrap on powerpc*-*-* [PR98839]

My recent dwarf2asm.c patch broke powerpc*-*-* bootstrap, while most target
define POINTER_SIZE to (cond ? cst1 : cst2) or constant, rs6000 defines
it to a variable, and the arbitrarily chosen type of that variable determines
whether we get warnings on comparison of that against signed or unsigned
ints.

Fixed by adding a cast.

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

PR bootstrap/98839
* dwarf2asm.c (dw2_assemble_integer): Cast DWARF2_ADDR_SIZE to int
in comparison.

3 years agoaarch64: Tighten up checks for ubfix [PR98681]
Jakub Jelinek [Tue, 26 Jan 2021 13:48:26 +0000 (14:48 +0100)]
aarch64: Tighten up checks for ubfix [PR98681]

The testcase in the patch doesn't assemble, because the instruction requires
that the penultimate operand (lsb) range is [0, 32] (or [0, 64]) and the last
operand's range is [1, 32 - lsb] (or [1, 64 - lsb]).
The INTVAL (shft_amnt) < GET_MODE_BITSIZE (mode) will accept the lsb operand
to be in range [MIN, 32] (or [MIN, 64]) and then we invoke UB in the
compiler and sometimes it will make it through.
The patch changes all the INTVAL uses in that function to UINTVAL,
which isn't strictly necessary, but can be done (e.g. after the
UINTVAL (shft_amnt) < GET_MODE_BITSIZE (mode) check we know it is not
negative and thus INTVAL (shft_amnt) and UINTVAL (shft_amnt) then behave the
same.  But, I had to add INTVAL (mask) > 0 check in that case, otherwise we
risk (hypothetically) emitting instruction that doesn't assemble.
The problem is with masks that have the MSB bit set, while the instruction
can handle those, e.g.
ubfiz w1, w0, 13, 19
will do
(w0 << 13) & 0xffffe000
in RTL we represent SImode constants with MSB set as negative HOST_WIDE_INT,
so it will actually be HOST_WIDE_INT_C (0xffffffffffffe000), and
the instruction uses %P3 to print the last operand, which calls
asm_fprintf (f, "%u", popcount_hwi (INTVAL (x)))
to print that.  But that will not print 19, but 51 instead, will include
there also all the copies of the sign bit.
Not supporting those masks with MSB set isn't a big loss though, they really
shouldn't appear normally, as both GIMPLE and RTL optimizations should
optimize those away (one isn't masking any bits off with such masks, so
just w0 << 13 will do too).

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

PR target/98681
* config/aarch64/aarch64.c (aarch64_mask_and_shift_for_ubfiz_p):
Use UINTVAL (shft_amnt) and UINTVAL (mask) instead of INTVAL (shft_amnt)
and INTVAL (mask).  Add && INTVAL (mask) > 0 condition.

* gcc.c-torture/execute/pr98681.c: New test.

3 years agoFix dumping of VEC_WIDEN_{PLUS,MINUS}_{LO,HI}_EXPR
Richard Biener [Tue, 26 Jan 2021 12:51:50 +0000 (13:51 +0100)]
Fix dumping of VEC_WIDEN_{PLUS,MINUS}_{LO,HI}_EXPR

This avoids dumping them as <<< ??? >>>.

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

* gimple-pretty-print.c (dump_binary_rhs): Handle
VEC_WIDEN_{PLUS,MINUS}_{LO,HI}_EXPR.

3 years agomiddle-end/98726 - fix VECTOR_CST element access
Richard Biener [Tue, 26 Jan 2021 12:32:27 +0000 (13:32 +0100)]
middle-end/98726 - fix VECTOR_CST element access

This fixes VECTOR_CST element access with POLY_INT elements and
allows to produce dump files of the PR98726 testcase without
ICEing.

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

PR middle-end/98726
* tree.h (vector_cst_int_elt): Remove.
* tree.c (vector_cst_int_elt): Use poly_wide_int for computations,
make static.

3 years agoliblsan: build missing lsan_posix.cpp file
Martin Liska [Tue, 26 Jan 2021 13:11:39 +0000 (14:11 +0100)]
liblsan: build missing lsan_posix.cpp file

libsanitizer/ChangeLog:

PR sanitizer/98828
* lsan/Makefile.am: Add missing lsan_posix.cpp file.
* lsan/Makefile.in: Likewise.

3 years agolibgcov: improve profile reproducibility
Martin Liska [Tue, 26 Jan 2021 11:44:34 +0000 (12:44 +0100)]
libgcov: improve profile reproducibility

libgcc/ChangeLog:

PR gcov-profile/98739
* libgcov.h (gcov_topn_add_value): Do not train when
we have a merged profile with a negative number of total
value.

3 years agoCommit test case for PR 67539.
Thomas Koenig [Tue, 26 Jan 2021 11:26:54 +0000 (12:26 +0100)]
Commit test case for PR 67539.

gcc/testsuite/ChangeLog:

PR fortran/67539
* gfortran.dg/elemental_assignment_1.f90: New test.

3 years agotestsuite/g++.dg/modules/modules.exp: Janitorial fixes
Tobias Burnus [Tue, 26 Jan 2021 10:46:01 +0000 (11:46 +0100)]
testsuite/g++.dg/modules/modules.exp: Janitorial fixes

gcc/testsuite/ChangeLog:

* g++.dg/modules/modules.exp: Remove unused CXX_MODULE_PATH;
add previously missing space in '$ident link'.

3 years agoamdgcn: Allow V64DFmode min/max reductions
Andrew Stubbs [Mon, 9 Nov 2020 17:42:34 +0000 (17:42 +0000)]
amdgcn: Allow V64DFmode min/max reductions

I don't know why these were disabled. There're no direct min/max DPP
instructions for this mode, but the "use moves" strategy works fine.

gcc/ChangeLog:

* config/gcn/gcn.c (gcn_expand_reduc_scalar): Use move instructions
for V64DFmode min/max reductions.

3 years agod: Merge upstream dmd 609c3ce2d, phobos 3dd5df686
Iain Buclaw [Mon, 25 Jan 2021 12:50:55 +0000 (13:50 +0100)]
d: Merge upstream dmd 609c3ce2d, phobos 3dd5df686

D front-end changes:

 - Contracts for pre- and postconditions are now implicitly "this"
   const, so that state can no longer be altered in these functions.

 - Inside a constructor scope, assigning to aggregate declaration
   members is done by considering the first assignment as initialization
   and subsequent assignments as modifications of the constructed
   object.  For const/immutable fields the initialization is accepted in
   the constructor but subsequent modifications are not.  However this
   rule did not apply when inside a constructor scope there is a call to
   a different constructor.  This been changed so it is now an error
   when there's a double initialization of immutable fields inside a
   constructor.

Phobos changes:

 - Don't run unit-tests for unsupported clocks in std.datetime.  The
   phobos and phobos_shared tests now add -fversion=Linux_Pre_2639 if
   required.

 - Deprecate public extern(C) bindings for getline and getdelim in
   std.stdio.  The correct module for bindings is core.sys.posix.stdio.

Reviewed-on: https://github.com/dlang/dmd/pull/12153
     https://github.com/dlang/phobos/pull/7768

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 609c3ce2d.
* d-compiler.cc (Compiler::loadModule): Rename to ...
(Compiler::onParseModule): ... this.
(Compiler::onImport): New function.
* d-lang.cc (d_parse_file): Remove call to Compiler::loadModule.

libphobos/ChangeLog:

* src/MERGE: Merge upstream phobos 3dd5df686.
* testsuite/libphobos.phobos/phobos.exp: Add compiler flag
-fversion=Linux_Pre_2639 if target is linux_pre_2639.
* testsuite/libphobos.phobos_shared/phobos_shared.exp: Likewise.

3 years agotestsuite: Fix up pr98807.c on i686-linux [PR98807]
Jakub Jelinek [Tue, 26 Jan 2021 08:33:04 +0000 (09:33 +0100)]
testsuite: Fix up pr98807.c on i686-linux [PR98807]

The new testcase FAILs on i686-linux with:
gcc/testsuite/gcc.dg/pr98807.c: In function 'foo0':
gcc/testsuite/gcc.dg/pr98807.c:20:1: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
gcc/testsuite/gcc.dg/pr98807.c:19:1: note: the ABI for passing parameters with 16-byte alignment has changed in GCC 4.6
gcc/testsuite/gcc.dg/pr98807.c:19:1: warning: SSE vector argument without SSE enabled changes the ABI [-Wpsabi]
FAIL: gcc.dg/pr98807.c (test for excess errors)

Adding usual testcase treatment for such cases.

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

PR middle-end/98807
* gcc.dg/pr98807.c: Add -Wno-psabi -w to dg-options.

3 years agodwarf2asm: Fix up -gdwarf-64 for 32-bit targets
Jakub Jelinek [Tue, 26 Jan 2021 08:20:23 +0000 (09:20 +0100)]
dwarf2asm: Fix up -gdwarf-64 for 32-bit targets

For the 32-bit targets the limitations of the object
file format (e.g. 32-bit ELF) will not allow > 2GiB debug info anyway,
and as I've just tested, e.g. on x86_64 with -m32 -gdwarf64 will not work
even on tiny testcases:
as: pr64716.o: unsupported relocation type: 0x1
pr64716.s: Assembler messages:
pr64716.s:6013: Error: cannot represent relocation type BFD_RELOC_64
as: pr64716.o: unsupported relocation type: 0x1
pr64716.s:6015: Error: cannot represent relocation type BFD_RELOC_64
as: pr64716.o: unsupported relocation type: 0x1
pr64716.s:6017: Error: cannot represent relocation type BFD_RELOC_64
So yes, we can either do a sorry, error, or could just avoid 64-bit
relocations (depending on endianity instead of emitting
.quad expression_that_needs_relocation
emit
.long expression_that_needs_relocation, 0
or
.long 0, expression_that_needs_relocation

This patch implements that last option, dunno if we need also configure tests
for that or not, maybe some 32-bit targets use 64-bit ELF and can handle such
relocations.

> 64bit relocs are not required here?  That is, can one with
> dwarf64 choose 32bit forms for select offsets (like could
> dwz exploit this?)?

I guess it depends on whether for 32-bit target and -gdwarf64, when
calling dw2_assemble_integer with non-CONST_INT argument we only
need positive values or might need negative ones too.
Because positive ones can be easily emulated through that
.long expression, 0
or
.long 0, expression
depending on endianity, but I'm afraid there is no way to emit
0 or -1 depending on the sign of expression, when it needs relocations.
Looking through dw2_asm_output_delta calls, at least the vast majority
of the calls seem to guarantee being positive, not 100% sure about
one case in .debug_line views, but I'd hope it is ok too.
In most cases, the deltas are between two labels where the first one
in the arguments is later in the same section than the other one,
or where the second argument is the start of a section or another section
base.

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

* dwarf2asm.c (dw2_assemble_integer): Handle size twice as large
as DWARF2_ADDR_SIZE if x is not a scalar int by emitting it as
two halves, one with x and the other with const0_rtx, ordered
depending on endianity.

3 years agoskip asan-poisoning of discarded vars
Alexandre Oliva [Tue, 26 Jan 2021 00:45:58 +0000 (21:45 -0300)]
skip asan-poisoning of discarded vars

GNAT may create temporaries to hold return values of function calls.
If such a temporary is created as part of a dynamic initializer of a
variable in a unit other than the one being compiled, the initializer
is dropped, including the temporary and its binding block.

Don't issue asan mark calls for such variables, they are gone.

for  gcc/ChangeLog

* gimplify.c (gimplify_decl_expr): Skip asan marking calls for
temporaries not seen in binding block, and not about to be
added as gimple variables.

for  gcc/testsuite/ChangeLog

* gnat.dg/asan1.adb: New test.
* gnat.dg/asan1_pkg.ads: New additional source.

3 years agoDaily bump.
GCC Administrator [Tue, 26 Jan 2021 00:16:34 +0000 (00:16 +0000)]
Daily bump.

3 years agoPR fortran/70070 - ICE on initializing character data beyond min/max bound
Harald Anlauf [Mon, 25 Jan 2021 20:33:53 +0000 (21:33 +0100)]
PR fortran/70070 - ICE on initializing character data beyond min/max bound

Check for initialization of substrings beyond bounds in DATA statements.

gcc/fortran/ChangeLog:

PR fortran/70070
* data.c (create_character_initializer): Check substring indices
against bounds.
(gfc_assign_data_value): Catch error returned from
create_character_initializer.

gcc/testsuite/ChangeLog:

PR fortran/70070
* gfortran.dg/pr70070.f90: New test.

3 years agoPR c++/98646 - spurious -Wnonnull calling a member on the result of static_cast
Martin Sebor [Mon, 25 Jan 2021 19:41:28 +0000 (12:41 -0700)]
PR c++/98646 - spurious -Wnonnull calling a member on the result of static_cast

gcc/c-family/ChangeLog:

PR c++/98646
* c-common.c (check_nonnull_arg): Adjust warning text.

gcc/cp/ChangeLog:

PR c++/98646
* cvt.c (cp_fold_convert): Propagate TREE_NO_WARNING.

gcc/ChangeLog:

PR c++/98646
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Adjust warning text.

gcc/testsuite/ChangeLog:

PR c++/98646
* g++.dg/warn/Wnonnull5.C: Adjust text of an expected warning.
* g++.dg/warn/Wnonnull10.C: New test.
* g++.dg/warn/Wnonnull9.C: New test.

3 years agoCommit test case for PR 96386.
Thomas Koenig [Mon, 25 Jan 2021 19:27:15 +0000 (20:27 +0100)]
Commit test case for PR 96386.

gcc/testsuite/ChangeLog:

* gfortran.dg/associate_57.f90: New test.

3 years agoAdd test case for PR 96843.
Thomas Koenig [Mon, 25 Jan 2021 19:18:14 +0000 (20:18 +0100)]
Add test case for PR 96843.

gcc/testsuite/ChangeLog:

PR fortran/96843
* gfortran.dg/interface_assignment_7.f90: New test.

3 years agolibgomp: Add documentation for omp_fulfill_event runtime function
Kwok Cheung Yeung [Mon, 25 Jan 2021 17:57:38 +0000 (09:57 -0800)]
libgomp: Add documentation for omp_fulfill_event runtime function

2021-01-25  Kwok Cheung Yeung  <kcy@codesourcery.com>

libgomp/
* libgomp.texi (omp_fulfill_event): New entry.

3 years agoFix wrong format for fprintf.
Martin Liska [Mon, 25 Jan 2021 16:48:32 +0000 (17:48 +0100)]
Fix wrong format for fprintf.

gcc/ChangeLog:

* value-prof.c (get_nth_most_common_value): Use %s instead
of %qs string.

3 years agoc++: [[no_unique_address]] in empty base [PR98463]
Jason Merrill [Fri, 22 Jan 2021 18:17:10 +0000 (13:17 -0500)]
c++: [[no_unique_address]] in empty base [PR98463]

In this testcase, cxx_eval_store_expression got confused trying to build up
CONSTRUCTORs for initializing a subobject because the subobject is a member
of an empty base.  In C++14 mode and below we don't build FIELD_DECLs for
empty bases, so the CONSTRUCTOR skipped the empty base, and treated the
member as a member of the derived class, which breaks.

Fixed by recognizing this situation and giving up on trying to build a
CONSTRUCTOR for the inner target at that point; since it doesn't have any
data, we don't need to actually store anything.

gcc/cp/ChangeLog:

PR c++/98463
* constexpr.c (get_or_insert_ctor_field): Add check.
(cxx_eval_store_expression): Handle discontinuity of refs.

gcc/testsuite/ChangeLog:

PR c++/98463
* g++.dg/cpp2a/no_unique_address8.C: New test.

3 years agogcc/fortran/intrinsic.texi: Fix typos
Tobias Burnus [Mon, 25 Jan 2021 13:40:33 +0000 (14:40 +0100)]
gcc/fortran/intrinsic.texi: Fix typos

gcc/fortran/ChangeLog:

* intrinsic.texi (CO_BROADCAST, CO_MIN, CO_REDUCE, CO_SUM): Fix typos.

3 years agoconfigure: Add workaround for buggy binutils 2.35 [PR98811]
Jakub Jelinek [Mon, 25 Jan 2021 13:20:05 +0000 (14:20 +0100)]
configure: Add workaround for buggy binutils 2.35 [PR98811]

binutils since https://sourceware.org/bugzilla/show_bug.cgi?id=25612
changes from March last year until the
https://sourceware.org/pipermail/binutils/2020-August/112684.html
fix in early August emits incorrect .debug_info when assembling files
with --gdwarf-5.  Instead of emitting proper DWARF 5 .debug_info header,
it emits DWARF 4 .debug_info header with 5 as the dwarf version instead of
4.  This results e.g. in libgcc.a (morestack.o) having garbage in its
.debug_info sections and e.g. libbacktrace during pretty much all libgo
tests fails miserably.

The following patch adds a workaround for that, don't set
HAVE_AS_GDWARF_5_DEBUG_FLAG if readelf can't read the .debug_info back.

Built tested on x86_64-linux against both binutils 2.35 (buggy ones) and
latest binutils trunk, the former with the patch now has DWARF 3
.debug_line and DWARF 2 .debug_info in morestack.o, while the latter
as before correct DWARF 5 .debug_line and .debug_info.

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

PR debug/98811
* configure.ac (HAVE_AS_GDWARF_5_DEBUG_FLAG): Only define if
readelf -wi is able to read the emitted .debug_info back.
* configure: Regenerated.

3 years agoEnable -fprofile-reproducible=parallel-runs for profiledbootstrap.
Martin Liska [Fri, 22 Jan 2021 14:36:11 +0000 (15:36 +0100)]
Enable -fprofile-reproducible=parallel-runs for profiledbootstrap.

ChangeLog:

PR gcov-profile/98739
* Makefile.in: Enable -fprofile-reproducible=parallel-runs
for profiledbootstrap.

3 years agoRestore profile reproducibility.
Martin Liska [Fri, 22 Jan 2021 10:27:16 +0000 (11:27 +0100)]
Restore profile reproducibility.

gcc/ChangeLog:

PR gcov-profile/98739
* common.opt: Add missing sign symbol.
* value-prof.c (get_nth_most_common_value): Restore handling
of PROFILE_REPRODUCIBILITY_PARALLEL_RUNS and
PROFILE_REPRODUCIBILITY_MULTITHREADED.

libgcc/ChangeLog:

PR gcov-profile/98739
* libgcov-merge.c (__gcov_merge_topn): Mark when merging
ends with a dropped counter.
* libgcov.h (gcov_topn_add_value): Add return value.

3 years agomiddle-end/98807 - more vector_element_bits fixes
Richard Biener [Mon, 25 Jan 2021 10:22:28 +0000 (11:22 +0100)]
middle-end/98807 - more vector_element_bits fixes

This simplifies vector_element_bits further, avoiding any mode
dependence and instead relying on boolean vector construction
to populate element precision accordingly.

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

PR middle-end/98807
* tree.c (vector_element_bits): Always use precision of
the element type for boolean vectors.

* gcc.dg/pr98807.c: New testcase.

3 years agoRTEMS: Fix default linker script
Sebastian Huber [Mon, 25 Jan 2021 11:29:05 +0000 (12:29 +0100)]
RTEMS: Fix default linker script

We have to use ENDFILE_SPEC for the default linker script and not
STARTFILE_SPEC, since STARTFILE_SPEC is place before the user provided
library search paths.

gcc/

* config/rtems.h (STARTFILE_SPEC): Remove qnolinkcmds.
(ENDFILE_SPEC): Evaluate qnolinkcmds.

3 years agoFix internal error on extension with interface at -O2
Eric Botcazou [Mon, 25 Jan 2021 10:27:29 +0000 (11:27 +0100)]
Fix internal error on extension with interface at -O2

This is a regression present on the mainline, 10 and 9 branches, in the
form of an internal error with the Ada compiler when a covariant-only
thunk is inlined into its caller.

gcc/ada/
* gcc-interface/trans.c (make_covariant_thunk): Set the DECL_CONTEXT
of the parameters and do not set TREE_PUBLIC on the thunk.
(maybe_make_gnu_thunk): Pass the alias to the covariant thunk.
* gcc-interface/utils.c (finish_subprog_decl): Set the DECL_CONTEXT
of the parameters here...
(begin_subprog_body): ...instead of here.

gcc/testsuite/
* gnat.dg/thunk2.adb, gnat.dg/thunk2.ads: New test.
* gnat.dg/thunk2_pkg.ads: New helper.

3 years agoFortran: Fix deferred character lengths in array constructors [PR98517].
Paul Thomas [Mon, 25 Jan 2021 10:27:51 +0000 (10:27 +0000)]
Fortran: Fix deferred character lengths in array constructors [PR98517].

2021-01-25  Steve Kargl  <kargl@gcc.gnu.org>

gcc/fortran
PR fortran/98517
* resolve.c (resolve_charlen): Check that length expression is
present before testing for scalar/integer..

gcc/testsuite/
PR fortran/98517
* gfortran.dg/charlen_18.f90 : New test.

3 years agoRTEMS: Fix GCC specification
Sebastian Huber [Fri, 22 Jan 2021 11:45:49 +0000 (12:45 +0100)]
RTEMS: Fix GCC specification

The use of -nostdlib and -nodefaultlibs disables the processing of
LIB_SPEC (%L) as specified by LINK_COMMAND_SPEC and thus disables the
default linker script for RTEMS.  Move the linker script to
STARTFILE_SPEC which is controlled by -nostdlib and -nostartfiles.  This
fits better since the linker script defines the platform start file
provided by the board support package in RTEMS.

gcc/

* config/rtems.h (STARTFILE_SPEC): Remove nostdlib and
nostartfiles handling since this is already done by
LINK_COMMAND_SPEC.  Evaluate qnolinkcmds.
(ENDFILE_SPEC): Remove nostdlib and nostartfiles handling since this
is already done by LINK_COMMAND_SPEC.
(LIB_SPECS): Remove nostdlib and nodefaultlibs handling since
this is already done by LINK_COMMAND_SPEC.  Remove qnolinkcmds
evaluation.

3 years agofold: Fix up strn{case,}cmp folding [PR98771]
Jakub Jelinek [Mon, 25 Jan 2021 09:03:40 +0000 (10:03 +0100)]
fold: Fix up strn{case,}cmp folding [PR98771]

As mentioned in the PR, the compiler behaves differently during strncmp
and strncasecmp folding between 32-bit and 64-bit hosts targeting 64-bit
target.  I think that is highly undesirable.

The culprit is the host_size_t_cst_p predicate that is used by
fold_const_call, which punts if the target size_t constants don't fit into
host size_t.  This patch gets rid of that behavior, instead it punts the
same when it doesn't fit into uhwi.

The predicate was used for strncmp and strncasecmp folding and for bcmp, memcmp and
memchr folding.
The constant is in all cases compared to 0, we can do that whether it fits
into size_t or unsigned HOST_WIDE_INT, then it is used in s2 <= s0 or
s2 <= s1 comparisons where s0 and s1 already have uhwi type and represent
the sizes of the objects.
The important difference is for strn{,case}cmp folding, we pass that s2
value as the last argument to the host functions comparing the c_getstr
results.  If s2 fits into size_t, then my patch makes no difference,
but if it is larger, we know the 2 c_getstr objects need to fit into the
host address space, so larger s2 should just act essentially as strcmp
or strcasecmp; as none of those objects can occupy 100% of the address
space, using MIN (SIZE_MAX, s2) achieves that.

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

PR testsuite/98771
* fold-const-call.c (host_size_t_cst_p): Renamed to ...
(size_t_cst_p): ... this.  Check and store unsigned HOST_WIDE_INT
value rather than host size_t.
(fold_const_call): Change type of s2 from size_t to
unsigned HOST_WIDE_INT.  Use size_t_cst_p instead of
host_size_t_cst_p.  For strncmp calls, pass MIN (s2, SIZE_MAX)
instead of s2 as last argument.

3 years agoArm: Add NEON and MVE complex mul, mla and mls patterns.
Tamar Christina [Mon, 25 Jan 2021 08:56:37 +0000 (08:56 +0000)]
Arm: Add NEON and MVE complex mul, mla and mls patterns.

This adds implementation for the optabs for complex operations.  With this the
following C code:

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

generates

NEON:

g:
        vmov.f32        q11, #0.0  @ v4sf
        add     r3, r2, #1600
.L2:
        vmov    q8, q11  @ v4sf
        vld1.32 {q10}, [r1]!
        vld1.32 {q9}, [r0]!
        vcmla.f32       q8, q9, q10, #0
        vcmla.f32       q8, q9, q10, #90
        vst1.32 {q8}, [r2]!
        cmp     r3, r2
        bne     .L2
        bx      lr

MVE:

g:
        push    {lr}
        mov     lr, #100
        dls     lr, lr
.L2:
        vldrw.32        q1, [r1], #16
        vldrw.32        q2, [r0], #16
        vcmul.f32       q3, q2, q1, #0
        vcmla.f32       q3, q2, q1, #90
        vstrw.32        q3, [r2], #16
        le      lr, .L2
        ldr     pc, [sp], #4

instead of

g:
        add     r3, r2, #1600
.L2:
        vld2.32 {d20-d23}, [r0]!
        vld2.32 {d16-d19}, [r1]!
        vmul.f32        q14, q11, q9
        vmul.f32        q15, q11, q8
        vneg.f32        q14, q14
        vfma.f32        q15, q10, q9
        vfma.f32        q14, q10, q8
        vmov    q13, q15  @ v4sf
        vmov    q12, q14  @ v4sf
        vst2.32 {d24-d27}, [r2]!
        cmp     r3, r2
        bne     .L2
        bx      lr

and

g:
        add     r3, r2, #1600
.L2:
        vld2.32 {d20-d23}, [r0]!
        vld2.32 {d16-d19}, [r1]!
        vmul.f32        q15, q10, q8
        vmul.f32        q14, q10, q9
        vmls.f32        q15, q11, q9
        vmla.f32        q14, q11, q8
        vmov    q12, q15  @ v4sf
        vmov    q13, q14  @ v4sf
        vst2.32 {d24-d27}, [r2]!
        cmp     r3, r2
        bne     .L2
        bx      lr

respectively.

gcc/ChangeLog:

* config/arm/iterators.md (rotsplit1, rotsplit2, conj_op, fcmac1,
VCMLA_OP, VCMUL_OP): New.
* config/arm/mve.md (mve_vcmlaq<mve_rot><mode>): Support vec_dup 0.
* config/arm/neon.md (cmul<conj_op><mode>3): New.
* config/arm/unspecs.md (UNSPEC_VCMLA_CONJ, UNSPEC_VCMLA180_CONJ,
UNSPEC_VCMUL_CONJ): New.
* config/arm/vec-common.md (cmul<conj_op><mode>3, arm_vcmla<rot><mode>,
cml<fcmac1><conj_op><mode>4): New.

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

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

3 years agolibphobos: Fix executables segfault on mipsel architecture
Iain Buclaw [Sat, 23 Jan 2021 23:20:25 +0000 (00:20 +0100)]
libphobos: Fix executables segfault on mipsel architecture

The dynamic section on MIPS is read-only, but this was not properly
handled in the runtime library.  The segfault only occurred for programs
that linked to the shared libphobos library.

libphobos/ChangeLog:

PR d/98806
* libdruntime/gcc/sections/elf_shared.d (MIPS_Any): Declare version
for MIPS32 and MIPS64.
(getDependencies): Adjust dlpi_addr on MIPS_Any.

3 years agoc++: private inheritance access diagnostics fix [PR17314]
Anthony Sharp [Fri, 22 Jan 2021 22:36:06 +0000 (22:36 +0000)]
c++: private inheritance access diagnostics fix [PR17314]

This patch fixes PR17314. Previously, when class C attempted
to access member a declared in class A through class B, where class B
privately inherits from A and class C inherits from B, GCC would correctly
report an access violation, but would erroneously report that the reason was
because a was "protected", when in fact, from the point of view of class C,
it was really "private". This patch updates the diagnostics code to generate
more correct errors in cases of failed inheritance such as these.

The reason this bug happened was because GCC was examining the
declared access of decl, instead of looking at it in the
context of class inheritance.

gcc/cp/ChangeLog:

2021-01-21  Anthony Sharp  <anthonysharp15@gmail.com>

* call.c (complain_about_access): Altered function.
* cp-tree.h (complain_about_access): Changed parameters of function.
(get_parent_with_private_access): Declared new function.
* search.c (get_parent_with_private_access): Defined new function.
* semantics.c (enforce_access): Modified function.
* typeck.c (complain_about_unrecognized_member): Updated function
arguments in complain_about_access.

gcc/testsuite/ChangeLog:

2021-01-21  Anthony Sharp  <anthonysharp15@gmail.com>

* g++.dg/lookup/scoped1.C: Modified testcase to run successfully
with changes.
* g++.dg/tc1/dr142.C: Same as above.
* g++.dg/tc1/dr52.C: Same as above.
* g++.old-deja/g++.brendan/visibility6.C: Same as above.
* g++.old-deja/g++.brendan/visibility8.C: Same as above.
* g++.old-deja/g++.jason/access8.C: Same as above.
* g++.old-deja/g++.law/access4.C: Same as above.
* g++.old-deja/g++.law/visibility12.C: Same as above.
* g++.old-deja/g++.law/visibility4.C: Same as above.
* g++.old-deja/g++.law/visibility8.C: Same as above.
* g++.old-deja/g++.other/access4.C: Same as above.

3 years agors6000: Fix up __m64 typedef in mmintrin.h [PR97301]
Jakub Jelinek [Sat, 23 Jan 2021 08:41:58 +0000 (09:41 +0100)]
rs6000: Fix up __m64 typedef in mmintrin.h [PR97301]

The x86 __m64 type is defined as:
/* The Intel API is flexible enough that we must allow aliasing with other
   vector types, and their scalar components.  */
typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
and so matches the comment above it in that reads and stores through
pointers to __m64 can alias anything.
But in the rs6000 headers that is the case only for __m128, but not __m64.

The following patch adds that attribute, which fixes the
FAIL: gcc.target/powerpc/sse-movhps-1.c execution test
FAIL: gcc.target/powerpc/sse-movlps-1.c execution test
regressions that appeared when Honza improved ipa-modref.

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

PR testsuite/97301
* config/rs6000/mmintrin.h (__m64): Add __may_alias__ attribute.

3 years agoc++: 'this' injection and static member functions [PR97399]
Patrick Palka [Sat, 23 Jan 2021 05:24:17 +0000 (00:24 -0500)]
c++: 'this' injection and static member functions [PR97399]

In the testcase pr97399.C below, finish_qualified_id_expr at parse time
adds an implicit 'this->' to the expression tmp::integral<T> (because
it's type-dependent, and also current_class_ptr is set at this point)
within the trailing return type.  Later when substituting into this
trailing return type we crash because we can't resolve the 'this', since
tsubst_function_type does inject_this_parm only for non-static member
functions, which tmp::func is not.

This patch fixes this issue by removing the type-dependence check
in finish_qualified_id_expr added by r9-5972, and instead relaxes
shared_member_p to handle dependent USING_DECLs:

> I think I was wrong in my assertion around Alex's patch that
> shared_member_p should abort on a dependent USING_DECL; it now seems
> appropriate for it to return false if we don't know, we just need to
> adjust the comment to say that.

And when parsing a friend function declaration, we shouldn't be setting
current_class_ptr at all, so this patch additionally suppresses
inject_this_parm in this case.

Finally, the self-contained change to cp_parser_init_declarator is so
that we properly communicate static-ness to cp_parser_direct_declarator
when parsing a member function template.  This lets us reject the
explicit use of 'this' in the testcase this2.C below.

gcc/cp/ChangeLog:

PR c++/97399
* cp-tree.h (shared_member_p): Adjust declaration.
* parser.c (cp_parser_init_declarator): If the storage class
specifier is sc_static, pass true for static_p to
cp_parser_declarator.
(cp_parser_direct_declarator): Don't do inject_this_parm when
the declarator is a friend.
* search.c (shared_member_p): Change return type to bool and
adjust function body accordingly.  Return false for a dependent
USING_DECL instead of aborting.
* semantics.c (finish_qualified_id_expr): Rely on shared_member_p
even when type-dependent.

gcc/testsuite/ChangeLog:

PR c++/88548
PR c++/97399
* g++.dg/cpp0x/this2.C: New test.
* g++.dg/template/pr97399.C: New test.

3 years agotestsuite: fix gcc.target/powerpc ilp32 failures
David Edelsohn [Sat, 23 Jan 2021 00:54:24 +0000 (19:54 -0500)]
testsuite: fix gcc.target/powerpc ilp32 failures

The recent vec insert code generation changes were not reflected in the
expected output for ilp32 targets.  This patch updates the expected
instructions and counts.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/fold-vec-insert-char-p9.c: Adjust ilp32.
* gcc.target/powerpc/fold-vec-insert-float-p9.c: Same.
* gcc.target/powerpc/fold-vec-insert-int-p9.c: Same.
* gcc.target/powerpc/fold-vec-insert-longlong.c: Same.
* gcc.target/powerpc/fold-vec-insert-short-p9.c: Same.
* gcc.target/powerpc/pr79251.p9.c: Same.

3 years agoDaily bump.
GCC Administrator [Sat, 23 Jan 2021 00:16:32 +0000 (00:16 +0000)]
Daily bump.

3 years agoaarch64: Use RTL builtins for integer mla intrinsics
Jonathan Wright [Thu, 14 Jan 2021 18:38:07 +0000 (18:38 +0000)]
aarch64: Use RTL builtins for integer mla intrinsics

Rewrite integer mla Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and optimization.

gcc/Changelog:

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

* config/aarch64/aarch64-simd-builtins.def: Add mla builtin
generator macro.
* config/aarch64/arm_neon.h (vmla_s8): Use RTL builtin rather
than asm.
(vmla_s16): Likewise.
(vmla_s32): Likewise.
(vmla_u8): Likewise.
(vmla_u16): Likewise.
(vmla_u32): Likewise.
(vmlaq_s8): Likewise.
(vmlaq_s16): Likewise.
(vmlaq_s32): Likewise.
(vmlaq_u8): Likewise.
(vmlaq_u16): Likewise.
(vmlaq_u32): Likewise.

3 years agoc++: ICE with noexcept in class in member function [PR96623]
Marek Polacek [Thu, 21 Jan 2021 21:12:28 +0000 (16:12 -0500)]
c++: ICE with noexcept in class in member function [PR96623]

I discovered very strange code in inject_parm_decls:

   if (args && is_this_parameter (args))
     {
       gcc_checking_assert (current_class_ptr == NULL_TREE);
       current_class_ptr = NULL_TREE;

We are tripping up on the assert because when we call inject_parm_decls,
current_class_ptr is set to 'A'.  It was set by inject_this_parameter
after we've parsed the parameter-declaration-clause of the member
function foo.  It seems correct to set ccp/ccr to A::B when we're
late parsing the noexcept-specifiers of bar* functions in B, so that
this-> does the right thing.  Since inject_parm_decls doesn't expect
to see non-null ccp/ccr, reset it before calling inject_parm_decls.

gcc/cp/ChangeLog:

PR c++/96623
* parser.c (inject_parm_decls): Remove a redundant assignment.
(cp_parser_class_specifier_1): Clear current_class_{ptr,ref}
before calling inject_parm_decls.

gcc/testsuite/ChangeLog:

PR c++/96623
* g++.dg/cpp0x/noexcept64.C: New test.

3 years agotestsuite: Enable spbp.C on AIX.
David Edelsohn [Fri, 22 Jan 2021 02:12:06 +0000 (21:12 -0500)]
testsuite: Enable spbp.C on AIX.

This testcase was disabled in the distant past when AIX did not have
support for DWARF and the testcase explicitly invokes DWARF debugging.
This patch re-enables the testcase.

gcc/testsuite/ChangeLog:

* g++.dg/eh/spbp.C: Remove skip on AIX.

3 years agodoc: ensure GCC_EXTRA_DIAGNOSTIC_OUTPUT gets an HTML anchor
David Malcolm [Fri, 22 Jan 2021 22:07:30 +0000 (17:07 -0500)]
doc: ensure GCC_EXTRA_DIAGNOSTIC_OUTPUT gets an HTML anchor

This is referenced by my recent release notes changes for GCC 11:
  https://gcc.gnu.org/pipermail/gcc-patches/2021-January/564164.html

gcc/ChangeLog:
* doc/invoke.texi (GCC_EXTRA_DIAGNOSTIC_OUTPUT): Add @findex
directive.

3 years agotestsuite: Fix a typo - UINON_TYPE to UNION_TYPE - in gcc.target/powerpc
Jakub Jelinek [Fri, 22 Jan 2021 21:55:44 +0000 (22:55 +0100)]
testsuite: Fix a typo - UINON_TYPE to UNION_TYPE - in gcc.target/powerpc

Spotted while fixing the rs6000 aliasing issue.

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

* gcc.target/powerpc/m128-check.h (CHECK_EXP, CHECK_FP_EXP): Fix a
typo, UINON_TYPE to UNION_TYPE.

3 years agotestsuite: Fix a typo - UINON_TYPE to UNION_TYPE - in gcc.target/i386
Jakub Jelinek [Fri, 22 Jan 2021 21:51:03 +0000 (22:51 +0100)]
testsuite: Fix a typo - UINON_TYPE to UNION_TYPE - in gcc.target/i386

Spotted while fixing the rs6000 aliasing issue.

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

* gcc.target/i386/m128-check.h (CHECK_EXP, CHECK_FP_EXP): Fix a typo,
UINON_TYPE to UNION_TYPE.
* gcc.target/i386/m256-check.h (CHECK_FP_EXP): Likewise.
* gcc.target/i386/m512-check.h (CHECK_ROUGH_EXP): Likewise.

3 years agotestsuite: Fix sse2-andnpd-1.c and sse-andnps-1.c testscases on powerpc
Jakub Jelinek [Fri, 22 Jan 2021 21:38:31 +0000 (22:38 +0100)]
testsuite: Fix sse2-andnpd-1.c and sse-andnps-1.c testscases on powerpc

On Mon, Sep 21, 2020 at 10:12:20AM +0200, Richard Biener wrote:
> On Mon, 21 Sep 2020, Jan Hubicka wrote:
> > these testcases now fails because they contains an invalid type puning
> > that happens via const VALUE_TYPE *v pointer. Since the check function
> > is noinline, modref is needed to trigger the wrong code.
> > I think it is easiest to fix it by no-strict-aliasing.
> >
> > Regtested x86_64-linux, OK?
>
> OK.
>
> >     * gcc.target/i386/m128-check.h: Add no-strict aliasing to
> >     CHECK_EXP macro.
> >
> > diff --git a/gcc/testsuite/gcc.target/i386/m128-check.h b/gcc/testsuite/gcc.target/i386/m128-check.h
> > index 48b23328539..6f414b07be7 100644
> > --- a/gcc/testsuite/gcc.target/i386/m128-check.h
> > +++ b/gcc/testsuite/gcc.target/i386/m128-check.h
> > @@ -78,6 +78,7 @@ typedef union
> >
> >  #define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT)             \
> >  static int                                         \
> > +__attribute__((optimize ("no-strict-aliasing")))   \
> >  __attribute__((noinline, unused))                  \
> >  check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v)     \
> >  {                                                  \

On powerpc64le the tests suffer from the exact same issue.

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

* gcc.target/powerpc/m128-check.h (check_##UINON_TYPE): Add
optimize ("no-strict-aliasing") attribute.

3 years agodwarf2out: Always emit required 0 entries for DWARF 5 in *.debug_line [PR98796]
Jakub Jelinek [Fri, 22 Jan 2021 21:37:36 +0000 (22:37 +0100)]
dwarf2out: Always emit required 0 entries for DWARF 5 in *.debug_line [PR98796]

When GCC is emitting .debug_line or .gnu.debuglto_.debug_line section by
itself (happens either with too old or non-GNU assembler, with
-gno-as-loc-support or with -flto) on empty translation units, it violates
the DWARF 5 requirements.
The standard says:
"The first entry is the current directory of the compilation."
and a few lines later:
"The first entry in the sequence is the primary source file whose file name
exactly matches that given in the DW_AT_name attribute in the compilation
unit debugging information entry."
GCC emits 4 zeros (directory entry format count, directories count,
filename entry format count and filename count), which would be ok if the
spec said The first entry may be rather than is.

I had a brief look at whether I could just fall through into the rest of the
function, but there are too many assumptions that there is at least one
normal file that it can't be done that way easily.

So this patch instead extends the early out code to emit the required
minimum, which is 15 bytes more than we used to emit before.

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

PR debug/98796
* dwarf2out.c (output_file_names): For -gdwarf-5, if there are no
filenames to emit, still emit the required 0 index directory and
filename entries that match DW_AT_comp_dir and DW_AT_name of the
compilation unit.

3 years agoMAINTAINERS: Add myself for write after approval
Jonathan Wright [Fri, 22 Jan 2021 19:09:11 +0000 (19:09 +0000)]
MAINTAINERS: Add myself for write after approval

ChangeLog:

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

* MAINTAINERS (Write After Approval): Add myself.

3 years agoc++: Fix base copy elision thinko [PR98744]
Jason Merrill [Fri, 22 Jan 2021 16:57:27 +0000 (11:57 -0500)]
c++: Fix base copy elision thinko [PR98744]

As Jakub points out in the PR, I was mixing up
DECL_HAS_IN_CHARGE_PARM_P (which is true for the abstract maybe-in-charge
constructor) and DECL_HAS_VTT_PARM_P (which is true for a base constructor
that needs to handle virtual bases).

gcc/cp/ChangeLog:

PR c++/98744
* call.c (make_base_init_ok): Use DECL_HAS_VTT_PARM_P.

gcc/testsuite/ChangeLog:

PR c++/98744
* g++.dg/init/elide7.C: New test.

3 years agoc++: Fix up ubsan false positives on references [PR95693]
Jakub Jelinek [Fri, 22 Jan 2021 18:03:23 +0000 (19:03 +0100)]
c++: Fix up ubsan false positives on references [PR95693]

Alex' 2 years old change to build_zero_init_1 to return NULL pointer with
reference type for references breaks the sanitizers, the assignment of NULL
to a reference typed member is then instrumented before it is overwritten
with a non-NULL address later on.
That change has been done to fix error recovery ICE during
process_init_constructor_record, where we:
          if (TYPE_REF_P (fldtype))
            {
              if (complain & tf_error)
                error ("member %qD is uninitialized reference", field);
              else
                return PICFLAG_ERRONEOUS;
            }
a few lines earlier, but then continue and ICE when build_zero_init returns
NULL.

The following patch reverts the build_zero_init_1 change and instead creates
the NULL with reference type constants during the error recovery.

The pr84593.C testcase Alex' change was fixing still works as before.

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

PR sanitizer/95693
* init.c (build_zero_init_1): Revert the 2018-03-06 change to
return build_zero_cst for reference types.
* typeck2.c (process_init_constructor_record): Instead call
build_zero_cst here during error recovery instead of build_zero_init.

* g++.dg/ubsan/pr95693.C: New test.

3 years agoc++: ICE when mangling operator name [PR98545]
Marek Polacek [Wed, 13 Jan 2021 21:33:39 +0000 (16:33 -0500)]
c++: ICE when mangling operator name [PR98545]

r11-6301 added some asserts in mangle.c, and now we trip over one of
them.  In particular, it's the one asserting that we didn't get
IDENTIFIER_ANY_OP_P when mangling an expression with a dependent name.

As this testcase shows, it's possible to get that, so turn the assert
into an if and write "on".  That changes the mangling in the following
way:

With this patch:

$ c++filt _ZN1i1hIJ1adS1_EEEDTcldtdefpTonclspcvT__EEEDpS2_
decltype (((*this).(operator()))((a)(), (double)(), (a)())) i::h<a, double, a>(a, double, a)

G++10:
$ c++filt _ZN1i1hIJ1adS1_EEEDTcldtdefpTclspcvT__EEEDpS2_
decltype (((*this).(operator()))((a)(), (double)(), (a)())) i::h<a, double, a>(a, double, a)

clang++/icc:
$ c++filt _ZN1i1hIJ1adS1_EEEDTclonclspcvT__EEEDpS2_
decltype ((operator())((a)(), (double)(), (a)())) i::h<a, double, a>(a, double, a)

This is now tracked in PR98756.

gcc/cp/ChangeLog:

PR c++/98545
* mangle.c (write_member_name): Emit abi_warn_or_compat_version_crosses
warnings regardless of abi_version_at_least.
(write_expression): When the expression is a dependent name
and an operator name, write "on" before writing its name.

gcc/ChangeLog:

PR c++/98545
* doc/invoke.texi: Update C++ ABI Version 15 description.

gcc/testsuite/ChangeLog:

PR c++/98545
* g++.dg/abi/mangle76.C: New test.

3 years agoFortran: Fix for class functions as associated target [PR98565].
Paul Thomas [Fri, 22 Jan 2021 17:11:06 +0000 (17:11 +0000)]
Fortran: Fix for class functions as associated target [PR98565].

2021-01-22  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/98565
* trans-intrinsic.c (gfc_conv_associated): Do not add a _data
component for scalar class function targets. Instead, fix the
function result and access the _data from that.

gcc/testsuite/
PR fortran/98565
* gfortran.dg/associated_target_7.f90 : New test.

3 years agoTestcase for old PR 47059
Martin Jambor [Fri, 22 Jan 2021 17:09:38 +0000 (18:09 +0100)]
Testcase for old PR 47059

I stumbled across PR 47059 from 2010 which has been addressed by
store-merging.  I am going to close it but would like to add its
testcase too.

gcc/testsuite/ChangeLog:

2021-01-08  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/47059
* gcc.dg/tree-ssa/pr47059.c: New test.

3 years agotree-ssa-mathopts: Use proper poly_int64 comparison with param_avoid_fma_max_bits...
Kyrylo Tkachov [Thu, 21 Jan 2021 16:33:49 +0000 (16:33 +0000)]
tree-ssa-mathopts: Use proper poly_int64 comparison with param_avoid_fma_max_bits [PR 98766]

We ICE here because we end up comparing a poly_int64 with a scalar using
<= rather than maybe_le.
This patch fixes that in the way rich suggests in the PR.

gcc/ChangeLog:

PR tree-optimization/98766
* tree-ssa-math-opts.c (convert_mult_to_fma): Use maybe_le when
comparing against type size with param_avoid_fma_max_bits.

gcc/testsuite/ChangeLog:

PR tree-optimization/98766
* gcc.dg/pr98766.c: New test.

3 years agotestsuite: Uniquify test names [PR 98795]
Nathan Sidwell [Fri, 22 Jan 2021 14:44:22 +0000 (06:44 -0800)]
testsuite: Uniquify test names [PR 98795]

Header unit names come from the path the preprocessor determines, and
thus can be absolute.  This tweaks the testsuite to elide that
absoluteness when embedded in a CMI name.  We were also not
distinguishing link and execute tests by the $std flags, so append
them when necessary.

PR testsuite/98795
gcc/testsuite/
* g++.dg/modules/modules.exp (module_cmi_p): Avoid
embedded absolute paths.
(module_do_it): Append $std to test name.

3 years agomiddle-end/98793 - properly handle BLKmode vectors in vector_element_bits
Richard Biener [Fri, 22 Jan 2021 13:32:39 +0000 (14:32 +0100)]
middle-end/98793 - properly handle BLKmode vectors in vector_element_bits

The previous change made AVX512 mask vectors correct but disregarded
the possibility of generic (BLKmode) boolean vectors which are exposed
by the frontends already.

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

PR middle-end/98793
* tree.c (vector_element_bits): Key single-bit bool vector on
integer mode rather than not vector mode.

* gcc.dg/pr98793.c: New testcase.

3 years agors6000: Enable vec_insert for P8 with rs6000_expand_vector_set_var_p8 [PR98093]
Xionghu Luo [Fri, 22 Jan 2021 03:03:28 +0000 (21:03 -0600)]
rs6000: Enable vec_insert for P8 with rs6000_expand_vector_set_var_p8 [PR98093]

Support P8 variable vec_insert and Update testcases' instruction count.

gcc/ChangeLog:

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

PR target/98093

* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
Generate ARRAY_REF(VIEW_CONVERT_EXPR) for P8 and later
platforms.
* config/rs6000/rs6000.c (rs6000_expand_vector_set_var): Update
to call different path for P8 and P9.
(rs6000_expand_vector_set_var_p9): New function.
(rs6000_expand_vector_set_var_p8): New function.

gcc/testsuite/ChangeLog:

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

* gcc.target/powerpc/pr79251.p8.c: New test.
* gcc.target/powerpc/fold-vec-insert-char-p8.c: Adjust
instruction counts.
* gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-double.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise.
* gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise.
* gcc.target/powerpc/vsx-builtin-7.c: Likewise.

3 years agors6000: Support variable insert and Expand vec_insert in expander [PR79251]
Xionghu Luo [Fri, 22 Jan 2021 03:01:24 +0000 (21:01 -0600)]
rs6000: Support variable insert and Expand vec_insert in expander [PR79251]

vec_insert accepts 3 arguments, arg0 is input vector, arg1 is the value
to be insert, arg2 is the place to insert arg1 to arg0.  Current expander
generates stxv+stwx+lxv if arg2 is variable instead of constant, which
causes serious store hit load performance issue on Power.  This patch tries
 1) Build VIEW_CONVERT_EXPR for vec_insert (i, v, n) like v[n&3] = i to
unify the gimple code, then expander could use vec_set_optab to expand.
 2) Expand the IFN VEC_SET to fast instructions: lvsr+insert+lvsl.
In this way, "vec_insert (i, v, n)" and "v[n&3] = i" won't be expanded too
early in gimple stage if arg2 is variable, avoid generating store hit load
instructions.

For Power9 V4SI:
addi 9,1,-16
rldic 6,6,2,60
stxv 34,-16(1)
stwx 5,9,6
lxv 34,-16(1)
=>
rlwinm 6,6,2,28,29
mtvsrwz 0,5
lvsr 1,0,6
lvsl 0,0,6
xxperm 34,34,33
xxinsertw 34,0,12
xxperm 34,34,32

Though instructions increase from 5 to 7, the performance is improved
60% in typical cases.
Tested with V2DI, V2DF V4SI, V4SF, V8HI, V16QI on Power9-LE.

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

gcc/ChangeLog:

PR target/79251
PR target/98065

* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
Ajdust variable index vec_insert from address dereference to
ARRAY_REF(VIEW_CONVERT_EXPR) tree expression.
* config/rs6000/rs6000-protos.h (rs6000_expand_vector_set_var):
New declaration.
* config/rs6000/rs6000.c (rs6000_expand_vector_set_var): New function.

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

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr79251.p9.c: New test.
* gcc.target/powerpc/pr79251-run.c: New test.
* gcc.target/powerpc/pr79251.h: New header.

3 years agoDrop time profile for multi-threaded training run.
Martin Liska [Fri, 22 Jan 2021 13:00:30 +0000 (14:00 +0100)]
Drop time profile for multi-threaded training run.

gcc/ChangeLog:

PR gcov-profile/98739
* profile.c (compute_value_histograms): Drop time profile for
-fprofile-reproducible=multithreaded.

3 years agodriver: do not check file existence here [PR 98452]
Nathan Sidwell [Tue, 19 Jan 2021 19:43:15 +0000 (11:43 -0800)]
driver: do not check file existence here [PR 98452]

The driver checks whether OPT_SPECIAL_input_file options are readable.
There's no need, the compiler proper will do that anyway.

gcc/
* gcc.c (process_command): Don't check OPT_SPECIAL_input_file
existence here.

3 years agomiddle-end/98773 - always sign extend CHREC_RIGHT
Richard Biener [Fri, 22 Jan 2021 10:29:17 +0000 (11:29 +0100)]
middle-end/98773 - always sign extend CHREC_RIGHT

The previous change exposed a miscompile when trying to interpret
CHREC_RIGHT correctly which in fact it already was to the extent
it is used.  The following reverts this part of the change, only
retaining the singling out of HOST_WIDE_INT_MIN.

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

PR middle-end/98773
* tree-data-ref.c (initalize_matrix_A): Revert previous
change, retaining failing on HOST_WIDE_INT_MIN CHREC_RIGHT.

* gcc.dg/torture/pr98773.c: New testcase.