gcc.git
4 years agoOpenMP: Support 'if (simd:/cancel:' in Fortran
Tobias Burnus [Wed, 22 Jul 2020 19:02:01 +0000 (21:02 +0200)]
OpenMP: Support 'if (simd:/cancel:' in Fortran

gcc/fortran/ChangeLog:

* gfortran.h (enum gfc_omp_if_kind): Add OMP_IF_CANCEL and OMP_IF_SIMD.
* openmp.c (OMP_SIMD_CLAUSES): Add OMP_CLAUSE_IF.
(gfc_match_omp_clauses, resolve_omp_clauses): Handle 'if (simd/cancel:'.
* dump-parse-tree.c (show_omp_clauses): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_cancel,
(gfc_split_omp_clauses): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/cancel-2.f90: New test.
* gfortran.dg/gomp/cancel-3.f90: New test.
* gfortran.dg/gomp/if-1.f90: New test.

4 years agors6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode
Peter Bergner [Wed, 22 Jul 2020 16:44:35 +0000 (11:44 -0500)]
rs6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode

PR96236 shows a problem where we don't correctly store our 512-bit accumulators
correctly in little-endian mode.  The patch below detects when we're doing a
little-endian memory access and stores to the correct memory locations.

2020-07-22  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96236
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Handle
little-endian memory ordering.

gcc/testsuite/
PR target/96236
* gcc.target/powerpc/mma-double-test.c: Update storing results for
correct little-endian ordering.
* gcc.target/powerpc/mma-single-test.c: Likewise.

4 years agoc++: Don't add enums to class's decl_list
Nathan Sidwell [Wed, 22 Jul 2020 15:38:58 +0000 (08:38 -0700)]
c++: Don't add enums to class's decl_list

We don't need to add CONST_DECLs to a template decl's decl list.  Also made the
code flow a bit clearer.

gcc/cp/
* class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.

4 years agodump: filenames containing -
Nathan Sidwell [Wed, 22 Jul 2020 15:34:22 +0000 (08:34 -0700)]
dump: filenames containing -

I discovered the dump machinery would get confused by filenames containing '-'.
Fixed thusly.

gcc/
* dumpfile.c (parse_dump_option): Deal with filenames
containing '-'

4 years agoc++: structural_comptypes addition
Nathan Sidwell [Wed, 22 Jul 2020 15:27:30 +0000 (08:27 -0700)]
c++: structural_comptypes addition

I had to debug structural_comptypes, and its complex if conditions and
tail calling of same_type_p made that hard.  I'd hope we can turn the
eqivalent of return boolean_fn () ? true : false; into a tail call of
the boolean.  We also were not dealing with TYPEOF_TYPE.

gcc/cp/
* typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
apart complex if.
[UNDERLYING_TYPE]: Use an if.
[TYPEOF_TYPE]: New.

4 years agoc++: More cleanups for modern C++
Nathan Sidwell [Wed, 22 Jul 2020 15:20:31 +0000 (08:20 -0700)]
c++: More cleanups for modern C++

Here are some more places where we can declare variables at the
assignment point, rather than use C89.  Also, let's name our variables
by what they contain -- the register allocator is perfectly able to
track liveness for us.

gcc/cp/
* decl.c (decls_match): Move variables into scopes
they're needed in.
(duplicate_decls): Use STRIP_TEMPLATE.
(build_typename_type): Move var decls to their assignments.
(begin_function_body): Likewise.
* decl2.c (get_guard): Likewise.
(mark_used): Use true for truthiness.
* error.c (dump_aggr_type): Hold the decl in a var called
'decl', not 'name'.

4 years agoc++: Shrink lambda-expr
Nathan Sidwell [Wed, 22 Jul 2020 15:07:25 +0000 (08:07 -0700)]
c++: Shrink lambda-expr

I noticed the default capture mode and the discriminator both used
ints.  That seems excessive.  This shrinks them to 8 bits and 16 bits
respectively.  I suppose the discriminator could use the remaining 24
bits of an int allocation unit, if we're worried about more that 64K
lambdas per function.  I know, users are strange :)  On a 64 bit system
this saves 64 bits, because we also had 32 bits of padding added.

gcc/cp/
* cp-tree.h (struct tree_lambda_expr): Shrink
default_capture_mode & discriminator.

4 years agopreprocessor: add_path simplifications
Nathan Sidwell [Wed, 22 Jul 2020 15:01:45 +0000 (08:01 -0700)]
preprocessor: add_path simplifications

I noticed add_path was calling strlen more than once on the same
string.  Let's not do that.

gcc/
* incpath.c (add_path): Avoid multiple strlen calls.

4 years agoc++: mangling cleanups
Nathan Sidwell [Wed, 22 Jul 2020 14:52:31 +0000 (07:52 -0700)]
c++: mangling cleanups

I noticed the mangler's handling of templates could be simplified.
We know template_info is non-null, which is sufficiently boolean --
no need for an explicit bool return.  also some of the internals of
template_args_equal had crept into find_substitution.  Let's not do
that.

gcc/cp/
* mangle.c (decl_is_template_id): Rename to ...
(maybe_template_info): ... here.  Return the template info,
rather than use a pointer.  Adjust all callers.
(find_substitution): Use template_args_equal, rather than
local check.

4 years agoLimit pr95237-6.c to x86 targets
H.J. Lu [Wed, 22 Jul 2020 14:33:54 +0000 (07:33 -0700)]
Limit pr95237-6.c to x86 targets

Since c-c++-common/pr95237-6.c is x86 specific, limit it to x86 targets.

PR target/95237
* c-c++-common/pr95237-6.c: Only run for x86 targets.

4 years agolibstdc++: Constrain reverse_iterator and move_iterator conversions [LWG 3435]
Jonathan Wakely [Wed, 22 Jul 2020 12:25:11 +0000 (13:25 +0100)]
libstdc++: Constrain reverse_iterator and move_iterator conversions [LWG 3435]

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (reverse_iterator): Constrain
converting constructor and converting assignment operator.
Access source iterator's data member directly instead of
calling base().
(move_iterator): Likewise.
* testsuite/24_iterators/move_iterator/dr3435.cc: New test.
* testsuite/24_iterators/reverse_iterator/dr3435.cc: New test.

4 years agoexpmed: Fix possible use of NULL_RTX return value from emit_store_flag
Jozef Lawrynowicz [Wed, 22 Jul 2020 11:37:29 +0000 (12:37 +0100)]
expmed: Fix possible use of NULL_RTX return value from emit_store_flag

MSP430 does not support have any store-flag instructions, so
emit_store_flag can return NULL_RTX.  Catch the NULL_RTX in
expmed.c:expand_sdiv_pow2.

gcc/ChangeLog:

* expmed.c (expand_sdiv_pow2): Check return value from emit_store_flag
is not NULL_RTX before use.

4 years agoexpr: Allow scalar_int_mode target mode when converting a constant
Jozef Lawrynowicz [Wed, 22 Jul 2020 11:34:30 +0000 (12:34 +0100)]
expr: Allow scalar_int_mode target mode when converting a constant

is_int_mode does not allow MODE_PARTIAL_INT modes, so convert_modes was
not allowing a constant value to be converted to a MODE_PARTIAL_INT for
use as operand 2 in patterns such as ashlpsi3. The constant had
to be copied into a register before it could be used, but now can be
used directly as an operand without any copying.

gcc/ChangeLog:

* expr.c (convert_modes): Allow a constant integer to be converted to
any scalar int mode.

4 years agocritical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite
Tobias Burnus [Wed, 22 Jul 2020 10:12:48 +0000 (12:12 +0200)]
critical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/critical-hint-1.c: New; moved from
gcc/testsuite/c-c++-common/gomp/.
* testsuite/libgomp.c-c++-common/critical-hint-2.c: Likewise.
* testsuite/libgomp.fortran/critical-hint-1.f90: New; moved
from gcc/testsuite/gfortran.dg/gomp/.
* testsuite/libgomp.fortran/critical-hint-2.f90: Likewise.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/critical-hint-1.c: Moved to libgomp/.
* c-c++-common/gomp/critical-hint-2.c: Moved to libgomp/.
* gfortran.dg/gomp/critical-hint-1.f90: Moved to libgomp/.
* gfortran.dg/gomp/critical-hint-2.f90: Moved to libgomp/.

4 years agoGeneration of adjusted ldp/stp for vector types
Przemyslaw Wirkus [Wed, 22 Jul 2020 09:14:39 +0000 (10:14 +0100)]
Generation of adjusted ldp/stp for vector types

Introduce simple peephole2 optimization which substitutes a sequence of
four consecutive load or store (LDR, STR) instructions with two load or
store pair (LDP, STP) instructions for 2 element supported vector modes
(V2SI, V2SF, V2DI, and V2DF).
Generated load / store pair instruction offset is adjusted accordingly.

Bootstrapped and tested on aarch64-none-linux-gnu.

Example:
$ cat stp_vec_v2sf.c
typedef float __attribute__((vector_size(8))) vec;

void
store_adjusted(vec *out, vec x, vec y)
{
  out[400] = x;
  out[401] = y;
  out[402] = y;
  out[403] = x;
}

Example compiled with:
$ ./aarch64-none-linux-gnu-gcc -S -O2 stp_vec_v2sf.c -dp

Before the patch:

store_adjusted:
    str     d0, [x0, 3200]    // 9    [c=4 l=4]  *aarch64_simd_movv2si/2
    str     d1, [x0, 3208]    // 11   [c=4 l=4]  *aarch64_simd_movv2si/2
    str     d1, [x0, 3216]    // 13   [c=4 l=4]  *aarch64_simd_movv2si/2
    str     d0, [x0, 3224]    // 15   [c=4 l=4]  *aarch64_simd_movv2si/2
    ret       // 26       [c=0 l=4]  *do_return

After the patch:

store_adjusted:
    add     x1, x0, 3200    // 27   [c=4 l=4]  *adddi3_aarch64/0
    stp     d0, d1, [x1]    // 28   [c=0 l=4]  vec_store_pairv2siv2si
    stp     d1, d0, [x1, 16]        // 29   [c=0 l=4]  vec_store_pairv2siv2si
    ret             // 22   [c=0 l=4]  *do_return

gcc/ChangeLog:

* config/aarch64/aarch64-ldpstp.md: Add two peepholes for adjusted vector
V2SI, V2SF, V2DI, V2DF load pair and store pair modes.
* config/aarch64/aarch64-protos.h (aarch64_gen_adjusted_ldpstp):
Change mode parameter to machine_mode.
(aarch64_operands_adjust_ok_for_ldpstp): Change mode parameter to
machine_mode.
* config/aarch64/aarch64.c (aarch64_operands_adjust_ok_for_ldpstp):
Change mode parameter to machine_mode.
(aarch64_gen_adjusted_ldpstp): Change mode parameter to machine_mode.
* config/aarch64/iterators.md (VP_2E): New iterator for 2 element vectors.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/ldp_vec_v2sf.c: New test.
* gcc.target/aarch64/ldp_vec_v2si.c: New test.
* gcc.target/aarch64/stp_vec_v2df.c: New test.
* gcc.target/aarch64/stp_vec_v2di.c: New test.
* gcc.target/aarch64/stp_vec_v2sf.c: New test.
* gcc.target/aarch64/stp_vec_v2si.c: New test.

4 years agodoc: fix a typo in languages.texi
Wei Wentao [Wed, 22 Jul 2020 09:16:34 +0000 (10:16 +0100)]
doc: fix a typo in languages.texi

gcc/
* doc/languages.texi: Fix “then”/“than” typo.

4 years agoMAINTAINERS: Add myself for write after approval
Przemyslaw Wirkus [Wed, 22 Jul 2020 09:13:00 +0000 (10:13 +0100)]
MAINTAINERS: Add myself for write after approval

2020-07-22  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

* MAINTAINERS (Write After Approval): Add myself.

4 years agoOpenMP: Fixes for omp critical + hint
Tobias Burnus [Tue, 21 Jul 2020 16:29:53 +0000 (18:29 +0200)]
OpenMP: Fixes for omp critical + hint

gcc/c-family/ChangeLog:

* c-omp.c (c_finish_omp_critical): Check for no name but
nonzero hint provided.

gcc/c/ChangeLog:

* c-parser.c (c_parser_omp_clause_hint): Require nonnegative hint clause.
(c_parser_omp_critical): Permit hint(0) clause without named critical.
(c_parser_omp_construct): Don't assert if error_mark_node is returned.

gcc/cp/ChangeLog:

* parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
(cp_parser_omp_critical): Permit hint(0) clause without named critical.
* pt.c (tsubst_expr): Re-check the latter for templates.

gcc/fortran/ChangeLog:

* openmp.c (gfc_match_omp_critical): Fix handling hints; permit
hint clause without named critical.
(resolve_omp_clauses): Require nonnegative constant integer
for the hint clause.
(gfc_resolve_omp_directive): Check for no name but
nonzero value for hint clause.
* parse.c (parse_omp_structured_block): Fix same-name check
for critical.
* trans-openmp.c (gfc_trans_omp_critical): Handle hint clause properly.

libgomp/ChangeLog:

* omp_lib.f90.in: Add omp_sync_hint_* and omp_sync_hint_kind.
* omp_lib.h.in: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/critical-3.C: Add nameless critical with hint testcase.
* c-c++-common/gomp/critical-hint-1.c: New test.
* c-c++-common/gomp/critical-hint-2.c: New test.
* gfortran.dg/gomp/critical-hint-1.f90: New test.
* gfortran.dg/gomp/critical-hint-2.f90: New test.

4 years agogcc.dg/no_profile_instrument_function-attr-1.c: Adjust for NO_DOT_IN_LABEL
Hans-Peter Nilsson [Wed, 22 Jul 2020 01:46:46 +0000 (03:46 +0200)]
gcc.dg/no_profile_instrument_function-attr-1.c: Adjust for NO_DOT_IN_LABEL

mmix-knuth-mmixware is a NO_DOT_IN_LABEL target, so it gets a "_"
instead of the "." in the identifier of interest.  Also tested and
compared to the output for cris-elf which is "regular" regarding
labels: there are no "false positive" identifiers there.  The "." in a
TCL bracket expression matches only a literal ".".

Committed as obvious.

gcc/testsuite:
* gcc.dg/no_profile_instrument_function-attr-1.c: Adjust scanned
regex for NO_DOT_IN_LABEL.

4 years agoDaily bump.
GCC Administrator [Wed, 22 Jul 2020 00:16:27 +0000 (00:16 +0000)]
Daily bump.

4 years agoAdd TARGET_LOWER_LOCAL_DECL_ALIGNMENT [PR95237]
Sunil K Pandey [Sat, 18 Jul 2020 02:42:09 +0000 (19:42 -0700)]
Add TARGET_LOWER_LOCAL_DECL_ALIGNMENT [PR95237]

Default for this hook is NOP. For x86, in 32 bit mode, this hook
sets alignment of long long on stack to 32 bits if preferred stack
boundary is 32 bits.

  - This patch prevents lowering of alignment from following macros.
LOCAL_ALIGNMENT
STACK_SLOT_ALIGNMENT
LOCAL_DECL_ALIGNMENT
  - This patch fixes
gcc.target/i386/pr69454-2.c
gcc.target/i386/stackalign/longlong-1.c
  - Regression test on x86-64, no new fail introduced.

Tested on x86-64.

gcc/c/ChangeLog:

PR target/95237
* c-decl.c (finish_decl): Call target hook
lower_local_decl_alignment to lower local decl alignment.

gcc/ChangeLog:

PR target/95237
* config/i386/i386-protos.h (ix86_local_alignment): Add
another function parameter may_lower alignment. Default is
false.
* config/i386/i386.c (ix86_lower_local_decl_alignment): New
function.
(ix86_local_alignment): Amend ix86_local_alignment to accept
another parameter may_lower. If may_lower is true, new align
may be lower than incoming alignment. If may_lower is false,
new align will be greater or equal to incoming alignment.
(TARGET_LOWER_LOCAL_DECL_ALIGNMENT): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (TARGET_LOWER_LOCAL_DECL_ALIGNMENT): New
hook.
* target.def (lower_local_decl_alignment): New hook.

gcc/cp/ChangeLog:

PR target/95237
* decl.c (cp_finish_decl): Call target hook
lower_local_decl_alignment to lower local decl alignment.

gcc/testsuite/ChangeLog:

PR target/95237
* c-c++-common/pr95237-1.c: New test.
* c-c++-common/pr95237-2.c: New test.
* c-c++-common/pr95237-3.c: New test.
* c-c++-common/pr95237-4.c: New test.
* c-c++-common/pr95237-5.c: New test.
* c-c++-common/pr95237-6.c: New test.
* c-c++-common/pr95237-7.c: New test.
* c-c++-common/pr95237-8.c: New test.
* c-c++-common/pr95237-9.c: New test.

4 years agors6000: Update test case count when compiling for power9
Peter Bergner [Tue, 21 Jul 2020 21:20:33 +0000 (16:20 -0500)]
rs6000: Update test case count when compiling for power9

2020-07-21  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
PR target/92488
* gcc.target/powerpc/convert-fp-128.c (bl): Update POWER9 count.

4 years agoc++: Fix scan forward over pragma [PR96257]
Nathan Sidwell [Tue, 21 Jul 2020 19:37:58 +0000 (12:37 -0700)]
c++: Fix scan forward over pragma [PR96257]

It turns out that the paren scanning code is used for speculatively searching
to see if we're looking at a compound_literal.  So we shouldn't always purge
pragma tokens.

gcc/cp/
* parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
(cp_parser_skip_to_closing_parenthesis_1): Only pass start token
to pragma skipper if recovering.
(cp_parser_skip_to_pragma_eol): Only purge and change pragma
state when recovering.
gcc/testsuite/
* g++.dg/parse/pr96257.C: New.

4 years agoPR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792
Harald Anlauf [Tue, 21 Jul 2020 19:37:30 +0000 (21:37 +0200)]
PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792

When checking for an external procedure from the same file, do not
consider symbols from different modules.

gcc/fortran/
PR fortran/89574
* trans-decl.c (gfc_get_extern_function_decl): Check whether a
symbol belongs to a different module.

4 years agoi386: Fix insn conditions of mfence patterns [PR95750]
Uros Bizjak [Tue, 21 Jul 2020 18:22:05 +0000 (20:22 +0200)]
i386: Fix insn conditions of mfence patterns [PR95750]

2020-07-21  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95750
* config/i386/sync.md (mfence_sse2): Enable for
TARGET_64BIT and TARGET_SSE2.
(mfence_nosse): Always enable.

4 years agoMSP430: Remove do_no_relax_short_jumps
Jozef Lawrynowicz [Tue, 21 Jul 2020 16:24:04 +0000 (17:24 +0100)]
MSP430: Remove do_no_relax_short_jumps

This is an old cludge from from when the Binutils linker could not relax
BR to JMP and vice-versa when shuffling "either" sections between upper
and lower memory. This has been fixed since at least Binutils 2.30.

gcc/ChangeLog:

* config/msp430/msp430-protos.h (msp430_do_not_relax_short_jumps):
Remove.
* config/msp430/msp430.c (msp430_do_not_relax_short_jumps): Likewise.
* config/msp430/msp430.md (cbranchhi4_real): Remove special case for
msp430_do_not_relax_short_jumps.

4 years agoMSP430: Define extendqipsi2
Jozef Lawrynowicz [Tue, 21 Jul 2020 16:24:03 +0000 (17:24 +0100)]
MSP430: Define extendqipsi2

The SXT instruction extends the sign of the low byte of the operand
through the entire PSImode register.
SXTX.A can be used to sign extend the low byte of a memory operand
through to the 19th bit. Bits 31:20 are cleared.

gcc/ChangeLog:

* config/msp430/msp430.md: New "extendqipsi2" define_insn.

4 years agoMSP430: Define NO_FUNCTION_CSE
Jozef Lawrynowicz [Tue, 21 Jul 2020 16:24:03 +0000 (17:24 +0100)]
MSP430: Define NO_FUNCTION_CSE

Calling a constant function address costs the same number of clock
cycles as calling an address stored in a register. However, in terms of
instruction length, calling a constant address is more expensive.

Set NO_FUNCTION_CSE to true, only when optimizing for speed.

gcc/ChangeLog:

* config/msp430/msp430.h (NO_FUNCTION_CSE): Set to true at -O2 and
above.

4 years agoScale down long-running tree-prof.exp tests for non-FDO testing.
Sandra Loosemore [Tue, 21 Jul 2020 16:20:36 +0000 (09:20 -0700)]
Scale down long-running tree-prof.exp tests for non-FDO testing.

2020-07-21  Sandra Loosemore  <sandra@codesourcery.com>

