Commit Graph

162492 Commits

Author SHA1 Message Date
David Malcolm dbf96d4945 selftest: introduce class auto_fix_quotes
This patch moves a workaround for locale differences from a
selftest in pretty-print.c to selftest.h/c to make it reusable; I need
this for a selftest in a followup patch.

gcc/ChangeLog:
	* pretty-print.c (selftest::test_pp_format): Move save and restore
	of quotes to class auto_fix_quotes, and add an instance.
	* selftest.c: Include "intl.h".
	(selftest::auto_fix_quotes::auto_fix_quotes): New ctor.
	(selftest::auto_fix_quotes::~auto_fix_quotes): New dtor.
	* selftest.h (selftest::auto_fix_quotes): New class.

From-SVN: r262317
2018-07-02 20:05:21 +00:00
Ian Lance Taylor 7edd4c1885 re PR go/86331 (the gccgo's "go" tool looks like failing to invoke any sub go command)
PR go/86331
    os: check return value as well as error from waitid
    
    https://gcc.gnu.org/PR86331 indicates that if a signal handler runs it
    is possible for syscall.Syscall6 to return a non-zero errno value even
    if no error occurs. That is a problem in general, but this fix will
    let us work around the general problem for the specific case of
    calling waitid.
    
    Reviewed-on: https://go-review.googlesource.com/121595

From-SVN: r262313
2018-07-02 16:28:43 +00:00
Richard Henderson a08acce83a aarch64: Add movprfx patterns alternatives
* config/aarch64/aarch64-protos.h, config/aarch64/aarch64.c
    (aarch64_sve_prepare_conditional_op): Remove.
    * config/aarch64/aarch64-sve.md (cond_<SVE_INT_BINARY><SVE_I>):
    Allow aarch64_simd_reg_or_zero as select operand; remove
    the aarch64_sve_prepare_conditional_op call.
    (cond_<SVE_INT_BINARY_SD><SVE_SDI>): Likewise.
    (cond_<SVE_COND_FP_BINARY><SVE_F>): Likewise.
    (*cond_<SVE_INT_BINARY><SVE_I>_z): New pattern.
    (*cond_<SVE_INT_BINARY_SD><SVE_SDI>_z): New pattern.
    (*cond_<SVE_COND_FP_BINARY><SVE_F>_z): New pattern.
    (*cond_<SVE_INT_BINARY><SVE_I>_any): New pattern.
    (*cond_<SVE_INT_BINARY_SD><SVE_SDI>_any): New pattern.
    (*cond_<SVE_COND_FP_BINARY><SVE_F>_any): New pattern
    and a splitters to match all of the *_any patterns.
    * config/aarch64/predicates.md (aarch64_sve_any_binary_operator): New.

    * config/aarch64/iterators.md (SVE_INT_BINARY_REV): Remove.
    (SVE_COND_FP_BINARY_REV): Remove.
    (sve_int_op_rev, sve_fp_op_rev): New.
    * config/aarch64/aarch64-sve.md (*cond_<SVE_INT_BINARY><SVE_I>_0): New.
    (*cond_<SVE_INT_BINARY_SD><SVE_SDI>_0): New.
    (*cond_<SVE_COND_FP_BINARY><SVE_F>_0): New.
    (*cond_<SVE_INT_BINARY><SVE_I>_2): Rename, add movprfx alternative.
    (*cond_<SVE_INT_BINARY_SD><SVE_SDI>_2): Similarly.
    (*cond_<SVE_COND_FP_BINARY><SVE_F>_2): Similarly.
    (*cond_<SVE_INT_BINARY><SVE_I>_3): Similarly; use sve_int_op_rev.
    (*cond_<SVE_INT_BINARY_SD><SVE_SDI>_3): Similarly.
    (*cond_<SVE_COND_FP_BINARY><SVE_F>_3): Similarly; use sve_fp_op_rev.

    * config/aarch64/aarch64-sve.md (cond_<SVE_COND_FP_BINARY><SVE_F>):
    Remove match_dup 1 from the inner unspec.
    (*cond_<SVE_COND_FP_BINARY><SVE_F>): Likewise.

    * config/aarch64/aarch64.md (movprfx): New attr.
    (length): Default movprfx to 8.
    * config/aarch64/aarch64-sve.md (*mul<SVE_I>3): Add movprfx alt.
    (*madd<SVE_I>, *msub<SVE_I): Likewise.
    (*<su>mul<SVE_I>3_highpart): Likewise.
    (*<SVE_INT_BINARY_SD><SVE_SDI>3): Likewise.
    (*v<ASHIFT><SVE_I>3): Likewise.
    (*<su><MAXMIN><SVE_I>3): Likewise.
    (*<su><MAXMIN><SVE_F>3): Likewise.
    (*fma<SVE_F>4, *fnma<SVE_F>4): Likewise.
    (*fms<SVE_F>4, *fnms<SVE_F>4): Likewise.
    (*div<SVE_F>4): Likewise.

From-SVN: r262312
2018-07-02 08:29:16 -07:00
Martin Liska 1234faf487 Fix GCOV scan pattern (PR testsuite/86366).
2018-07-02  Martin Liska  <mliska@suse.cz>

        PR testsuite/86366
	* gcc.dg/profile-dir-1.c: Fix scanned pattern.
	* gcc.dg/profile-dir-2.c: Likewise.
	* gcc.dg/profile-dir-3.c: Likewise.

From-SVN: r262311
2018-07-02 14:54:07 +00:00
Christophe Lyon 6b632b5e68 [ARM][testsuite] Fix arm-soft-strd-even.c
2018-07-02  Christophe Lyon  <christophe.lyon@linaro.org>

	* gcc.target/arm/arm-soft-strd-even.c: Skip if -mfloat-abi is
	overriden.

From-SVN: r262309
2018-07-02 16:23:19 +02:00
Richard Sandiford d379ac227d Fix typo in vect_recog_widen_shift_pattern
Noticed by Christophe on arm-none-linux-gnueabihf.

2018-07-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-patterns.c (vect_recog_widen_shift_pattern): Fix typo
	in dump string.

From-SVN: r262308
2018-07-02 13:34:49 +00:00
Richard Biener 92590cd35f re PR tree-optimization/86363 (wrong code with __builtin_memset() at -O1)
2018-07-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/86363
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Check the
	memset argument refers to a non-variable address.

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

From-SVN: r262307
2018-07-02 13:32:26 +00:00
Aldy Hernandez 94ee1558a8 Abstract a lot of the {PLUS,MINUS}_EXPR code in
extract_range_from_binary_expr_1 into separate functions.

From-SVN: r262306
2018-07-02 12:18:00 +00:00
Aldy Hernandez d9957cf9a9 tree-vrp.c (extract_range_from_unary_expr): Abstract ABS_EXPR code...
* tree-vrp.c (extract_range_from_unary_expr): Abstract ABS_EXPR
	code...
	(extract_range_from_abs_expr): ...here.

From-SVN: r262305
2018-07-02 12:17:47 +00:00
Martin Liska 108e1a8581 Add new tests for --completion option.
2018-07-02  Martin Liska  <mliska@suse.cz>

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

From-SVN: r262304
2018-07-02 10:30:43 +00:00
Eric Botcazou ee24c8e14e i386.c (ix86_finalize_stack_frame_flags): Do not overrule -fno-omit-frame-pointer when not optimizing.
* config/i386/i386.c (ix86_finalize_stack_frame_flags): Do not overrule
	-fno-omit-frame-pointer when not optimizing.

From-SVN: r262302
2018-07-02 10:15:42 +00:00
Richard Biener 5d4e9f7bee re PR lto/86321 (ICE: in splice_child_die, at dwarf2out.c:5693 for several Fortran tests with -g -flto)
2018-07-02  Richard Biener  <rguenther@suse.de>

	PR lto/86321
	* trans-types.c (gfc_get_array_type_bounds): Unshare TYPE_FIELDs
	for the distinct type copy.

From-SVN: r262301
2018-07-02 08:00:47 +00:00
Paul Thomas e057d3e550 re PR fortran/45305 (Array-valued calles to elementals are not simplified)
2018-07-02  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/45305
	* expr.c : Add a prototype for scalarize_intrinsic_call.
	(gfc_simplify_expr): Use scalarize_intrinsic_call for elemental
	intrinsic function calls.
	(scalarize_intrinsic_call): Add 'init_flag' argument. Check if
	the expression or any of the actual argument expressions are
	NULL. Before calling gfc_check_init_expr, check 'init_flag'.
	Only simplify the scalarized expressions if there are no errors
	on the stack.
	(gfc_check_init_expr): Set 'init_flag' true in the call to
	scalarize_intrinsic_call.

2018-07-02  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/45305
	* gfortran.dg/scalarize_parameter_array_2.f90: New test.

From-SVN: r262300
2018-07-02 07:24:43 +00:00
Paul Thomas 87c789f1c0 re PR fortran/45305 (Array-valued calles to elementals are not simplified)
2018-07-02  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/45305
	* expr.c : Add a prototype for scalarize_intrinsic_call.
	(gfc_simplify_expr): Use scalarize_intrinsic_call for elemental
	intrinsic function calls.
	(scalarize_intrinsic_call): Add 'init_flag' argument. Check if
	the expression or any of the actual argument expressions are
	NULL. Before calling gfc_check_init_expr, check 'init_flag'.
	Only simplify the scalarized expressions if there are no errors
	on the stack.
	(gfc_check_init_expr): Set 'init_flag' true in the call to
	scalarize_intrinsic_call.

2018-07-02  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/45305
	* gfortran.dg/scalarize_parameter_array_2.f90: New test.

From-SVN: r262299
2018-07-02 07:20:27 +00:00
Martin Liska 61c74e84bb Revert 2 ::get to ::get_create for IPA summaries (PR ipa/86279).
2018-07-02  Martin Liska  <mliska@suse.cz>

        PR ipa/86279
	* ipa-pure-const.c (malloc_candidate_p): Revert usage of ::get.
	(propagate_nothrow): Likewise.
2018-07-02  Martin Liska  <mliska@suse.cz>

        PR ipa/86279
	* gcc.dg/ipa/pr86279.c: New test.

From-SVN: r262298
2018-07-02 07:04:20 +00:00
Martin Liska b412559eaf Revert one ipa_call_summaries::get to get_create (PR ipa/86323).
2018-07-02  Martin Liska  <mliska@suse.cz>

        PR ipa/86323
	* ipa-inline.c (early_inliner): Revert wrongly added ::get call.
2018-07-02  Martin Liska  <mliska@suse.cz>

        PR ipa/86323
	* g++.dg/ipa/pr86323.C: New test.

From-SVN: r262297
2018-07-02 07:04:01 +00:00
Martin Liska 24e8271910 Bump libgnat to 9.
2018-07-02  Martin Liska  <mliska@suse.cz>

	* gnatvsn.ads: Bump Library_Version to 9.

From-SVN: r262296
2018-07-02 07:03:23 +00:00
David Malcolm d72596738a Reinstate dump_generic_expr_loc
gcc/ChangeLog:
	* dumpfile.c (dump_generic_expr_loc): Undo removal of this
	function in r262149, changing "loc" param from source_location to
	const dump_location_t &.
	* dumpfile.h (dump_generic_expr_loc): Undo removal of this
	declaration, as above.

From-SVN: r262295
2018-07-02 03:39:48 +00:00
GCC Administrator 4d78796dba Daily bump.
From-SVN: r262294
2018-07-02 00:16:24 +00:00
Tom de Vries 2d0bc0af9c Revert "[testsuite/guality] Prevent optimization of local in vla-1.c"
2018-07-01  Tom de Vries  <tdevries@suse.de>

	revert:
	2018-07-01  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/prevent-optimization.h (VOLATILE): Define.
	* gcc.dg/guality/vla-1.c (f1): Mark local vla a as VOLATILE.

From-SVN: r262290
2018-07-01 20:25:55 +00:00
Paul Koning 4aef57c991 Add -mgnu-asm; change -mdec-asm to generate DEC assembler
compatible output.

	* common/config/pdp11/pdp11-common.c (pdp11_handle_option): Handle
	-munit-asm, -mgnu-asm, -mdec-asm.
	* config/pdp11/pdp11-protos.h (pdp11_gen_int_label): New.
	(pdp11_output_labelref): New.
	(pdp11_output_def): New.
	(pdp11_output_addr_vec_elt): New.
	* config/pdp11/pdp11.c: Use tab between opcode and operands.  Use
	%# and %@ format codes.
	(pdp11_option_override): New.
	(TARGET_ASM_FILE_START_FILE_DIRECTIVE): Define.
	(pdp11_output_ident): New.
	(pdp11_asm_named_section): New.
	(pdp11_asm_init_sections): New.
	(pdp11_file_start): New.
	(pdp11_file_end): New.
	(output_ascii): Use .ascii/.asciz for -mdec-asm.
	(pdp11_asm_print_operand): Update %# and %$ for -mdec-asm.  Add
	%o, like %c but octal.
	(pdp11_option_override): New.
	* config/pdp11/pdp11.h (TEXT_SECTION_ASM_OP): Update for
	-mdec-asm.
	(DATA_SECTION_ASM_OP): Ditto.
	(READONLY_DATA_SECTION_ASM_OP): New.
	(IS_ASM_LOGICAL_LINE_SEPARATOR): New.
	(ASM_GENERATE_INTERNAL_LABEL): Use new function.
	(ASM_OUTPUT_LABELREF): Ditto.
	(ASM_OUTPUT_DEF): Ditto.
	(ASM_OUTPUT_EXTERNAL): New.
	(ASM_OUTPUT_SOURCE_FILENAME): New.
	(ASM_OUTPUT_ADDR_VEC_ELT): Use new function.
	(ASM_OUTPUT_SKIP): Update for -mdec-asm.
	* config/pdp11/pdp11.md: Use tab between opcode and operands.  Use
	%# and %@ format codes.
	* config/pdp11/pdp11.opt (mgnu-asm): New.
	(mdec-asm): Conflicts with -mgnu-asm and -munix-asm.
	(munix-asm): Conflicts with -mdec-asm and -mgnu-asm.
	* doc/invoke.txt (PDP-11 Options): Add -mgnu-asm.

From-SVN: r262289
2018-07-01 15:19:39 -04:00
Tom de Vries 518ab2a0ec [testsuite/guality] Use @main as bp loc instead of line nrs in const-volatile.c
2018-07-01  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (gdb-test): Handle '@' prefix in line number
	argument.
	* gcc.dg/guality/const-volatile.c: Replace gdb-test line nrs 50 and 58
	with @main.

From-SVN: r262288
2018-07-01 18:28:24 +00:00
Tom de Vries 81d3b8f702 [testsuite/guality] Prevent optimization of local in vla-1.c
2018-07-01  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/prevent-optimization.h (VOLATILE): Define.
	* gcc.dg/guality/vla-1.c (f1): Mark local vla a as VOLATILE.

From-SVN: r262287
2018-07-01 15:54:48 +00:00
Tom de Vries c2e755187e [testsuite/guality] Use relative line numbers in vla-1.c
2018-07-01  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-dg.exp (get-absolute-line): Handle '.'.
	* gcc.dg/guality/vla-1.c: Use relative line numbers.

From-SVN: r262286
2018-07-01 15:54:38 +00:00
Tom de Vries 2d43b86277 [testsuite] Fix get-absolute-line error handling
2018-07-01  Tom de Vries  <tdevries@suse.de>

	* gcc.dg-selftests/dg-final.exp (verify_call_1): Factor out of ...
	(verify_call): ... here.  Move to toplevel.
	(verify_call_np, dg_final_directive_check_utils): New proc.
	(toplevel): Call dg_final_directive_check_utils.
	* lib/gcc-dg.exp (get-absolute-line): Fix typo in variable reference.

From-SVN: r262284
2018-07-01 14:56:09 +00:00
Aldy Hernandez 6b150ce95d Allow jump threading of multiple paths that start from the same BB.
From-SVN: r262283
2018-07-01 10:54:45 +00:00
GCC Administrator 19792aa023 Daily bump.
From-SVN: r262282
2018-07-01 00:16:18 +00:00
Jim Wilson 666fdc46bc RISC-V: Add patterns to convert AND mask to two shifts.
gcc/
	* config/riscv/predicates.md (p2m1_shift_operand): New.
	(high_mask_shift_operand): New.
	* config/riscv/riscv.md (lshrsi3_zero_extend_3+1): New combiner
	pattern using p2m1_shift_operand.
	(lshsi3_zero_extend_3+2): New combiner pattern using
	high_mask_shift_operand.

	gcc/testsuite/
	* gcc.target/riscv/shift-shift-1.c: New.
	* gcc.target/riscv/shift-shift-2.c: New.
	* gcc.target/riscv/shift-shift-3.c: New.

From-SVN: r262278
2018-06-30 14:52:01 -07:00
Richard Sandiford 3330053eca [13/n] PR85694: Try to avoid vectorising casts of invariants
vect_recog_rotate_pattern had code to prevent operations
on invariants being vectorised unnecessarily:

  if (dt == vect_external_def
      && TREE_CODE (oprnd1) == SSA_NAME
      && is_a <loop_vec_info> (vinfo))
    {
      struct loop *loop = as_a <loop_vec_info> (vinfo)->loop;
      ext_def = loop_preheader_edge (loop);
      if (!SSA_NAME_IS_DEFAULT_DEF (oprnd1))
        {
          basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (oprnd1));
          if (bb == NULL
              || !dominated_by_p (CDI_DOMINATORS, ext_def->dest, bb))
            ext_def = NULL;
        }
    }
  [..]
      if (ext_def)
        {
          basic_block new_bb
            = gsi_insert_on_edge_immediate (ext_def, def_stmt);
          gcc_assert (!new_bb);
        }

