Commit Graph

179324 Commits

Author SHA1 Message Date
Richard Biener
db918db2c3 enable live comparison vectorization
This removes a check preventing vectorization of live results of
vectorized comparisons.  I tested it with AVX512 mask registers
(inspecting assembly) and traditional vector masks.

2020-09-09  Richard Biener  <rguenther@suse.de>

	* tree-vect-stmts.c (vectorizable_comparison): Allow
	STMT_VINFO_LIVE_P stmts.

	* gcc.dg/vect/vect-live-6.c: New testcase.
2020-09-09 13:12:27 +02:00
Tobias Burnus
cbc12c5824 gfortran.dg/gomp/combined-if.f90: Update nvptx tree-dump times
nvptx has additional omp simd lines with _simt_ with -O1 and higher.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/combined-if.f90: Update scan-tree-dump-times for
	'omp simd.*if' for nvptx even more.
2020-09-09 11:49:08 +02:00
Richard Biener
783dc66f9c enable live condition vectorization
This removes a check preventing vectorization of live results of
vectorized conditions.

2020-09-09  Richard Biener  <rguenther@suse.de>

	* tree-vect-stmts.c (vectorizable_condition): Allow
	STMT_VINFO_LIVE_P stmts.

	* gcc.dg/vect/vect-cond-13.c: New testcase.
	* gcc.target/i386/pr87007-4.c: Adjust.
	* gcc.target/i386/pr87007-5.c: Likewise.
2020-09-09 11:36:19 +02:00
Rainer Orth
0d7d52131a config: Sync largefile.m4 from binutils-gdb
The following patch improves handling of largefile support with procfs
on 32-bit Solaris.  It has already been approved and installed for
binutils-gdb in the thread starting at

	[PATCH] Unify Solaris procfs and largefile handling
        https://sourceware.org/pipermail/gdb-patches/2020-June/169977.html

I'm syncing the config/largefile.m4 part to gcc now which is the master
for config.  Since ACX_LARGEFILE isn't used anywhere in the gcc tree,
I'm installing it as obvious.

2020-09-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	config:
	* largefile.m4: Sync from binutils-gdb.
2020-09-09 11:02:01 +02:00
Richard Biener
fb51be60c8 tree-optimization/96978 - fix fallout of BB vectorization of live stmts
This avoids looking at STMT_VINFO_LIVE_P when vectorizing BBs.

2020-09-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96978
	* tree-vect-stmts.c (vectorizable_condition): Do not
	look at STMT_VINFO_LIVE_P for BB vectorization.
	(vectorizable_comparison): Likewise.
2020-09-09 10:38:34 +02:00
liuhongt
e470d8af81 Implement __builtin_thread_pointer for x86 TLS.
gcc/ChangeLog:
	PR target/96955
	* config/i386/i386.md (get_thread_pointer<mode>): New
	expander.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/builtin_thread_pointer.c: New test.
2020-09-09 16:17:42 +08:00
Tobias Burnus
61c2d476a5 Fortran: Fixes for OpenMP loop-iter privatization (PRs 95109 + 94690)
This commit also fixes a gfortran.dg/gomp/target1.f90 regression;
target1.f90 tests the resolve.c and openmp.c changes.

gcc/fortran/ChangeLog:

	PR fortran/95109
	PR fortran/94690
	* resolve.c (gfc_resolve_code): Also call
	gfc_resolve_omp_parallel_blocks for 'distribute parallel do (simd)'.
	* openmp.c (gfc_resolve_omp_parallel_blocks): Handle it.
	(gfc_resolve_do_iterator): Remove special code for SIMD, which is
	not needed.
	* trans-openmp.c (gfc_trans_omp_target): For TARGET_PARALLEL_DO_SIMD,
	call simd not do processing function.

gcc/testsuite/ChangeLog:

	PR fortran/95109
	PR fortran/94690
	* gfortran.dg/gomp/combined-if.f90: Update scan-tree-dump-times for
	'omp simd.*if'.
	* gfortran.dg/gomp/openmp-simd-5.f90: New test.
2020-09-09 09:33:51 +02:00
Ian Lance Taylor
f56f1a5a75 libbacktrace: don't strip leading underscore on 64-bit PE
* pecoff.c (coff_initialize_syminfo): Add is_64 parameter.
	(coff_add): Determine and pass is_64.
2020-09-08 19:21:54 -07:00
Ian Lance Taylor
181f877b6c libbacktrace: fetch executable path on macOS
PR libbacktrace/96973
	* fileline.c (macho_get_executable_path): New static function.
	(fileline_initialize): Call macho_get_executable_path.
