Commit Graph

66778 Commits

Author SHA1 Message Date
Martin Liska 3e08f9feda Backport r253845
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-10-18  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82545
	* asan.c (asan_expand_poison_ifn): Do not put gimple stmt
	on an abnormal edge.
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-10-18  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82545
	* gcc.dg/asan/pr82545.c: New test.

From-SVN: r255008
2017-11-21 16:00:26 +00:00
Martin Liska 543d5c3289 Backport r253639
2017-11-21  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-10-11  Martin Liska  <mliska@suse.cz>

	* print-rtl.c (print_insn): Move declaration of idbuf
	to same scope as name.

From-SVN: r255007
2017-11-21 15:59:56 +00:00
Claudiu Zissulescu 78ec951e50 [ARC] Backport r254866.
From-SVN: r255000
2017-11-21 12:57:16 +01:00
Rainer Orth 4a7a8e11a3 Adapt Solaris 12 references
libgo:
	Backport from mainline

    With the change in the Solaris release model (no more major releases
    like Solaris 12 but only minor ones like 11.4), the Solaris 12
    references in GCC need to be adapted.

    Patch by Rainer Orth.

    Reviewed-on: https://go-review.googlesource.com/77490

	libgcc:
	Backport from mainline
	2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config.host (*-*-solaris2*): Adapt comment for Solaris 12
	renaming.
	* config/sol2/crtpg.c (__start_crt_compiler): Likewise.
	* configure.ac (libgcc_cv_solaris_crts): Likewise.
	* configure: Regenerate.

	gcc:
	Backport from mainline
	2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config.gcc (*-*-solaris2*): Enable default_use_cxa_atexit since
	Solaris 11.  Update comment.
	* configure.ac (gcc_cv_ld_pid): Adapt comment for Solaris 12
	renaming.
	* config/sol2.h (STARTFILE_SPEC): Likewise.
	* configure: Regenerate.

	gcc/testsuite:
	Backport from mainline
	2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* lib/target-supports.exp (check_effective_target_pie): Adapt
	comment for Solaris 12 renaming.

	* gcc.dg/torture/pr60092.c: Remove *-*-solaris2.11* dg-xfail-run-if.

From-SVN: r254994
2017-11-21 09:31:12 +00:00
Segher Boessenkool 5c956beb8a rs6000: Don't touch below the stack pointer (PR77687)
With the 32-bit SVR4 ABI we don't have a red zone, so we have to restore
the callee-saved registers before we restore the stack pointer.

The previous fix for this PR failed in two ways, for huge frames: first,
we use a negative offset from r11 in that case, so the (mem:BLK 11) access
does no good; second, sched does not handle accesses to mem:BLK correctly
in this case (does not make dependencies).

This patch fixes it by doing a store to (mem:BLK (scratch)) instead.
This means no unrelated (not to stack) loads/stores can be moved over the
stack restore either, but so be it.


	PR target/77687
	* config/rs6000/rs6000.md (stack_restore_tie): Store to a scratch
	address instead of to r1 and r11.

gcc/testsuite/
	PR target/77687
	* gcc.target/powerpc/pr77687.c: New testcase.

From-SVN: r254968
2017-11-20 21:10:28 +01:00
Vineet Gupta 2c8462947a [ARC] Backport ARC patch r250097.
From-SVN: r254864
2017-11-17 12:15:26 +01:00
Uros Bizjak fe3c24c3ed i386.c (x86_print_call_or_nop): Emit 5 byte nop explicitly as a stream of bytes.
* config/i386/i386.c (x86_print_call_or_nop): Emit 5 byte nop
	explicitly as a stream of bytes.

From-SVN: r254828
2017-11-16 17:04:21 +01:00
Richard Biener e1f38328f4 re PR tree-optimization/82985 (ICC: in vn_nary_build_or_lookup_1, at tree-ssa-sccvn.c:1722)
2017-11-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82985
	Backport from mainline
	2017-08-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81790
	* tree-ssa-sccvn.c (vn_lookup_simplify_result): Handle both
	CONSTRUCTORs from simplifying and VN.

	* gcc.dg/torture/pr81790.c: New testcase.
	* g++.dg/torture/pr82985.C: Likewise.

From-SVN: r254766
2017-11-15 12:50:39 +00:00
Pierre-Marie de Rodat 395decb0d1 [PATCH] [PR82155] Fix crash in dwarf2out_abstract_function
Backport from mainline (r253147):

This patch is an attempt to fix the crash reported in PR82155.

When generating a C++ class method for a class that is itself nested in
a class method, dwarf2out_early_global_decl currently leaves the
existing context DIE as it is if it already exists.  However, it is
possible that this call happens at a point where this context DIE is
just a declaration that is itself not located in its own context.

From there, if dwarf2out_early_global_decl is not called on any of the
FUNCTION_DECL in the context chain, DIEs will be left badly scoped and
some (such as the nested method) will be removed by the type pruning
machinery.  As a consequence, dwarf2out_abstract_function will will
crash when called on the corresponding DECL because it asserts that the
DECL has a DIE.

This patch fixes this crash making dwarf2out_early_global_decl process
context DIEs the same way we process abstract origins for FUNCTION_DECL:
if the corresponding DIE exists but is only a declaration, call
dwarf2out_decl anyway on it so that it is turned into a more complete
DIE and so that it is relocated in the proper context.

Bootstrapped and regtested on x86_64-linux.

gcc/

	PR debug/82155
	* dwarf2out.c (dwarf2out_early_global_decl): Call dwarf2out_decl
	on the FUNCTION_DECL function context if it has a DIE that is a
	declaration.

gcc/testsuite/

	* g++.dg/pr82155.C: New testcase.

From-SVN: r254761
2017-11-15 11:54:11 +00:00
Rainer Orth f512f6f96b Use -xbrace_comment=no with recent Solaris/x86 as
Backport from mainline
	2017-10-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (gcc_cv_as_ix86_xbrace_comment): Check if assembler
	supports -xbrace_comment option.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/i386/sol2.h (ASM_XBRACE_COMMENT_SPEC): Define.
	(ASM_CPU_SPEC): Use it.

From-SVN: r254681
2017-11-13 12:38:16 +00:00
Segher Boessenkool 2ae87906ec Backport PRs 64682, 69567, 69737, 82683
Backport from mainline
	2017-11-01  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/64682
	PR rtl-optimization/69567
	PR rtl-optimization/69737
	PR rtl-optimization/82683
	* combine.c (distribute_notes) <REG_DEAD>: If the new I2 sets the same
	register mentioned in the note, drop the note, unless it came from I3,
	in which case it should go to I3 again.

From-SVN: r254564
2017-11-09 11:21:06 +01:00
Eric Botcazou 2364fa7f79 re PR rtl-optimization/81803 (miscompilation at -O1 on mips64el)
PR rtl-optimization/81803
	* lra-constraints.c (curr_insn_transform): Also reload the whole
	register for a strict subreg no wider than a word if this is for
	a WORD_REGISTER_OPERATIONS target.

From-SVN: r254488
2017-11-07 07:44:58 +00:00
Wilco Dijkstra cebaca3600 PR60580: Fix frame pointer option magic
To fix PR60580 simplify the logic in aarch64_override_options_after_change_1 (). 
If the frame pointer is enabled, set it to a special value that behaves similar
to frame pointer omission.  If we don't do this all leaf functions will get a
frame pointer even if flag_omit_leaf_frame_pointer is set.

If flag_omit_frame_pointer has this special value, we must force the frame
pointer if not in a leaf function.  We also need to force it in a leaf function
if flag_omit_frame_pointer is not set or if LR is used.

Doing this allows both -fomit-frame-pointer and -fomit-leaf-frame-pointer to be
independently set and changed in each function with the expected behaviour.

    gcc/
	PR middle-end/60580
	* config/aarch64/aarch64.c (aarch64_frame_pointer_required)
	Check special value of flag_omit_frame_pointer.
	(aarch64_can_eliminate): Likewise.
	(aarch64_override_options_after_change_1): Simplify handling of
	-fomit-frame-pointer and -fomit-leaf-frame-pointer.

From-SVN: r254377
2017-11-03 15:01:10 +00:00
Eric Botcazou f92892ddbb Move testsuite entry to proper file
From-SVN: r254347
2017-11-02 15:02:23 +00:00
Martin Jambor aafe60b2f4 [PR 81702] Remove devirtualization assert
2017-11-01  Martin Jambor  <mjambor@suse.cz>

	PR c++/81702
	* gimple-fold.c (gimple_get_virt_method_for_vtable): Remove assert.

testsuite/
	* g++.dg/tree-ssa/pr81702.C: New test.

From-SVN: r254295
2017-11-01 11:35:13 +01:00
Uros Bizjak 902b2d9d0a re PR target/82772 (GCC crashes as compiling ags_thread.c source file on alpha architecture)
PR target/82772
	* config/alpha/sync.md (fetchop_constr) <and>: Change to "rINM".

From-SVN: r254254
2017-10-31 11:34:55 +01:00
Jakub Jelinek 9dccb36f6b backport: re PR c++/82159 (ICE: in assign_temp, at function.c:961)
Backported from mainline
	2017-10-12  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82159
	* expr.c (store_field): Don't optimize away bitsize == 0 store
	from CALL_EXPR with addressable return type.

	* g++.dg/opt/pr82159-2.C: New test.

From-SVN: r254181
2017-10-27 22:35:06 +02:00
Jakub Jelinek d84264fb75 backport: re PR sanitizer/81715 (asan-stack=1 redzone allocation is too inflexible)
Backported from mainline
	2017-09-21  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/81715
	* tree-inline.c (expand_call_inline): Emit clobber stmts for
	VAR_DECLs to which addressable non-volatile parameters are mapped
	and for id->retvar after the return value assignment, though
	for -fsanitize=kernel-address only.  Clear id->retval and id->retbnd
	after inlining.

	* g++.dg/asan/pr81715.C: New test.

From-SVN: r254179
2017-10-27 22:33:35 +02:00
Jakub Jelinek 7b3d2ce965 backport: re PR c/82234 (__builtin_shuffle is not in the keyword index)
Backported from mainline
	2017-09-18  Jakub Jelinek  <jakub@redhat.com>

	PR c/82234
	* doc/extend.texi: Add @findex entry for __builtin_shuffle.

From-SVN: r254178
2017-10-27 22:32:47 +02:00
Jakub Jelinek eeecd15ffc backport: re PR rtl-optimization/82192 (gcc produces incorrect code with -O2 and bit-field)
Backported from mainline
	2017-09-15  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/82192
	* combine.c (make_extraction): Don't look through non-paradoxical
	SUBREGs or TRUNCATE if pos + len is or might be bigger than
	inner's mode.

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

From-SVN: r254177
2017-10-27 22:32:21 +02:00
Jakub Jelinek dba9a0fe80 re PR target/82703 (Wrong addition of std::array components with -O2 -ftree-loop-vectorize -ftree-slp-vectorize (works fine with -O2))
PR target/82703
	* config/i386/i386-protos.h (maybe_get_pool_constant): Removed.
	* config/i386/i386.c (maybe_get_pool_constant): Removed.
	(ix86_split_to_parts): Use avoid_constant_pool_reference instead of
	maybe_get_pool_constant.
	* config/i386/predicates.md (zero_extended_scalar_load_operand):
	Likewise.

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

From-SVN: r254146
2017-10-27 14:25:34 +02:00
Qing Zhao 631e4d36eb re PR middle-end/80295 (ICE in __builtin_update_setjmp_buf expander)
gcc/ChangeLog

2017-10-24  Qing Zhao <qing.zhao@oracle.com>
	    Wilco Dijkstra <wilco.dijkstra@arm.com>

        * builtins.c (expand_builtin_update_setjmp_buf): Add a
        converstion to Pmode from the buf_addr.

gcc/testsuite/ChangeLog

2017-10-24  Qing Zhao <qing.zhao@oracle.com>
	    Wilco Dijkstra <wilco.dijkstra@arm.com>

        PR middle-end/80295
        * gcc.target/aarch64/pr80295.c: New test.

Co-Authored-By: Wilco Dijkstra <wdijkstr@arm.com>

From-SVN: r254063
2017-10-24 22:46:19 +00:00
Richard Biener 47ffadd915 re PR tree-optimization/82603 (ICE in ifcvt_local_dce w/ -O2 -ftree-loop-vectorize)
2017-10-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82603
	* tree-if-conv.c (predicate_mem_writes): Make sure to only
	remove false predicated stores.

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

From-SVN: r253932
2017-10-20 11:19:03 +00:00
Richard Biener 29ad09f6a8 backport: re PR tree-optimization/82436 (465.tonto ICE in vect_get_slp_vect_defs, at tree-vect-slp.c:3410)
2017-10-20  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-10-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82436
	* tree-vect-slp.c (vect_supported_load_permutation_p): More
	conservatively choose the vectorization factor when checking
	whether we can perform the required load permutation.
	(vect_transform_slp_perm_load): Assert when we may not fail.

	* gcc.dg/vect/pr82436.c: New testcase.

From-SVN: r253931
2017-10-20 11:18:00 +00:00
Richard Earnshaw ca7e162896 [ARM] PR 82445 - suppress 32-bit aligned ldrd/strd peepholing with -mno-unaligned-access
Peephole patterns exist in the arm backend to spot load/store
operations to adjacent memory operations in order to convert them into
ldrd/strd instructions.  However, when we have strict alignment
enforced, then we can only do this if the accesses are known to be
64-bit aligned; this is unlikely to be the case for most loads.  The
patch adds some alignment checking to the code that validates the
addresses for use in the peephole patterns.  This should also fix
incorrect generation of ldrd/strd with unaligned accesses that could
previously have occurred on ARMv5e where all such operations must be
64-bit aligned.