This patch reuses the same idea for casts of invariants created
during widening optimisations.

One hitch was that vect_loop_versioning asserted that the vector loop
preheader was still empty, although the cfg transformation it's doing
should be correct either way.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-patterns.c (vect_get_external_def_edge): New function,
	split out from...
	(vect_recog_rotate_pattern): ...here.
	(vect_convert_input): Try to insert casts of invariants in the
	preheader.
	* tree-vect-loop-manip.c (vect_loop_versioning): Don't require the
	preheader to be empty.

gcc/testsuite/
	* gcc.dg/vect/vect-widen-mult-extern-1.c: New test.

From-SVN: r262277
2018-06-30 13:56:34 +00:00
Richard Sandiford 003479340f [12/n] PR85694: Rework detection of widened operations
This patch adds helper functions for detecting widened operations and
generalises the existing code to handle more cases.

One of the main changes is to recognise multi-stage type conversions,
which are possible even in the original IR and can also occur as a
result of earlier pattern matching (especially after the main
over-widening patch).  E.g. for:

  unsigned int res = 0;
  for (__INTPTR_TYPE__ i = 0; i < N; ++i)
    {
      int av = a[i];
      int bv = b[i];
      short diff = av - bv;
      unsigned short abs = diff < 0 ? -diff : diff;
      res += abs;
    }