2020-09-08 19:09:21 -07:00
Ian Lance Taylor
0755f573f0 libbacktrace: avoid ambiguous binary search
Searching for a range match can cause the search order to not match
the sort order, which can cause libbacktrace to miss matching entries.
Allocate an extra entry at the end of function_addrs and unit_addrs vectors,
so that we can safely compare to the next entry when searching.
Adjust the matching code accordingly.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/44.

	* dwarf.c (function_addrs_search): Compare against the next entry
	low address, not the high address.
	(unit_addrs_search): Likewise.
	(build_address_map): Add a trailing unit_addrs.
	(read_function_entry): Add a trailing function_addrs.
	(read_function_info): Likewise.
	(report_inlined_functions): Search backward for function_addrs
	match.
	(dwarf_lookup_pc): Search backward for unit_addrs and
	function_addrs matches.
2020-09-08 18:22:35 -07:00
GCC Administrator
31a0504624 Daily bump. 2020-09-09 00:16:29 +00:00
Ian Lance Taylor
494c5103c9 libbacktrace: fix tipo in comment
* simple.c (simple_unwind): Correct comment spelling.
2020-09-08 15:07:24 -07:00
Ian Lance Taylor
a8a7a97b4e libbacktrace: correct memory lengths in Mach-O dsym support
* macho.c (macho_add_dsym): Make space for '/' in dsym.  Use
	correct length when freeing diralc.
2020-09-08 14:51:32 -07:00
Julian Brown
8183ebcdc1 openacc: Fix atomic_capture-2.c iteration-ordering issues
The test case was written with assumptions about loop iteration ordering
that are not guaranteed by OpenACC and do not apply on all targets,
in particular AMD GCN. This patch removes those assumptions.

2020-09-08  Julian Brown  <julian@codesourcery.com>

libgomp/
	* testsuite/libgomp.oacc-c-c++-common/atomic_capture-2.c: Remove
	iteration-ordering assumptions.
2020-09-08 13:26:42 -07:00
Julian Brown
e929d65b48 amdgcn: Add waitcnt after LDS write instructions
Data-share write (ds_write) instructions do not necessarily complete
the write to LDS immediately. When a write completes, LGKM_CNT is
decremented. For now, we wait until LGKM_CNT reaches zero after each
ds_write instruction.

This fixes a race condition in the case where LDS is read immediately
after being written. This can happen with broadcast operations.

2020-09-08  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/gcn/gcn-valu.md (scatter<mode>_insn_1offset_ds<exec_scatter>):
	Add waitcnt.
	* config/gcn/gcn.md (*mov<mode>_insn, *movti_insn): Add waitcnt to
	ds_write alternatives.
2020-09-08 13:26:42 -07:00
Julian Brown
3aee3aaf48 openacc: Fix mkoffload SGPR/VGPR count parsing for HSACO v3
If an offload kernel uses a large number of VGPRs, AMD GCN hardware may
need to limit the number of threads/workers launched for that kernel.
The number of SGPRs/VGPRs in use is detected by mkoffload and recorded in
the processed output.  The patterns emitted detailing SGPR/VGPR occupancy
changed between HSACO v2 and v3 though, so this patch updates parsing
to account for that.

2020-09-08  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/gcn/mkoffload.c (process_asm): Initialise regcount.  Update
	scanning for SGPR/VGPR usage for HSACO v3.
2020-09-08 13:26:42 -07:00
Julian Brown
d6d9be7c6b openacc: Fix race condition in Fortran loop collapse tests
The gangs participating in a gang-partitioned loop are not all guaranteed
to complete before some given gang continues to execute beyond that loop.
This means that two existing test cases contain a race condition,
because a loop that may be gang-partitioned is followed immediately by
another loop.  The fix is to place the loops in separate parallel regions.

2020-09-08  Julian Brown  <julian@codesourcery.com>

libgomp/
	* testsuite/libgomp.oacc-fortran/collapse-1.f90: Fix race condition.
	* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.
2020-09-08 13:26:42 -07:00
Ian Lance Taylor
488e33339e libbacktrace: correctly swap Mach-O 32-bit file offset
libbacktrace/ChangeLog:
	PR libbacktrace/96973
	* macho.c (macho_add_fat): Correctly swap 32-bit file offset.
2020-09-08 13:20:26 -07:00
Ian Lance Taylor
651c61c3ce libbacktrace: only match magic number at start of line
libbacktrace/ChangeLog:
	PR libbacktrace/96971
	* filetype.awk: Only match magic number at start of line.
2020-09-08 12:52:29 -07:00
Felix Willgerodt
87603e5656 floatformat.h: Add bfloat16 support.
This change is motivated by a patchset that adds bfloat16 debugging
support for new avx512 instructions to GDB. The gdb thread can be found
here: https://sourceware.org/pipermail/gdb-patches/2020-July/170820.html