I've added some new tests as well.  In doing so I discovered that the
ldrd/strd peephole tests could never fail since they would match the
source file name in the scanned assembly as well as any instructions
of the intended type.  I've fixed those by tightening the scan results
slightly.

gcc:

* config/arm/arm.c (align_ok_ldrd_strd): New function.
(mem_ok_for_ldrd_strd): New parameter align.  Extract the alignment of the
mem into it.
(gen_operands_ldrd_strd): Validate the alignment of the accesses.

testsuite:

* gcc.target/arm/peep-ldrd-1.c: Tighten test scan pattern.
* gcc.target/arm/peep-strd-1.c: Likewise.
* gcc.target/arm/peep-ldrd-2.c: New test.
* gcc.target/arm/peep-strd-2.c: New test.

From-SVN: r253891
2017-10-19 13:14:55 +00:00
Segher Boessenkool b0a9b256be ira: volatile asm's are not moveable (PR82602)
A volatile asm statement can not be moved (relative to other volatile
asm, etc.), but IRA would do it nevertheless.  This patch fixes it.


	PR rtl-optimization/82602
	* ira.c (rtx_moveable_p): Return false for volatile asm.

From-SVN: r253870
2017-10-18 23:13:16 +02:00
Vladimir Makarov 9aae1b1f15 re PR middle-end/82556 (internal compiler error in curr_insn_transform, at lra-constraints.c:4307)
2017-10-18  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/82556
	* lra-constraints.c (curr_insn_transform): Use non-input operand
	instead of output one for matched reload.

2017-10-18  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/82556
	* gcc.target/i386/pr82556.c: New.

From-SVN: r253863
2017-10-18 16:47:38 +00:00
Jakub Jelinek 0c2ff9c396 re PR tree-optimization/82549 (ICE at -O1 and above: verify_gimple failed)
PR tree-optimization/82549
	* fold-const.c (optimize_bit_field_compare, fold_truth_andor_1):
	Formatting fixes.  Instead of calling make_bit_field_ref with negative
	bitpos return 0.

	* gcc.c-torture/compile/pr82549.c: New test.

From-SVN: r253816
2017-10-17 16:47:15 +02:00
Jakub Jelinek 7aaf7ebd9b re PR target/82274 (__builtin_mul_overflow fails to detect overflow for int64_t when compiled with -m32)
PR target/82274
	* internal-fn.c (expand_mul_overflow): If both operands have
	the same highpart of -1 or 0 and the topmost bit of lowpart
	is different, overflow is if res <= 0 rather than res < 0.

	* libgcc2.c (__mulvDI3): If both operands have
	the same highpart of -1 and the topmost bit of lowpart is 0,
	multiplication overflows even if both lowparts are 0.

	* gcc.dg/pr82274-1.c: New test.
	* gcc.dg/pr82274-2.c: New test.

From-SVN: r253735
2017-10-13 19:26:28 +02:00
Jakub Jelinek f35018157d re PR target/82524 (expensive-optimizations produces wrong results)
PR target/82524
	* config/i386/i386.md (addqi_ext_1, andqi_ext_1,
	*andqi_ext_1_cc, *<code>qi_ext_1, *xorqi_ext_1_cc): Change
	=Q constraints to +Q and into insn condition add check
	that operands[0] and operands[1] are equal.
	(*addqi_ext_2, *andqi_ext_2, *<code>qi_ext_2): Change
	=Q constraints to +Q and into insn condition add check
	that operands[0] is equal to either operands[1] or operands[2].

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

From-SVN: r253711
2017-10-13 09:39:42 +02:00
Andreas Tobler 0065f0d500 backport: config.gcc: (armv7*-*-freebsd*): New target.
2017-10-10  Andreas Tobler  <andreast@gcc.gnu.org>

    Backported from mainline r253602
    2017-10-10  Andreas Tobler  <andreast@gcc.gnu.org>

    * config.gcc: (armv7*-*-freebsd*): New target.
    (armv6*-*-freebsd*): Remove obsolete TARGET_FREEBSD_ARMv6 define.

From-SVN: r253603
2017-10-10 20:43:47 +02:00
Christophe Lyon 1e28109018 [AArch64] Backport to gcc-7 PR71727 fix -mstrict-align
2017-10-06  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	Backport from mainline r253242.
	2017-09-27  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/71727
	* config/aarch64/aarch64.c
	(aarch64_builtin_support_vector_misalignment): Always return false
	when misalignment is unknown.

	gcc/testsuite/
	Backport from mainline r253251.
	2017-09-27  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/71727
	* gcc.target/aarch64/pr71727-2.c: New test.

From-SVN: r253477
2017-10-06 09:38:51 +02:00
Jason Merrill 3eb1e9c89d PR c++/82406 - C++17 error with noexcept function type
PR c++/70029 - ICE with ref-qualifier and -flto
gcc/
	* langhooks.h (struct lang_hooks_for_types): Add
	copy_lang_qualifiers.
	* langhooks-def.h (LANG_HOOKS_COPY_LANG_QUALIFIERS): Default to
	NULL.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
	* tree.c (verify_type): Re-enable TYPE_CANONICAL main variant check.
	(build_type_attribute_qual_variant): Use copy_lang_qualifiers.
gcc/cp/
	* tree.c (cxx_copy_lang_qualifiers): New.
	* cp-tree.h: Declare it.
	* cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.

From-SVN: r253424
2017-10-04 13:47:08 -04:00
Bill Schmidt 21cc5b7750 backport: re PR tree-optimization/82337 (ICE: SSA corruption at tree-ssa-coalesce.c:1010)
[gcc]

2017-10-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-09-29  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/82337
	* gimple-ssa-strength-reduction.c (find_phi_def): Don't record a
	phi definition if the PHI result appears in an abnormal PHI.
	(find_basis_for_base_expr): Don't record a basis if the LHS of the
	basis appears in an abnormal PHI.

[gcc]

2017-10-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-09-29  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/82337
	* gcc.c-torture/compile/pr82337.c: New file.

From-SVN: r253359
2017-10-02 18:07:45 +00:00
Jakub Jelinek 0624feee0b i386.c (ix86_split_idivmod): Use mode instead of always SImode for DIV and MOD in REG_EQUAL notes.
* config/i386/i386.c (ix86_split_idivmod): Use mode instead of
	always SImode for DIV and MOD in REG_EQUAL notes.

From-SVN: r253320
2017-09-30 10:27:27 +02:00
Jakub Jelinek 4eb003869d backport: re PR c++/82159 (ICE: in assign_temp, at function.c:961)
Backported from mainline
	2017-09-27  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82159
	* gimplify.c (gimplify_modify_expr): Don't optimize away zero sized
	lhs from calls if the lhs has addressable type.

	* g++.dg/opt/pr82159.C: New test.

From-SVN: r253318
2017-09-30 10:25:02 +02:00
Krister Walfridsson ac5cb7c9a0 backport: re PR target/77480 (netbsd specfile will not link against libc when building -shared (+patch))
2017-09-29  Krister Walfridsson  <krister.walfridsson@gmail.com>

	Backport from mainline
	2017-06-29  Maya Rashish  <coypu@sdf.org>

	PR target/77480
	* config/netbsd.h (NETBSD_LIB_SPEC): Add -lc when creating shared
	objects.

From-SVN: r253309
2017-09-29 21:34:00 +00:00
Krister Walfridsson 4ffa3da132 backport: re PR target/39570 (cabs and cabsf are named differently on NetBSD 5)
2017-09-29  Krister Walfridsson  <krister.walfridsson@gmail.com>

	Backport from mainline
	2017-09-26  Krister Walfridsson  <krister.walfridsson@gmail.com>

	PR target/39570
	* gcc/config/netbsd-protos.h: New file.
	* gcc/config/netbsd.c: New file.
	* gcc/config/netbsd.h (SUBTARGET_INIT_BUILTINS): Define.
	* gcc/config/t-netbsd: New file.
	* gcc/config.gcc (tm_p_file): Add netbsd-protos.h.
	(tmake_file) Add t-netbsd.
	(extra_objs) Add netbsd.o.