we have:

  _9 = _7 - _8;
  diff_20 = (short int) _9;
  _10 = (int) diff_20;
  _11 = ABS_EXPR <_10>;

where the first cast establishes the sign of the promotion done
by the second cast.

vect_recog_sad_pattern didn't handle this kind of intermediate promotion
between the MINUS_EXPR and the ABS_EXPR.  Sign extensions and casts from
unsigned to signed are both OK there.  Unsigned promotions aren't, and
need to be rejected, but should have been folded away earlier anyway.

Also, the dot_prod and widen_sum patterns both required the promotions
to be from one signedness to the same signedness, rather than say signed
char to unsigned int.  That shouldn't be necessary, since it's only the
sign of the input to the promotion that matters.  Nothing requires the
narrow and wide types in a DOT_PROD_EXPR or WIDEN_SUM_EXPR to have the
same sign (and IMO that's a good thing).

Fixing these fixed an XFAIL in gcc.dg/vect/vect-widen-mult-sum.c.

vect_widened_op_tree is a bit more general than the current patch needs,
since it copes with a tree of operations rather than a single statement.
This is used by the later average-detection patch.

The patch also uses a common routine to handle both the WIDEN_MULT_EXPR
and WIDEN_LSHIFT_EXPR patterns.  I hope this could be reused for other
similar operations in future.

Also, the patch means we recognise the index calculations in
vect-mult-const-pattern*.c as widening multiplications, whereas the
scan test was expecting them to be recognised as mult patterns instead.
The patch makes the tests check specifically for the multiplication we
care about.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-patterns.c (append_pattern_def_seq): Take an optional
	vector type.  If given, install it in the new statement's
	STMT_VINFO_VECTYPE.
	(vect_element_precision): New function.
	(vect_unpromoted_value): New struct.
	(vect_unpromoted_value::vect_unpromoted_value): New function.
	(vect_unpromoted_value::set_op): Likewise.
	(vect_look_through_possible_promotion): Likewise.
	(vect_joust_widened_integer, vect_joust_widened_type): Likewise.
	(vect_widened_op_tree, vect_convert_input): Likewise.
	(vect_convert_inputs, vect_convert_output): Likewise.
	(vect_recog_dot_prod_pattern): Use vect_look_through_possible_promotion
	to handle the optional cast of the multiplication result and
	vect_widened_op_tree to detect the widened multiplication itself.
	Do not require the input and output of promotion casts to have
	the same sign, but base the signedness of the operation on the
	input rather than the result.  If the pattern includes two
	promotions, check that those promotions have the same sign.
	Do not restrict the MULT_EXPR handling to a double-width result;
	handle quadruple-width results and wider.  Use vect_convert_inputs
	to convert the inputs to the common type.
	(vect_recog_sad_pattern):  Use vect_look_through_possible_promotion
	to handle the optional cast of the ABS result.  Also allow a sign
	change or a sign extension between the ABS and MINUS.
	Use vect_widened_op_tree to detect the widened subtraction and use
	vect_convert_inputs to convert the inputs to the common type.
	(vect_handle_widen_op_by_const): Delete.
	(vect_recog_widen_op_pattern): New function.
	(vect_recog_widen_mult_pattern): Use it.
	(vect_recog_widen_shift_pattern): Likewise.
	(vect_recog_widen_sum_pattern): Use
	vect_look_through_possible_promotion to handle the promoted
	PLUS_EXPR operand.

gcc/testsuite/
	* gcc.dg/vect/vect-widen-mult-sum.c: Remove xfail.
	* gcc.dg/vect/no-scevccp-outer-6.c: Don't match widened multiplications
	by 4 in the computation of a[i].
	* gcc.dg/vect/vect-mult-const-pattern-1.c: Test specifically for the
	main multiplication constant.
	* gcc.dg/vect/vect-mult-const-pattern-2.c: Likewise.
	* gcc.dg/vect/vect-widen-mult-const-s16.c: Likewise.
	* gcc.dg/vect/vect-widen-mult-const-u16.c: Likewise.  Expect the
	pattern to cast the result to int.
	* gcc.dg/vect/vect-reduc-dot-1.c: New test.
	* gcc.dg/vect/vect-reduc-dot-2.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-3.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-4.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-5.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-6.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-7.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-8.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-1.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-2.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-3.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-4.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-5.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-6.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-7.c: Likewise.
	* gcc.dg/vect/vect-reduc-sad-8.c: Likewise.
	* gcc.dg/vect/vect-widen-mult-1.c: Likewise.
	* gcc.dg/vect/vect-widen-mult-2.c: Likewise.
	* gcc.dg/vect/vect-widen-mult-3.c: Likewise.
	* gcc.dg/vect/vect-widen-mult-4.c: Likewise.

From-SVN: r262276
2018-06-30 12:49:06 +00:00
Richard Sandiford 41949de9de [11/n] PR85694: Apply pattern matching to pattern definition statements
Although the first pattern match wins in the sense that no later
function can match the *old* gimple statement, it still seems worth
letting them match the *new* gimple statements, just like we would if
the original IR had included that sequence from the outset.

This is mostly true after the later patch for PR85694, where e.g. we
could recognise:

   signed char a;
   int ap = (int) a;
   int res = ap * 3;

as the pattern:

   short ap' = (short) a;
   short res = ap' * 3;     // S1: definition statement
   int res = (int) res;     // S2: pattern statement

and then apply the mult pattern to "ap' * 3".  The patch needs to
come first (without its own test cases) so that the main over-widening
patch doesn't regress anything.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* gimple-iterator.c (gsi_for_stmt): Add a new overload that takes
	the containing gimple_seq *.
	* gimple-iterator.h (gsi_for_stmt): Declare it.
	* tree-vect-patterns.c (vect_recog_dot_prod_pattern)
	(vect_recog_sad_pattern, vect_recog_widen_sum_pattern)
	(vect_recog_widen_shift_pattern, vect_recog_rotate_pattern)
	(vect_recog_vector_vector_shift_pattern, vect_recog_divmod_pattern)
	(vect_recog_mask_conversion_pattern): Remove STMT_VINFO_IN_PATTERN_P
	checks.
	(vect_init_pattern_stmt, vect_set_pattern_stmt): New functions,
	split out from...
	(vect_mark_pattern_stmts): ...here.  Handle cases in which the
	statement being replaced is part of an existing pattern
	definition sequence, inserting the new pattern statements before
	the original one.
	(vect_pattern_recog_1): Don't return a bool.  If the statement
	is already part of a pattern, instead apply pattern matching
	to the pattern definition statements.  Don't clear the
	STMT_VINFO_RELATED_STMT if is_pattern_stmt_p.
	(vect_pattern_recog): Don't break after the first match;
	continue processing the pattern definition statements instead.
	Don't bail out for STMT_VINFO_IN_PATTERN_P here.

From-SVN: r262275
2018-06-30 12:48:51 +00:00
Richard Sandiford 7b98e98a98 [10/n] PR85694: Split out check for vectorizable associative reductions
This patch adds an overload of vect_reassociating_reduction_p
that checks for a vectorizable associative reduction,
since the check was duplicated in three functions.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-patterns.c (vect_reassociating_reduction_p): New function.
	(vect_recog_dot_prod_pattern, vect_recog_sad_pattern)
	(vect_recog_widen_sum_pattern): Use it.

From-SVN: r262274
2018-06-30 12:47:50 +00:00
Richard Sandiford 0f8c840c28 [9b/n] PR85694: Make vect_is_simple_use look through pattern statements
As suggested by Richard B., this patch makes vect_is_simple_use check
whether a defining statement has been replaced by a pattern statement,
and if so returns the pattern statement instead.

The reason for doing this is that the main patch for PR85694
makes over_widening handle more general cases.  These over-widened
patterns can still be useful when matching later statements;
e.g. an overwidened MULT_EXPR could be the input to a DOT_PROD_EXPR.

The patch doesn't do anything with the STMT_VINFO_IN_PATTERN_P checks
in vect_recog_over_widening_pattern or vect_recog_widen_shift_pattern
since later patches rewrite them anyway.

Doing this fixed an XFAIL in vect-reduc-dot-u16b.c.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-loop.c (vectorizable_reduction): Assert that the
	phi is not a pattern statement and has not been replaced by
	a pattern statement.
	* tree-vect-patterns.c (type_conversion_p): Don't check
	STMT_VINFO_IN_PATTERN_P.
	(vect_recog_vector_vector_shift_pattern): Likewise.
	(vect_recog_dot_prod_pattern): Expect vect_is_simple_use to return
	the pattern statement rather than the original statement; check
	directly for a WIDEN_MULT_EXPR here.
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Expect
	vect_is_simple_use to return the pattern statement rather
	than the original statement; use is_pattern_stmt_p to check
	for such a pattern statement.
	* tree-vect-stmts.c (process_use): Expect vect_is_simple_use
	to return the pattern statement rather than the original statement;
	don't do the same transformation here.
	(vect_is_simple_use): If the defining statement has been replaced
	by a pattern statement, return the pattern statement instead.
	Remove the corresponding (local) transformation from the vectype
	overload.

gcc/testsuite/
	* gcc.dg/vect/vect-reduc-dot-u16b.c: Remove xfail and update the
	test for vectorization along the lines described in the comment.

From-SVN: r262273
2018-06-30 12:47:25 +00:00
Richard Sandiford 894dd753ca [9a/n] PR85694: Reorder vect_is_simple_use arguments
As suggested by Richard B., this patch reorders the arguments to
vect_is_simple_use so that def_stmt comes last and is optional.
Many callers can then drop it, making it more obvious which of
the remaining calls would be affected by the next patch.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (vect_is_simple_use): Move the gimple ** to the
	end and default to null.
	* tree-vect-loop.c (vect_create_epilog_for_reduction)
	(vectorizable_reduction): Update calls accordingly, dropping the
	gimple ** argument if the passed-back statement isn't needed.
	* tree-vect-patterns.c (vect_get_internal_def, type_conversion_p)
	(vect_recog_rotate_pattern): Likewise.
	(vect_recog_mask_conversion_pattern): Likewise.
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise.
	(vect_mask_constant_operand_p): Likewise.
	* tree-vect-stmts.c (is_simple_and_all_uses_invariant, process_use):
	(vect_model_simple_cost, vect_get_vec_def_for_operand): Likewise.
	(get_group_load_store_type, get_load_store_type): Likewise.
	(vect_check_load_store_mask, vect_check_store_rhs): Likewise.
	(vectorizable_call, vectorizable_simd_clone_call): Likewise.
	(vectorizable_conversion, vectorizable_assignment): Likewise.
	(vectorizable_shift, vectorizable_operation): Likewise.
	(vectorizable_store, vect_is_simple_cond): Likewise.
	(vectorizable_condition, vectorizable_comparison): Likewise.
	(get_same_sized_vectype, vect_get_mask_type_for_stmt): Likewise.
	(vect_is_simple_use): Rename the def_stmt argument to def_stmt_out
	and move it to the end.  Cope with null def_stmt_outs.

From-SVN: r262272
2018-06-30 12:46:36 +00:00
Bernd Edlinger 55c8e04cb1 018-06-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
* Makefile.in (FLAGS_TO_PASS): Add RANLIB_FOR_TARGET.

From-SVN: r262271
2018-06-30 12:19:57 +00:00
Tom de Vries 37d0ffd54d [testsuite/guality] Don't use attribute used in pr45882.c for -O0
2018-06-30  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/guality.exp (guality_transform_options): New proc.
	(toplevel): Apply guality_transform_options on DG_TORTURE_OPTIONS and
	LTO_TORTURE_OPTIONS.
	* gcc.dg/guality/prevent-optimization.h: New file.
	* gcc.dg/guality/pr45882.c: Include prevent-optimization.h.
	(a): Replace __attribute__((used)) with ATTRIBUTE_USED.

From-SVN: r262270
2018-06-30 08:09:26 +00:00
Tom de Vries f269206b1b [testsuite/guality] Use relative line numbers in gdb-test
2018-06-30  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/pr45882.c (foo): Use relative line numbers.
	* lib/gcc-dg.exp (dg-final): New proc.
	* lib/gcc-gdb-test.exp (gdb-test): Add and handle additional line number
	argument.

From-SVN: r262269
2018-06-30 08:07:01 +00:00
Alexandre Oliva da34ca3f12 Introduce @unless/@endunless and postbootstrap Makefile targets
This patch turns dependencies of non-bootstrap targets on bootstrap
targets for bootstrap builds into dependencies on stage_last.  This
arrangement gets stage1-bubble to run from stage_last if we haven't
started a bootstrap yet, and to use the current stage otherwise.  This
was already the case of target libs, just not of non-bootstrapped host
modules.

In order to retain preexisting dependencies in non-bootstrap builds,
or in gcc-less builds, this introduces support for @unless/@endunless
pairs in Makefile.in.

There is a remaining possibility of problem if activating, in a tree
configured for bootstrap, a parallel build of two or more modules, at
least one bootstrapped and one not.  In this case, make might decide
to build stage_current and stage_last in parallel, the latter will
start a submake to build stage1 while the initial make, having
satisfied stage_current, proceeds to build the bootstrapped module in
non-bootstrapped configurations.  The two builds will overlap and will
likely conflict.  This situation does NOT arise in normal settings,
however: a post-bootstrap build of all-host all-target will indeed
activate such targets concurrently, but only after building all
bootstrapped modules successfully, and it will have both stage_last
and stage_current targets already satisfied, so the potential race
between builds will not arise.

Another remaining problem, that is slightly expanded with this patch,
is that of an interrupted build in a tree configured for bootstrap,
continued with a non-bootstrapped target.  Target modules that were
not bootstrapped would already fail to complete the current stage when
activated explicitly in the command line for a retry; host modules,
however, would attempt to build their bootstrapped dependencies, which
is what led to the problem of concurrent builds addressed with this
patch.  An interrupted or failed build might still recover correctly,
if the non-bootstrapped target is activated in both builds, because
then make will remove stage_last when its build command is
interrupted, so that it will attempt to recreate it with stage1-bubble
in the second try.  A bootstrap build, however, will not be attempting
to build stage_last, so the file will remain and the retry won't go
through stage1-bubble.  We have lived with that for target modules, so
we can probably live with that for host modules too.

Another undesirable consequence of this change is that non-boostrapped
host modules, in a tree configured for bootstrap, when activated as
make all-<module>, will build all of stage1 instead of only the
module's usual dependencies.  This is intentional and necessary to fix
the parallel-build problem.  If it's not desirable, disabling the
unnecessary bootstrap configuration will suffice to restore the
original set of dependencies.


for  ChangeLog

	* configure.ac: Introduce support for @unless/@endunless.
	* Makefile.tpl (dep-kind): Rewrite with cond; return
	postbootstrap in some cases.
	(make-postboot-dep, postboot-targets): New.
	(dependencies): Do not output postbootstrap dependencies at
	first.  Output non-target ones changed for configure to depend
	on stage_last @if gcc-bootstrap, and the original deps @unless
	gcc-bootstrap.
	* configure.in, Makefile.in: Rebuilt.

From-SVN: r262267
2018-06-30 02:47:29 +00:00
GCC Administrator 6662eec399 Daily bump.
From-SVN: r262266
2018-06-30 00:16:35 +00:00
Jeff Law bc5e6ab695 v850.c (v850_legitimate_address_p): Handle large displacements for TARGET_V850E2V3 and newer.
* config/v850/v850.c (v850_legitimate_address_p): Handle large
	displacements for TARGET_V850E2V3 and newer.
	(TARGET_LRA_P): Remove.  Defaults to LRA now.
	* config/v850/v850.md (sign23byte_load): Remove.
	(unsign23byte_load, sign23hword_load, unsign23hword_load): Likewise.
	(23word_load, 23byte_store, 23hword_store, 23word_store): Likewise.

From-SVN: r262257
2018-06-29 12:42:35 -06:00
Martin Sebor 0bcf7e67ab strlenopt-46.c: Define strnlen for targets like Solaris 10 that don't define the function.
gcc/testsuite/ChangeLog:

	* gcc.dg/strlenopt-46.c: Define strnlen for targets like Solaris 10
	that don't define the function.

From-SVN: r262255
2018-06-29 10:37:54 -06:00
Marek Polacek dd2a449867 re PR c++/86184 (Conditional expression with omitted operand cannot use rvalue of type convertible to bool)
PR c++/86184
	* tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.

	* g++.dg/ext/cond3.C: New test.

From-SVN: r262254
2018-06-29 15:25:14 +00:00
Martin Liska 1f2bb38a85 When using -fprofile-generate=/some/path mangle absolute path of file (PR lto/85759).
2018-06-29  Martin Liska  <mliska@suse.cz>

	PR lto/85759
	* coverage.c (coverage_init): Mangle full path name.
	* doc/invoke.texi: Document the change.
	* gcov-io.c (mangle_path): New.
	* gcov-io.h (mangle_path): Likewise.
	* gcov.c (mangle_name): Use mangle_path for path mangling.

From-SVN: r262251
2018-06-29 14:03:36 +00:00
Kyrylo Tkachov 52057dc4ac [arm] Avoid STRD with odd register for TARGET_ARM in output_move_double
In this testcase the user forces an odd register as the starting reg for a DFmode value.
The output_move_double function tries to store that using an STRD instruction.
But for TARGET_ARM the starting register of an STRD must be an even one.
This is always the case with compiler-allocated registers for DFmode values, but the
inline assembly forced our hand here.

This patch  restricts the STRD-emitting logic in output_move_double to not avoid
odd-numbered source registers in STRD.
I'm not a fan of the whole function, we should be exposing a lot of the logic in there
to RTL rather than at the final output stage, but that would need to be fixed separately.

	* config/arm/arm.c (output_move_double): Don't allow STRD instructions
	if starting source register is not even.

	* gcc.target/arm/arm-soft-strd-even.c: New test.

From-SVN: r262250
2018-06-29 13:36:35 +00:00
Alexander Monakov b33aa7209e contrib: introduce Vim addon directory, add match.pd syntax plugin
* vim-gcc-dev/README: New file.
	* vim-gcc-dev/ftdetect/gcc-dev.vim: New file.
	* vim-gcc-dev/syntax/gcc-match.vim: New file.
	* gimple.vim: Move under vim-gcc-dev/syntax/.
	* gcc-rtl.vim: Likewise.

From-SVN: r262249
2018-06-29 16:14:46 +03:00
Tom de Vries 8864590b7c [testsuite/guality] Use line number vars in gdb-test
2018-06-29  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/pr45882.c (foo): Add line number var for breakpoint
	line, and use it.
	* lib/gcc-dg.exp (get-absolute-line): Factor out of ...
	(process-message): ... here.
	* lib/gcc-gdb-test.exp (gdb-test): Use get-absolute-line.

From-SVN: r262248
2018-06-29 11:25:49 +00:00
Martin Liska 3f10efd4ee Fix bit-test expansion for single cluster (PR tree-optimization/86263).
2018-06-29  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86263
	* tree-switch-conversion.c (switch_decision_tree::try_switch_expansion):
        Make edge redirection.
2018-06-29  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86263
	* gcc.dg/tree-ssa/pr86263.c: New test.

From-SVN: r262247
2018-06-29 10:57:00 +00:00
David Malcolm 6475e077a0 dumpfile.c: add indentation via DUMP_VECT_SCOPE
This patch adds a concept of nested "scopes" to dumpfile.c's dump_*_loc
calls, and wires it up to the DUMP_VECT_SCOPE macro in tree-vectorizer.h,
so that the nested structure is shown in -fopt-info by indentation.

For example, this converts -fopt-info-all e.g. from:

test.c:8:3: note: === analyzing loop ===
test.c:8:3: note: === analyze_loop_nest ===
test.c:8:3: note: === vect_analyze_loop_form ===
test.c:8:3: note: === get_loop_niters ===
test.c:8:3: note: symbolic number of iterations is (unsigned int) n_9(D)
test.c:8:3: note: not vectorized: loop contains function calls or data references that cannot be analyzed
test.c:8:3: note: vectorized 0 loops in function

to:

test.c:8:3: note: === analyzing loop ===
test.c:8:3: note:  === analyze_loop_nest ===
test.c:8:3: note:   === vect_analyze_loop_form ===
test.c:8:3: note:    === get_loop_niters ===
test.c:8:3: note:   symbolic number of iterations is (unsigned int) n_9(D)
test.c:8:3: note:   not vectorized: loop contains function calls or data references that cannot be analyzed
test.c:8:3: note: vectorized 0 loops in function

showing that the "symbolic number of iterations" message is within
the "=== analyze_loop_nest ===" (and not within the
"=== vect_analyze_loop_form ===").

This is also enabling work for followups involving optimization records
(allowing the records to directly capture the nested structure of the
dump messages).

gcc/ChangeLog:
	* dumpfile.c (dump_loc): Add indentation based on scope depth.
	(dump_scope_depth): New variable.
	(get_dump_scope_depth): New function.
	(dump_begin_scope): New function.
	(dump_end_scope): New function.
	* dumpfile.h (get_dump_scope_depth): New declaration.
	(dump_begin_scope): New declaration.
	(dump_end_scope): New declaration.
	(class auto_dump_scope): New class.
	(AUTO_DUMP_SCOPE): New macro.
	* tree-vectorizer.h (DUMP_VECT_SCOPE): Reimplement in terms of
	AUTO_DUMP_SCOPE.

From-SVN: r262246
2018-06-29 09:56:40 +00:00
Jonathan Wakely 6fdce073fc Add whitespace to some dejagnu directives in libstdc++ tests
* testsuite/20_util/add_rvalue_reference/requirements/alias_decl.cc:
	Add whitespace to dejagnu directive.
	* testsuite/23_containers/array/element_access/at_neg.cc: Likewise.

From-SVN: r262245
2018-06-29 10:54:07 +01:00
Richard Biener c2fd033cdf tree-vect-data-refs.c (vect_analyze_data_ref_dependences): Assert compute_all_dependences succeeds.
2018-06-29  Richard Biener  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_analyze_data_ref_dependences): Assert
	compute_all_dependences succeeds.
	* tree-vect-loop.c (vect_get_datarefs_in_loop): Fail early if we
	exceed --param loop-max-datarefs-for-datadeps.

From-SVN: r262244
2018-06-29 09:49:14 +00:00