include:
2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

	* floatformat.h (floatformat_bfloat16_big): New.
	(floatformat_bfloat16_little): New.

libiberty:
2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

	* floatformat.c (floatformat_bfloat16_big): New.
	(floatformat_bfloat16_little): New.
2020-09-08 17:38:12 +00:00
David Malcolm
34d926dba0 analyzer: fix another ICE in constructor-handling [PR96949]
PR analyzer/96949 reports an ICE with
--param analyzer-max-svalue-depth=0, where the param value leads
to INTEGER_CST values in a RANGE_EXPR being treated as unknown
symbolic values.

This patch replaces implicit assumptions that these values are
concrete (and thus have concrete bit offsets), adding
error-handling for symbolic cases instead of assertions.

gcc/analyzer/ChangeLog:
	PR analyzer/96949
	* store.cc (binding_map::apply_ctor_val_to_range): Add
	error-handling for the cases where we have symbolic offsets.

gcc/testsuite/ChangeLog:
	PR analyzer/96949
	* gfortran.dg/analyzer/pr96949.f90: New test.
2020-09-08 10:51:22 -04:00
David Malcolm
af656c401e analyzer: fix ICE on RANGE_EXPR with CONSTRUCTOR value [PR96950]
gcc/analyzer/ChangeLog:
	PR analyzer/96950
	* store.cc (binding_map::apply_ctor_to_region): Handle RANGE_EXPR
	where min_index == max_index.
	(binding_map::apply_ctor_val_to_range): Replace assertion that we
	don't have a CONSTRUCTOR value with error-handling.
2020-09-08 10:50:12 -04:00
David Malcolm
47997a32e6 analyzer: fix ICE on machine-specific builtins [PR96962]
In g:ee7bfbe5eb70a23bbf3a2cedfdcbd2ea1a20c3f2 I added a
  switch (DECL_UNCHECKED_FUNCTION_CODE (callee_fndecl))
to region_model::on_call_pre guarded by
  fndecl_built_in_p (callee_fndecl).
I meant to handle only normal built-ins, whereas this
single-argument overload of fndecl_built_in_p returns true for any
kind of built-in.

PR analyzer/96962 reports a case where this matches for a
machine-specific builtin, leading to an ICE.  Fixed thusly.

gcc/analyzer/ChangeLog:
	PR analyzer/96962
	* region-model.cc (region_model::on_call_pre): Fix guard on switch
	on built-ins to only consider BUILT_IN_NORMAL, rather than other
	kinds of build-ins.
2020-09-08 10:49:05 -04:00
Aldy Hernandez
19b0fed7c2 PR tree-optimization/96967 - cast label range to type of switch operand
PR tree-optimization/96967
	* tree-vrp.c (find_case_label_range): Cast label range to
	type of switch operand.
2020-09-08 13:43:35 +02:00
Jozef Lawrynowicz
b75863a88e MSP430: Fix detection of assembler support for .mspabi_attribute
The assembly code ".mspabi_attribute 4,1" uses the object attribute
mechanism to indicate that the 430 ISA is in use. However, the default
ISA is 430X, so GAS fails to assemble this since the ISA wasn't also set
to 430 on the command line.

gcc/ChangeLog:

	* config/msp430/msp430.c (msp430_file_end): Fix jumbled
	HAVE_AS_MSPABI_ATTRIBUTE and HAVE_AS_GNU_ATTRIBUTE checks.
	* configure: Regenerate.
	* configure.ac: Use ".mspabi_attribute 4,2" to check for assembler
	support for this object attribute directive.
2020-09-08 11:31:56 +01:00
Iain Buclaw
285d81be97 libphobos: libdruntime doesn't support shadow stack (PR95680)
Rather than implementing support within D runtime itself, use libc
getcontext/swapcontext functions if CET is enabled.

Removes whatever CET support was in the switchContext routine for x86
D runtime, along with setting version AsmExternal, so that the fallback
ucontext_t implementation is used, which is capable of doing shadow
stack handling.

libphobos/ChangeLog:

	PR d/95680
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (DCFG_ENABLE_CET): Substitute.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/config/x86/switchcontext.S: Remove CET support code.
	* libdruntime/core/thread.d: Import gcc.config.  Don't set version
	AsmExternal when GNU_Enable_CET is true.
	* libdruntime/gcc/config.d.in (GNU_Enable_CET): Define.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2020-09-08 12:14:56 +02:00
Jozef Lawrynowicz
cd2d3822ca MSP430: Use enums to handle -mcpu= values
The -mcpu= option accepts only a handful of string values.
Using enums instead of strings to handle the accepted values removes the
need to have specific processing of the strings in the backend, and
simplifies any comparisons which need to be performed on the value.