From-SVN: r253283
2017-09-29 09:38:08 +00:00
Krister Walfridsson 98c9c18131 backport: re PR target/80600 (hidden symbol `__cpu_model' is referenced by DSO)
gcc/ChangeLog:

	Backport from mainline
	2017-05-14  Krister Walfridsson  <krister.walfridsson@gmail.com>

	PR target/80600
	* config/netbsd.h (NETBSD_LIBGCC_SPEC): Always add -lgcc.

libgcc/ChangeLog:

	Backport from mainline
	2017-05-14  Krister Walfridsson  <krister.walfridsson@gmail.com>

	PR target/80600
	* config.host (*-*-netbsd*): Add t-slibgcc-libgcc to tmake_file.

From-SVN: r253263
2017-09-28 19:17:51 +00:00
Christophe Lyon dc6124e513 backport: sourcebuild.texi (ARM-specific attributes): Document new arm_neon_ok_no_float_abi effective target.
Backport from trunk r249639.

2017-09-27  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
 	Backport from trunk r249639.
 	2017-06-26  Christophe Lyon  <christophe.lyon@linaro.org>

	* doc/sourcebuild.texi (ARM-specific attributes): Document new
	arm_neon_ok_no_float_abi effective target.

	gcc/testsuite/
	Backport from trunk r249639.
	2017-06-26  Christophe Lyon  <christophe.lyon@linaro.org>

	* lib/target-supports.exp
	(check_effective_target_arm_neon_ok_nocache): Add flags with
	-mfloat-abi=hard. Include arm_neon.h.
	(check_effective_target_arm_neon_ok_no_float_abi_nocache): New.
	(check_effective_target_arm_neon_ok_no_float_abi): New.
	* gcc.target/arm/lto/pr65837_0.c: Require
	arm_neon_ok_no_float_abi. Add -mfpu=neon to dg-lto-options.
	* gcc.target/arm/lto/pr65837-attr_0.c: Require
	arm_neon_ok_no_float_abi. Remove dg-suppress-ld-options.

From-SVN: r253234
2017-09-27 17:40:39 +02:00
Richard Biener 87c7cf4766 Backport PRs 82244, 82264, 82276, 82285, 82291
2017-09-26  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-09-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82244
	* tree-vrp.c (remove_range_assertions): Do not propagate
	a constant to abnormals but replace the assert with a copy.

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

	2017-09-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82276
	PR tree-optimization/82244
	* tree-vrp.c (build_assert_expr_for): Set
	SSA_NAME_OCCURS_IN_ABNORMAL_PHI if the variable we assert on
	has it set.
	(remove_range_assertions): Revert earlier change.

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

	2017-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82264
	* tree-ssa-sccvn.c (vn_phi_eq): Use safe_dyn_cast to check
	for GIMPLE_CONDs.
	(vn_phi_lookup): Likewise.
	(vn_phi_insert): Likewise.
	* is-a.h (safe_dyn_cast): New.

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

	2017-09-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82285
	* tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
	enumeral types.

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

	2017-09-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82291
	* tree-if-conv.c (predicate_mem_writes): Make sure to
	remove writes in blocks predicated with false.

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

From-SVN: r253190
2017-09-26 10:16:40 +00:00
Alan Modra 896c30e0fd PR81996, __builtin_return_address(0) fails
rs6000_return_addr assumes that the stack link is at frame+0, which is
true for count>0.  For count==0, rs6000_return_addr is called with
frame==frame_pointer_rtx and the stack link is *not* at frame+0 if
-fstack-protector-all or -fsanitize=address because rs6000.h sets
FRAME_GROWS_DOWNWARD for those options.

	PR target/81996
	* gcc/config/rs6000/rs6000.c (rs6000_return_addr): Use
	stack_pointer_rtx for count 0.  Update comments.  Break up
	large rtl expression.

From-SVN: r253067
2017-09-21 22:25:37 +09:30
Wilco Dijkstra c568955a6d PR71951: Fix unwinding with -fomit-frame-pointer
As described in PR71951, if libgcc is built with -fomit-frame-pointer,
unwinding crashes, for example while doing a backtrace.  The underlying
reason is the Dwarf unwinder does not setup the frame pointer register
in the initialization code.  When later unwinding a function that uses
the frame pointer, it tries to read FP using _Unwind_GetGR, and this
crashes if has never restored FP.  To unwind correctly the first frame
must save and restore FP (it is unwound in a special way so that it
uses SP instead of FP).  This is done by adding -fno-omit-frame-pointer.

    gcc/
	PR target/71951
	* config/aarch64/aarch64.h (LIBGCC2_UNWIND_ATTRIBUTE): Define.

From-SVN: r253063
2017-09-21 12:16:31 +00:00
Uros Bizjak 9e634ac9bc i386.c (fold_builtin_cpu): Add M_AMDFAM17H to processor_model and "amdfam17h" to arch_names_table.
* config/i386/i386.c (fold_builtin_cpu): Add M_AMDFAM17H
	to processor_model and "amdfam17h" to arch_names_table.
	* doc/extend.texi (__builtin_cpu_is): Document amdfam17h CPU name.

From-SVN: r252978
2017-09-19 16:57:14 +02:00
Martin Liska cf9ff480ce Ignore empty string in target attribute (PR c++/81355).
2017-09-19  Martin Liska  <mliska@suse.cz>

	PR c++/81355
	* config/i386/i386.c (sorted_attr_string): Skip empty strings.

From-SVN: r252970
2017-09-19 09:03:05 +00:00
Martin Liska c2d655fa22 Revert backport.
From-SVN: r252969
2017-09-19 09:02:33 +00:00
Richard Biener e1eaa7a325 backport: [multiple changes]
2017-09-18  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-09-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82084
	* fold-const.h (can_native_encode_string_p): Declare.
	* fold-const.c (can_native_encode_string_p): Factor out from ...
	(native_encode_string): ... here.
	* tree-vect-stmts.c (vectorizable_store): Call it to avoid
	vectorizing stores from constants we later cannot handle.

	* g++.dg/torture/pr82084.C: New testcase.

	2017-09-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82108
	* tree-vect-stmts.c (vectorizable_load): Fix pointer adjustment
	for gap in the non-permutation SLP case.

	* gcc.dg/vect/pr82108.c: New testcase.

From-SVN: r252918
2017-09-18 10:13:54 +00:00
Jakub Jelinek 8ccf92f52b backport: re PR target/81325 (-fcompare-debug failure on ppc64le)
Backported from mainline
	2017-09-14  Jakub Jelinek  <jakub@redhat.com>
 
	PR target/81325
	* cfgbuild.c (find_bb_boundaries): Ignore debug insns in decisions
	if and where to split a bb, except for splitting before debug insn
	sequences followed by non-label real insn.  Delete debug insns
	in between basic blocks.

	* g++.dg/cpp0x/pr81325.C: New test.

From-SVN: r252805
2017-09-15 13:26:03 +02:00
Jakub Jelinek 47d845c39f backport: re PR target/82112 (internal compiler error: in fold_convert_loc, at fold-const.c:2262)
Backported from mainline
	2017-09-12  Jakub Jelinek  <jakub@redhat.com>

	PR target/82112
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): For
	ALTIVEC_BUILTIN_VEC_LD if arg1 has array type call default_conversion
	on it early, rather than manual conversion late.  For
	ALTIVEC_BUILTIN_VEC_ST if arg2 has array type call default_conversion
	instead of performing manual conversion.

	* gcc.target/powerpc/pr82112.c: New test.
	* g++.dg/ext/altivec-18.C: New test.

From-SVN: r252804
2017-09-15 13:24:49 +02:00
Martin Liska 84b42a8f0f Fix backport.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-09-14  Martin Liska  <mliska@suse.cz>

	* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge):
	Add proper printf format.

From-SVN: r252790
2017-09-15 08:19:50 +00:00
Martin Liska f38aca72f0 Backport r251530
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-30  Martin Liska  <mliska@suse.cz>

	PR inline-asm/82001
	* ipa-icf-gimple.c (func_checker::compare_tree_list_operand):
	Rename to ...
	(func_checker::compare_asm_inputs_outputs): ... this function.
	(func_checker::compare_gimple_asm): Use the function to compare
	also ASM constrains.
	* ipa-icf-gimple.h: Rename the function.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-30  Martin Liska  <mliska@suse.cz>

	PR inline-asm/82001
	* gcc.dg/ipa/pr82001.c: New test.

From-SVN: r252788
2017-09-15 08:19:15 +00:00
Martin Liska 4bcb671a49 Subject: Backport r251400
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-29  Martin Liska  <mliska@suse.cz>

	PR other/39851
	* gcc.c (driver_handle_option): Add new argument.
	* opts-common.c (handle_option): Pass
	target_option_override_hook.
	* opts-global.c (lang_handle_option): Add new option.
	(set_default_handlers):  Add new argument.
	(decode_options): Likewise.
	* opts.c (target_handle_option): Likewise.
	(common_handle_option): Call target_option_override_hook.
	* opts.h (struct cl_option_handler_func): Add hook for
	target option override.
	(struct cl_option_handlers): Likewise.
	(set_default_handlers): Add new argument.
	(decode_options): Likewise.
	(common_handle_option): Likewise.
	(target_handle_option): Likewise.
	* toplev.c (toplev::main): Pass targetm.target_option.override
	hook.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-29  Martin Liska  <mliska@suse.cz>

	PR other/39851
	* c-common.c (parse_optimize_options): Add argument to function
	call.
	* c-pragma.c (handle_pragma_diagnostic): Likewise.

From-SVN: r252787
2017-09-15 08:18:34 +00:00
Martin Liska 99fc8910b0 Backport r251020
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-10  Martin Liska  <mliska@suse.cz>

	PR c++/81355
	* c-attribs.c (handle_target_attribute):
	Report warning for an empty string argument of target attribute.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-10  Martin Liska  <mliska@suse.cz>

	PR c++/81355
	* g++.dg/other/pr81355.C: New test.

From-SVN: r252785
2017-09-15 08:13:58 +00:00
Martin Liska d87e2f8f94 Backport r250951
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-08  Martin Liska  <mliska@suse.cz>

	PR tree-opt/81696
	* ipa-icf-gimple.c (func_checker::compare_cst_or_decl): Consider
	LABEL_DECLs that can be from a different function.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-08-08  Martin Liska  <mliska@suse.cz>

	PR tree-opt/81696
	* gcc.dg/ipa/pr81696.c: New test.

From-SVN: r252784
2017-09-15 08:13:23 +00:00
Martin Liska 1afc6fafb2 Backport r249735
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-28  Martin Liska  <mliska@suse.cz>

	PR ipa/81128
	* ipa-visibility.c (non_local_p): Handle visibility.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-28  Martin Liska  <mliska@suse.cz>

	PR ipa/81128
	* c-attribs.c (handle_alias_ifunc_attribute): Append ifunc alias
	to a function declaration.
2017-09-15  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-28  Martin Liska  <mliska@suse.cz>

	PR ipa/81128
	* gcc.target/i386/pr81128.c: New test.

From-SVN: r252782
2017-09-15 08:12:30 +00:00
Bill Schmidt ce1a6c358b backport: re PR target/81833 (PowerPC: VSX: Miscompiles ffmpeg's scalarproduct_int16_vsx at -O1)
[gcc]

2017-09-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/81833
	* config/rs6000/altivec.md (altivec_vsum2sws): Convert from a
	define_insn to a define_expand.
	(altivec_vsum2sws_direct): New define_insn.
	(altivec_vsumsws): Convert from a define_insn to a define_expand.

[gcc/testsuite]

2017-09-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/81833
	* gcc.target/powerpc/pr81833-1.c: New file.
	* gcc.target/powerpc/pr81833-2.c: New file.

From-SVN: r252042
2017-09-12 21:02:13 +00:00
Max Filippov 7cd44d39d3 xtensa: fix PR target/82181
2017-09-11  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
	Backport from mainline

	* config/xtensa/xtensa.c (xtensa_mem_offset): Check that both
	words of DImode object are reachable by xtensa_uimm8x4 access.

From-SVN: r251987
2017-09-11 21:44:42 +00:00
Bill Schmidt cb3903dac5 backport: re PR target/80695 (gratuitous use of stxvx to store multiple pointers)
[gcc]

2017-09-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-05-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/80695
	* config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost):
	Account for direct move costs for vec_construct of integer
	vectors.

	Backport from mainline
	2017-07-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/80695
	* config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost):
	Reduce cost estimate for direct moves.

[gcc/testsuite]

2017-09-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-05-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/80695
	* gcc.target/powerpc/pr80695-p8.c: New file.
	* gcc.target/powerpc/pr80695-p9.c: New file.

From-SVN: r251952
2017-09-10 21:09:38 +00:00
Eric Botcazou 35a04528f8 re PR target/81988 (invalid std instruction with odd register)
PR target/81988
	* config/sparc/sparc.md (mulsi3): Rename into *mulsi3_sp32.
	(*mulsi3_sp64): New instruction.
	(mulsi3): New expander.

From-SVN: r251905
2017-09-08 17:12:15 +00:00
Jakub Jelinek f0da73ec40 backport: re PR middle-end/81768 (error: control flow in the middle of basic block)
Backported from mainline
	2017-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/81768
	* omp-low.c (lower_omp_for): Recompute tree invariant if
	gimple_omp_for_initial/final is ADDR_EXPR.

	* gcc.dg/gomp/pr81768-2.c: New test.

From-SVN: r251857
2017-09-07 22:41:42 +02:00
Jakub Jelinek 22bfd3f3a9 backport: re PR middle-end/81768 (error: control flow in the middle of basic block)
Backported from mainline
	2017-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/81768
	* omp-expand.c (expand_omp_simd): Force second operands of COND_EXPR
	into gimple val before gimplification fo the COND_EXPR.

	* gcc.dg/gomp/pr81768-1.c: New test.

From-SVN: r251856
2017-09-07 22:40:06 +02:00
Jakub Jelinek 7804f36f1e backport: lra-remat.c (reg_overlap_for_remat_p): Fix a pasto.
Backported from mainline
	2017-09-04  Jakub Jelinek  <jakub@redhat.com>

	* lra-remat.c (reg_overlap_for_remat_p): Fix a pasto.

From-SVN: r251855
2017-09-07 22:30:58 +02:00
Jakub Jelinek f7b87491a9 backport: re PR sanitizer/81923 ([ASAN] gcc emites wrong odr asan instrumentation for glibc)
Backported from mainline
	2017-09-01  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/81923
	* asan.c (create_odr_indicator): Strip name encoding from assembler
	name before appending it after __odr_asan_.

	* gcc.dg/asan/pr81923.c: New test.

From-SVN: r251854
2017-09-07 22:29:04 +02:00
Jakub Jelinek 9e2e13bd6d backport: re PR c/81687 (Compiler drops label in OpenMP region)
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-08-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/81687
	* omp-low.c (omp_copy_decl): Don't remap FORCED_LABEL or DECL_NONLOCAL
	LABEL_DECLs.
	* tree-cfg.c (move_stmt_op): Don't adjust DECL_CONTEXT of FORCED_LABEL
	or DECL_NONLOCAL labels.
	(move_stmt_r) <case GIMPLE_LABEL>: Adjust DECL_CONTEXT of FORCED_LABEL
	or DECL_NONLOCAL labels here.

	* testsuite/libgomp.c/pr81687-1.c: New test.
	* testsuite/libgomp.c/pr81687-2.c: New test.

From-SVN: r251853
2017-09-07 22:26:34 +02:00
Jakub Jelinek 6b6bdf1822 backport: re PR target/81621 (ICE in delete_insn, at cfgrtl.c:167 with s390x cross compiler)
Backported from mainline
	2017-08-03  Jakub Jelinek  <jakub@redhat.com>

	PR target/81621
	* bb-reorder.c (pass_partition_blocks::execute): Return TODO_df_finish
	after setting changeable df flags.

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

From-SVN: r251851
2017-09-07 22:23:14 +02:00
Jakub Jelinek 2926cf5b22 backport: re PR driver/81650 (gcc -m32 mishandles -Walloc-size-larger-than=9223372036854775807)
Backported from mainline
	2017-08-03  Jakub Jelinek  <jakub@redhat.com>

	PR driver/81650
	* calls.c (alloc_max_size): Use HOST_WIDE_INT_UC (10??)
	instead of 10??LU, perform unit multiplication in wide_int,
	don't change alloc_object_size_limit if the limit is larger
	than SSIZE_MAX.

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

From-SVN: r251850
2017-09-07 22:20:43 +02:00
Jakub Jelinek d85d1bf482 backport: re PR middle-end/81052 (ICE in verify_dominators, at dominance.c:1184)
Backported from mainline
	2017-08-03  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/81052
	* omp-low.c (diagnose_sb_0): Handle flag_openmp_simd like flag_openmp.
	(pass_diagnose_omp_blocks::gate): Enable also for flag_openmp_simd.

	* c-c++-common/pr81052.c: New test.

From-SVN: r251849
2017-09-07 22:19:47 +02:00
Bill Schmidt 2d3af62ba5 backport: re PR tree-optimization/81987 (ICE in verify_ssa with -O3 -march=skylake-avx512)
[gcc]

2017-09-06  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline:
	2017-08-30  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/81987
	* gimple-ssa-strength-reduction.c (insert_initializers): Don't
	insert an initializer in a location not dominated by the stride
	definition.

[gcc/testsuite]

2017-09-06  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline:
	2017-08-30  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/81987
	* g++.dg/torture/pr81987.C: New file.

From-SVN: r251815
2017-09-06 18:42:56 +00:00
Bill Schmidt 540b5cb6c7 backport: re PR tree-optimization/81503 (Wrong code at -O2)
[gcc]

2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-08-29  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
		    Jakub Jelinek  <jakub@redhat.com>
		    Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81503
	* gimple-ssa-strength-reduction.c (replace_mult_candidate): Ensure
	folded constant fits in the target type; reorder tests for clarity.

[gcc/testsuite]

2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-08-29  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
		    Jakub Jelinek  <jakub@redhat.com>
		    Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81503
	* gcc.c-torture/execute/pr81503.c: New file.

From-SVN: r251743
2017-09-05 21:49:01 +00:00
Pierre-Marie de Rodat db72abb6b8 [PR79542][Ada] Fix ICE in dwarf2out.c with nested func. inlining
This is a backport from trunk.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79542 reports an ICE in
dwarf2out.c for an Ada testcase built with optimization.

This crash happens during the late generation pass because
add_gnat_descriptive_type cannot find the type DIE corresponding to some
descriptive type after having tried to generate it. This is because the
DIE was generated during the early generation pass, but then pruned by
the type pruning machinery. So why was it pruned?

We are in a situation where we have cloned types (because of inlining,
IIUC) whose TYPE_NAME have non-null DECL_ABSTRACT_ORIGIN attributes. As
a consequence:

  * In modified_type_die, the "handle C typedef types" part calls
    gen_type_die on the cloned type.

  * gen_type_die matches a typedef variant, and then calls gen_decl_die
    on its TYPE_NAME, which will end up calling gen_typedef_die.

  * gen_typedef_die checks decl_ultimate_origin for this TYPE_DECL, and
    finds one, so it only adds a DW_AT_abstract_origin attribute to the
    DW_TAG_typedef DIE, but the cloned type itself does not get its own
    DIE.

  * Back in modified_type_die, the call to lookup_type_die on the type
    passed to gen_type_die returns NULL.

In the end, whole type trees, i.e. the ones referenced by
DECL_ABSTRACT_ORIGIN attributes, are never referenced from type pruning
"roots" and are thus pruned. The descriptive type at stake here is one
of them, hence the assertion failure.

This patch attemps to fix that with what seems to be the most sensible
thing to do in my opinion: updating the "handle C typedef types" part in
modified_type_die to check decl_ultimate_origin before calling
gen_type_die: if that function returns something not null, then we know
that gen_type_die/gen_typedef_die will not generate a DIE for the input
type, so we try to process the ultimate origin instead. It also updates
in a similar way gen_type_die_with_usage, assert that when
gen_typedef_die is called on nodes that have an ultimate origin, this
origin is themselves.

gcc/
	PR ada/79542
	* dwarf2out.c (modified_type_die): For C typedef types that have
	an ultimate origin, process the ultimate origin instead of the
	input type.
	(gen_typedef_die): Assert that input DECLs have no ultimate
	origin.
	(gen_type_die_with_usage): For typedef variants that have an
	ultimate origin, just call gen_decl_die on the original DECL.
	(process_scope_var): Avoid creating DIEs for local typedefs and
	concrete static variables.

gcc/testsuite/

	PR ada/79542
	* gnat.dg/debug13.ads, gnat.dg/debug13.adb: New testcase.

From-SVN: r251709
2017-09-05 11:04:41 +00:00
Bill Schmidt 38babcc9c2 backport: re PR target/81504 (gcc-7 regression: vec_st in loop misoptimized)
2017-08-31  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-08-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/81504
	* config/rs6000/rs6000.c (find_alignment_op): Add reference
	parameter and_insn and return it.
	(recombine_lvx_pattern): Insert a copy to ensure availability of
	the base register of the copied masking operation at the point of
	the instruction replacement.
	(recombine_stvx_pattern): Likewise.

From-SVN: r251575
2017-08-31 20:28:17 +00:00
Michael Meissner 5eebe567c3 backport: re PR target/81593 (Optimize PowerPC vector set from vector extract)
[gcc]
2017-08-29  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-08-07  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81593
	* config/rs6000/vsx.md (vsx_concat_<mode>_1): New combiner insns
	to recognize inserting into a vector from a double word element
	that was extracted from another vector, and eliminate extra
	XXPERMDI instructions.
	(vsx_concat_<mode>_2): Likewise.
	(vsx_concat_<mode>_3): Likewise.
	(vsx_set_<mode>, VSX_D): Rewrite vector set in terms of vector
	concat to allow optimizing inserts from previous extracts.

[gcc/testsuite]
2017-08-29  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-08-07  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81593
	* gcc.target/powerpc/vec-setup.h: New tests to test various
	combinations of setting up vectors of 2 double word elements.
	* gcc.target/powerpc/vec-setup-long.c: Likewise.
	* gcc.target/powerpc/vec-setup-double.c: Likewise.
	* gcc.target/powerpc/vec-setup-be-long.c: Likewise.
	* gcc.target/powerpc/vec-setup-be-double.c: Likewise.

From-SVN: r251445
2017-08-30 01:12:21 +00:00
Alan Modra f3235b72ec [RS6000] linux startfile/endfile
These need to match the gnu-user.h definitions to support
--enable-default-pie.  Otherwise we end up linking the wrong startup
files when defaulting to PIE.

	PR target/81170
	PR target/81295
	* config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Upgrade to
	match gnu-user.h startfile.
	(ENDFILE_LINUX_SPEC): Similarly.

From-SVN: r251403
2017-08-29 17:53:44 +09:30
Alan Modra 82cd399fbe PR driver/81523: Make -static override -pie
-static and -pie together behave differently depending on whether GCC is
configured with --enable-default-pie.  On x86, "-static -pie" fails to
create executable when --enable-default-pie isn't used, but creates a
static executable when --enable-default-pie is used.  This patch makes
-static completely override -pie to create a static executable, regardless
if --enable-default-pie is used to configure GCC.

	PR target/81170
	PR target/81295
	PR driver/81523
	* gcc.c (NO_PIE_SPEC): Delete.
	(PIE_SPEC): Define as !no-pie/pie.  Move static|shared|r
	exclusion..
	(LINK_PIE_SPEC): ..to here.
	(LINK_COMMAND_SPEC): Support -no-pie.
	* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Correct
	chain of crtbegin*.o selection, update for PIE_SPEC changes and
	format.
	(GNU_USER_TARGET_ENDFILE_SPEC): Similarly.
	* config/sol2.h (STARTFILE_CRTBEGIN_SPEC): Similarly.
	(ENDFILE_CRTEND_SPEC): Similarly.

From-SVN: r251402
2017-08-29 17:52:44 +09:30
Richard Biener 897c0169ea backport: re PR tree-optimization/81977 (Issue with inline memcpy with optimizations enabled)
2017-08-29  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81977
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Fix look through
	memcpy.

	* g++.dg/torture/pr81977.C: New testcase.

	2017-08-28  Richard Biener  <rguenther@suse.de>

	PR debug/81993
	* dwarf2out.c (gen_remaining_tmpl_value_param_die_attributes):
	Do nothing for removed DIEs.

From-SVN: r251399
2017-08-29 07:06:46 +00:00
Richard Biener 8dc7f6cba5 backport: [multiple changes]
2017-08-28  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-06-14  Richard Biener  <rguenther@suse.de>

	PR middle-end/81088
	* fold-const.c (split_tree): Drop TREE_OVERFLOW flag from
	literal constants.
	(fold_binary_loc): When associating do not treat pre-existing
	TREE_OVERFLOW on literal constants as a reason to allow
	TREE_OVERFLOW on associated literal constants.

	* c-c++-common/ubsan/pr81088.c: New testcase.

	2017-06-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/81065
	* fold-const.c (extract_muldiv_1): Remove bogus distribution
	case of C * (x * C2 + C3).
	(fold_addr_of_array_ref_difference): Properly fold index difference.

	* c-c++-common/ubsan/pr81065.c: New testcase.

	2017-06-08  Marek Polacek  <polacek@redhat.com>

	PR sanitize/80932
	* c-c++-common/ubsan/pr80932.c: Test with ints, not with long ints.

	2017-06-07  Marek Polacek  <polacek@redhat.com>

	PR sanitizer/80932
	* fold-const.c (extract_muldiv_1) <case MINUS_EXPR>: Add
	TYPE_OVERFLOW_WRAPS check. 

	* c-c++-common/ubsan/pr80932.c: New test.

From-SVN: r251381
2017-08-28 12:49:55 +00:00
Richard Biener 9563a3d30a backport: [multiple changes]
2017-08-28  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-08-21  Richard Biener  <rguenther@suse.de>

	PR middle-end/81884
	* tree-ssa-alias.c (stmt_kills_ref_p): Handle array accesses
	at struct end conservatively when comparing common bases.

	* g++.dg/torture/pr81884.C: New testcase.

	2017-05-04  Richard Biener  <rguenther@suse.de>
 
	* tree.c (array_at_struct_end_p): Handle arrays at struct
	end with flexarrays more conservatively.  Refactor and treat
	arrays of arrays or aggregates more strict.  Fix
	VIEW_CONVERT_EXPR handling.  Remove allow_compref argument.
	* tree.h (array_at_struct_end_p): Adjust prototype.
	* gimple-fold.c (get_range_strlen): Likewise.
	* tree-chkp.c (chkp_may_narrow_to_field): Likewise.

From-SVN: r251379
2017-08-28 12:16:06 +00:00
Richard Biener 2377f9833d backport: [multiple changes]
2017-08-28  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-08-01  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81181
	* tree-ssa-pre.c (compute_antic_aux): Defer clean() to ...
	(compute_antic): ... end of iteration here.

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

	2017-08-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81723
	* tree-vect-slp.c (struct bst_traits): New hash traits.
	(bst_fail): New global.
	(vect_build_slp_tree_2): New worker, split out from ...
	(vect_build_slp_tree): ... this now wrapping it with using
	bst_fail set to cache SLP tree build fails.  Properly handle
	max_tree_size.
	(vect_analyze_slp_instance): Allocate and free bst_fail.

	* gfortran.dg/pr81723.f: New testcase.

	2017-08-24  Richard Biener  <rguenther@suse.de>

	PR target/81921
	* config/i386/i386.c: Include symbol-summary.h, ipa-prop.h
	and ipa-inline.h.
	(ix86_can_inline_p): When ix86_fpmath flags do not match
	check whether the callee uses FP math at all.

	* gcc/testsuite/gcc.target/i386/pr81921.c: New testcase.

From-SVN: r251376
2017-08-28 10:19:17 +00:00
Peter Bergner cd53429f1d backport: re PR target/72804 (Poor code gen with -mvsx-timode)
gcc/
	Backport from mainline
	2017-08-17  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/72804
	* config/rs6000/vsx.md (*vsx_le_permute_<mode>): Add support for
	operands residing in integer registers.
	(*vsx_le_perm_load_<mode>): Likewise.
	(*vsx_le_perm_store_<mode>): Likewise.
	(define_peephole2): Add peepholes to optimize the above.

gcc/testsuite/
	Backport from mainline
	2017-08-17  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/72804
	* gcc.target/powerpc/pr72804.c: New test.

From-SVN: r251318
2017-08-23 15:03:46 -05:00
Peter Bergner 8bd5889eaa backport: re PR target/80210 (ICE in in extract_insn, at recog.c:2311 on ppc64 for with __builtin_pow)
gcc/
	Backport from mainline
	2017-08-17  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/80210
	* config/rs6000/rs6000.c (rs6000_activate_target_options): New function.
	(rs6000_set_current_function): Rewrite function to use it.

gcc/testsuite/
	Backport from mainline
	2017-08-17  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/80210
	* gcc.target/powerpc/pr80210.c: New test.

From-SVN: r251293
2017-08-22 15:13:11 -05:00
Sebastian Huber 70f0aa4d6d [PowerPC/RTEMS] Enable -mcmodel option
gcc/
	* config.gcc (powerpc-*-rtems*): Add rs6000/linux64.opt.
	* config/rs6000/rtems.h (ASM_PREFERRED_EH_DATA_FORMAT): New define.
	(DOT_SYMBOLS): Likewise.
	(MINIMAL_TOC_SECTION_ASM_OP): Likewise.
	(RELOCATABLE_NEEDS_FIXUP): Likewise.
	(RS6000_ABI_NAME): Likewise.
	(TARGET_CMODEL): Likewise.
	(TOC_SECTION_ASM_OP): Likewise.
	(SET_CMODEL): New macro.
	(SUBSUBTARGET_OVERRIDE_OPTIONS): Evaluate cmodel options.

From-SVN: r251277
2017-08-22 13:59:37 +00:00
Georg-Johann Lay 4525932d39 backport: re PR target/81910 ([avr] ICE with "address" attribute on type)
gcc/
	Backport from 2017-08-22 trunk r251256.
	PR target/81910
	* config/avr/avr.c (avr_handle_addr_attribute): Early return if
	not VAR_P. Filter attribute warnings with OPT_Wattributes.
	(avr_attribute_table) <io, io_low, address>: Initialize
	.decl_required with true.

From-SVN: r251257
2017-08-22 07:55:34 +00:00
Georg-Johann Lay 5d6744e9e4 re PR target/79883 (avr i18n: untranslated "interrupt" or "signal")
PR target/79883
	* config/avr/avr.c (avr_set_current_function): Typo in diagnostic.

From-SVN: r251224
2017-08-21 12:42:47 +00:00
Uros Bizjak e016034b39 re PR target/81894 (Typo in x86 built-in function list)
PR target/81894
	* doc/extend.texi (x86 Built-in Functions): Correct the name of
	__builtin_ia32_lzcnt_u16.

From-SVN: r251198
2017-08-19 10:22:54 +02:00
Uros Bizjak 7355ab54e2 backport: re PR target/81861 (ASan pr64820.c testcase segfaults with LTO and -fstack-protector-strong)
Backport from mainline
	2017-08-17  Maxim Ostapenko  <m.ostapenko@samsung.com>

	PR target/81861
	* config/i386/i386.c (ix86_option_override_internal): Save target
	specific options after ix86_stack_protector_guard_reg was changed.

From-SVN: r251162
2017-08-17 21:37:06 +02:00
Bill Schmidt 05d98180cc backport: re PR tree-optimization/81354 (Segmentation fault in SSA Strength Reduction using -O3)
[gcc]

2017-08-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-08-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/81354
	* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge):
	Insert on edges rather than explicitly creating landing pads.
	(analyze_candidates_and_replace): Commit edge inserts.


[gcc/testsuite]

2017-08-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2017-08-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/81354
	* g++.dg/torture/pr81354.C: New file.

From-SVN: r251120
2017-08-16 14:09:15 +00:00
Joseph Myers 52caeae857 Limit SH strncmp inline expansion (PR target/78460).
GCC mainline built for sh4-linux-gnu runs out of memory building a
glibc test, which calls strncmp with very large constant size
argument, resulting in the SH inline strncmp expansion trying to
inline a fully unrolled expansion of strncmp for that size.

This patch limits that fully unrolled expansion to the case of less
than 32 bytes.  This is explicitly *not* trying to be optimal in any
way (very likely a lower threshold makes sense), just to limit enough
to avoid the out-of-memory issue in the glibc testsuite.

I have *not* run the GCC testsuite for SH.  I have verified that this
allows the glibc testsuite to build OK, with both GCC mainline and GCC
7 branch (and that the included test builds quickly with patched GCC,
runs out of memory with unpatched GCC).

	PR target/78460
	PR target/67712
gcc:
	* config/sh/sh-mem.cc (sh_expand_cmpnstr): Only unroll for
	constant count if that count is less than 32.

gcc/testsuite:
	* gcc.c-torture/compile/string-large-1.c: New test.

From-SVN: r251109
2017-08-16 00:43:11 +01:00
Richard Biener 7c645777da BASE-VER: Set to 7.2.1.
2017-08-14  Richard Biener  <rguenther@suse.de>

        * BASE-VER: Set to 7.2.1.

From-SVN: r251083
2017-08-14 08:04:56 +00:00
Richard Biener 586a0829dc Update ChangeLog and version files for release
From-SVN: r251081
2017-08-14 07:59:11 +00:00
Richard Biener 783f5cb4ca re PR target/81766 (ICE in maybe_add_or_update_dep_1, at sched-deps.c:924 caused by r250815)
2017-08-08  Richard Biener  <rguenther@suse.de>

	PR middle-end/81766
	* function.c (thread_prologue_and_epilogue_insns): Restore
	behavior of always calling find_many_sub_basic_blocks on
	the inserted prologue.

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

From-SVN: r250958
2017-08-08 13:21:12 +00:00
Jakub Jelinek b396c65489 re PR middle-end/79499 (ICE in rtl_verify_bb_insns, at cfgrtl.c:2661)
PR middle-end/79499
	* function.c (thread_prologue_and_epilogue_insns): Determine blocks
	for find_many_sub_basic_blocks bitmap by looking up BLOCK_FOR_INSN
	of first NONDEBUG_INSN_P in each of the split_prologue_seq and
	prologue_seq sequences - if any.

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

From-SVN: r250815
2017-08-02 09:26:46 +02:00
Uros Bizjak 5ed13b67d0 re PR target/81641 (Assemble failure with named address spaces and -masm=intel)
PR target/81641
	* config/i386/i386.c (ix86_print_operand_address_as): For -masm=intel
	print "ds:" only for immediates in generic address space.

testsuite/ChangeLog:

	PR target/81641
	* gcc.target/i386/pr81641.c: New test.

From-SVN: r250801
2017-08-02 00:06:11 +02:00
Jakub Jelinek c49cb08753 re PR target/81622 (ICE on invalid altivec code with ppc64{,le})
PR target/81622
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): For
	__builtin_vec_cmpne verify both arguments are compatible vectors
	before looking at TYPE_MODE on the element type.  For __builtin_vec_ld
	verify arg1_type is a pointer or array type.  For __builtin_vec_st,
	move computation of aligned to after checking the argument types.
	Formatting fixes.

	* gcc.target/powerpc/pr81622.c: New test.

From-SVN: r250787
2017-08-01 18:44:17 +02:00
Martin Liska d124e3d61c Fix segfault in gcov.c (PR gcov-profile/81561).
2017-08-01  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-07-26  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/81561
	* gcov.c (unblock): Make unblocking safe as we need to preserve
	index correspondence of blocks and block_lists.

From-SVN: r250782
2017-08-01 14:49:54 +00:00
Richard Biener d90e0fb9ae re PR tree-optimization/71752 (ICE in compute_live_loop_exits, at tree-ssa-loop-manip.c:229 w/ -O1 -ftree-vectorize)
2017-08-01  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71752
	PR tree-optimization/81633
	* tree-vect-slp.c (vect_get_slp_defs): Handle null operands
	in the original suggested way.

	* gcc.dg/vect/pr81633.c: New testcase.

From-SVN: r250779
2017-08-01 13:58:13 +00:00
Richard Sandiford 2d55c24f77 Backport fix for PR 80769
2017-08-01  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	PR tree-optimization/80769
	* tree-ssa-strlen.c (strinfo): Document that "stmt" is also used
	for malloc and calloc.  Document the new invariant that all related
	strinfos have delayed lengths or none do.
	(get_next_strinfo): New function.
	(verify_related_strinfos): Move earlier in file.
	(set_endptr_and_length): New function, split out from...
	(get_string_length): ...here.  Also set the lengths of related
	strinfos.

gcc/testsuite/
	PR tree-optimization/80769
	* gcc.dg/strlenopt-31.c: New test.
	* gcc.dg/strlenopt-31g.c: Likewise.

From-SVN: r250772
2017-08-01 12:22:03 +00:00
Jakub Jelinek fb700fcbf0 re PR tree-optimization/81588 (Wrong code at -O2)
PR tree-optimization/81588
	* tree-ssa-reassoc.c (optimize_range_tests_var_bound): If
	ranges[i].in_p, invert comparison code ccode.  For >/>=,
	swap rhs1 and rhs2 and comparison code unconditionally,
	for </<= don't do that.  Don't swap rhs1/rhs2 again if
	ranges[i].in_p, instead invert comparison code ccode if
	opcode or oe->rank is BIT_IOR_EXPR.

	* gcc.dg/tree-ssa/pr81588.c: New test.
	* gcc.dg/pr81588.c: New test.
	* gcc.c-torture/execute/pr81588.c: New test.

From-SVN: r250761
2017-08-01 10:43:45 +02:00
Andreas Krebbel 8a9a2371a7 [Committed] S/390: Support z14 as CPU name.
With IBM z14 officially announced we can add support for z14 as
preferred CPU name.  We still pass arch12 to Binutils in order to keep
older Binutils versions supported.

gcc/ChangeLog:

2017-07-31  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	Backport from mainline
	2017-07-31  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config.gcc: Add z14.
	* config/s390/driver-native.c (s390_host_detect_local_cpu): Add
	CPU model numbers for z13s and z14.
	* config/s390/s390-c.c (s390_resolve_overloaded_builtin): Replace
	arch12 with z14.
	* config/s390/s390-opts.h (enum processor_type): Rename
	PROCESSOR_ARCH12 to PROCESSOR_3906_Z14.
	* config/s390/s390.c (processor_table): Add field for CPU name to
	be passed to Binutils.
	(s390_asm_output_machine_for_arch): Use the new field in
	processor_table for Binutils.
	(s390_expand_builtin): Replace arch12 with z14.
	(s390_issue_rate): Rename PROCESSOR_ARCH12 to PROCESSOR_3906_Z14.
	(s390_get_sched_attrmask): Likewise.
	(s390_get_unit_mask): Likewise.
	* config/s390/s390.opt: Add z14 to processor_type enum.

From-SVN: r250740
2017-07-31 11:33:18 +00:00
Jakub Jelinek 9e4de329b1 re PR sanitizer/81604 (Ubsan type reporting can be bogus in some cases)
PR sanitizer/81604
	* ubsan.c (ubsan_type_descriptor): For UBSAN_PRINT_ARRAY don't
	change type to the element type, instead add eltype variable and
	use it where we are interested in the element type.

	* c-c++-common/ubsan/pr81604.c: New test.

From-SVN: r250729
2017-07-31 10:46:29 +02:00
Peter Bergner 7a4b10a14f backport: ppc-auxv.h (PPC_FEATURE2_DARN): New define.
gcc/
	Backport from mainline
	2017-07-28  Peter Bergner  <bergner@vnet.ibm.com>

	* config/rs6000/ppc-auxv.h (PPC_FEATURE2_DARN): New define.
	(PPC_FEATURE2_SCV): Likewise.
	* config/rs6000/rs6000.c (cpu_supports_info): Use them.

gcc/testsuite/
	Backport from mainline
	2017-07-28  Peter Bergner  <bergner@vnet.ibm.com>

	* gcc.target/powerpc/cpu-builtin-1.c (darn, scv): Add tests.

From-SVN: r250688
2017-07-28 17:29:31 -05:00
David Edelsohn fc626ac32f backport: dwarf2asm.c (dw2_asm_output_nstring): Encode double quote character for AIX.
Backport from mainline
2017-07-25  David Edelsohn  <dje.gcc@gmail.com>

        * dwarf2asm.c (dw2_asm_output_nstring): Encode double quote
        character for AIX.
        * dwarf2out.c (output_macinfo): Copy debug_line_section_label
        to dl_section_ref.  On AIX, append an expression to subtract
        the size of the section length to dl_section_ref.

From-SVN: r250663
2017-07-28 09:25:40 -04:00
Bin Cheng c2ca7b74ce backport: re PR target/81414 (ICE in fma steering on AArch64/cortex-a57)
Backport from mainline r250496
	2017-07-25  Bin Cheng  <bin.cheng@arm.com>

	PR target/81414
	* config/aarch64/cortex-a57-fma-steering.c (analyze): Skip fmul/fmac
	instructions if no du chain is found.

	* gcc.target/aarch64/pr81414.C: New.

From-SVN: r250657
2017-07-28 11:13:45 +00:00
Sebastian Huber 3df4b03a37 [PowerPC/RTEMS] Add 64-bit support using ELFv2 ABI
Add 64-bit support for RTEMS using the ELFv2 ABI with 64-bit long
double.

gcc/
	* config.gcc (powerpc-*-rtems*): Remove rs6000/eabi.h.  Add
	rs6000/biarch64.h.
	* config/rs6000/rtems.h (ASM_DECLARE_FUNCTION_SIZE): New macro.
	(ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Likewise.
	(CRT_CALL_STATIC_FUNCTION): Likewise.
	(ASM_DEFAULT_SPEC): New define.
	(ASM_SPEC32): Likewise.
	(ASM_SPEC64): Likewise.
	(ASM_SPEC_COMMON): Likewise.
	(ASM_SPEC): Likewise.
	(INVALID_64BIT): Likewise.
	(LINK_OS_DEFAULT_SPEC): Likewise.
	(LINK_OS_SPEC32): Likewise.
	(LINK_OS_SPEC64): Likewise.
	(POWERPC_LINUX): Likewise.
	(PTRDIFF_TYPE): Likewise.
	(RESTORE_FP_PREFIX): Likewise.
	(RESTORE_FP_SUFFIX): Likewise.
	(SAVE_FP_PREFIX): Likewise.
	(SAVE_FP_SUFFIX): Likewise.
	(SIZE_TYPE): Likewise.
	(SUBSUBTARGET_OVERRIDE_OPTIONS): Likewise.
	(TARGET_64BIT): Likewise.
	(TARGET_64BIT): Likewise.
	(TARGET_AIX): Likewise.
	(WCHAR_TYPE_SIZE): Likewise.
	(WCHAR_TYPE): Undefine.
	(TARGET_OS_CPP_BUILTINS): Add 64-bit PowerPC defines.
	(CPP_OS_DEFAULT_SPEC): Use previous CPP_OS_RTEMS_SPEC.
	(CPP_OS_RTEMS_SPEC): Delete.
	(SUBSUBTARGET_EXTRA_SPECS): Remove cpp_os_rtems.  Add
	asm_spec_common, asm_spec32, asm_spec64, link_os_spec32, and
	link_os_spec64.
	* config/rs6000/t-rtems: Add mcpu=e6500/m64 multilibs.

libgcc/
	* config/rs6000/ibm-ldouble.c: Disable if defined __rtems__.

From-SVN: r250654
2017-07-28 08:20:50 +00:00
Sebastian Huber 438c40546f [RISC-V] Add RTEMS support
gcc/
	* config.gcc (riscv*-*-elf*): Add (riscv*-*-rtems*).
	* config/riscv/rtems.h: New file.

From-SVN: r250649
2017-07-28 06:06:37 +00:00
Eric Botcazou 31722be4ad sparc.c (sparc_option_override): Set MASK_FSMULD flag earlier and only if MASK_FPU is set.
* config/sparc/sparc.c (sparc_option_override): Set MASK_FSMULD flag
	earlier and only if MASK_FPU is set.  Adjust formatting.

From-SVN: r250624
2017-07-27 12:57:23 +00:00
Andreas Krebbel 3c8aa2bdcb S/390: Fix PR81534
The HI/QI atomic_fetch_<atomic><mode>" expander accepted symbolic
references and emitted CAS patterns whose insn predicates rejected them.

Fixed by allowing symbolic references there as well.  Reload will get
rid of them due to the constraint letter.

Regression tested on s390x.

gcc/ChangeLog:

2017-07-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	Backport from mainline
	2017-07-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	PR target/81534
	* config/s390/s390.md ("*atomic_compare_and_swap<mode>_1")
	("*atomic_compare_and_swapdi_2", "*atomic_compare_and_swapsi_3"):
	Change s_operand to memory_operand.

gcc/testsuite/ChangeLog:

2017-07-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	Backport from mainline
	2017-07-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	PR target/81534
	* gcc.target/s390/pr81534.c: New test.

From-SVN: r250618
2017-07-27 10:42:22 +00:00
Jakub Jelinek 26590fc68b re PR tree-optimization/81555 (Wrong code at -O1)
PR tree-optimization/81555
	PR tree-optimization/81556
	* tree-ssa-reassoc.c (rewrite_expr_tree): Add NEXT_CHANGED argument,
	if true, force CHANGED for the recursive invocation.
	(reassociate_bb): Remember original length of ops array, pass
	len != orig_len as NEXT_CHANGED in rewrite_expr_tree call.

	* gcc.c-torture/execute/pr81555.c: New test.
	* gcc.c-torture/execute/pr81556.c: New test.

From-SVN: r250610
2017-07-27 11:06:08 +02:00
Martin Liska 01cee97570 Subject: Backport r250271
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-07-17  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81302
	* opts.c (finish_options): Do not allow -fgnu-tm
	w/ -fsanitize={kernel-,}address.  Say sorry.

From-SVN: r250608
2017-07-27 08:38:35 +00:00
Martin Liska 4dad7c1d13 Backport r250561
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-07-26  Martin Liska  <mliska@suse.cz>

	PR sanitize/81186
	* function.c (expand_function_start): Make expansion of
	nonlocal_goto_save_area after parm_birth_insn.
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-07-26  Martin Liska  <mliska@suse.cz>

	PR sanitize/81186
	* gcc.dg/asan/pr81186.c: New test.

From-SVN: r250605
2017-07-27 07:32:53 +00:00
Martin Liska da7b783895 Backport r249833
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-30  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81021
	* tree-eh.c (lower_resx): Call BUILT_IN_ASAN_HANDLE_NO_RETURN
	before BUILT_IN_UNWIND_RESUME when ASAN is used.
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-30  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81021
	* g++.dg/asan/pr81021.C: New test.

From-SVN: r250604
2017-07-27 07:32:15 +00:00
Martin Liska 7d3d0ac762 Backport r249728
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-28  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81224
	* asan.c (instrument_derefs): Bail out inner references
	that are hard register variables.
2017-07-27  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2017-06-28  Martin Liska  <mliska@suse.cz>

	PR sanitizer/81224
	* gcc.dg/asan/pr81224.c: New test.

From-SVN: r250603
2017-07-27 07:31:19 +00:00
Sebastian Huber 2582725929 [SPARC] Add -mfsmuld option
Add the -mfsmuld option to control the generation of the FsMULd
instruction.  In general, this instruction is available in architecture
version V8 and V9 CPUs with FPU.  Some CPUs of this category do not
support this instruction properly, e.g. AT697E, AT697F and UT699.  Some
CPUs of this category do not implement it in hardware, e.g. LEON3/4 with
GRFPU-lite.

gcc/
	* config/sparc/sparc.c (dump_target_flag_bits): Dump MASK_FSMULD.
	(sparc_option_override): Honour MASK_FSMULD.
	* config/sparc/sparc.h (MASK_FEATURES): Add MASK_FSMULD.
	* config/sparc/sparc.md (muldf3_extend): Use TARGET_FSMULD.
	* config/sparc/sparc.opt (mfsmuld): New option.
	* doc/invoke.texi (mfsmuld): Document option.

From-SVN: r250571
2017-07-26 12:42:03 +00:00
Georg-Johann Lay cb42c9b08e backport: re PR lto/81487 ([mingw32] ld.exe: error: asprintf failed)
lto-plugin/
	Backport from 2017-07-21 trunk r250428.
	PR lto/81487
	* lto-plugin.c (claim_file_handler): Use xasprintf instead of
	asprintf.
	[hi!=0]: Swap hi and lo arguments supplied to xasprintf.
gcc/
	Backport from 2017-07-25 trunk r250499.
	PR 81487
	* hsa-brig.c (brig_init): Use xasprintf instead of asprintf.
	* gimple-pretty-print.c (dump_probability): Same.
	* tree-ssa-structalias.c (alias_get_name): Same.

From-SVN: r250562
2017-07-26 08:58:37 +00:00
Richard Biener 259828e6c7 Backport PRs 80721, 81175, 81410, 81455, 81505
2017-07-26  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-06-02  Richard Biener  <rguenther@suse.de>
		Markus Eisenmann  <meisenmann.lba@fh-salzburg.ac.at>

	PR libstdc++/80721
	* libsupc++/eh_alloc.cc (pool::free): Keep list properly
	sorted and add missing freelist item merging cases.

	2017-06-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81410
	* tree-vect-stmts.c (vectorizable_load): Properly adjust for
	the gap in the ! slp_perm SLP case after each group.

	* gcc.dg/vect/pr81410.c: New testcase.

	2017-07-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81455
	* tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to
	not walk in cycles when looking for guards.

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

	2017-07-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/81505
	* fold-const.c (fold_negate_const): TREE_OVERFLOW should be
	sticky.

	* gcc.dg/ubsan/pr81505.c: New testcase.

	2017-07-04  Jakub Jelinek  <jakub@redhat.com>

	PR target/81175
	* gcc.target/i386/pr69255-2.c (foo): Use the return value of the
	gather.

	2017-06-28  Jakub Jelinek  <jakub@redhat.com>

	PR target/81175
	* config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin
	rather than def_builtin_pure for __builtin_ia32_gatherpf*.

	2017-06-26  Richard Biener  <rguenther@suse.de>

	PR target/81175
	* config/i386/i386.c (ix86_init_mmx_sse_builtins):
	Use def_builtin_pure for all gather builtins.

	* gfortran.dg/pr81175.f: New testcase.

	2017-06-21  Marc Glisse  <marc.glisse@inria.fr>
 
	* config/i386/i386.c (struct builtin_isa): New field pure_p.
	Reorder for compactness.
	(def_builtin, def_builtin2, ix86_add_new_builtins): Handle pure_p.
	(def_builtin_pure, def_builtin_pure2): New functions.
	(ix86_init_mmx_sse_builtins) [__builtin_ia32_stmxcsr]: Mark as pure.

 	* gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
 	* gcc.dg/tree-ssa/addadd-2.c: New file.

From-SVN: r250560
2017-07-26 08:36:34 +00:00
Sebastian Huber 2c88b546bc [SPARC] Drop superfluous MASK_FPU enable
All TARGET_DEFAULT defines set MASK_FPU.  There is no need to set it in
some CPU target flags enable.

gcc/
	* config/sparc/sparc.c (sparc_option_override): Remove MASK_FPU
	from all CPU target flags enable members.

From-SVN: r250559
2017-07-26 08:32:41 +00:00
Sebastian Huber 145e8bfade [RTEMS] Add GCC Runtime Library Exception
gcc/
	PR libgcc/61152
	* config/aarch64/rtems.h: Add GCC Runtime Library Exception.
	Format changes.
	* config/arm/rtems.h: Likewise.
	* config/bfin/rtems.h: Likewise.
	* config/i386/rtemself.h: Likewise.
	* config/lm32/rtems.h: Likewise.
	* config/m32c/rtems.h: Likewise.
	* config/m68k/rtemself.h: Likewise.
	* config/microblaze/rtems.h: Likewise.
	* config/mips/rtems.h: Likewise.
	* config/moxie/rtems.h: Likewise.
	* config/nios2/rtems.h: Likewise.
	* config/rs6000/rtems.h: Likewise.
	* config/rtems.h: Likewise.
	* config/sh/rtems.h: Likewise.
	* config/sh/rtemself.h: Likewise.
	* config/sparc/rtemself.h: Likewise.

From-SVN: r250558
2017-07-26 08:31:09 +00:00
Bill Schmidt db1f03b6f7 backport: re PR tree-optimization/81162 (UBSAN switch triggers incorrect optimization in SLSR)
[gcc]

2016-07-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2016-07-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/81162
	* gimple-ssa-strength-reduction.c (replace_mult_candidate): Don't
	replace a negate with an add.

[gcc/testsuite]

2016-07-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Backport from mainline
	2016-07-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/81162
	* gcc.dg/ubsan/pr81162.c: New file.

From-SVN: r250542
2017-07-25 19:40:50 +00:00
Georg-Johann Lay 1e0bc91345 backport: re PR target/81407 ([avr] Diagnose if a variable in progmem needs constructing.)
gcc/
	Backport from 2017-07-12 trunk r250151.
	PR target/81407
	* config/avr/avr.c (avr_encode_section_info)
	[progmem && !TREE_READONLY]: Error if progmem object needs
	constructing.

From-SVN: r250522
2017-07-25 14:32:30 +00:00
Wilco Dijkstra ca73e1b3d3 re PR target/79041 (aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used)
Fix PR79041

As described in PR79041, -mcmodel=large -mpc-relative-literal-loads
may be used to avoid generating ADRP/ADD or ADRP/LDR.  However both
trunk and GCC7 may still emit ADRP for some constant pool literals.
Fix this by adding a aarch64_pcrelative_literal_loads check.

    gcc/
	PR target/79041
	* config/aarch64/aarch64.c (aarch64_classify_symbol):
	Avoid SYMBOL_SMALL_ABSOLUTE for literals with pc-relative literals.
    gcc/testsuite/
	* gcc.target/aarch64/pr79041-2.c: New test.

From-SVN: r250514
2017-07-25 12:08:59 +00:00
Georg-Johann Lay 7db1c40d36 backport: re PR rtl-optimization/75964 (insn combiner removes comparison after ABS)
gcc/
	Backport from 2017-05-06 trunk r247719.
	PR rtl-optimization/75964
	* simplify-rtx.c (simplify_const_relational_operation): Remove
	invalid handling of comparisons of integer ABS.
gcc/testsuite/
	Backport from 2017-05-06 trunk r247719.
	PR rtl-optimization/75964
	* gcc.dg/torture/pr75964.c: New test.

From-SVN: r250509
2017-07-25 11:39:23 +00:00
Bin Cheng 16ac9369b0 backport: re PR tree-optimization/81388 (Incorrect code generation with -O1)
Backport from 2017-07-20 trunk r250384.

	PR tree-optimization/81388
	Revert r238585:
	2016-07-21  Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Clean up
	by removing computation of may_be_zero.

	gcc/testsuite
	PR tree-optimization/81388
	* gcc.dg/tree-ssa/pr81388-1.c: New test.
	* gcc.dg/tree-ssa/pr81388-2.c: New test.

From-SVN: r250497
2017-07-25 08:56:26 +00:00
Uros Bizjak 0c9fcbd9a7 re PR target/80569 (i686: "shrx" instruction generated in 16-bit mode)
PR target/80569
	* config/i386/i386.c (ix86_option_override_internal): Disable
	BMI, BMI2 and TBM instructions for -m16.

testsuite/ChangeLog:

	PR target/80569
	* gcc.target/i386/pr80569.c: New test.

From-SVN: r250460
2017-07-23 12:33:08 +02:00
Michael Meissner 4aae5594ac backport: re PR target/81193 (PowerPC GCC __builtin_cpu_is and __builtin_cpu_supports should warn about old libraries)
[gcc]
2017-07-19  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-07-12  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81193
	* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): If GLIBC
	provides the hardware capability bits, define the macro
	__BUILTIN_CPU_SUPPORTS__.
	* config/rs6000/rs6000.c (cpu_expand_builtin): Generate a warning
	if GLIBC does not provide the hardware capability bits.  Add a
	gcc_unreachable call if the built-in cpu function is neither
	__builtin_cpu_is nor __builtin_cpu_supports.
	* doc/extend.texi (PowerPC built-in functions): Document that
	GLIBC 2.23 or newer is needed by __builtin_cpu_is and
	__builtin_cpu_supports.  Document the macros defined by GCC if the
	newer GLIBC is available.

[gcc/testsuite]
2017-07-19  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-07-12  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81193
	* gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef
	__BUILTIN_CPU_SUPPORTS to see if the GLIBC is new enough that
	__builtin_cpu_is and __builtin_cpu_supports are supported.

From-SVN: r250368
2017-07-19 20:31:53 +00:00
Uros Bizjak c3221d0c67 re PR target/81471 (internal compiler error: in curr_insn_transform, at lra-constraints.c:3495)
PR target/81471
	* config/i386/i386.md (rorx_immediate_operand): New mode attribute.
	(*bmi2_rorx<mode>3_1): Use rorx_immediate_operand as
	operand 2 predicate.
	(*bmi2_rorxsi3_1_zext): Use const_0_to_31_operand as
	operand 2 predicate.
	(ror,rol -> rorx splitters): Use const_int_operand as
	operand 2 predicate.

testsuite/ChangeLog:

	PR target/81471
	* gcc.target/i386/pr81471.c: New test.

From-SVN: r250317
2017-07-18 20:28:12 +02:00
Tom de Vries bffd88f860 Backport "Insert diverging jump alap in nvptx_single"
2017-07-18  Tom de Vries  <tom@codesourcery.com>

	backport from mainline:
	2017-07-17  Tom de Vries  <tom@codesourcery.com>

	PR target/81069
	* config/nvptx/nvptx.c (nvptx_single): Insert diverging branch as late
	as possible.

From-SVN: r250308
2017-07-18 13:06:07 +00:00
Georg-Johann Lay 415f3135e6 backport: re PR target/81473 ([avr] build fails due to INT8_MIN and friends.)
gcc/
	Backport from 2017-07-18 trunk r250301.
	PR target/81473
	* config/avr/avr.c (avr_optimize_casesi): Don't use
	INT8_MIN, INT8_MAX, UINT8_MAX, INT16_MIN, INT16_MAX, UINT16_MAX.

From-SVN: r250302
2017-07-18 09:39:53 +00:00
Jakub Jelinek 4771e97b8b re PR tree-optimization/81428 (ICE: in build_one_cst, at tree.c:2079 with -O2. Fixed point division.)
PR tree-optimization/81428
	* match.pd (X / X -> one): Don't optimize _Fract divisions, as 1
	can't be built for those types.

	* gcc.dg/fixed-point/pr81428.c: New test.

From-SVN: r250289
2017-07-17 21:45:59 +02:00
Jakub Jelinek ffaf3bdd97 re PR tree-optimization/81365 (GCC miscompiles swap)
PR tree-optimization/81365
	* tree-ssa-phiprop.c (propagate_with_phi): When considering hoisting
	aggregate moves onto bb predecessor edges, make sure there are no
	loads that could alias the lhs in between the start of bb and the
	loads from *phi.

	* g++.dg/torture/pr81365.C: New test.

From-SVN: r250288
2017-07-17 21:42:37 +02:00
Jakub Jelinek fc28766c1a backport: re PR target/81225 (ICE with -mavx512ifma -O3 -ffloat-store)
Backported from mainline
	2017-06-30  Jakub Jelinek  <jakub@redhat.com>

	PR target/81225
	* config/i386/sse.md (vec_extract_lo_<mode><mask_name>): For
	V8FI, V16FI and VI8F_256 iterators, use <store_mask_predicate> instead
	of nonimmediate_operand and <store_mask_constraint> instead of m for
	the input operand.  For V8FI iterator, always split if input is a MEM.
	For V16FI and V8SF_256 iterators, don't test if both operands are MEM
	if <mask_applied>.  For VI4F_256 iterator, use <store_mask_predicate>
	instead of register_operand and <store_mask_constraint> instead of v for
	the input operand.  Make sure both operands aren't MEMs for if not
	<mask_applied>.

	* gcc.target/i386/pr81225.c: New test.

From-SVN: r250285
2017-07-17 21:38:29 +02:00
Georg-Johann Lay 495da5a6fd backport: re PR middle-end/80929 (Division with constant no more optimized to mult highpart)
Backport from 2017-07-17 trunk r250258.
	PR 80929
	* config/avr/avr.c (avr_mul_highpart_cost): New static function.
	(avr_rtx_costs_1) [TRUNCATE]: Use it to compute mul_highpart cost.
	[LSHIFTRT, outer_code = TRUNCATE]: Same.

From-SVN: r250259
2017-07-17 09:06:39 +00:00
Sebastian Huber 18f04b519f [SPARC/RTEMS] Add __FIX_LEON3FT_B2BST
In case the LEON3FT back-to-back store workaround is active
(sparc_fix_b2bst), then define the builtin define __FIX_LEON3FT_B2BST on
RTEMS.  The intended use case for this is operating system code in
assembly language.  See also:

https://lists.rtems.org/pipermail/devel/2017-July/018463.html

gcc/
	*  gcc/config/sparc/rtemself.h (TARGET_OS_CPP_BUILTINS): Add
	conditional builtin define __FIX_LEON3FT_B2BST.

From-SVN: r250255
2017-07-17 05:28:38 +00:00
Daniel Cederman 0e43fc9ee5 [RTEMS] Add multilibs for LEON3FT back-to-back store workaround
Replace MULTILIB_EXCEPTIONS with MULTILIB_REQUIRED for readability.
-mfix-gr712rc and -mfix-ut700 are currently equivalent.

gcc/
	* config/sparc/t-rtems: Add mfix-gr712rc multilibs. Replace
	MULTILIB_EXCEPTIONS with MULTILIB_REQUIRED. Match -mfix-gr712rc
	with -mfix-ut700.

From-SVN: r250253
2017-07-17 05:20:59 +00:00
Eric Botcazou 1fcc5158c5 re PR rtl-optimization/81424 (internal error on GPRbuild with -O2)
PR rtl-optimization/81424
	* optabs.c (prepare_cmp_insn): Use copy_to_reg instead of force_reg
	to remove potential trapping from operands if -fnon-call-exceptions.

From-SVN: r250247
2017-07-16 22:07:15 +00:00
Daniel Cederman faefaf5172 sparc.md (divdf3_fix): Add NOP to prevent back to back store errata sensitive sequence from being...
2017-07-16  Daniel Cederman  <cederman@gaisler.com>

	* config/sparc/sparc.md (divdf3_fix): Add NOP to prevent back
	to back store errata sensitive sequence from being generated.
	(sqrtdf2_fix): Likewise.

From-SVN: r250235
2017-07-16 10:43:47 +00:00
Georg-Johann Lay 6cc498e884 backport: re PR target/79883 (avr i18n: untranslated "interrupt" or "signal")
gcc/
	Backport from 2017-07-12 trunk r250156.
	PR target/79883
	* config/avr/avr.c (avr_set_current_function): In diagnostic
	messages: Quote keywords and (parts of) identifiers.
	[WITH_AVRLIBC]: Warn for functions named "ISR", "SIGNAL" or
	"INTERRUPT".

From-SVN: r250157
2017-07-12 15:31:22 +00:00
Daniel Cederman 9c36e9c261 sparc.opt (mfix-ut700): New option.
* config/sparc/sparc.opt (mfix-ut700): New option.
	(mfix-gr712rc): Likewise.
	(sparc_fix_b2bst): New variable.
	* doc/invoke.texi (SPARC options): Document them.
	(ARM options): Fix warnings.
	* config/sparc/sparc.c (sparc_do_work_around_errata): Insert NOP
	instructions to prevent sequences that can trigger the store-store
	errata for certain LEON3FT processors.
	(pass_work_around_errata::gate): Also test sparc_fix_b2bst.
	(sparc_option_override): Set sparc_fix_b2bst appropriately.
	* config/sparc/sparc.md (fix_b2bst): New attribute.
	(in_branch_delay): Prevent stores in delay slot if fix_b2bst.

From-SVN: r250121
2017-07-11 07:21:04 +00:00
Uros Bizjak b0c4c9f1fb re PR target/81375 (unrecognizable insn)
PR target/81375
	* config/i386/i386.md (divsf3): Add TARGET_SSE to TARGET_SSE_MATH.
	(rcpps): Ditto.
	(*rsqrtsf2_sse): Ditto.
	(rsqrtsf2): Ditto.
	(div<mode>3): Macroize insn from divdf3 and divsf3
	using MODEF mode iterator.

testsuite/ChangeLog:

	PR target/81375
	* gcc.target/i386/pr81375.c: New test.

From-SVN: r250113
2017-07-11 07:32:39 +02:00
Michael Meissner 69115c8c9d backport: re PR target/81348 (PowerPC64: Code built with -mcpu=power9 hits SEGV in RTL split2)
[gcc]
2017-07-07  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Backport from mainline

	PR target/81348
	* config/rs6000/rs6000.md (HI sign_extend splitter): Use the
	correct operand in doing the split.

[gcc/testsuite]
2017-07-07  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Backport from mainline
	2017-07-07  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81348
	* gcc.target/powerpc/pr81348.c: New test.

From-SVN: r250060
2017-07-07 20:47:15 +00:00
Jose E. Marchesi 0316d24f7a Support for the SPARC M8 cpu.
This patch serie adds support for the SPARC M8 processor to GCC.
The SPARC M8 processor implements the Oracle SPARC Architecture 2017.

- bmask* instructions are put in their own instruction type.  It makes
  little sense to have them in the same category than array
  instructions.

- Similarly, VIS compare instructions are put in their own instruction
  type.  This is to better accommodate subtypes, which are not quite
  the same than the subtypes of `visl' instructions.

- The introduction of a new `subtype' insn attribute in sparc.md
  avoids the need for adjusting the instruction scheduler DFAs for
  previous cpu models every time a new cpu is introduced.

- The full set of SPARC instructions used in sparc.md, and their
  position in the type/subtype hierarchy, is documented in a comment.
  This eases the modification of the DFA schedulers, and the addition
  of new cpus.

- The M7 DFA scheduler is reworked:

  + To use the new type/subtype hierarchy.
  + The v3pipe insn attribute is no longer needed.
  + More accurate latencies for instructions.
  + The S4 core pipeline is documented in a comment in niagara7.md.

- Support for -mcpu=m8 (we are thus suggesting to abandon the niagaraN
  denomination for M8 and later processors.)

- Support for a new VIS level, VIS4B, covering the new VIS
  instructions introduced in OSA2017 and implemented in the M8.  Also
  built-ins.

- A M8 DFA scheduler:

  + Also based on the new type/subtype hierarchy.
  + The functional units in the S5 core are explicitly documented in a
    comment in m8.md.


gcc/ChangeLog:

	* config/sparc/m8.md: New file.
	* config/sparc/sparc.md: Include m8.md.

	* config/sparc/sparc.opt: New option -mvis4b.
	* config/sparc/sparc.c (dump_target_flag_bits): Handle MASK_VIS4B.
	(sparc_option_override): Handle VIS4B.
	(enum sparc_builtins): Define
	SPARC_BUILTIN_DICTUNPACK{8,16,32},
	SPARC_BUILTIN_FPCMP{LE,GT,EQ,NE}{8,16,32}SHL,
	SPARC_BUILTIN_FPCMPU{LE,GT}{8,16,32}SHL,
	SPARC_BUILTIN_FPCMPDE{8,16,32}SHL and
	SPARC_BUILTIN_FPCMPUR{8,16,32}SHL.
	(check_constant_argument): New function.
	(sparc_vis_init_builtins): Define builtins
	__builtin_vis_dictunpack{8,16,32},
	__builtin_vis_fpcmp{le,gt,eq,ne}{8,16,32}shl,
	__builtin_vis_fpcmpu{le,gt}{8,16,32}shl,
	__builtin_vis_fpcmpde{8,16,32}shl and
	__builtin_vis_fpcmpur{8,16,32}shl.
	(sparc_expand_builtin): Check that the constant operands to
	__builtin_vis_fpcmp*shl and _builtin_vis_dictunpack* are indeed
	constant and in range.
	* config/sparc/sparc-c.c (sparc_target_macros): Handle
	TARGET_VIS4B.
	* config/sparc/sparc.h (SPARC_IMM2_P): Define.
	(SPARC_IMM5_P): Likewise.
	* config/sparc/sparc.md (cpu_feature): Add new feagure "vis4b".
	(enabled): Handle vis4b.
	(UNSPEC_DICTUNPACK): New unspec.
	(UNSPEC_FPCMPSHL): Likewise.
	(UNSPEC_FPUCMPSHL): Likewise.
	(UNSPEC_FPCMPDESHL): Likewise.
	(UNSPEC_FPCMPURSHL): Likewise.
	(cpu_feature): New CPU feature `vis4b'.
	(dictunpack{8,16,32}): New insns.
	(FPCSMODE): New mode iterator.
	(fpcscond): New code iterator.
	(fpcsucond): Likewise.
	(fpcmp{le,gt,eq,ne}{8,16,32}{si,di}shl): New insns.
	(fpcmpu{le,gt}{8,16,32}{si,di}shl): Likewise.
	(fpcmpde{8,16,32}{si,di}shl): Likewise.
	(fpcmpur{8,16,32}{si,di}shl): Likewise.
	* config/sparc/constraints.md: Define constraints `q' for unsigned
	2-bit integer constants and `t' for unsigned 5-bit integer
	constants.
	* config/sparc/predicates.md (imm5_operand_dictunpack8): New
	predicate.
	(imm5_operand_dictunpack16): Likewise.
	(imm5_operand_dictunpack32): Likewise.
	(imm2_operand): Likewise.
	* doc/invoke.texi (SPARC Options): Document -mvis4b.
	* doc/extend.texi (SPARC VIS Built-in Functions): Document the
	ditunpack* and fpcmp*shl builtins.

	* config.gcc: Handle m8 in --with-{cpu,tune} options.
	* config.in: Add HAVE_AS_SPARC6 define.
	* config/sparc/driver-sparc.c (cpu_names): Add entry for the SPARC
	M8.
	* config/sparc/sol2.h (CPP_CPU64_DEFAULT_SPEC): Define for
	TARGET_CPU_m8.
	(ASM_CPU32_DEFAUILT_SPEC): Likewise.
	(CPP_CPU_SPEC): Handle m8.
	(ASM_CPU_SPEC): Likewise.
	* config/sparc/sparc-opts.h (enum processor_type): Add
	PROCESSOR_M8.
	* config/sparc/sparc.c (m8_costs): New struct.
	(sparc_option_override): Handle TARGET_CPU_m8.
	(sparc32_initialize_trampoline): Likewise.
	(sparc64_initialize_trampoline): Likewise.
	(sparc_issue_rate): Likewise.
	(sparc_register_move_cost): Likewise.
	* config/sparc/sparc.h (TARGET_CPU_m8): Define.
	(CPP_CPU64_DEFAULT_SPEC): Define for M8.
	(ASM_CPU64_DEFAULT_SPEC): Likewise.
	(CPP_CPU_SPEC): Handle M8.
	(ASM_CPU_SPEC): Likewise.
	(AS_M8_FLAG): Define.
	* config/sparc/sparc.md: Add m8 to the cpu attribute.
	* config/sparc/sparc.opt: New option -mcpu=m8 for sparc targets.
	* configure.ac (HAVE_AS_SPARC6): Check for assembler support for
	M8 instructions.
	* configure: Regenerate.
	* doc/invoke.texi (SPARC Options): Document -mcpu=m8 and
	-mtune=m8.

	* config/sparc/niagara7.md: Rework the DFA scheduler to use insn
	subtypes.
	* config/sparc/sparc.md: Remove the `v3pipe' insn attribute.
	("*movdi_insn_sp32"): Do not set v3pipe.
	("*movsi_insn"): Likewise.
	("*movdi_insn_sp64"): Likewise.
	("*movsf_insn"): Likewise.
	("*movdf_insn_sp32"): Likewise.
	("*movdf_insn_sp64"): Likewise.
	("*zero_extendsidi2_insn_sp64"): Likewise.
	("*sign_extendsidi2_insn"): Likewise.
	("*mov<VM32:mode>_insn"): Likewise.
	("*mov<VM64:mode>_insn_sp64"): Likewise.
	("*mov<VM64:mode>_insn_sp32"): Likewise.
	("<plusminus_insn><VADDSUB:mode>3"): Likewise.
	("<vlop:code><VL:mode>3"): Likewise.
	("*not_<vlop:code><VL:mode>3"): Likewise.
	("*nand<VL:mode>_vis"): Likewise.
	("*<vlnotop:code>_not1<VL:mode>_vis"): Likewise.
	("*<vlnotop:code>_not2<VL:mode>_vis"): Likewise.
	("one_cmpl<VL:mode>2"): Likewise.
	("faligndata<VM64:mode>_vis"): Likewise.
	("alignaddrsi_vis"): Likewise.
	("alignaddrdi_vis"): Likweise.
	("alignaddrlsi_vis"): Likewise.
	("alignaddrldi_vis"): Likewise.
	("fcmp<gcond:code><GCM:gcm_name><P:mode>_vis"): Likewise.
	("bmaskdi_vis"): Likewise.
	("bmasksi_vis"): Likewise.
	("bshuffle<VM64:mode>_vis"): Likewise.
	("cmask8<P:mode>_vis"): Likewise.
	("cmask16<P:mode>_vis"): Likewise.
	("cmask32<P:mode>_vis"): Likewise.
	("pdistn<P:mode>_vis"): Likewise.
	("<vis3_addsub_ss_patname><VASS:mode>3"): Likewise.

	* config/sparc/sparc.md ("subtype"): New insn attribute.
	("*wrgsr_sp64"): Set insn subtype.
	("*rdgsr_sp64"): Likewise.
	("alignaddrsi_vis"): Likewise.
	("alignaddrdi_vis"): Likewise.
	("alignaddrlsi_vis"): Likewise.
	("alignaddrldi_vis"): Likewise.
	("<plusminus_insn><VADDSUB:mode>3"): Likewise.
	("fexpand_vis"): Likewise.
	("fpmerge_vis"): Likewise.
	("faligndata<VM64:mode>_vis"): Likewise.
	("bshuffle<VM64:mode>_vis"): Likewise.
	("cmask8<P:mode>_vis"): Likewise.
	("cmask16<P:mode>_vis"): Likewise.
	("cmask32<P:mode>_vis"): Likewise.
	("fchksm16_vis"): Likewise.
	("v<vis3_shift_patname><GCM:mode>3"): Likewise.
	("fmean16_vis"): Likewise.
	("fp<plusminus_insn>64_vis"): Likewise.
	("<plusminus_insn>v8qi3"): Likewise.
	("<vis3_addsub_ss_patname><VASS:mode>3"): Likewise.
	("<vis4_minmax_patname><VMMAX:mode>3"): Likewise.
	("<vis4_uminmax_patname><VMMAX:mode>3"): Likewise.
	("<vis3_addsub_ss_patname>v8qi3"): Likewise.
	("<vis4_addsub_us_patname><VAUS:mode>3"): Likewise.
	("*movqi_insn"): Likewise.
	("*movhi_insn"): Likewise.
	("*movsi_insn"): Likewise.
	("movsi_pic_gotdata_op"): Likewise.
	("*movdi_insn_sp32"): Likewise.
	("*movdi_insn_sp64"): Likewise.
	("movdi_pic_gotdata_op"): Likewise.
	("*movsf_insn"): Likewise.
	("*movdf_insn_sp32"): Likewise.
	("*movdf_insn_sp64"): Likewise.
	("*zero_extendhisi2_insn"): Likewise.
	("*zero_extendqihi2_insn"): Likewise.
	("*zero_extendqisi2_insn"): Likewise.
	("*zero_extendqidi2_insn"): Likewise.
	("*zero_extendhidi2_insn"): Likewise.
	("*zero_extendsidi2_insn_sp64"): Likewise.
	("ldfsr"): Likewise.
	("prefetch_64"): Likewise.
	("prefetch_32"): Likewise.
	("tie_ld32"): Likewise.
	("tie_ld64"): Likewise.
	("*tldo_ldub_sp32"): Likewise.
	("*tldo_ldub1_sp32"): Likewise.
	("*tldo_ldub2_sp32"): Likewise.
	("*tldo_ldub_sp64"): Likewise.
	("*tldo_ldub1_sp64"): Likewise.
	("*tldo_ldub2_sp64"): Likewise.
	("*tldo_ldub3_sp64"): Likewise.
	("*tldo_lduh_sp32"): Likewise.
	("*tldo_lduh1_sp32"): Likewise.
	("*tldo_lduh_sp64"): Likewise.
	("*tldo_lduh1_sp64"): Likewise.
	("*tldo_lduh2_sp64"): Likewise.
	("*tldo_lduw_sp32"): Likewise.
	("*tldo_lduw_sp64"): Likewise.
	("*tldo_lduw1_sp64"): Likewise.
	("*tldo_ldx_sp64"): Likewise.
	("*mov<VM32:mode>_insn"): Likewise.
	("*mov<VM64:mode>_insn_sp64"): Likewise.
	("*mov<VM64:mode>_insn_sp32"): Likewise.

	* config/sparc/sparc.md ("type"): New insn type viscmp.
	("fcmp<gcond:code><GCM:gcm_name><P:mode>_vis"): Set insn type to
	viscmp.
	("fpcmp<gcond:code>8<P:mode>_vis"): Likewise.
	("fucmp<gcond:code>8<P:mode>_vis"): Likewise.
	("fpcmpu<gcond:code><GCM:gcm_name><P:mode>_vis"): Likewise.
	* config/sparc/niagara7.md ("n7_vis_logical_v3pipe"): Handle
	viscmp.
	("n7_vis_logical_11cycle"): Likewise.
	* config/sparc/niagara4.md ("n4_vis_logical"): Likewise.
	* config/sparc/niagara2.md ("niag3_vis": Likewise.
	* config/sparc/niagara.md ("niag_vis"): Likewise.
	* config/sparc/ultra3.md ("us3_fga"): Likewise.
	* config/sparc/ultra1_2.md ("us1_fga_double"): Likewise.

	* config/sparc/sparc.md: New instruction type `bmask'.
	(bmaskdi_vis): Use the `bmask' type.
	(bmasksi_vis): Likewise.
	* config/sparc/ultra3.md (us3_array): Likewise.
	* config/sparc/niagara7.md (n7_array): Likewise.
	* config/sparc/niagara4.md (n4_array): Likewise.
	* config/sparc/niagara2.md (niag2_vis): Likewise.
	(niag3_vis): Likewise.
	* config/sparc/niagara.md (niag_vis): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/sparc/dictunpack.c: New file.
	* gcc.target/sparc/fpcmpdeshl.c: Likewise.
	* gcc.target/sparc/fpcmpshl.c: Likewise.
	* gcc.target/sparc/fpcmpurshl.c: Likewise.
	* gcc.target/sparc/fpcmpushl.c: Likewise.

From-SVN: r250050
2017-07-07 17:42:43 +02:00
Georg-Johann Lay edfd992166 backport: re PR target/81305 ([avr] avrtiny uses LDS for SREG in ISR routines which is out of range of LDS.)
gcc/
	Backport from 2017-07-05 trunk r249995.
	PR target/81305
	* config/avr/avr.c (avr_out_movhi_mr_r_xmega) [CONSTANT_ADDRESS_P]:
	Don't depend on "optimize > 0".
	(out_movhi_r_mr, out_movqi_mr_r): Same.
	(out_movhi_mr_r, out_movqi_r_mr): Same.
	(avr_address_cost) [CONSTANT_ADDRESS_P]: Don't depend cost for
	io_address_operand on "optimize > 0".
gcc/testsuite/
	Backport from 2017-07-05 trunk r249995, r249996.
	PR target/81305
	* gcc.target/avr/isr-test.h: New file.
	* gcc.target/avr/torture/isr-01-simple.c: New test.
	* gcc.target/avr/torture/isr-02-call.c: New test.
	* gcc.target/avr/torture/isr-03-fixed.c: New test.

From-SVN: r249998
2017-07-05 12:49:08 +00:00
Uros Bizjak df3f3c4b11 re PR target/81300 (-fpeephole2 breaks __builtin_ia32_sbb_u64, _subborrow_u64 on AMD64)
PR target/81300
	* config/i386/i386.md (setcc + movzbl/and to xor + setcc peepholes):
	Require dead FLAGS_REG at the beginning of a peephole.

	PR target/81294
	* config/i386/adxintrin.h (_subborrow_u32): Swap _X and _Y
	arguments in the call to __builtin_ia32_sbb_u32.
	(_subborrow_u64): Swap _X and _Y arguments in the call to
	__builtin_ia32_sbb_u64.

testsuite/ChangeLog:

	PR target/81300
	* gcc.target/i386/pr81300.c: New test.

	PR target/81294
	* gcc.target/i386/adx-addcarryx32-2.c (adx_test): Swap
	x and y arguments in the call to _subborrow_u32.
	* gcc.target/i386/adx-addcarryx64-2.c (adx_test): Swap
	x and y arguments in the call to _subborrow_u64.
	* gcc.target/i386/pr81294-1.c: New test.
	* gcc.target/i386/pr81294-2.c: Ditto.

From-SVN: r249978
2017-07-04 23:05:17 +02:00
Thomas Preud'homme 05009fb215 Fix ChangeLog format in r249596
This patch fixes relative pathnames in gcc/ChangeLog for r249596.

From-SVN: r249965
2017-07-04 13:31:16 +00:00
Segher Boessenkool df063da574 backport: rs6000.md (add<mode>3): Use reg_or_subregno instead of REGNO.
Backport from trunk:

2017-06-15  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000.md (add<mode>3): Use reg_or_subregno instead
of REGNO.

From-SVN: r249905
2017-07-03 14:20:02 +02:00
Tom de Vries 3c60c3693d Backport "Fix sigsegv in find_same_succ_bb"
2017-07-03  Tom de Vries  <tom@codesourcery.com>

	backport from mainline:
	2017-07-03  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/81192
	* tree-ssa-tail-merge.c (same_succ_flush_bb): Handle
	BB_SAME_SUCC (bb) == NULL.

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

From-SVN: r249898
2017-07-03 08:32:20 +00:00
Michael Meissner 3a202a726d backport: re PR target/80510 (Optimize Power7/power8 Altivec load/stores)
[gcc]
2017-06-29  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Backport from mainline
	2017-06-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/80510
	* config/rs6000/rs6000.md (ALTIVEC_DFORM): Do not allow DImode in
	32-bit, since indexed is not valid for DImode.
	(mov<mode>_hardfloat32): Reorder ISA 2.07 load/stores before ISA
	3.0 d-form load/stores to be the same as mov<mode>_hardfloat64.
	(define_peephole2 for Altivec d-form load): Add 32-bit support.
	(define_peephole2 for Altivec d-form store): Likewise.

	Backport from mainline
	2017-06-20  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/79799
	* config/rs6000/rs6000.c (rs6000_expand_vector_init): Add support
	for doing vector set of SFmode on ISA 3.0.
	* config/rs6000/vsx.md (vsx_set_v4sf_p9): Likewise.
	(vsx_set_v4sf_p9_zero): Special case setting 0.0f to a V4SF
	element.
	(vsx_insert_extract_v4sf_p9): Add an optimization for inserting a
	SFmode value into a V4SF variable that was extracted from another
	V4SF variable without converting the element to double precision
	and back to single precision vector format.
	(vsx_insert_extract_v4sf_p9_2): Likewise.

[gcc/testsuite]
2017-06-29  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Backport from mainline
	2017-06-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/80510
	* gcc.target/powerpc/pr80510-1.c: Allow test to run on 32-bit.
	* gcc.target/powerpc/pr80510-2.c: Likewise.

	Backport from mainline
	2017-06-20  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/79799
	* gcc.target/powerpc/pr79799-1.c: New test.
	* gcc.target/powerpc/pr79799-2.c: Likewise.
	* gcc.target/powerpc/pr79799-3.c: Likewise.
	* gcc.target/powerpc/pr79799-4.c: Likewise.
	* gcc.target/powerpc/pr79799-5.c: Likewise.

From-SVN: r249819
2017-06-29 22:19:29 +00:00
Richard Biener 4d69799530 backport: re PR ipa/81112 (internal compiler error: tree check: expected integer_cst, have range_expr in get_len, at tree.h:5321)
2017-06-29  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-06-19  Richard Biener  <rguenther@suse.de>

	PR ipa/81112
	* ipa-prop.c (find_constructor_constant_at_offset): Handle
	RANGE_EXPR conservatively.

	* g++.dg/torture/pr81112.C: New testcase.

From-SVN: r249772
2017-06-29 08:53:27 +00:00
Richard Biener 075a5f6aaf backport: [multiple changes]
2017-06-28  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-06-09  Richard Biener  <rguenther@suse.de>

	PR middle-end/81007
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::restrict_to_inner_class):
	Skip FIELD_DECLs with error_mark_node type.
	* passes.def (all_lowering_passes): Run pass_build_cgraph_edges
	last again.

	* g++.dg/pr81007.C: New testcase.

	2017-06-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81083
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Do not use abnormals
	as values.

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

	2017-06-21  Richard Biener  <rguenther@suse.de>

	PR gcov-profile/81080
	* configure.ac: Add AC_SYS_LARGEFILE.
	* libgcov.h: Include auto-target.h before tsystem.h to pick
	up _FILE_OFFSET_BITS which might differ for multilibs.
	* config.in: Regenerate.
	* configure: Likewise.

From-SVN: r249738
2017-06-28 13:25:33 +00:00
Segher Boessenkool e1ae299417 backports
From-SVN: r249699
2017-06-27 18:43:35 +02:00
Jakub Jelinek 4e365a51f6 re PR sanitizer/81209 (-fsanitize=undefined ICE on darwin)
PR sanitizer/81209
	* ubsan.c (ubsan_encode_value): Initialize DECL_CONTEXT on var.

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

From-SVN: r249680
2017-06-27 10:18:10 +02:00
Jakub Jelinek b8c5e47875 re PR middle-end/81207 (tree check fail in simplify_builtin_call)
PR middle-end/81207
	* gimple-fold.c (replace_call_with_call_and_fold): Handle
	gimple_vuse copying separately from gimple_vdef copying.

	* gcc.c-torture/compile/pr81207.c: New test.

From-SVN: r249679
2017-06-27 10:16:10 +02:00