gcc/testsuite/
* lib/profopt.exp (auto-profopt-execute): Pass -DFOR_AUTOFDO_TESTING
on command line for both compiles.
* gcc.dg/tree-prof/cold_partition_label.c: Scale down for
non-FDO testing.
* gcc.dg/tree-prof/crossmodule-indir-call-topn-1.c: Likewise.
* gcc.dg/tree-prof/crossmodule-indir-call-topn-2.c: Likewise.
* gcc.dg/tree-prof/indir-call-prof-topn.c: Likewise.
* gcc.dg/tree-prof/section-attr-1.c: Likewise.
* gcc.dg/tree-prof/section-attr-2.c: Likewise.
* gcc.dg/tree-prof/section-attr-3.c: Likewise.

4 years agotestsuite: Add default_packed filters
Dimitar Dimitrov [Thu, 9 Jul 2020 19:29:13 +0000 (22:29 +0300)]
testsuite: Add default_packed filters

Fix test cases assumptions that target has alignment constraints.

gcc/testsuite/ChangeLog:

* gcc.dg/attr-copy-4.c: Unpacked may still have alignment of 1
on targets with default_packed.
* gcc.dg/c11-align-9.c: Remove AVR target filter and replace
with default_packed filter.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
4 years agotestsuite: Relax pattern to include "packed" targets
Dimitar Dimitrov [Thu, 9 Jul 2020 19:29:37 +0000 (22:29 +0300)]
testsuite: Relax pattern to include "packed" targets

The actual warning message depends on the default alignment of the
target. With this update the test correctly passes on AVR and PRU
targets.

gcc/testsuite/ChangeLog:

* gcc.dg/pr53037-1.c: Relax warning pattern.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
4 years agotestsute: Add expected warning for packed attribute
Dimitar Dimitrov [Thu, 9 Jul 2020 19:04:38 +0000 (22:04 +0300)]
testsute: Add expected warning for packed attribute

Targets which pack structures by default get warnings for packed structure
attributes. This is expected, so add markers in the test cases.

gcc/testsuite/ChangeLog:

* c-c++-common/Waddress-of-packed-member-2.c: Add dg-warning for
ignored attribute if target is default_packed.
* c-c++-common/Wattributes.c: Ditto.
* c-c++-common/attr-copy.c: Ditto.
* c-c++-common/builtin-has-attribute-4.c: Ditto.
* c-c++-common/pr51628-29.c: Ditto.
* c-c++-common/pr51628-30.c: Ditto.
* c-c++-common/pr51628-32.c: Ditto.
* gcc.dg/Wattributes-6.c: Ditto.
* gcc.dg/attr-copy-4.c: Ditto.
* gcc.dg/attr-copy-8.c: Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
4 years agotestsuite: Filter unaligned pointer value warning
Dimitar Dimitrov [Thu, 9 Jul 2020 19:00:46 +0000 (22:00 +0300)]
testsuite: Filter unaligned pointer value warning

Targets which pack structures by default will not get warnings about
unaligned access to structure members.

gcc/testsuite/ChangeLog:

* c-c++-common/Waddress-of-packed-member-1.c: Filter dg-warning
for targets who pack by default.
* c-c++-common/Waddress-of-packed-member-2.c: Ditto.
* c-c++-common/pr51628-13.c: Ditto.
* c-c++-common/pr51628-15.c: Ditto.
* c-c++-common/pr51628-16.c: Ditto.
* c-c++-common/pr51628-26.c: Ditto.
* c-c++-common/pr51628-27.c: Ditto.
* c-c++-common/pr51628-28.c: Ditto.
* c-c++-common/pr51628-29.c: Ditto.
* c-c++-common/pr51628-3.c: Ditto.
* c-c++-common/pr51628-30.c: Ditto.
* c-c++-common/pr51628-31.c: Ditto.
* c-c++-common/pr51628-32.c: Ditto.
* c-c++-common/pr51628-33.c: Ditto.
* c-c++-common/pr51628-35.c: Ditto.
* c-c++-common/pr51628-4.c: Ditto.
* c-c++-common/pr51628-5.c: Ditto.
* c-c++-common/pr51628-6.c: Ditto.
* c-c++-common/pr51628-8.c: Ditto.
* c-c++-common/pr51628-9.c: Ditto.
* c-c++-common/pr88664-2.c: Ditto.
* gcc.dg/pr51628-17.c: Ditto.
* gcc.dg/pr51628-19.c: Ditto.
* gcc.dg/pr51628-20.c: Ditto.
* gcc.dg/pr51628-21.c: Ditto.
* gcc.dg/pr51628-22.c: Ditto.
* gcc.dg/pr51628-24.c: Ditto.
* gcc.dg/pr51628-25.c: Ditto.
* gcc.dg/pr51628-34.c: Ditto.
* gcc.dg/pr88928.c: Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
4 years agotestsuite: Add signal checking for signal related testcase in analyzer.
Kito Cheng [Mon, 20 Jul 2020 06:41:04 +0000 (14:41 +0800)]
testsuite: Add signal checking for signal related testcase in analyzer.

 - Verifed on RISC-V and x86.

gcc/testsuite/ChangeLog:

* gcc.dg/analyzer/signal-1.c: Add dg-require-effective-target
signal.
* gcc.dg/analyzer/signal-2.c: Ditto.
* gcc.dg/analyzer/signal-3.c: Ditto.
* gcc.dg/analyzer/signal-4a.c: Ditto.
* gcc.dg/analyzer/signal-4b.c: Ditto.
* gcc.dg/analyzer/signal-5.c: Ditto.
* gcc.dg/analyzer/signal-6.c: Ditto.
* gcc.dg/analyzer/signal-exit.c: Ditto.

4 years agors6000: Define movsf_from_si2 to extract high part SF element from DImode[PR89310]
Xionghu Luo [Tue, 21 Jul 2020 03:37:30 +0000 (22:37 -0500)]
rs6000: Define movsf_from_si2 to extract high part SF element from DImode[PR89310]

For extracting high part element from DImode register like:

{%1:SF=unspec[r122:DI>>0x20#0] 86;clobber scratch;}

split it before reload with "and mask" to avoid generating shift right
32 bit then shift left 32 bit.  This pattern also exists in PR42475 and
PR67741, etc.

srdi 3,3,32
sldi 9,3,32
mtvsrd 1,9
xscvspdpn 1,1

=>

rldicr 3,3,0,31
mtvsrd 1,3
xscvspdpn 1,1

Bootstrap and regression tested pass on Power8-LE.

gcc/ChangeLog:

2020-07-21  Xionghu Luo  <luoxhu@linux.ibm.com>

PR rtl-optimization/89310
* config/rs6000/rs6000.md (movsf_from_si2): New define_insn_and_split.

gcc/testsuite/ChangeLog:

2020-07-21  Xionghu Luo  <luoxhu@linux.ibm.com>

PR rtl-optimization/89310
* gcc.target/powerpc/pr89310.c: New test.

4 years agors6000/test: Add vector with length test cases
Kewen Lin [Tue, 21 Jul 2020 03:14:19 +0000 (22:14 -0500)]
rs6000/test: Add vector with length test cases

This patch is to add the test coverage for vector with
length feature on rs6000.  Tested on P9 LE, P7 BE and
P9 BE (aix), the results looked fine.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/p9-vec-length-1.h: New test.
* gcc.target/powerpc/p9-vec-length-2.h: New test.
* gcc.target/powerpc/p9-vec-length-3.h: New test.
* gcc.target/powerpc/p9-vec-length-4.h: New test.
* gcc.target/powerpc/p9-vec-length-5.h: New test.
* gcc.target/powerpc/p9-vec-length-6.h: New test.
* gcc.target/powerpc/p9-vec-length-7.h: New test.
* gcc.target/powerpc/p9-vec-length-8.h: New test.
* gcc.target/powerpc/p9-vec-length-epil-1.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-2.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-3.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-4.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-5.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-6.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-7.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-8.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-1.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-2.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-3.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-4.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-5.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-6.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-7.c: New test.
* gcc.target/powerpc/p9-vec-length-epil-run-8.c: New test.
* gcc.target/powerpc/p9-vec-length-full-1.c: New test.
* gcc.target/powerpc/p9-vec-length-full-2.c: New test.
* gcc.target/powerpc/p9-vec-length-full-3.c: New test.
* gcc.target/powerpc/p9-vec-length-full-4.c: New test.
* gcc.target/powerpc/p9-vec-length-full-5.c: New test.
* gcc.target/powerpc/p9-vec-length-full-6.c: New test.
* gcc.target/powerpc/p9-vec-length-full-7.c: New test.
* gcc.target/powerpc/p9-vec-length-full-8.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-1.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-2.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-3.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-4.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-5.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-6.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-7.c: New test.
* gcc.target/powerpc/p9-vec-length-full-run-8.c: New test.
* gcc.target/powerpc/p9-vec-length-run-1.h: New test.
* gcc.target/powerpc/p9-vec-length-run-2.h: New test.
* gcc.target/powerpc/p9-vec-length-run-3.h: New test.
* gcc.target/powerpc/p9-vec-length-run-4.h: New test.
* gcc.target/powerpc/p9-vec-length-run-5.h: New test.
* gcc.target/powerpc/p9-vec-length-run-6.h: New test.
* gcc.target/powerpc/p9-vec-length-run-7.h: New test.
* gcc.target/powerpc/p9-vec-length-run-8.h: New test.
* gcc.target/powerpc/p9-vec-length.h: New test.

4 years agogcc.dg/independent-cloneids-1.c: Skip for mmix.
Hans-Peter Nilsson [Tue, 21 Jul 2020 00:43:11 +0000 (02:43 +0200)]
gcc.dg/independent-cloneids-1.c: Skip for mmix.

Regular ELF label definitions for this test-case, matched by the
regexps, e.g.:
 /* { dg-final { scan-assembler-times {(?n)^_*bar[.$_]constprop[.$_]0:} 1 } } */
typically look like this:
bar_constprop.0:

For MMIX, they look like this:
bar_constprop::0 IS @

I think it's better to just skip the test for MMIX than further
uglifying the matching regexps, since the test is IIUC general
enough that nothing in the target port can reasonably make a
difference: it passes for all targets or fail for all targets.

gcc/testsuite:
* gcc.dg/independent-cloneids-1.c: Skip for mmix.
flag_stack_usage_info.

4 years agogcc.dg/cdce3.c: Update matched line-number.
Hans-Peter Nilsson [Tue, 21 Jul 2020 00:35:26 +0000 (02:35 +0200)]
gcc.dg/cdce3.c: Update matched line-number.

I missed updating the line-number when adding that dg-skip-if.
Committed as obvious.

* gcc.dg/cdce3.c: Update matched line-number.

4 years agoDaily bump.
GCC Administrator [Tue, 21 Jul 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.

4 years agommix: support -fstack-usage
Hans-Peter Nilsson [Mon, 20 Jul 2020 23:15:36 +0000 (01:15 +0200)]
mmix: support -fstack-usage

MMIX has two stacks; the regular one using register $254 as a
convention and the register-stack, pushed and popped by call
instructions (usually).  The decision to only report the stack usage
of the regular stack (and not of the register stack) may be updated,
perhaps the sum is better.  This initial decision is helped a little
bit by the order of passes: the size of the register-stack is
calculated only later (in the machine-dependent reorg pass), long
after finalization of the stack-usage info (in the prologue/epilogue
pass).  No regressions for mmix-knuth-mmixware (but a whole lot more
PASSes), committed.

gcc:
* config/mmix/mmix.c (mmix_expand_prologue): Calculate the total
allocated size and set current_function_static_stack_size, if
flag_stack_usage_info.

4 years agolibstdc++: Add std::from_chars for floating-point types
Jonathan Wakely [Mon, 20 Jul 2020 22:49:27 +0000 (23:49 +0100)]
libstdc++: Add std::from_chars for floating-point types

This adds the missing std::from_chars overloads for floating-point
types, as required for C++17 conformance.

The implementation is a hack and not intended to be used in the long
term. Rather than parsing the string directly, this determines the
initial portion of the string that matches the pattern determined by the
chars_format parameter, then creates a NTBS to be parsed by strtod (or
strtold or strtof).

Because creating a NTBS requires allocating memory, but std::from_chars
is noexcept, we need to be careful to minimise allocation. Even after
being careful, allocation failure is still possible, and so a
non-conforming std::no_more_memory error code might be returned.

Because strtod et al depend on the current locale, but std::from_chars
does not, we change the current thread's locale to "C" using newlocale
and uselocale before calling strtod, and restore it afterwards.

Because strtod doesn't have the equivalent of a std::chars_format
parameter, it has to examine the input to determine the format in use,
even though the std::from_chars code has already parsed it once (or
twice for large input strings!)

By replacing the use of strtod we could avoid allocation, avoid changing
locale, and use optimised code paths specific to each std::chars_format
case. We would also get more portable behaviour, rather than depending
on the presence of uselocale, and on any bugs or quirks of the target
libc's strtod. Replacing strtod is a project for a later date.

libstdc++-v3/ChangeLog:

* acinclude.m4 (libtool_VERSION): Bump version.
* config.h.in: Regenerate.
* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.29 version and new
exports.
* config/os/gnu-linux/ldbl-extra.ver: Add _GLIBCXX_LDBL_3.4.29
version and new export.
* configure: Regenerate.
* configure.ac: Check for <xlocale.h> and uselocale.
* crossconfig.m4: Add macro or checks for uselocale.
* include/std/charconv (from_chars): Declare overloads for
float, double, and long double.
* src/c++17/Makefile.am: Add new file.
* src/c++17/Makefile.in: Regenerate.
* src/c++17/floating_from_chars.cc: New file.
(from_chars): Define for float, double, and long double.
* testsuite/20_util/from_chars/1_c++20_neg.cc: Prune extra
diagnostics caused by new overloads.
* testsuite/20_util/from_chars/1_neg.cc: Likewise.
* testsuite/20_util/from_chars/2.cc: Check leading '+'.
* testsuite/20_util/from_chars/4.cc: New test.
* testsuite/20_util/from_chars/5.cc: New test.
* testsuite/util/testsuite_abi.cc: Add new symbol versions.

4 years agoc++: Pseudo-destructor ends object lifetime.
Jason Merrill [Sun, 12 Jul 2020 21:31:24 +0000 (17:31 -0400)]
c++: Pseudo-destructor ends object lifetime.

P0593R6 is mostly about a new object model whereby malloc and the like are
treated as implicitly starting the lifetime of whatever trivial types are
necessary to give the program well-defined semantics; that seems only
relevant to TBAA, and is not implemented here.

The paper also specifies that a pseudo-destructor call (a destructor call
for a non-class type) ends the lifetime of the object like a destructor call
for an object of class type, even though it doesn't call a destructor; this
patch implements that change.

The paper was voted as a DR, so I'm applying this change to all standard
levels.  Like class end-of-life clobbers, it is controlled by
-flifetime-dse.

gcc/cp/ChangeLog:

* pt.c (type_dependent_expression_p): A pseudo-dtor can be
dependent.
* semantics.c (finish_call_expr): Use build_trivial_dtor_call for
pseudo-destructor.
(finish_pseudo_destructor_expr): Leave type NULL for dependent arg.

gcc/testsuite/ChangeLog:

* g++.dg/opt/flifetime-dse7.C: New test.

4 years agoc++: Allow subobject references in C++20.
Jason Merrill [Tue, 7 Jul 2020 05:41:35 +0000 (01:41 -0400)]
c++: Allow subobject references in C++20.

The last new thing allowed by P1907R1: subobject addresses as template
arguments.  The ABI group has discussed mangling for this; there has been
some talk of a compressed subobject mangling, but it hasn't been finalized,
so for now I'm using normal expression mangling.  In order for two array
subobject references to compare as equal template arguments, the offsets
need to have the same type, so I convert them to always be the same type,
currently ptrdiff_t.  Base class conversions are represented as a cast to
reference type, only if necessary to resolve an ambiguity.

This patch also updates the value of __cpp_nontype_template_args, since
the paper is fully implemented.

gcc/cp/ChangeLog:

* mangle.c (write_base_ref): New.
(write_expression): Use it for base field COMPONENT_REFs.
* pt.c (invalid_tparm_referent_p): Canonicalize the type
of array offsets.  Allow subobjects.

gcc/c-family/ChangeLog:

* c-cppbuiltin.c (c_cpp_builtins): Update
__cpp_nontype_template_args for C++20.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/nontype2.C: No error in C++20.
* g++.dg/template/nontype25.C: No error in C++20.
* g++.dg/template/nontype8.C: No error in C++20.
* g++.dg/cpp2a/nontype-subob1.C: New test.
* g++.dg/cpp2a/nontype-subob2.C: New test.
* g++.dg/cpp1z/nontype3.C: Now C++17-only.
* g++.dg/cpp2a/feat-cxx2a.C: Adjust expected value.

4 years agoc++: Aggregate CTAD and string constants.
Jason Merrill [Wed, 8 Jul 2020 05:11:44 +0000 (01:11 -0400)]
c++: Aggregate CTAD and string constants.

In CWG discussion, it was suggested that deduction from a string literal
should be to reference-to-const, so that we deduce 'char' rather than 'const
char' for T.

gcc/cp/ChangeLog:

* pt.c (collect_ctor_idx_types): Add 'const' when deducing from
a string constant.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/class-deduction-aggr7.C: New test.

4 years agosparc/sparc64: use crtendS.o for default-pie executables [PR96190]
Sergei Trofimovich [Tue, 14 Jul 2020 06:48:42 +0000 (07:48 +0100)]
sparc/sparc64: use crtendS.o for default-pie executables [PR96190]

In --enable-default-pie mode compiler should switch from
using crtend.o to crtendS.o. On sparc it is especially important
because crtend.o contains PIC-unfriendly code.

We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get
crtendS.o instead of crtend.o in !no-pie mode.

gcc:

2020-07-14  Sergei Trofimovich  <siarheit@google.com>

PR target/96190
* config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC
to get crtendS.o for !no-pie mode.
* config/sparc/linux64.h (ENDFILE_SPEC): Ditto.

4 years agolibstdc++: Avoid overflow in istream::get(streambuf&) [LWG 3464]
Jonathan Wakely [Mon, 20 Jul 2020 19:06:46 +0000 (20:06 +0100)]
libstdc++: Avoid overflow in istream::get(streambuf&) [LWG 3464]

Similar to the recent changes to basic_istream::ignore, this change
ensures that _M_gcount doesn't overflow when extracting characters and
inserting them into another streambuf.

The solution used here is to use unsigned long long for the count. We
assume that the number of characters extracted won't exceed the maximum
value for that type, but even if it does we avoid any undefined
behaviour.

libstdc++-v3/ChangeLog:

* include/bits/istream.tcc
(basic_istream::get(__streambuf_type&, char_type): Use unsigned
long long for counter and check if it would overflow _M_gcount.
* testsuite/27_io/basic_istream/get/char/lwg3464.cc: New test.
* testsuite/27_io/basic_istream/get/wchar_t/lwg3464.cc: New test.

4 years agovect: Fix an ICE in vectorizable_simd_clone_call
y00520163 [Mon, 20 Jul 2020 18:47:05 +0000 (19:47 +0100)]
vect: Fix an ICE in vectorizable_simd_clone_call

In vectorizable_simd_clone_call, type compatibility is handled based on
the number of elements and the type compatibility of elements, which is
not enough. This patch add VIEW_CONVERT_EXPRs if the arguments types
and return type of simd clone function are distinct with the vectype of
stmt.

2020-07-20  Yang Yang  <yangyang305@huawei.com>

gcc/ChangeLog:

* tree-vect-stmts.c (vectorizable_simd_clone_call): Add
VIEW_CONVERT_EXPRs if the arguments types and return type
of simd clone function are distinct with the vectype of stmt.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/pr96195.c: New test.

4 years agoi386: Use lock prefixed insn instead of MFENCE [PR95750]
Uros Bizjak [Mon, 20 Jul 2020 18:34:46 +0000 (20:34 +0200)]
i386: Use lock prefixed insn instead of MFENCE [PR95750]

Currently, __atomic_thread_fence(seq_cst) on x86 and x86-64 generates
mfence instruction. A dummy atomic instruction (a lock-prefixed instruction
or xchg with a memory operand) would provide the same sequential consistency
guarantees while being more efficient on most current CPUs. The mfence
instruction additionally orders non-temporal stores, which is not relevant
for atomic operations and are not ordered by seq_cst atomic operations anyway.

2020-07-20  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95750
* config/i386/i386.h (TARGET_AVOID_MFENCE):
Rename from TARGET_USE_XCHG_FOR_ATOMIC_STORE.
* config/i386/sync.md (mfence_sse2): Disable for TARGET_AVOID_MFENCE.
(mfence_nosse): Enable also for TARGET_AVOID_MFENCE. Emit stack
referred memory in word_mode.
(mem_thread_fence): Do not generate mfence_sse2 pattern when
TARGET_AVOID_MFENCE is true.
(atomic_store<mode>): Update for rename.
* config/i386/x86-tune.def (X86_TUNE_AVOID_MFENCE):
Rename from X86_TUNE_USE_XCHG_FOR_ATOMIC_STORE.

gcc/testsuite/ChangeLog:
PR target/95750
* gcc.target/i386/pr95750.c: New test.

4 years agoCorrect handling of constant representations containing embedded nuls.
Martin Sebor [Mon, 20 Jul 2020 18:06:18 +0000 (12:06 -0600)]
Correct handling of constant representations containing embedded nuls.

Resolves:
PR middle-end/95189 - memcmp being wrongly stripped like strcm
PR middle-end/95886 - suboptimal memcpy with embedded zero bytes

gcc/ChangeLog:

PR middle-end/95189
PR middle-end/95886
* builtins.c (inline_expand_builtin_string_cmp): Rename...
(inline_expand_builtin_bytecmp): ...to this.
(builtin_memcpy_read_str): Don't expect data to be nul-terminated.
(expand_builtin_memory_copy_args): Handle object representations
with embedded nul bytes.
(expand_builtin_memcmp): Same.
(expand_builtin_strcmp): Adjust call to naming change.
(expand_builtin_strncmp): Same.
* expr.c (string_constant): Create empty strings with nonzero size.
* fold-const.c (c_getstr): Rename locals and update comments.
* tree.c (build_string): Accept null pointer argument.
(build_string_literal): Same.
* tree.h (build_string): Provide a default.
(build_string_literal): Same.

gcc/testsuite/ChangeLog:

PR middle-end/95189
PR middle-end/95886
* gcc.dg/memcmp-pr95189.c: New test.
* gcc.dg/strncmp-3.c: New test.
* gcc.target/i386/memcpy-pr95886.c: New test.

4 years agoRegenerate .pot files.
Joseph Myers [Mon, 20 Jul 2020 18:05:30 +0000 (18:05 +0000)]
Regenerate .pot files.

gcc/po/
* gcc.pot: Regenerate.

libcpp/po/
* cpplib.pot: Regenerate.

4 years agoRemove stray text from option description (PR c/96249).
Martin Sebor [Mon, 20 Jul 2020 17:56:54 +0000 (11:56 -0600)]
Remove stray text from option description (PR c/96249).

gcc/c-family/ChangeLog:
PR c/96249
* c.opt: Remove stray text.

4 years agojit: Fix truncation of testsuite output [PR69435]
Alex Coplan [Mon, 20 Jul 2020 15:15:29 +0000 (16:15 +0100)]
jit: Fix truncation of testsuite output [PR69435]

This fixes a bug in jit.exp which causes the DejaGnu output of the
libgccjit testsuite to be nondeterministically truncated. This bug was
copied from DejaGnu's own implementation of the host_execute function.
See the upstream bug report [0] where the maintainers point out that the
regex patterns in host_execute should (but don't currently) explicitly
match newlines to avoid relying on DejaGnu not reading more than one
line of the output (which is not guaranteed).

This should make it easier to test jit patches in the future, since it
makes it possible to reliably compare the output of two jit.sum files
(as with the other tests in GCC).

[0] : https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42399

gcc/testsuite/
PR jit/69435
* jit.dg/jit.exp (fixed_host_execute): Fix regex patterns to
always explicitly match newlines.

4 years agoremove write-only array in rev_post_order_and_mark_dfs_back_seme
Richard Biener [Mon, 20 Jul 2020 13:58:19 +0000 (15:58 +0200)]
remove write-only array in rev_post_order_and_mark_dfs_back_seme

This removes a write-only array in
rev_post_order_and_mark_dfs_back_seme.

2020-07-20  Richard Biener  <rguenther@suse.de>

* cfganal.c (rev_post_order_and_mark_dfs_back_seme): Remove
write-only post array.

4 years agopreprocessor: line-map cleanups
Nathan Sidwell [Mon, 20 Jul 2020 12:07:08 +0000 (05:07 -0700)]
preprocessor: line-map cleanups

I found the linemap logic dealing with running out of column numbers
confusing.  There's no need for completely separate code blocks there,
as we can rely on the masking operations working all the way down to
zero bits.  The two binary searches for linemap lookups could do with
modernization of placing the var decls at their initialization point.
(These two searches work in opposite directions, and while lower_bound
would work there, the caching got in the way and I decided to be
conservative.)

libcpp/
* line-map.c (linemap_add): Simplify column overflow calculation.
Add comment about range and column bit init.
(linemap_ordinary_map_lookup): Refactor for RAII
(linemap_macro_map_lookup): Likewise.

4 years agogimple-fold: Handle bitfields in fold_const_aggregate_ref_1 [PR93121]
Jakub Jelinek [Mon, 20 Jul 2020 08:24:19 +0000 (10:24 +0200)]
gimple-fold: Handle bitfields in fold_const_aggregate_ref_1 [PR93121]

When working on __builtin_bit_cast that needs to handle bitfields too,
I've made the following change to handle at least some bitfields in
fold_const_aggregate_ref_1 (those that have integral representative).
It already handles some, but only those that start and end at byte
boundaries.

2020-07-20  Jakub Jelinek  <jakub@redhat.com>

PR libstdc++/93121
* gimple-fold.c (fold_const_aggregate_ref_1): For COMPONENT_REF
of a bitfield not aligned on byte boundaries try to
fold_ctor_reference DECL_BIT_FIELD_REPRESENTATIVE if any and
adjust it depending on endianity.

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

4 years agofold-const: Handle bitfields in native_encode_initializer [PR93121]
Jakub Jelinek [Mon, 20 Jul 2020 08:08:28 +0000 (10:08 +0200)]
fold-const: Handle bitfields in native_encode_initializer [PR93121]

When working on __builtin_bit_cast that needs to handle bitfields too,
I've made the following change to handle at least some bitfields in
native_encode_initializer (those that have integral representative).

2020-07-20  Jakub Jelinek  <jakub@redhat.com>

PR libstdc++/93121
* fold-const.c (native_encode_initializer): Handle bit-fields.

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

4 years agogcc.dg/const-uniq-1.c: Adjust scanned pattern for mmix.
Hans-Peter Nilsson [Mon, 20 Jul 2020 03:06:49 +0000 (05:06 +0200)]
gcc.dg/const-uniq-1.c: Adjust scanned pattern for mmix.

Apparently local labels end up in the gimple dumps.  For mmix,
local labels that for other targets look like ".LC0" or "LC.0"
instead look like "LC:0".  Committed as obvious.

gcc/testsuite:
* gcc.dg/const-uniq-1.c: Adjust scanned pattern for mmix.

4 years agogcc.dg/cdce3.c: Skip for mmix.
Hans-Peter Nilsson [Mon, 20 Jul 2020 02:34:39 +0000 (04:34 +0200)]
gcc.dg/cdce3.c: Skip for mmix.

The test is gated on effective-target hard_float but what it
really requires is a sqrtf insn (SFmode, not DFmode).  (It
indeed passes for mmix-knuth-mmixware if the sqrtf is changed to
sqrt and float to double; there is a DFmode sqrt insn.)

Committed.

gcc/testsuite:
* gcc.dg/cdce3.c: Skip for mmix.

4 years agovect: Support length-based partial vectors approach
Kewen Lin [Mon, 20 Jul 2020 01:40:10 +0000 (20:40 -0500)]
vect: Support length-based partial vectors approach

Power9 supports vector load/store instruction lxvl/stxvl which allow
us to operate partial vectors with one specific length.  This patch
extends some of current mask-based partial vectors support code for
length-based approach, also adds some length specific support code.
So far it assumes that we can only have one partial vectors approach
at the same time, it will disable to use partial vectors if both
approaches co-exist.

Like the description of optab len_load/len_store, the length-based
approach can have two flavors, one is length in bytes, the other is
length in lanes.  This patch is mainly implemented and tested for
length in bytes, but as Richard S. suggested, most of code has
considered both flavors.

This also introduces one parameter vect-partial-vector-usage allow
users to control when the loop vectorizer considers using partial
vectors as an alternative to falling back to scalar code.

gcc/ChangeLog:

* config/rs6000/rs6000.c (rs6000_option_override_internal):
Set param_vect_partial_vector_usage to 0 explicitly.
* doc/invoke.texi (vect-partial-vector-usage): Document new option.
* optabs-query.c (get_len_load_store_mode): New function.
* optabs-query.h (get_len_load_store_mode): New declare.
* params.opt (vect-partial-vector-usage): New.
* tree-vect-loop-manip.c (vect_set_loop_controls_directly): Add the
handlings for vectorization using length-based partial vectors, call
vect_gen_len for length generation, and rename some variables with
items instead of scalars.
(vect_set_loop_condition_partial_vectors): Add the handlings for
vectorization using length-based partial vectors.
(vect_do_peeling): Allow remaining eiters less than epilogue vf for
LOOP_VINFO_USING_PARTIAL_VECTORS_P.
* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Init
epil_using_partial_vectors_p.
(_loop_vec_info::~_loop_vec_info): Call release_vec_loop_controls
for lengths destruction.
(vect_verify_loop_lens): New function.
(vect_analyze_loop): Add handlings for epilogue of loop when it's
marked to use vectorization using partial vectors.
(vect_analyze_loop_2): Add the check to allow only one vectorization
approach using partial vectorization at the same time.  Check param
vect-partial-vector-usage for partial vectors decision.  Mark
LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P if the epilogue is
considerable to use partial vectors.  Call release_vec_loop_controls
for lengths destruction.
(vect_estimate_min_profitable_iters): Adjust for loop vectorization
using length-based partial vectors.
(vect_record_loop_mask): Init factor to 1 for vectorization using
mask-based partial vectors.
(vect_record_loop_len): New function.
(vect_get_loop_len): Likewise.
* tree-vect-stmts.c (check_load_store_for_partial_vectors): Add
checks for vectorization using length-based partial vectors.  Factor
some code to lambda function get_valid_nvectors.
(vectorizable_store): Add handlings when using length-based partial
vectors.
(vectorizable_load): Likewise.
(vect_gen_len): New function.
* tree-vectorizer.h (struct rgroup_controls): Add field factor
mainly for length-based partial vectors.
(vec_loop_lens): New typedef.
(_loop_vec_info): Add lens and epil_using_partial_vectors_p.
(LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P): New macro.
(LOOP_VINFO_LENS): Likewise.
(LOOP_VINFO_FULLY_WITH_LENGTH_P): Likewise.
(vect_record_loop_len): New declare.
(vect_get_loop_len): Likewise.
(vect_gen_len): Likewise.

4 years agogcc.dg/pr87485.c: Require scheduling
Hans-Peter Nilsson [Mon, 20 Jul 2020 02:01:43 +0000 (04:01 +0200)]
gcc.dg/pr87485.c: Require scheduling

Committed as obvious, fixing one failure for mmix-knuth-mmixware.

gcc/testsuite:
* gcc.dg/pr87485.c: Require scheduling.

4 years agommix: When debug-dump, revert to "standard" pseudos for emitting integers
Hans-Peter Nilsson [Mon, 20 Jul 2020 01:17:04 +0000 (03:17 +0200)]
mmix: When debug-dump, revert to "standard" pseudos for emitting integers

The sole purpose of not providing pseudos and forcing use of
TARGET_ASM_INTEGER is to arrange for assembly output that people can,
instead of using gas, usefullt feed to mmixal (Knuth's assembler).  It
uses pseudos with slightly different semantics (BYTE, WYDE, TETRA,
OCTA).  Nice when it works, but that only happens for limited
use-cases and debug-information is excluded.

The dwarf2out.c shortcuts, looking up the pseudo-strings and doing the
output on its own, has the result that in absence of such
integer-emitting pseudos, the target TARGET_ASM_INTEGER hook is
called, which by definition outputs a newline, and then the
dwarf2out.c code redundantly adds another.  That uglifies output and
breaks the expectations of the dwarf2 parts of the test-suite.

The wart by which an extra newline is emitted is ripe for a cleanup,
and I started out thinking I'd add a default argument for emitting a
newline to the assemble_integer family of functions, but then
reconsidered.  I also can't bring myself to use different pseudos
with/without -g so instead I check for options for the more detailed
dumps, as used by the test-suite to get those DW_* strings in detailed
assembly output.

This eliminates all FAILs in the dwarf2-specific parts of the gcc
test-suite for mmix-knuth-mmixware, with no regressions.  Committed.

gcc:
* config/mmix/mmix.c (mmix_option_override): Reinstate default
integer-emitting targetm.asm_out pseudos when dumping detailed
assembly-code.
(mmix_assemble_integer): Update comment.

4 years agoDaily bump.
GCC Administrator [Mon, 20 Jul 2020 00:16:19 +0000 (00:16 +0000)]
Daily bump.

4 years agoAlways use name from c_interop_kinds_table for -fc-prototypes.
Thomas Koenig [Sun, 19 Jul 2020 15:27:45 +0000 (17:27 +0200)]
Always use name from c_interop_kinds_table for -fc-prototypes.

When a user specified a KIND that was a parameter taking the value
of an iso_c_binding KIND, the code used the name of that parameter
to look up the type name.  Corrected by always looking it up in
the table of C interop kinds (which was previously done for
non-C-interop types, anyway).

gcc/fortran/ChangeLog:

PR fortran/96220
* dump-parse-tree.c (get_c_type_name): Always use the entries from
c_interop_kinds_table to find the correct C type.

4 years agox86: Add __cpuidex and include guard to <cpuid.h>
H.J. Lu [Sat, 18 Jul 2020 11:43:10 +0000 (04:43 -0700)]
x86: Add __cpuidex and include guard to <cpuid.h>

Add

void __cpuidex (int __cpuid_info[4], int __leaf, int __subleaf);

as well as include guard to <cpuid.h>.

gcc/

PR target/95973
PR target/96238
* config/i386/cpuid.h: Add include guard.
(__cpuidex): New.

gcc/testsuite/

PR target/95973
PR target/96238
* gcc.target/i386/pr95973.c: New test.

4 years agoFix handling of implicit_pure by checking if non-pure procedures are called.
Thomas Koenig [Sun, 19 Jul 2020 10:23:43 +0000 (12:23 +0200)]
Fix handling of implicit_pure by checking if non-pure procedures are called.

Procedures are marked as implicit_pure if they fulfill the criteria of
pure procedures.  In this case, a procedure was not marked as not being
implicit_pure which called another procedure, which had not yet been
marked as not being implicit_impure.

Fixed by iterating over all procedures, setting callers of procedures
which are non-pure and non-implicit_pure as non-implicit_pure and
doing this until no more procedure has been changed.

gcc/fortran/ChangeLog:

2020-07-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/96018
* frontend-passes.c (gfc_check_externals): Adjust formatting.
(implicit_pure_call): New function.
(implicit_pure_expr): New function.
(gfc_fix_implicit_pure): New function.
* gfortran.h (gfc_fix_implicit_pure): New prototype.
* parse.c (translate_all_program_units): Call gfc_fix_implicit_pure.

4 years agogcc.dg/attr-copy-6.c: Require visibility.
Hans-Peter Nilsson [Sun, 19 Jul 2020 03:55:18 +0000 (05:55 +0200)]
gcc.dg/attr-copy-6.c: Require visibility.

Another trivial one.

gcc/testsuite:
* gcc.dg/attr-copy-6.c: Require visibility.

4 years agogcc.dg/Wno-frame-address.c: Skip for cris and mmix.
Hans-Peter Nilsson [Sun, 19 Jul 2020 03:18:57 +0000 (05:18 +0200)]
gcc.dg/Wno-frame-address.c: Skip for cris and mmix.

Long-standing FAIL remedied; committed.  Maybe better to list
the targets that *do* support arbitrary frame access?

gcc/testsuite:
* gcc.dg/Wno-frame-address.c: Skip for cris and mmix.

4 years agoDaily bump.
GCC Administrator [Sun, 19 Jul 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.

4 years agotestsuite: Fix pragma-eof.c failure due to added line to the test.
Jakub Jelinek [Sat, 18 Jul 2020 21:09:56 +0000 (23:09 +0200)]
testsuite: Fix pragma-eof.c failure due to added line to the test.

2020-07-18  Jakub Jelinek  <jakub@redhat.com>

* c-c++-common/cpp/pragma-eof.c: Use .+3 instead of 6 in
dg-error.

4 years agofortran: Restore translation to hint.
David Edelsohn [Thu, 2 Jul 2020 20:03:03 +0000 (16:03 -0400)]
fortran: Restore translation to hint.

This patch restore translation for the variable hint.  The translation
tag conflicted with the previous declaration of hint as char[] and
broke bootstrap, so the translation tags were removed.  The
declaration was changed to char *.  This patch restores the translation
tags to the string.

gcc/fortran/ChangeLog

2020-07-18  David Edelsohn  <dje.gcc@gmail.com>

* check.c (gfc_invalid_boz): Mark hint for translation using _().

4 years agotestsuite: fix goacc/finalize-1.f "original" regex for 32 bits.
David Edelsohn [Fri, 17 Jul 2020 23:38:35 +0000 (19:38 -0400)]
testsuite: fix goacc/finalize-1.f "original" regex for 32 bits.

The "bias" portion of the regex for "original" expects

bias: (integer(kind=<N>) parm.0.data - (integer(kind=<N>)) del_f_p.data

(or cpo_f_p.data)

on 32 bit platforms, the dump file can show (signed int) instead of
(integer(kind=8)... .  This patch adjusts the regex to allow any content
containing the word int between the parentheses.

2020-07-18  David Edelsohn  <dje.gcc@gmail.com>

gcc/testsuite/ChangeLog

* gfortran.dg/goacc/finalize-1.f: Adjust regex for 32 bits.

4 years agox86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL
H.J. Lu [Fri, 26 Jun 2020 20:59:31 +0000 (13:59 -0700)]
x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL

Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

gcc/

PR target/95620
* config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

libgomp/

PR target/95620
* testsuite/libgomp.c/pr95620.c: New test.

4 years agotestsuite/c-c++-common/cpp/pragma-eof.c: Add missing require fopenmp
Hans-Peter Nilsson [Sat, 18 Jul 2020 03:24:46 +0000 (05:24 +0200)]
testsuite/c-c++-common/cpp/pragma-eof.c: Add missing require fopenmp

Committed as obvious.  Gets rid of a spurious failure for mmix.

gcc/testsuite:
* c-c++-common/cpp/pragma-eof.c: Require fopenmp.

4 years agors6000: Generate _Decimal128 to _Decimal32 hardware conversion instructions
Peter Bergner [Sat, 18 Jul 2020 02:06:30 +0000 (21:06 -0500)]
rs6000: Generate _Decimal128 to _Decimal32 hardware conversion instructions

We do not currently generate hardware conversion instructions when
converting from _Decimal128 to _Decimal32.  There is no one instruction
that does the conversion, so we currently call the __dpd_trunctdsd2
lib function to do the conversion for us.  However, there is a short
sequence of dfp hardware instructions that will do the conversion
correctly.

2020-07-17  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/92488
* config/rs6000/dfp.md (trunctdsd2): New define_insn.
* config/rs6000/rs6000.md (define_attr "isa"): Add p9.
(define_attr "enabled"): Handle p9.

gcc/testsuite/
PR target/92488
* gcc.target/powerpc/convert-fp-128.c (bl, drsp, drdpq): Update counts.
(__dpd_trunctdsd2): Make conditional on !hard_dfp.
(__dpd_extendsddd2, __dpd_extendsdtd2, __dpd_truncddsd2,
__dpd_extendddtd2, __dpd_trunctddd2): Use !hard_dfp.
* gcc.target/powerpc/pr92488.c: New test.

4 years agoDaily bump.
GCC Administrator [Sat, 18 Jul 2020 00:16:24 +0000 (00:16 +0000)]
Daily bump.

4 years agolibgo: update to Go 1.14.6 release
Ian Lance Taylor [Fri, 17 Jul 2020 19:30:51 +0000 (12:30 -0700)]
libgo: update to Go 1.14.6 release

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

4 years agolibstdc++, coroutine: Add missing constexpr markers.
Iain Sandoe [Sun, 12 Jul 2020 19:16:21 +0000 (20:16 +0100)]
libstdc++, coroutine: Add missing constexpr markers.

The methods of the trivial awaitables are intended to
be constexpr.

libstdc++-v3/ChangeLog:

* include/std/coroutine: Mark the methods of the
trivial awaitables as constexpr.

4 years agoc++: Diagnose cv-qualified decltype(auto) [PR79815]
Marek Polacek [Wed, 8 Jul 2020 23:45:34 +0000 (19:45 -0400)]
c++: Diagnose cv-qualified decltype(auto) [PR79815]

"If the placeholder is the decltype(auto) type-specifier, T shall be the
placeholder alone." but we weren't detecting "const decltype(auto)".

I've just expanded the existing diagnostic detecting "decltype(auto) &"
and similar.

gcc/cp/ChangeLog:

PR c++/79815
* decl.c (grokdeclarator): Detect cv-qual decltype(auto).
* pt.c (do_auto_deduction): Likewise.

gcc/testsuite/ChangeLog:

PR c++/79815
* g++.dg/cpp1y/auto-fn59.C: New test.

4 years agomiddle-end: Prefer TRULY_NOOP_TRUNCATION_MODES_P over raw target hook.
Roger Sayle [Fri, 17 Jul 2020 13:06:45 +0000 (14:06 +0100)]
middle-end: Prefer TRULY_NOOP_TRUNCATION_MODES_P over raw target hook.

2020-07-16  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* function.c (assign_parm_setup_block): Use the macro
TRULY_NOOP_TRUNCATION_MODES_P instead of calling
targetm.truly_noop_truncation directly.

4 years agox86: Rename VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256
H.J. Lu [Mon, 13 Jul 2020 16:07:00 +0000 (09:07 -0700)]
x86: Rename VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256

Since ix86_emit_swsqrtsf shouldn't be called with DF vector modes, rename
VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256 and drop DF vector modes.

gcc/

PR target/96186
PR target/88713
* config/i386/sse.md (VF_AVX512VL_VF1_128_256): Renamed to ...
(VF1_AVX512ER_128_256): This.  Drop DF vector modes.
(rsqrt<mode>2): Replace VF_AVX512VL_VF1_128_256 with
VF1_AVX512ER_128_256.

gcc/testsuite/

PR target/96186
PR target/88713
* gcc.target/i386/pr88713-3.c: New test.

4 years agoAArch64: Add test for -mcpu=native
Tamar Christina [Fri, 17 Jul 2020 12:13:12 +0000 (13:13 +0100)]
AArch64: Add test for -mcpu=native

This adds some tests to the GCC testsuite for testing the
-mcpu=native code.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/aarch64-cpunative.exp: New test.
* gcc.target/aarch64/cpunative/info_0: New test.
* gcc.target/aarch64/cpunative/info_1: New test.
* gcc.target/aarch64/cpunative/info_10: New test.
* gcc.target/aarch64/cpunative/info_11: New test.
* gcc.target/aarch64/cpunative/info_12: New test.
* gcc.target/aarch64/cpunative/info_13: New test.
* gcc.target/aarch64/cpunative/info_14: New test.
* gcc.target/aarch64/cpunative/info_15: New test.
* gcc.target/aarch64/cpunative/info_2: New test.
* gcc.target/aarch64/cpunative/info_3: New test.
* gcc.target/aarch64/cpunative/info_4: New test.
* gcc.target/aarch64/cpunative/info_5: New test.
* gcc.target/aarch64/cpunative/info_6: New test.
* gcc.target/aarch64/cpunative/info_7: New test.
* gcc.target/aarch64/cpunative/info_8: New test.
* gcc.target/aarch64/cpunative/info_9: New test.
* gcc.target/aarch64/cpunative/native_cpu_0.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_1.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_10.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_11.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_12.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_13.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_14.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_15.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_2.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_3.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_4.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_5.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_6.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_7.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_8.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_9.c: New test.

4 years agoTestuite: Document environment setting directives
Tamar Christina [Fri, 17 Jul 2020 12:12:46 +0000 (13:12 +0100)]
Testuite: Document environment setting directives

This document some of the existing DejaGnu directives to modify
environment variables before test or compiler invocations.

gcc/ChangeLog:

* doc/sourcebuild.texi (dg-set-compiler-env-var,
dg-set-target-env-var): Document.

4 years agoTestsuite: Make it easier to debug environment setting functions
Tamar Christina [Fri, 17 Jul 2020 12:12:23 +0000 (13:12 +0100)]
Testsuite: Make it easier to debug environment setting functions

This adds verbose output to dg-set-compiler-env-var and dg-set-target-env-var
so you can actually see what they're setting when you add -v -v.

gcc/testsuite/ChangeLog:

* lib/gcc-dg.exp (dg-set-compiler-env-var, dg-set-target-env-var): Add
verbose output.

4 years agoArm: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:12:00 +0000 (13:12 +0100)]
Arm: Add GCC_CPUINFO override

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using these are added later on.

gcc/ChangeLog:

* config/arm/driver-arm.c (host_detect_local_cpu): Add GCC_CPUINFO.

4 years agoAArch64: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:10:53 +0000 (13:10 +0100)]
AArch64: Add GCC_CPUINFO override

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using this are added later on.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (host_detect_local_cpu):
Add GCC_CPUINFO.

4 years agoAArch64: Fix bugs in -mcpu=native detection.
Tamar Christina [Fri, 17 Jul 2020 12:10:28 +0000 (13:10 +0100)]
AArch64: Fix bugs in -mcpu=native detection.

This patch fixes a couple of issues in AArch64's -mcpu=native processing:

The buffer used to read the lines from /proc/cpuinfo is 128 bytes long.  While
this was enough in the past with the increase in architecture extensions it is
no longer enough.   It results in two bugs:

1) No option string longer than 127 characters is correctly parsed.  Features
   that are supported are silently ignored.

2) It incorrectly enables features that are not present on the machine:
  a) It checks for substring matching instead of full word matching.  This makes
     it incorrectly detect sb support when ssbs is provided instead.
  b) Due to the truncation at the 127 char border it also incorrectly enables
     features due to the full feature being cut off and the part that is left
     accidentally enables something else.

This breaks -mcpu=native detection on some of our newer system.

The patch fixes these issues by reading full lines up to the \n in a string.
This gives us the full feature line.  Secondly it creates a set from this string
to:

 1) Reduce matching complexity from O(n*m) to O(n*logm).
 2) Perform whole word matching instead of substring matching.

To make this code somewhat cleaner I also changed from using char* to using
std::string and std::set.

Note that I have intentionally avoided the use of ifstream and stringstream
to make it easier to backport.  I have also not change the substring matching
for the initial line classification as I cannot find a documented cpuinfo format
which leads me to believe there may be kernels out there that require this which
may be why the original code does this.

I also do not want this to break if the kernel adds a new line that is long and
indents the file by two tabs to keep everything aligned.  In short I think an
imprecise match is the right thing here.

Test for this is added as the last thing in this series as it requires some
changes to be made to be able to test this.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (INCLUDE_SET): New.
(parse_field): Use std::string.
(split_words, readline, find_field): New.
(host_detect_local_cpu): Fix truncation issues.

4 years agoamdgcn: Fix elf.h build issue
Andrew Stubbs [Fri, 17 Jul 2020 10:45:34 +0000 (11:45 +0100)]
amdgcn: Fix elf.h build issue

Allow building on systems with elf.h that includes AMDGPU definitions,
partially or completely.

gcc/ChangeLog:

* config/gcn/mkoffload.c (EM_AMDGPU): Undefine before defining.
(ELFOSABI_AMDGPU_HSA): Likewise.
(ELFABIVERSION_AMDGPU_HSA): Likewise.
(EF_AMDGPU_MACH_AMDGCN_GFX803): Likewise.
(EF_AMDGPU_MACH_AMDGCN_GFX900): Likewise.
(EF_AMDGPU_MACH_AMDGCN_GFX906): Likewise.
(reserved): Delete.

4 years agovector creation from two parts of two vectors produces TBL rather than ins (PR 93720)
Dmitrij Pochepko [Fri, 17 Jul 2020 09:24:46 +0000 (10:24 +0100)]
vector creation from two parts of two vectors produces TBL rather than ins (PR 93720)

The following patch enables vector permutations optimization by trying
to use ins instruction instead of slow and generic tbl.

example:

vector float f0(vector float a, vector float b)
{
  return __builtin_shuffle (a, a, (vector int){3, 1, 2, 3});
}

was compiled into:
...
adrp    x0, .LC0
ldr     q1, [x0, #:lo12:.LC0]
tbl     v0.16b, {v0.16b}, v1.16b
...

and after patch:
...
ins     v0.s[0], v0.s[3]
...

bootstrapped and tested on aarch64-linux-gnu with no regressions

gcc/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

PR target/93720
* config/aarch64/aarch64.c (aarch64_evpc_ins): New function.
(aarch64_expand_vec_perm_const_1): Call it.
* config/aarch64/aarch64-simd.md (aarch64_simd_vec_copy_lane): Make
public, and add a "@" prefix.

gcc/testsuite/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

PR target/93720
* gcc.target/aarch64/vins-1.c: New test.
* gcc.target/aarch64/vins-2.c: New test.
* gcc.target/aarch64/vins-3.c: New test.

Co-Authored-By: Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
4 years ago__builtin_shuffle sometimes should produce zip1 rather than TBL (PR82199)
Dmitrij Pochepko [Fri, 17 Jul 2020 09:20:12 +0000 (10:20 +0100)]
__builtin_shuffle sometimes should produce zip1 rather than TBL (PR82199)

The following patch enables vector permutations optimization by using
another vector element size when applicable.  It allows usage of simpler
instructions in applicable cases.

example:

vector float f(vector float a, vector float b)
{
  return __builtin_shuffle  (a, b, (vector int){0, 1, 4,5});
}

was compiled into:
...
adrp    x0, .LC0
ldr     q2, [x0, #:lo12:.LC0]
tbl     v0.16b, {v0.16b - v1.16b}, v2.16b
...

and after patch:
...
zip1    v0.2d, v0.2d, v1.2d
...

bootstrapped and tested on aarch64-linux-gnu with no regressions

gcc/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

PR target/82199
* config/aarch64/aarch64.c (aarch64_evpc_reencode): New function.
(aarch64_expand_vec_perm_const_1): Call it.

gcc/testsuite/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

PR target/82199
* gcc.target/aarch64/vdup_n_3.c: New test.
* gcc.target/aarch64/vzip_1.c: New test.
* gcc.target/aarch64/vzip_2.c: New test.
* gcc.target/aarch64/vzip_3.c: New test.
* gcc.target/aarch64/vzip_4.c: New test.

Co-Authored-By: Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
4 years agoAArch64: Add flags in built-in functions [PR94442]
xiezhiheng [Fri, 17 Jul 2020 09:00:37 +0000 (10:00 +0100)]
AArch64: Add flags in built-in functions [PR94442]

2020-07-17  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.c (enum aarch64_type_qualifiers):
Add new field flags.
(VAR1): Add new field FLAG in macro.
(VAR2): Likewise.
(VAR3): Likewise.
(VAR4): Likewise.
(VAR5): Likewise.
(VAR6): Likewise.
(VAR7): Likewise.
(VAR8): Likewise.
(VAR9): Likewise.
(VAR10): Likewise.
(VAR11): Likewise.
(VAR12): Likewise.
(VAR13): Likewise.
(VAR14): Likewise.
(VAR15): Likewise.
(VAR16): Likewise.
(aarch64_general_fold_builtin): Likewise.
(aarch64_general_gimple_fold_builtin): Likewise.
* config/aarch64/aarch64-simd-builtins.def: Add default flag for
each built-in function.
* config/aarch64/geniterators.sh: Add new field in BUILTIN macro.

4 years agogcc-changelog: Fix typo in output
Jonathan Wakely [Fri, 17 Jul 2020 08:53:19 +0000 (09:53 +0100)]
gcc-changelog: Fix typo in output

contrib/ChangeLog:

* gcc-changelog/git_update_version.py: Fix typo.

4 years agoFix PR96127
Andreas Krebbel [Fri, 17 Jul 2020 06:49:29 +0000 (08:49 +0200)]
Fix PR96127

In s390_expand_insv the movstrict patterns are always generated with a
CC clobber although only movstricthi actually needs one.  The patch
invokes the expanders instead of constructing the pattern by hand.

Bootstrapped and regression tested on s390x.

gcc/ChangeLog:

PR target/96127
* config/s390/s390.c (s390_expand_insv): Invoke the movstrict
expanders to generate the pattern.
* config/s390/s390.md ("*movstricthi", "*movstrictqi"): Remove the
'*' to have callable expanders.

gcc/testsuite/ChangeLog:

PR target/96127
* gcc.target/s390/pr96127.c: New test.

4 years agors6000/test: Add -fno-vect-cost-model to conv-vectorize-[12].c
Kewen Lin [Fri, 17 Jul 2020 05:31:03 +0000 (00:31 -0500)]
rs6000/test: Add -fno-vect-cost-model to conv-vectorize-[12].c

In my testing with cost tweaking for vector with length, I found
two cases below didn't get the expected output.  Since the expected
instructions reply on the vectorization occurrence, we don't expect
vectorization gets disabled by cost model.

To make it not fragile, the fix is to force it without vect cost model.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/conv-vectorize-1.c: Add option
-fno-vect-cost-model.
* gcc.target/powerpc/conv-vectorize-2.c: Likewise.

4 years agoDaily bump.
GCC Administrator [Fri, 17 Jul 2020 00:16:27 +0000 (00:16 +0000)]
Daily bump.

4 years agocombine: Use single_set for is_just_move
Segher Boessenkool [Thu, 16 Jul 2020 23:42:46 +0000 (23:42 +0000)]
combine: Use single_set for is_just_move

Since we now only call is_just_move on the original instructions, we
always have an rtx_insn* (not just a pattern), so we can use single_set
on it.  This makes no detectable difference at all on all thirty Linux
targets I test, but it does help cris, and it is simpler, cleaner code
anyway.

2020-07-16  Hans-Peter Nilsson  <hp@axis.com>
    Segher Boessenkool  <segher@kernel.crashing.org>

PR target/93372
* combine.c (is_just_move): Take an rtx_insn* as argument.  Use
single_set on it.

4 years agoopenacc: Fix standalone attach for Fortran assumed-shape array pointers
Julian Brown [Tue, 9 Jun 2020 22:53:39 +0000 (15:53 -0700)]
openacc: Fix standalone attach for Fortran assumed-shape array pointers

This patch makes it so that an "attach" operation for a Fortran pointer
with an array descriptor copies that array descriptor to the target,
and similarly that detach operations release the array descriptor.

2020-07-16  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Rework OpenACC
attach/detach handling for arrays with descriptors.

gcc/testsuite/
* gfortran.dg/goacc/attach-descriptor.f90: New test.

libgomp/
* testsuite/libgomp.oacc-fortran/attach-descriptor-1.f90: New test.
* testsuite/libgomp.oacc-fortran/attach-descriptor-2.f90: New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
4 years agocoroutines: Correct frame capture of compiler temps [PR95591+4].
Iain Sandoe [Sat, 11 Jul 2020 07:49:33 +0000 (08:49 +0100)]
coroutines: Correct frame capture of compiler temps [PR95591+4].

When a full expression contains a co_await (or co_yield), this means
that it might be suspended; which would destroy temporary variables
(on a stack for example).  However the language guarantees that such
temporaries are live until the end of the expression.

In order to preserve this, we 'promote' temporaries where necessary
so that they are saved in the coroutine frame (which allows them to
remain live potentially until the frame is destroyed).  In addition,
sub-expressions that produce control flow (such as TRUTH_AND/OR_IF
or COND_EXPR) must be handled specifically to ensure that await
expressions are properly expanded.

This patch corrects two mistakes in which we were (a) failing to
promote some temporaries and (b) we we failing to sequence DTORs for
the captures properly. This manifests in a number of related (but not
exact duplicate) PRs.

The revised code collects the actions into one place and maps all the
control flow into one form - a benefit of this is that co_returns are
now expanded earlier (which provides an opportunity to address PR95517
in some future patch).

We replace a statement that contains await expression(s) with a bind
scope that has a variable list describing the temporaries that have
been 'promoted' and a statement list that contains a series of cleanup
expressions for each of those.  Where we encounter nested conditional
expressions, these are wrapped in a try-finally block with a guard var
for each sub-expression variable that needs a DTOR.  The guards are all
declared and initialized to false before the first conditional sub-
expression.  The 'finally' block contains a series of if blocks (one
per guard variable) enclosing the relevant DTOR.

Variables listed in a bind scope in this manner are automatically moved
to a coroutine frame version by existing code (so we re-use that rather
than having a separate mechanism).

gcc/cp/ChangeLog:

PR c++/95591
PR c++/95599
PR c++/95823
PR c++/95824
PR c++/95895
* coroutines.cc (struct coro_ret_data): Delete.
(coro_maybe_expand_co_return): Delete.
(co_return_expander): Delete.
(expand_co_returns): Delete.
(co_await_find_in_subtree): Remove unused name.
(build_actor_fn): Remove unused parm, remove handling
for co_return expansion.
(register_await_info): Demote duplicate info message to a
warning.
(coro_make_frame_entry): Move closer to use site.
(struct susp_frame_data): Add fields for final suspend label
and a flag to indicate await expressions with initializers.
(captures_temporary): Delete.
(register_awaits): Remove unused code, update comments.
(find_any_await): New.
(tmp_target_expr_p): New.
(struct interesting): New.
(find_interesting_subtree): New.
(struct var_nest_node): New.
(flatten_await_stmt): New.
(handle_nested_conditionals): New.
(process_conditional): New.
(replace_statement_captures): Rename to...
(maybe_promote_temps): ... this.
(maybe_promote_captured_temps): Delete.
(analyze_expression_awaits): Check for await expressions with
initializers.  Simplify handling for truth-and/or-if.
(expand_one_truth_if): Simplify (map cases that need expansion
to COND_EXPR).
(await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
handling for truth-and/or-if expressions.
(register_local_var_uses): Ensure that we create names in the
implementation namespace.
(morph_fn_to_coro): Add final suspend label to suspend frame
callback data and remove it from the build_actor_fn call.

gcc/testsuite/ChangeLog:

PR c++/95591
PR c++/95599
PR c++/95823
PR c++/95824
PR c++/95895
* g++.dg/coroutines/pr95591.C: New test.
* g++.dg/coroutines/pr95599.C: New test.
* g++.dg/coroutines/pr95823.C: New test.
* g++.dg/coroutines/pr95824.C: New test.

4 years agoanalyzer: Use noexcept instead of throw() for C++11 and later (PR 96014)
Jonathan Wakely [Thu, 16 Jul 2020 10:44:32 +0000 (11:44 +0100)]
analyzer: Use noexcept instead of throw() for C++11 and later (PR 96014)

gcc/testsuite/ChangeLog:

PR testsuite/96014
* g++.dg/analyzer/pr94028.C: Replace dynamic exception
specification with noexcept-specifier for C++11 and later.

4 years agoi386: Additional peephole2 to use flags from CMPXCHG more [PR96189]
Uros Bizjak [Thu, 16 Jul 2020 18:11:43 +0000 (20:11 +0200)]
i386: Additional peephole2 to use flags from CMPXCHG more [PR96189]

CMPXCHG instruction sets ZF flag if the values in the destination operand
and EAX register are equal; otherwise the ZF flag is cleared and value
from destination operand is loaded to EAX. Following assembly:

        xorl    %eax, %eax
        lock cmpxchgl   %edx, (%rdi)
        testl   %eax, %eax
        sete    %al

can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened.  This patch adds peephole2
pattern to also handle XOR zeroing and load of -1 by OR.

2020-07-16  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/96189
* config/i386/sync.md
(peephole2 to remove unneded compare after CMPXCHG):
New pattern, also handle XOR zeroing and load of -1 by OR.

gcc/testsuite/ChangeLog:
PR target/96189
* gcc.target/i386/pr96189-1.c: New test.

4 years agoReunify x86 stack checking implementation
Eric Botcazou [Thu, 16 Jul 2020 15:50:26 +0000 (17:50 +0200)]
Reunify x86 stack checking implementation

The stack clash protection mechanism in the x86 back-end was implemented
by largely duplicating the existing stack checking implementation.  Now
the only significant difference between them is the probing window, which
is shifted by 1 probing interval (not 2 as documented in explow.c), but we
can certainly do 1 more probe for stack checking even if it is redundant
in almost all cases.

gcc/ChangeLog:
* config/i386/i386.c (ix86_compute_frame_layout): Minor tweak.
(ix86_adjust_stack_and_probe): Delete.
(ix86_adjust_stack_and_probe_stack_clash): Rename to above and add
PROTECTION_AREA parameter.  If it is true, probe PROBE_INTERVAL plus
a small dope beyond SIZE bytes.
(ix86_emit_probe_stack_range): Use local variable.
(ix86_expand_prologue): Adjust calls to ix86_adjust_stack_and_probe
and tidy up the stack checking code.
* explow.c (get_stack_check_protect): Fix head comment.
(anti_adjust_stack_and_probe_stack_clash): Likewise.
(allocate_dynamic_stack_space): Add comment.

* tree-nested.c (lookup_field_for_decl): Set the DECL_IGNORED_P and
TREE_NO_WARNING but not TREE_ADDRESSABLE flags on the field.