It also allows the default value to have semantic equivalence to a user
set value, whilst retaining the ability to differentiate between them.
Practically, this allows a user set -mcpu= value to override the the ISA set by
-mmcu, whilst the default -mcpu= value can still have an explicit meaning.

gcc/ChangeLog:

	* common/config/msp430/msp430-common.c (msp430_handle_option): Remove
	OPT_mcpu_ handling.
	Set target_cpu value to new enum values when parsing certain -mmcu=
	values.
	* config/msp430/msp430-opts.h (enum msp430_cpu_types): New.
	* config/msp430/msp430.c (msp430_option_override): Handle new
	target_cpu enum values.
	Set target_cpu using extracted value for given MCU when -mcpu=
	option is not passed by the user.
	* config/msp430/msp430.opt: Handle -mcpu= values using enums.

gcc/testsuite/ChangeLog:

	* gcc.target/msp430/mcpu-is-430.c: New test.
	* gcc.target/msp430/mcpu-is-430x.c: New test.
	* gcc.target/msp430/mcpu-is-430xv2.c: New test.
2020-09-08 10:12:25 +01:00
Thomas Koenig
213200a27d Fix description of FINDLOC result.
gcc/fortran/ChangeLog:

	* intrinsic.texi: Fix description of FINDLOC result.
2020-09-08 08:13:29 +02:00
Alan Modra
fff56ce438 ubsan: d-demangle.c:214 signed integer overflow
Running the libiberty testsuite
./test-demangle < libiberty/testsuite/d-demangle-expected
libiberty/d-demangle.c:214:14: runtime error: signed integer overflow: 922337203 * 10 cannot be represented in type 'long int'

On looking at silencing ubsan, I found a real bug in dlang_number.
For a 32-bit long, some overflows won't be detected.  For example,
21474836480.  Why?  Well 214748364 * 10 is 0x7FFFFFF8 (no overflow so
far).  Adding 8 gives 0x80000000 (which does overflow but there is no
test for that overflow in the code).  Then multiplying 0x80000000 * 10
= 0x500000000 = 0 won't be caught by the multiplication overflow test.
The same holds for a 64-bit long using similarly crafted digit
sequences.

	* d-demangle.c: Include limits.h.
	(ULONG_MAX, UINT_MAX): Provide fall-back definition.
	(dlang_number): Simplify and correct overflow test.  Only
	write *ret on returning non-NULL.  Make "ret" an unsigned long*.
	Only succeed for result of [0,UINT_MAX].
	(dlang_decode_backref): Simplify and correct overflow test.
	Only write *ret on returning non-NULL.  Only succeed for
	result [1,MAX_LONG].
	(dlang_backref): Remove now unnecessary range check.
	(dlang_symbol_name_p): Likewise.
	(string_need): Take a size_t n arg, and use size_t tem.
	(string_append): Use size_t n.
	(string_appendn, string_prependn): Take a size_t n arg.
	(TEMPLATE_LENGTH_UNKNOWN): Define as -1UL.
	(dlang_lname, dlang_parse_template): Take an unsigned long len
	arg.
	(dlang_symbol_backref, dlang_identifier, dlang_parse_integer),
	(dlang_parse_integer, dlang_parse_string),
	(dlang_parse_arrayliteral, dlang_parse_assocarray),
	(dlang_parse_structlit, dlang_parse_tuple),
	(dlang_template_symbol_param, dlang_template_args): Use
	unsigned long variables.
	* testsuite/d-demangle-expected: Add new tests.
2020-09-08 10:45:15 +09:30
GCC Administrator
a995c40d03 Daily bump. 2020-09-08 00:16:32 +00:00
Harald Anlauf
9164caf25c PR fortran/96711 - ICE with NINT() for integer(16) result
When rounding a real to the nearest integer, temporarily convert the real
argument to a longer real kind when the result is of type/kind integer(16).

gcc/fortran/ChangeLog:

	* trans-intrinsic.c (build_round_expr): Use temporary with
	appropriate kind for conversion before rounding to nearest
	integer when the result precision is 128 bits.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr96711.f90: New test.
2020-09-07 21:42:30 +02:00
Richard Sandiford
6001db79c4 lra: Avoid cycling on certain subreg reloads [PR96796]
This PR is about LRA cycling for a reload of the form:

----------------------------------------------------------------------------
Changing pseudo 196 in operand 1 of insn 103 on equiv [r105:DI*0x8+r140:DI]
      Creating newreg=287, assigning class ALL_REGS to slow/invalid mem r287
      Creating newreg=288, assigning class ALL_REGS to slow/invalid mem r288
  103: r203:SI=r288:SI<<0x1+r196:DI#0
      REG_DEAD r196:DI
    Inserting slow/invalid mem reload before:
  316: r287:DI=[r105:DI*0x8+r140:DI]
  317: r288:SI=r287:DI#0
----------------------------------------------------------------------------

The problem is with r287.  We rightly give it a broad starting class of
POINTER_AND_FP_REGS (reduced from ALL_REGS by preferred_reload_class).
However, we never make forward progress towards narrowing it down to
a specific choice of class (POINTER_REGS or FP_REGS).

I think in practice we rely on two things to narrow a reload pseudo's
class down to a specific choice:

(1) a restricted class is specified when the pseudo is created

    This happens for input address reloads, where the class is taken
    from the target's chosen base register class.  It also happens
    for simple REG reloads, where the class is taken from the chosen
    alternative's constraints.

(2) uses of the reload pseudo as a direct input operand

    In this case get_reload_reg tries to reuse the existing register
    and narrow its class, instead of creating a new reload pseudo.

However, neither occurs here.  As described above, r287 rightly
starts out with a wide choice of class, ultimately derived from
ALL_REGS, so we don't get (1).  And as the comments in the PR
explain, r287 is never used as an input reload, only the subreg is,
so we don't get (2):

----------------------------------------------------------------------------
         Choosing alt 13 in insn 317:  (0) r  (1) w {*movsi_aarch64}
      Creating newreg=291, assigning class FP_REGS to r291
  317: r288:SI=r291:SI
    Inserting insn reload before:
  320: r291:SI=r287:DI#0
----------------------------------------------------------------------------

IMO, in this case we should rely on the reload of r316 to narrow
down the class of r278.  Currently we do:

----------------------------------------------------------------------------
         Choosing alt 7 in insn 316:  (0) r  (1) m {*movdi_aarch64}
      Creating newreg=289 from oldreg=287, assigning class GENERAL_REGS to r289
  316: r289:DI=[r105:DI*0x8+r140:DI]
    Inserting insn reload after:
  318: r287:DI=r289:DI
---------------------------------------------------

i.e. we create a new pseudo register r289 and give *that* pseudo
GENERAL_REGS instead.  This is because get_reload_reg only narrows
down the existing class for OP_IN and OP_INOUT, not OP_OUT.

But if we have a reload pseudo in a reload instruction and have chosen
a specific class for the reload pseudo, I think we should simply install
it for OP_OUT reloads too, if the class is a subset of the existing class.
We will need to pick such a register whatever happens (for r289 in the
example above).  And as explained in the PR, doing this actually avoids
an unnecessary move via the FP registers too.

The patch is quite aggressive in that it does this for all reload
pseudos in all reload instructions.  I wondered about reusing the
condition for a reload move in in_class_p:

          INSN_UID (curr_insn) >= new_insn_uid_start
          && curr_insn_set != NULL
          && ((OBJECT_P (SET_SRC (curr_insn_set))
               && ! CONSTANT_P (SET_SRC (curr_insn_set)))
              || (GET_CODE (SET_SRC (curr_insn_set)) == SUBREG
                  && OBJECT_P (SUBREG_REG (SET_SRC (curr_insn_set)))
                  && ! CONSTANT_P (SUBREG_REG (SET_SRC (curr_insn_set)))))))

but I can't really justify that on first principles.  I think we
should apply the rule consistently until we have a specific reason
for doing otherwise.

gcc/
	PR rtl-optimization/96796
	* lra-constraints.c (in_class_p): Add a default-false
	allow_all_reload_class_changes_p parameter.  Do not treat
	reload moves specially when the parameter is true.
	(get_reload_reg): Try to narrow the class of an existing OP_OUT
	reload if we're reloading a reload pseudo in a reload instruction.

gcc/testsuite/
	PR rtl-optimization/96796
	* gcc.c-torture/compile/pr96796.c: New test.
2020-09-07 20:15:36 +01:00
Jonathan Wakely
ec5096f48b libstdc++: Simplify chrono::duration::_S_gcd
We can simplify this constexpr function further because we know that
period::num >= 1 and period::den >= 1 so only the remainder can ever be
zero.

libstdc++-v3/ChangeLog:

	* include/std/chrono (duration::_S_gcd): Use invariant that
	neither value is zero initially.
2020-09-07 20:09:17 +01:00
Jonathan Wakely
00ffe73007 libstdc++: Simplify constraints for semiregular-box [LWG 3477]
libstdc++-v3/ChangeLog:

	* include/std/ranges (__box): Simplify constraints as per LWG 3477.
2020-09-07 20:09:17 +01:00
Andrea Corallo
e147bb0faa vec: Revert "dead code removal in tree-vect-loop.c" and add a comment.
gcc/ChangeLog

2020-09-07  Andrea Corallo  <andrea.corallo@arm.com>

	* tree-vect-loop.c (vect_estimate_min_profitable_iters): Revert
	dead-code removal introduced by 09fa6acd8d + add a comment to
	clarify.
2020-09-07 19:49:25 +02:00
Jozef Lawrynowicz
016b190036 doc: Update documentation on MODE_PARTIAL_INT subregs
In d8487c949a, MODE_PARTIAL_INT modes were changed from having an
unknown number of undefined bits, to having a known number of undefined
bits, however the documentation on using SUBREG expressions with
MODE_PARTIAL_INT modes was not updated to reflect this.

gcc/ChangeLog:

	* doc/rtl.texi (subreg): Fix documentation to state there is a known
	number of undefined bits in regs and subregs of MODE_PARTIAL_INT modes.
2020-09-07 17:54:23 +01:00
Jozef Lawrynowicz
7f87e44669 MSP430: Don't override default ISA when MCU name is unrecognized
430X is the default ISA under normal operation, so even when the MCU name
passed to -mmcu= is unrecognized, it should not be overriden.

gcc/ChangeLog:

	* config/msp430/msp430.c (msp430_option_override): Don't set the
	ISA to 430 when the MCU is unrecognized.

gcc/testsuite/ChangeLog:

	* gcc.target/msp430/430x-default-isa.c: New test.
2020-09-07 17:35:04 +01:00
Iain Sandoe
84e9fc470f Darwin, testsuite : Update pubtypes tests.
Recent changes in debug output have resulted in a change
in the length of the pub types info.  This updates the tests to
reflect the new length.

gcc/testsuite/ChangeLog:

	* gcc.dg/pubtypes-2.c: Amend Pub Info Length.
	* gcc.dg/pubtypes-3.c: Likewise.
	* gcc.dg/pubtypes-4.c: Likewise.
2020-09-07 17:08:47 +01:00
Iain Sandoe
2e746cebd9 Darwin : Update libc function availability.
Darwin libc has sincos from 10.9 (darwin13) onwards.

gcc/ChangeLog:

	* config/darwin.c (darwin_libc_has_function): Report sincos
	available from 10.9.
2020-09-07 17:06:52 +01:00
Alex Coplan
2f8ae301f6 aarch64: Remove redundant mult patterns
Following on from the previous commit to fix up the syntax for
add/sub/adds/subs and friends with a sign/zero-extended operand, this
patch removes the "mult" variants of these patterns which are all
redundant.

This patch removes the following patterns from the AArch64 backend:

 *adds_mul_imm_<mode>
 *subs_mul_imm_<mode>
 *adds_<optab><mode>_multp2
 *subs_<optab><mode>_multp2
 *add_mul_imm_<mode>
 *add_<optab><ALLX:mode>_mult_<GPI:mode>
 *add_<optab><SHORT:mode>_mult_si_uxtw
 *add_<optab><mode>_multp2
 *add_<optab>si_multp2_uxtw
 *add_uxt<mode>_multp2
 *add_uxtsi_multp2_uxtw
 *sub_mul_imm_<mode>
 *sub_mul_imm_si_uxtw
 *sub_<optab><mode>_multp2
 *sub_<optab>si_multp2_uxtw
 *sub_uxt<mode>_multp2
 *sub_uxtsi_multp2_uxtw
 *neg_mul_imm_<mode>2
 *neg_mul_imm_si2_uxtw

Together with the following predicates which were used only by these
patterns:

  aarch64_pwr_imm3
  aarch64_pwr_2_si
  aarch64_pwr_2_di

These patterns are all redundant since multiplications by powers of two
should be represented as shfits outside a (mem).

---

gcc/ChangeLog:

	* config/aarch64/aarch64.md (*adds_mul_imm_<mode>): Delete.
	(*subs_mul_imm_<mode>): Delete.
	(*adds_<optab><mode>_multp2): Delete.
	(*subs_<optab><mode>_multp2): Delete.
	(*add_mul_imm_<mode>): Delete.
	(*add_<optab><ALLX:mode>_mult_<GPI:mode>): Delete.
	(*add_<optab><SHORT:mode>_mult_si_uxtw): Delete.
	(*add_<optab><mode>_multp2): Delete.
	(*add_<optab>si_multp2_uxtw): Delete.
	(*add_uxt<mode>_multp2): Delete.
	(*add_uxtsi_multp2_uxtw): Delete.
	(*sub_mul_imm_<mode>): Delete.
	(*sub_mul_imm_si_uxtw): Delete.
	(*sub_<optab><mode>_multp2): Delete.
	(*sub_<optab>si_multp2_uxtw): Delete.
	(*sub_uxt<mode>_multp2): Delete.
	(*sub_uxtsi_multp2_uxtw): Delete.
	(*neg_mul_imm_<mode>2): Delete.
	(*neg_mul_imm_si2_uxtw): Delete.
	* config/aarch64/predicates.md (aarch64_pwr_imm3): Delete.
	(aarch64_pwr_2_si): Delete.
	(aarch64_pwr_2_di): Delete.
2020-09-07 15:24:03 +01:00
Alex Coplan
d4febc75e8 aarch64: Don't emit invalid zero/sign-extend syntax
Given the following C function:

double *f(double *p, unsigned x)
{
    return p + x;
}

prior to this patch, GCC at -O2 would generate:

f:
        add     x0, x0, x1, uxtw 3
        ret

but this add instruction uses architecturally-invalid syntax: the width
of the third operand conflicts with the width of the extension
specifier. The third operand is only permitted to be an x register when
the extension specifier is (u|s)xtx.

This instruction, and analogous insns for adds, sub, subs, and cmp, are
rejected by clang, but accepted by binutils. Assembling and
disassembling such an insn with binutils gives the architecturally-valid
version in the disassembly:

   0:   8b214c00        add     x0, x0, w1, uxtw #3

This patch fixes several patterns in the AArch64 backend to use the
standard syntax as specified in the Arm ARM such that GCC's output can
be assembled by assemblers other than GAS.

---

gcc/ChangeLog:

	* config/aarch64/aarch64.md
	(*adds_<optab><ALLX:mode>_<GPI:mode>): Ensure extended operand
	agrees with width of extension specifier.
	(*subs_<optab><ALLX:mode>_<GPI:mode>): Likewise.
	(*adds_<optab><ALLX:mode>_shift_<GPI:mode>): Likewise.
	(*subs_<optab><ALLX:mode>_shift_<GPI:mode>): Likewise.
	(*add_<optab><ALLX:mode>_<GPI:mode>): Likewise.
	(*add_<optab><ALLX:mode>_shft_<GPI:mode>): Likewise.
	(*add_uxt<mode>_shift2): Likewise.
	(*sub_<optab><ALLX:mode>_<GPI:mode>): Likewise.
	(*sub_<optab><ALLX:mode>_shft_<GPI:mode>): Likewise.
	(*sub_uxt<mode>_shift2): Likewise.
	(*cmp_swp_<optab><ALLX:mode>_reg<GPI:mode>): Likewise.
	(*cmp_swp_<optab><ALLX:mode>_shft_<GPI:mode>): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/adds3.c: Fix test w.r.t. new syntax.
	* gcc.target/aarch64/cmp.c: Likewise.
	* gcc.target/aarch64/subs3.c: Likewise.
	* gcc.target/aarch64/subsp.c: Likewise.
	* gcc.target/aarch64/extend-syntax.c: New test.
2020-09-07 15:20:21 +01:00
Richard Biener
931832a5cc improve SLP vect dumping
This adds additional dumping helping in particular basic-block
vectorization SLP dump reading plus showing what we actually
generate code from.

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

	* tree-vect-slp.c (vect_analyze_slp_instance): Dump
	stmts we start SLP analysis from, failure and splitting.
	(vect_schedule_slp): Dump SLP graph entry and root stmt
	we are about to emit code for.
2020-09-07 14:29:39 +02:00
Martin Storsjö
3fe3efe5c1 gcc: Make strchr return value pointers const
This fixes compilation of codepaths for dos-like filesystems
with Clang. When built with clang, it treats C input files as C++
when the compiler driver is invoked in C++ mode, triggering errors
when the return value of strchr() on a pointer to const is assigned
to a pointer to non-const variable.

This matches similar variables outside of the ifdefs for dos-like
path handling.

2020-09-07  Martin Storsjö  <martin@martin.st>

gcc/
	* dwarf2out.c (file_name_acquire): Make a strchr return value
	pointer to const.
libcpp/
	* files.c (remap_filename): Make a strchr return value pointer
	to const.
2020-09-07 13:20:21 +02:00
Tobias Burnus
2b0df0a6ac Fortran: Fixes for pointer function call as variable (PR96896)
gcc/fortran/ChangeLog:

	PR fortran/96896
	* resolve.c (get_temp_from_expr): Also reset proc_pointer +
	use_assoc attribute.
	(resolve_ptr_fcn_assign): Use information from the LHS.

gcc/testsuite/ChangeLog:

	PR fortran/96896
	* gfortran.dg/ptr_func_assign_4.f08: Update dg-error.
	* gfortran.dg/ptr-func-3.f90: New test.
2020-09-07 12:30:11 +02:00
Tom de Vries
c9c87dc958 [libatomic, testsuite] Add missing include in atomic-generic.c
When compiling atomic-generic.c from the libatomic testsuite, we run into:
...
$ gcc src/libatomic/testsuite/libatomic.c/atomic-generic.c -latomic
src/libatomic/testsuite/libatomic.c/atomic-generic.c: In function ‘main’:
src/libatomic/testsuite/libatomic.c/atomic-generic.c:31:7: warning: \
  implicit declaration of function ‘memcmp’ [-Wimplicit-function-declaration]
   if (memcmp (&a, &zero, size))
       ^~~~~~
...

Fix this by adding the missing string.h include.

Tested on x86_64.

libatomic/ChangeLog:

	* testsuite/libatomic.c/atomic-generic.c: Include string.h.
2020-09-07 12:02:05 +02:00
liuhongt
703bc188f4 Adjust testcase.
gcc/testsuite/ChangeLog:

	* gcc.dg/vect/slp-46.c: Add --param vect-epilogues-nomask=0 to
	void backend interference.
2020-09-07 16:39:25 +08:00
Jakub Jelinek
fea13fcd0d lto: Stream edge goto_locus [PR94235]
The following patch adds streaming of edge goto_locus (both LOCATION_LOCUS
and LOCATION_BLOCK from it), the PR shows a testcase (inappropriate for
gcc testsuite) where the lack of streaming of goto_locus results in worse
debug info.
Earlier version of the patch (without the output_function changes) failed
miserably, because on the order mismatch - input_function would
first input_cfg, then input_eh_regions and then input_bb (all of which now
have locations), while output_function used output_eh_regions, then output_bb
and then output_cfg.  *_cfg went to a separate stream...
Now, is there a reason why the order is different?

If the intent is that the cfg could be read separately from the rest of
function or vice versa, alternatively we'd need to clear_line_info ();
before output_eh_regions and before/after output_cfg to make them
independent.

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

	PR debug/94235
	* lto-streamer-out.c (output_cfg): Also stream goto_locus for edges.
	Use bp_pack_var_len_unsigned instead of streamer_write_uhwi to stream
	e->dest->index and e->flags.
	(output_function): Call output_cfg before output_ssa_name, rather than
	after streaming all bbs.
	* lto-streamer-in.c (input_cfg): Stream in goto_locus for edges.
	Use bp_unpack_var_len_unsigned instead of streamer_read_uhwi to stream
	in dest_index and edge_flags.
2020-09-07 09:54:38 +02:00
Richard Biener
095d42feed code generate live lanes in basic-block vectorization
The following adds the capability to code-generate live lanes in
basic-block vectorization using lane extracts from vector stmts
rather than keeping the original scalar code around for those.
This eventually makes previously not profitable vectorizations
profitable (the live scalar code was appropriately costed so
are the lane extracts now), without considering the cost model
this patch doesn't add or remove any basic-block vectorization
capabilities.

The patch re/ab-uses STMT_VINFO_LIVE_P in basic-block vectorization
mode to tell whether a live lane is vectorized or whether it is
provided by means of keeping the scalar code live.

The patch is a first step towards vectorizing sequences of
stmts that do not end up in stores or vector constructors though.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

2020-09-04  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (vectorizable_live_operation): Adjust.
	* tree-vect-loop.c (vectorizable_live_operation): Vectorize
	live lanes out of basic-block vectorization nodes.
	* tree-vect-slp.c (vect_bb_slp_mark_live_stmts): New function.
	(vect_slp_analyze_operations): Analyze live lanes and their
	vectorization possibility after the whole SLP graph is final.
	(vect_bb_slp_scalar_cost): Adjust for vectorized live lanes.
	* tree-vect-stmts.c (can_vectorize_live_stmts): Adjust.
	(vect_transform_stmt): Call can_vectorize_live_stmts also for
	basic-block vectorization.

	* gcc.dg/vect/bb-slp-46.c: New testcase.
	* gcc.dg/vect/bb-slp-47.c: Likewise.
	* gcc.dg/vect/bb-slp-32.c: Adjust.
2020-09-07 09:47:36 +02:00
Francois-Xavier Coudert
d30869a8d4 fortran: Fix argument types in derived types procedures
gcc/fortran/ChangeLog

	* trans-types.c (gfc_get_derived_type): Fix argument types.
2020-09-07 09:38:25 +02:00
Francois-Xavier Coudert
a502683de1 fortran: Fix arg types of _gfortran_is_extension_of
gcc/fortran/ChangeLog

	* resolve.c (resolve_select_type): Provide a formal arg list.
2020-09-07 09:37:01 +02:00