Commit Graph

143002 Commits

Author SHA1 Message Date
Alan Lawrence
b3e4665562 Empty the redirect_edge_var_map after each pass
Alan Lawrence  <alan.lawrence@arm.com>
	Richard Biener  <richard.guenther@gmail.com>

	* cfgexpand.c (pass_expand::execute): Replace call to
	redirect_edge_var_map_destroy with redirect_edge_var_map_empty.
	* tree-ssa.c (delete_tree_ssa): Likewise.
	* function.c (set_cfun): Call redirect_edge_var_map_empty.
	* passes.c (execute_one_ipa_transform_pass, execute_one_pass): Likewise.
	* tree-ssa.h (redirect_edge_var_map_destroy): Remove.
	(redirect_edge_var_map_empty): New.
	* tree-ssa.c (redirect_edge_var_map_destroy): Remove.
	(redirect_edge_var_map_empty): New.

Co-Authored-By: Richard Biener <richard.guenther@gmail.com>

From-SVN: r231232
2015-12-03 15:46:57 +00:00
Jeff Law
46bd784bfb [PR tree-optimization/68599] Avoid over-zealous optimization with -funsafe-loop-optimizations
PR tree-optimization/68599
	* loop-init.c (rtl_loop_init): Set LOOPS_HAVE_RECORDED_EXITS
	in call to loop_optimizer_init.
	* loop-iv.c (get_simple_loop_desc): Only allow unsafe loop
	optimization to drop the assumptions/infinite notations if
	the loop has a single exit.

From-SVN: r231231
2015-12-03 08:40:08 -07:00
Richard Sandiford
a54a5997d9 Documentation tweaks for internal-fn-related optabs
As Bernd requested, this patch adds "This pattern cannot FAIL" to the
documentation of optabs that came to be mapped to interal functions.
For consistency I did the same for optabs that were already being
used for internal functions.

Many of the optabs weren't documented in the first place, so I added
entries for the missing ones.  Also, there were some inaccuracies in
the documentation of the rounding optabs.  The bitcount optabs said
that operand 0 has mode @var{m} and that operand 1 is under target
control, whereas it should be the other way around.

Tested on x86_64-linux-gnu.

gcc/
	* doc/md.texi (vec_load_lanes@var{m}@var{n}): Document that
	the pattern cannot FAIL.
	(vec_store_lanes@var{m}@var{n}): Likewise.
	(maskload@var{m}@var{n}): Likewise.
	(maskstore@var{m}@var{n}): Likewise.  Fix a cut-&-paste error
	in the name of the pattern.
	(rsqrt@var{m}2): Document that mode m must be a scalar or vector
	floating-point mode and that all operands have that mode.
	(fmin@var{m}3, fmax@var{m}3): Likewise.  Document that the
	pattern cannot FAIL.
	(sqrt@var{m}2): Document that mode m must be a scalar or vector
	floating-point mode, that all operands have that mode, and that
	the patterns cannot FAIL.  Remove previous documentation referring
	to @code{double} and @code{float}.
	(fmod@var{m}3, remainder@var{m}3, cos@var{m}2, sin@var{m}2)
	(sincos@var{m}3, log@var{m}2, pow@var{m}3, atan2@var{m}3)
	(copysign@var{m}3): Likewise.
	(exp@var{m}2): Likewise.  Explicitly state the base.
	(floor@var{m}2): As for sqrt@var{m}2, but also specify the operands.
	(btrunc@var{m}2, rint@var{m}2): Likewise.
	(round@var{m}2): Likewise.  Fix incorrect description of rounding
	effect.
	(ceil@var{m}2): As for round@var{m}2.
	(nearbyint@var{m}2): As for floor@var{m}2, but also mention that
	the instruction must not raise an inexact condition.
	(scalb@var{m}3): Document previously-undocumented pattern
	(ldexp@var{m}3, tan@var{m}2, asin@var{m}2, acos@var{m}2)
	(atan@var{m}2, expm1@var{m}2, exp10@var{m}2, exp2@var{m}2)
	(log1p@var{m}2, log10@var{m}2, log2@var{m}2, logb@var{m}2)
	(significand@var{m}2): Likewise.
	(ffs@var{m}2): Fix the description of the modes, so that operand 1 has
	mode m and operand 0 is defined more freely.  Document that @var{m}
	can be a scalar or vector integer mode and that the pattern is not
	allowed to FAIL.
	(clz@var{m}2, ctz@var{m}2, popcount@var{m}2, parity@var{m}2): Likewise.
	(clrsb@var{m}2): Likewise, except that the description of the
	mode was missing in this case.

From-SVN: r231230
2015-12-03 14:36:19 +00:00
Richard Sandiford
ee62a5a602 Add an rsqrt_optab and IFN_RSQRT internal function
All current uses of builtin_reciprocal convert 1.0/sqrt into rsqrt.
This patch adds an rsqrt optab and associated internal function for
that instead.  We can then pick up the vector forms of rsqrt automatically,
fixing an AArch64 regression from my internal_fn patches.

With that change, builtin_reciprocal only needs to handle target-specific
built-in functions.  I've restricted the hook to those since, if we need
a reciprocal of another standard function later, I think there should be
a strong preference for adding a new optab and internal function for it,
rather than hiding the code in a backend.

Three targets implement builtin_reciprocal: aarch64, i386 and rs6000.
i386 and rs6000 already used the obvious rsqrt<mode>2 pattern names
for the instructions, so they pick up the new code automatically.
aarch64 needs a slight rename.

mn10300 is unusual in that its native operation is rsqrt, and
sqrt is approximated as 1.0/rsqrt.  The port also uses rsqrt<mode>2
for the rsqrt pattern, so after the patch we now pick it up as a native
operation.

Two other ports define rsqrt patterns: sh and v850.  AFAICT these
patterns aren't currently used, but I think the patch does what the
authors of the patterns would have expected.  There's obviously some
risk of fallout though.

Tested on x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf
(as a target without the hooks) and powerpc64-linux-gnu.

gcc/
	* internal-fn.def (RSQRT): New function.
	* optabs.def (rsqrt_optab): New optab.
	* doc/md.texi (rsqrtM2): Document.
	* target.def (builtin_reciprocal): Replace gcall argument with
	a function decl.  Restrict hook to machine functions.
	* doc/tm.texi: Regenerate.
	* targhooks.h (default_builtin_reciprocal): Update prototype.
	* targhooks.c (default_builtin_reciprocal): Likewise.
	* tree-ssa-math-opts.c: Include internal-fn.h.
	(internal_fn_reciprocal): New function.
	(pass_cse_reciprocals::execute): Call it, and build a call to an
	internal function on success.  Only call targetm.builtin_reciprocal
	for machine functions.
	* config/aarch64/aarch64-protos.h (aarch64_builtin_rsqrt): Remove
	second argument.
	* config/aarch64/aarch64-builtins.c (aarch64_expand_builtin_rsqrt):
	Rename aarch64_rsqrt_<mode>2 to rsqrt<mode>2.
	(aarch64_builtin_rsqrt): Remove md_fn argument and only handle
	machine functions.
	* config/aarch64/aarch64.c (use_rsqrt_p): New function.
	(aarch64_builtin_reciprocal): Replace gcall argument with a
	function decl.  Use use_rsqrt_p.  Remove optimize_size check.
	Only handle machine functions.  Update call to aarch64_builtin_rsqrt.
	(aarch64_optab_supported_p): New function.
	(TARGET_OPTAB_SUPPORTED_P): Define.
	* config/aarch64/aarch64-simd.md (aarch64_rsqrt_<mode>2): Rename to...
	(rsqrt<mode>2): ...this.
	* config/i386/i386.c (use_rsqrt_p): New function.
	(ix86_builtin_reciprocal): Replace gcall argument with a
	function decl.  Use use_rsqrt_p.  Remove optimize_insn_for_size_p
	check.  Only handle machine functions.
	(ix86_optab_supported_p): Handle rsqrt_optab.
	* config/rs6000/rs6000.c (TARGET_OPTAB_SUPPORTED_P): Define.
	(rs6000_builtin_reciprocal): Replace gcall argument with a
	function decl.  Remove optimize_insn_for_size_p check.
	Only handle machine functions.
	(rs6000_optab_supported_p): New function.

From-SVN: r231229
2015-12-03 14:31:55 +00:00
Bernd Schmidt
47e16c6a6a Fix some issues with the ROP patch (PR 68471, 68472)
PR target/68471
	PR target/68472
	* config/i386/i386.c (ix86_mitigate_rop): Don't call
	compute_bb_for_insn again.  Call df_insn_rescan_all.
	* config/i386/i386.md (set_got_rex64): Override modrm_class.

	* regrename.c (build_def_use): Ignore stack regs if regstack_completed.

testsuite/
	* gcc.target/i386/rop1.c: New test.

From-SVN: r231228
2015-12-03 14:17:35 +00:00
Nathan Sidwell
9a863523b4 nvptx-protos.h (npvptx_section_from_addr_space): Delete.
gcc/
	* config/nvptx/nvptx-protos.h (npvptx_section_from_addr_space):	Delete.
	* config/nvptx/nvptx.c (enum nvptx_data_area): New.
	(SYMBOL_DATA_AREA, SET_SYMBOL_DATA_AREA): New defines.
	(nvptx_option_override): Set data ares for worker vars.
	(nvptx_addr_space_from_sym): Delete.
	(nvptx_encode_section_info): New.
	(section_for_sym, section_for_decl): New.
	(nvptx_maybe_convert_symbolic_operand): Get data area from symbol
	flags,
	(nvptx_section_from_addr_space): Delete.
	(nvptx_section_for_decl): Delete.
	(nvptx_output_aligned, nvptx_declare_object_name,
	nvptx_assemble_undefined_decl): Use section_for_decl, remove
	unnecessary checks.
	(nvptx_print_operand): Add 'D', adjust 'A'.
	(nvptx_expand_worker_addr): Adjust unspec generation.
	(TARGET_ENCODE_SECTION_INFO): Override.
	* config/nvptx/nvptx.h (ADDR_SPACE_GLOBAL, ADDR_SPACE_SHARED,
	ADDR_SPACE_CONST, ADDR_SPACE_LOCAL, ADDR_SPACE_PARAM): Delete.
	* config/nvptx/nvptx.md (UNSPEC_FROM_GLOBAL, UNSPEC_FROM_LOCAL,
	UNSPEC_FROM_PARAM, UNSPEC_FROM_SHARED, UNSPEC_FROM_CONST,
	UNSPEC_TO_GLOBAL, UNSPEC_TO_LOCAL, UNSPEC_TO_PARAM,
	UNSPEC_TO_SHARED, UNSPEC_TO_CONST): Delete.
	(UNSPEC_TO_GENERIC): New.
	(nvptx_register_or_symbolic_operand): Delete.
	(cvt_code, cvt_name, cvt_str): Delete.
	(convaddr_<cvt_name><mode> [P]): Delete.
	(convaddr_<mode> [P]): New.

	gcc/testsuite/
	* gcc.target/nvptx/decl.c: New.
	* gcc.target/nvptx/uninit-decl.c: Robustify regexps.

From-SVN: r231227
2015-12-03 13:59:20 +00:00
Kyrylo Tkachov
1986d6791c [RTL-ifcvt] PR rtl-optimization/68624: Clean up logic that checks for clobbering conflicts across basic blocks
PR rtl-optimization/68624
	* ifcvt.c (noce_try_cmove_arith): Check clobbers of temp regs in both
	blocks if they exist and simplify the logic choosing the order to emit
	them in.

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

From-SVN: r231226
2015-12-03 13:28:55 +00:00
Richard Biener
97a1a64299 re PR tree-optimization/66051 (can't vectorize reductions inside an SLP group)
2015-12-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/66051
	* tree-vect-slp.c (vect_build_slp_tree_1): Remove restriction
	on load group size.  Do not pass in vectorization_factor.
	(vect_transform_slp_perm_load): Do not require any permute support.
	(vect_build_slp_tree): Do not pass in vectorization factor.
	(vect_analyze_slp_instance): Do not compute vectorization
	factor estimate.  Use vector size instead of vectorization factor
	estimate to split store groups for BB vectorization.

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

From-SVN: r231225
2015-12-03 11:26:56 +00:00
Ilya Enkovich
b5be36b1db cfgexpand.c (expand_gimple_stmt_1): Return statement with DECL as return value is allowed to have NULL bounds.
gcc/

	* cfgexpand.c (expand_gimple_stmt_1): Return statement with
	DECL as return value is allowed to have NULL bounds.

From-SVN: r231224
2015-12-03 10:35:41 +00:00
Tom de Vries
71819f4573 Guard isl_ast_op_zdiv_r usage with HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
2015-12-03  Tom de Vries  <tom@codesourcery.com>

	* graphite-isl-ast-to-gimple.c (binary_op_to_tree)
	(gcc_expression_from_isl_expr_op): Guard isl_ast_op_zdiv_r usage with
	HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS.

From-SVN: r231223
2015-12-03 10:16:07 +00:00
Kirill Yukhin
73500c31de Added missing ChangeLogs. Fix scan pattern for gcc.target/i386/avx512vl-vextracti32x4-1.c.
From-SVN: r231222
2015-12-03 10:00:57 +00:00
Richard Biener
b308d872e6 re PR tree-optimization/67800 (Missed vectorization opportunity on x86 (DOT_PROD_EXPR in non-reduction))
2015-12-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/67800
	PR tree-optimization/68333
	* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Restore
	restriction to reduction contexts but allow SLP reductions as well.
	(vect_recog_sad_pattern): Likewise.
	(vect_recog_widen_sum_pattern): Likewise.

	* gcc.target/i386/vect-pr67800.c: New testcase.

From-SVN: r231221
2015-12-03 08:43:22 +00:00
Richard Biener
8349b02428 re PR tree-optimization/68639 (ICE: Floating point exception)
2015-12-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68639
	* tree-vect-data-refs.c (dr_group_sort_cmp): Split groups
	belonging to different loops.
	(vect_analyze_data_ref_accesses): Likewise.

	* gfortran.fortran-torture/compile/pr68639.f90: New testcase.

From-SVN: r231220
2015-12-03 08:38:10 +00:00
Jan Hubicka
d8e3e8a571 ipa-pure-const.c (ignore_edge_for_pure_const): New function.
* ipa-pure-const.c (ignore_edge_for_pure_const): New function.
	(propagate_pure_const): Use it; fix comments and optimize loops.

From-SVN: r231219
2015-12-03 04:21:50 +00:00
Jan Hubicka
9644e52a6b ipa-pure-const.c (ignore_edge): Rename to ...
* ipa-pure-const.c (ignore_edge): Rename to ...
	(ignore_edge_for_nothrow) ... this one; also ignore eges to
	interposable functions or ones that can not throw.
	(propagate_nothrow): Fix handling of availability.

From-SVN: r231218
2015-12-03 04:19:44 +00:00
Jan Hubicka
89bbe9ba36 re PR c++/68184 (Exception from a virtual function does not get caught)
PR ipa/68184
	* g++.dg/torture/pr68184.C: New testcase.
	* cgraphunit.c (cgraph_node::analyze): Set can_throw_external.

From-SVN: r231217
2015-12-03 04:13:33 +00:00
GCC Administrator
eaa728e3a2 Daily bump.
From-SVN: r231216
2015-12-03 00:16:13 +00:00
Jakub Jelinek
6eb4a53763 re PR preprocessor/57580 (Repeated _Pragma message directives in macro causes problems)
PR preprocessor/57580
	* c-ppoutput.c (print): Change printed field to bool.
	Move src_file last for smaller padding.
	(init_pp_output): Set print.printed to false instead of 0.
	(scan_translation_unit): Fix up formatting.  Set print.printed
	to true after printing something other than newline.
	(scan_translation_unit_trad): Set print.printed to true instead of 1.
	(maybe_print_line_1): Set print.printed to false instead of 0.
	(print_line_1): Likewise.
	(do_line_change): Set print.printed to true instead of 1.
	(cb_define, dump_queued_macros, cb_include, cb_def_pragma,
	dump_macro): Set print.printed to false after printing newline.

	* c-c++-common/cpp/pr57580.c: New test.
	* c-c++-common/gomp/pr57580.c: New test.

From-SVN: r231213
2015-12-03 00:53:43 +01:00
Aditya Kumar
49ed2fa429 handle missing isl_ast_expr
From ISL's documentation, isl_ast_op_zdiv_r is equal to zero iff the remainder
on integer division is zero.  Code generate a modulo operation for that.

	* graphite-isl-ast-to-gimple.c (binary_op_to_tree): Handle isl_ast_op_zdiv_r.
        (gcc_expression_from_isl_expr_op): Same.

	* gcc.dg/graphite/id-28.c: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231212
2015-12-02 23:06:29 +00:00
Aditya Kumar
1a67d2cd3c do not insert code outside the generated region
on the testcase we used to generate code in the function entry bb_0,
and that choked the cfg verifier.

	* graphite-isl-ast-to-gimple.c (copy_bb_and_scalar_dependences): Check
	that insertion point is still in the region.

	* gfortran.dg/graphite/id-26.f03: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231211
2015-12-02 23:01:24 +00:00
Jason Merrill
fa26da2236 Allow running the testsuite in C++1z mode.
gcc/cp/
	* Make-lang.in (check-c++1z, check-c++-all): New.
gcc/testsuite/
	* lib/g++.exp: Handle --stds= option.
	* lib/g++-dg.exp (g++-dg-runtest): Use it.

From-SVN: r231209
2015-12-02 17:18:18 -05:00
Tobias Burnus
5df445a2a5 check.c (gfc_check_event_query): New function.
2015-12-02  Tobias Burnus  <burnus@net-b.de>
	    Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>

	* check.c (gfc_check_event_query): New function.
	* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
	EXEC_EVENT_WAIT.
	* expr.c (gfc_check_vardef_context): New check for event variables
	definition.
	* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
	(struct symbol_attribute): New field.
	(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
	* gfortran.texi: Document about new events functions and minor
	changes.
	* interface.c (compare_parameter): New check.
	(gfc_procedure_use): New check for explicit procedure interface.
	(add_subroutines): Add event_query.
	* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
	New prototypes.
	* iresolve.c (gfc_resolve_event_query): New function.
	* iso-fortran-env.def (event_type): New type.
	* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
	New functions.
	(gfc_match_name): New event post and event wait.
	* match.h (gfc_match_event_post,gfc_match_event_wait):
	New prototypes.
	* module.c (ab_attribute): Add AB_EVENT_COMP.
	(attr_bits): Likewise.
	(mio_symbol_attribute): Handle event_comp attribute.
	* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(parse_derived): Check for event_type components.
	* resolve.c (resolve_allocate_expr): Check for event variable def.
	(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
	includes logic for locks and events.
	(gfc_resolve_code): Call it.
	(gfc_resolve_symbol): New check for event variable to be a corray.
	* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
	EXEC_EVENT_WAIT.
	* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
	gfor_fndecl_caf_event_query): New global variables.
	(generate_coarray_sym_init): Checking for event_type.
	(gfc_conv_procedure_call): Check for C bind attribute.
	* trans-intrinsic.c (conv_intrinsic_event_query): New function.
	(conv_intrinsic_move_alloc): Call it.
	* trans-stmt.c (gfc_trans_lock_unlock): Passing address
	of actual argument.
	(gfc_trans_sync): Likewise.
	(gfc_trans_event_post_wait): New function.
	* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
	* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
	* trans.c (gfc_allocate_using_lib): New argument and logic for events.
	(gfc_allocate_allocatable): Passing new argument.
	(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
	* trans.h (gfc_coarray_type): New elements.
	(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
	gfor_fndecl_caf_event_query): Declare them.

2015-12-02  Tobias Burnus  <burnus@net-b.de>
	    Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>

	* gfortran.dg/coarray/event_1.f90: New.
	* gfortran.dg/coarray/event_2.f90: New.

Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>

From-SVN: r231208
2015-12-02 21:59:05 +00:00
Aditya Kumar
ca377fc371 fix PR68550: do not handle ISL loop peeled statements
In case ISL did some loop peeling, like this:

  S_8(0);
  for (int c1 = 1; c1 <= 5; c1 += 1) {
    S_8(c1);
  }
  S_8(6);

we should not copy loop-phi nodes in S_8(0) or in S_8(6).

	PR tree-optimization/68550
	* graphite-isl-ast-to-gimple.c (copy_loop_phi_nodes): Add dump.
	(copy_bb_and_scalar_dependences): Do not code generate loop peeled
	statements.

	* gfortran.dg/graphite/pr68550-1.f90: New.
	* gfortran.dg/graphite/pr68550-2.f90: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231206
2015-12-02 20:40:17 +00:00
Marek Polacek
c297b7cd54 re PR c/68513 (ICE in gimplify_expr, at gimplify.c:8832, c_maybe_const_expr in IL)
PR c/68513
	* gcc.dg/pr68513.c: New test.

From-SVN: r231205
2015-12-02 20:01:37 +00:00
Cesar Philippidis
2f9bcf538c re PR fortran/63861 (OpenACC coarray ICE (also with OpenMP?))
gcc/fortran/
	PR fortran/63861
	* openmp.c (gfc_match_omp_clauses): Allow subarrays for acc reductions.
	(resolve_omp_clauses): Error on any acc reductions on arrays.

	gcc/testsuite/
	* gfortran.dg/goacc/array-reduction.f90: New test.
	* gfortran.dg/goacc/assumed.f95: Update expected diagnostics.
	* gfortran.dg/goacc/coarray.f95: Likewise.
	* gfortran.dg/goacc/coarray_2.f90: Likewise.
	* gfortran.dg/goacc/reduction-2.f95: Likewise.
	* gfortran.dg/goacc/reduction.f95: Likewise.

From-SVN: r231204
2015-12-02 11:59:27 -08:00
Markus Trippelsdorf
e7fc41a776 Fix c++/67337 (segfault in mangle.c)
PR c++/67337
	* mangle.c (write_template_prefix): Guard against context==NULL.

From-SVN: r231203
2015-12-02 19:57:55 +00:00
Ulrich Weigand
157bb85d48 configure.ac: Check assembler support for R_PPC64_ENTRY relocation.
* configure.ac: Check assembler support for R_PPC64_ENTRY relocation.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/rs6000/rs6000.c (rs6000_global_entry_point_needed_p): New
	function.
	(rs6000_output_function_prologue): Use it instead of checking
	cfun->machine->r2_setup_needed.  Use internal labels instead of
	GNU as local label extension.  Handle ELFv2 large code model.
	(rs6000_output_mi_thunk): Do not set cfun->machine->r2_setup_needed.
	(rs6000_elf_declare_function_name): Handle ELFv2 large code model.

From-SVN: r231202
2015-12-02 19:52:53 +00:00
Jakub Jelinek
8923e02ee4 re PR target/68647 (__builtin_popcountll doesn't generate popcnt instructions when targeting -mpopcnt on x86_32)
PR target/68647
	* optabs.c (expand_doubleword_popcount, expand_doubleword_parity):
	New functions.
	(expand_unop): Use them.

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

From-SVN: r231201
2015-12-02 20:39:11 +01:00
Marek Polacek
d6221ad458 re PR c++/68653 (ICE: in nonnull_arg_p, at tree.c:13853)
PR c++/68653
	* tree.c (nonnull_arg_p): Allow OFFSET_TYPE.

	* g++.dg/warn/nonnull3.C: New test.

From-SVN: r231200
2015-12-02 19:29:17 +00:00
Ian Lance Taylor
105b682e13 re PR go/66147 (go fails to cross build)
./:	PR go/66147
	* Makefile.tpl (HOST_EXPORTS): Add XGCC_FLAGS_FOR_TARGET.
	* Makefile.in: Regenerate.
gotools/:
	PR go/66147
	* Makefile.am (GOCOMPILER): In NATIVE case, add
	$(XGCC_FLAGS_FOR_TARGET).

From-SVN: r231199
2015-12-02 19:27:58 +00:00
Jason Merrill
f479b43da0 Do constant folding in warn_* functions.
gcc/c-family/
	* c-common.c (fold_for_warn): New.
	(warn_logical_operator, warn_tautological_cmp)
	(check_function_arguments_recurse, maybe_warn_bool_compare): Use it.
gcc/cp/
	* call.c (build_new_op_1): Don't fold arguments to
	warn_logical_operator or maybe_warn_bool_compare.

From-SVN: r231198
2015-12-02 14:04:48 -05:00
Jason Merrill
7426fcc84f Introduce cp_fold_rvalue.
* cp-gimplify.c (cp_fold_maybe_rvalue, cp_fold_rvalue): New.
	(c_fully_fold): Use cp_fold_rvalue.
	(cp_fold): Use them for rvalue operands.

From-SVN: r231197
2015-12-02 14:04:43 -05:00
Jason Merrill
4250754eea Define c_fully_fold separately for C and C++.
gcc/c-family/
	* c-common.c (c_disable_warnings, c_enable_warnings, c_fully_fold)
	(c_fully_fold_internal, decl_constant_value_for_optimization):
	Move to c/c-fold.c.
	* c-common.h: Don't declare decl_constant_value_for_optimization.
gcc/c/
	* c-fold.c (c_disable_warnings, c_enable_warnings, c_fully_fold)
	(c_fully_fold_internal, decl_constant_value_for_optimization):
	Move from c-common.c.
	* c-tree.h: Declare decl_constant_value_for_optimization.
	* Make-lang.in (C_AND_OBJC_OBJS): Add c-fold.o.
gcc/cp/
	* cp-gimplify.c (c_fully_fold): Define.

From-SVN: r231196
2015-12-02 14:04:38 -05:00
Jason Merrill
e9ea372d08 * cp-gimplify.c (cp_fold): Use fold_build*.
From-SVN: r231195
2015-12-02 14:04:32 -05:00
Joseph Myers
e9e32ee6e8 Fix TYPE_MAIN_VARIANT construction for arrays of qualified typedefs (PR c/68162).
PR c/68162 reports a spurious warning about incompatible types
involving arrays of const double, constructed in one place using a
typedef for const double and in another place literally using const
double.

The problem is that the array of the typedef was incorrectly
constructed without a TYPE_MAIN_VARIANT being an array of unqualified
elements as it should be (though it seems some more recent change
resulted in this producing incorrect diagnostics, likely the support
for C++-style handling of arrays of qualified type).  This patch fixes
the logic in grokdeclarator to determine first_non_attr_kind, which is
used to determine whether it is necessary to use the TYPE_MAIN_VARIANT
of the type in the declaration specifiers.

However, fixing that logic introduces a failure of
gcc.dg/debug/dwarf2/pr47939-4.c, a test introduced along with
first_non_attr_kind.  Thus, it is necessary to track the original
qualified typedef when qualifying an array type, to use it rather than
a newly-constructed type, to avoid regressing regarding typedef names
in debug info.  This is done along lines I suggested in
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47939#c6>: track the
original type and the number of levels of array indirection at which
it appears, and, in possibly affected cases, pass extra arguments to
c_build_qualified_type (with default arguments to avoid needing to
pass those extra arguments explicitly everywhere).  Given Richard's
recent fix to dwarf2out.c, this allows the C bug to be fixed without
causing debug information regressions.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc/c:
	PR c/68162
	* c-decl.c (grokdeclarator): Set first_non_attr_kind before
	following link from declarator to next declarator.  Track original
	qualified type and pass it to c_build_qualified_type.
	* c-typeck.c (c_build_qualified_type): Add arguments
	orig_qual_type and orig_qual_indirect.

gcc/c-family:
	PR c/68162
	* c-common.h (c_build_qualified_type): Add extra default
	arguments.

gcc/cp:
	PR c/68162
	* tree.c (c_build_qualified_type): Add extra arguments.

gcc/testsuite:
	PR c/68162
	* gcc.dg/pr68162-1.c: New test.

From-SVN: r231194
2015-12-02 18:24:23 +00:00
Matthias Klose
701fa326a1 configure.ac: Move AM_ENABLE_MULTILIB before GCC_LIBSTDCXX_RAW_CXX_FLAGS.
2015-12-02  Matthias Klose  <doko@ubuntu.com>

        * configure.ac: Move AM_ENABLE_MULTILIB before
        GCC_LIBSTDCXX_RAW_CXX_FLAGS.
        * configure: Regenerate.

From-SVN: r231193
2015-12-02 18:18:51 +00:00
Nathan Sidwell
592632598b nvptx.c (enum nvptx_shuffle_kind): New.
* config/nvptx/nvptx.c (enum nvptx_shuffle_kind): New.  Absorb
	SHUFFLE defines.
	(nvptx_gen_shuffle, nvptx_print_operand, nvptx_expand_shuffle): Adjust.

From-SVN: r231192
2015-12-02 17:28:32 +00:00
Aditya Kumar
2e733703c0 fix invalid bounds on array refs
While enabling graphite in -O3 we found a Fortran testcase that fails
because the max of the type domain is -1.  We used to add that as a constraint
to the elements accessed by the array, leading to a unfeasible constraint:
0 <= i <= -1.  Having that constraint, drops the data reference as that says
that there are no elements accessed in the array.

	* graphite-dependences.c (scop_get_reads): Add extra dumps.
	(scop_get_must_writes): Same.
	(scop_get_may_writes): Same.
	(compute_deps): Same.
	* graphite-sese-to-poly.c (bounds_are_valid): New.
	(pdr_add_data_dimensions): Call bounds_are_valid.

	* gfortran.dg/graphite/run-id-3.f90: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231191
2015-12-02 17:11:52 +00:00
Aditya Kumar
84c36240fc rename flag_loop_optimize_isl to flag_loop_nest_optimize
* common.opt (flag_loop_optimize_isl): Renamed flag_loop_nest_optimize.
	* graphite-poly.c (apply_poly_transforms): Same.
	* graphite.c (gate_graphite_transforms): Same.
	* toplev.c (process_options): Same.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231190
2015-12-02 17:11:41 +00:00
Eric Botcazou
f4886d807d re PR c++/68290 (g++.dg/concepts/auto1.C FAILs)
PR c++/68290
	* constraint.cc (make_constrained_auto): Move to...
	* pt.c (make_auto_1): Add set_canonical parameter and set
	TYPE_CANONICAL on the type only if it is true.
	(make_decltype_auto): Adjust call to make_auto_1.
	(make_auto): Likewise.
	(splice_late_return_type): Likewise.
	(make_constrained_auto): ...here.  Call make_auto_1 instead of
	make_auto and pass false.  Set TYPE_CANONICAL directly.

From-SVN: r231189
2015-12-02 16:41:02 +00:00
Eric Botcazou
f74e65509f mips.c (mips_emit_probe_stack_range): Adjust.
* config/mips/mips.c (mips_emit_probe_stack_range): Adjust.
	(mips_output_probe_stack_range): Rotate the loop and simplify.

From-SVN: r231188
2015-12-02 16:34:58 +00:00
David Sherwood
202d0c11b9 aarch64.md: New pattern.
2015-12-02  David Sherwood  <david.sherwood@arm.com>

    gcc/
	* config/aarch64/aarch64.md: New pattern.
	* config/aarch64/aarch64-simd.md: Likewise.
	* config/aarch64/iterators.md: New unspecs, iterators.
    gcc/testsuite
	* gcc.target/aarch64/fmaxmin.c: New test.

From-SVN: r231187
2015-12-02 16:29:17 +00:00
Pierre-Marie de Rodat
f2834b5d87 Track indirect calls for call site information in debug info
gcc/ChangeLog:

	* dwarf2out.c (dwar2out_var_location): In addition to notes,
	process indirect calls whose target is compile-time known.
	Enhance pattern matching to get the SYMBOL_REF they embed.
	(gen_subprogram_die): Handle such calls.
	* final.c (final_scan_insn): For call instructions, invoke the
	var_location debug hook only after the call has been emitted.

From-SVN: r231185
2015-12-02 15:57:34 +00:00
Thomas Schwinge
ff7a55bf56 Some OpenACC host_data cleanup
gcc/c/
	* c-parser.c (c_parser_omp_clause_name)
	(c_parser_oacc_all_clauses): Alphabetical sorting.
	gcc/cp/
	* parser.c (cp_parser_omp_clause_name)
	(cp_parser_oacc_all_clauses): Alphabetical sorting.
	* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE.
	gcc/testsuite/
	* c-c++-common/goacc/host_data-5.c: New file.
	* c-c++-common/goacc/host_data-6.c: Likewise.
	* gfortran.dg/goacc/coarray.f95: XFAIL.
	* gfortran.dg/goacc/coarray_2.f90: Adjust dg-excess-errors
	directive.
	* gfortran.dg/goacc/host_data-tree.f95: Remove dg-prune-output
	directive.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/host_data-2.c: Restrict to
	target openacc_nvidia_accel_selected.
	* testsuite/libgomp.oacc-c-c++-common/host_data-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/host_data-5.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/host_data-3.c: Remove file.
	* testsuite/libgomp.oacc-c-c++-common/host_data-6.c: Remove file.

Co-Authored-By: James Norris <James_Norris@mentor.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>

From-SVN: r231184
2015-12-02 16:53:34 +01:00
Tom de Vries
db0f1c7a90 Fix oacc kernels default mapping for scalars
2015-12-02  Tom de Vries  <tom@codesourcery.com>

	* gimplify.c (enum gimplify_omp_var_data): Add enum value
	GOVD_MAP_FORCE.
	(oacc_default_clause): Fix default for scalars in oacc kernels.
	(gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_FORCE.

	* c-c++-common/goacc/kernels-default-2.c: New test.
	* c-c++-common/goacc/kernels-default.c: New test.

From-SVN: r231183
2015-12-02 15:48:45 +00:00
Tom de Vries
86938de6f6 Mark pointers to allocated target vars as restricted, if possible
2015-12-02  Tom de Vries  <tom@codesourcery.com>

	* omp-low.c (install_var_field, scan_sharing_clauses): Add and handle
	parameter base_pointers_restrict.
	(omp_target_base_pointers_restrict_p): New function.
	(scan_omp_target): Call scan_sharing_clauses with base_pointers_restrict
	arg.

	* c-c++-common/goacc/kernels-alias-2.c: New test.
	* c-c++-common/goacc/kernels-alias-3.c: New test.
	* c-c++-common/goacc/kernels-alias-4.c: New test.
	* c-c++-common/goacc/kernels-alias-5.c: New test.
	* c-c++-common/goacc/kernels-alias-6.c: New test.
	* c-c++-common/goacc/kernels-alias-7.c: New test.
	* c-c++-common/goacc/kernels-alias-8.c: New test.
	* c-c++-common/goacc/kernels-alias.c: New test.

From-SVN: r231182
2015-12-02 15:48:35 +00:00
Jonathan Wakely
28eca950b7 Fix ambiguity with multiple enable_shared_from_this bases
PR libstdc++/56383
	* testsuite/20_util/enable_shared_from_this/56383.cc: New.
	* include/bits/shared_ptr_base.h (__enable_shared_from_this): Make
	friend declaration match previous declaration of
	__enable_shared_from_this_helper.
	* include/bits/shared_ptr.h (enable_shared_from_this): Likewise.

From-SVN: r231181
2015-12-02 15:08:18 +00:00
Nathan Sidwell
f313d112b0 nvptx-protos.h (nvptx_output_mov_insn): Declare.
* config/nvptx/nvptx-protos.h (nvptx_output_mov_insn): Declare.
	(nvptx_underlying_object_mode): Delete.
	* config/nvptx/nvptx.c (nvptx_underlying_object_mode): Delete.
	(output_reg): New.
	(nvptx_declare_function_name): Use output_reg.  Remove punning
	buffer.
	(nvptx_output_mov_insn): New.
	(nvptx_print_operand): Separate SUBREG handling, remove 'f' case,
	Use output_reg. Merge 't' and 'u' handling.
	* config/nvptx/nvptx.h (NVPTX_PUNNING_BUFFER_REGNUM): Delete.
	(struct machine_function): Remvoe punning_buffer_size.
	(REGISTER_NAMES): Remove %punbuffer.
	* config/nvptx/nvptx.md (UNSPEC_CPLX_LOWPART,
	UNSPEC_CPLX_HIGHPART): Delete.
	(*mov<mode>_insn [QHSDIM): Remove unnecessary constraints, use
	nvptx_output_mov_insn.
	(*mov<mode>_insn [SDFM): Reorder constraints to match integer
	moc.  Use nvptx_output_mov_insn.
	(highpartscsf2,  set_highpartscsf2, lowpartscsf2,
	set_lowpartscsf2): Delete.
	(mov<mode> [SDCM]): Delete.

From-SVN: r231180
2015-12-02 14:57:54 +00:00
Richard Biener
7b2eca0029 tree.h (tree_invariant_p): Declare.
2015-12-02  Richard Biener  <rguenther@suse.de>

	* tree.h (tree_invariant_p): Declare.
	* tree.c (tree_invariant_p): Export.
	* genmatch.c (dt_simplify::gen_1): For GENERIC code-gen never
	create SAVE_EXPRs but reject patterns if we would need to.

From-SVN: r231178
2015-12-02 14:50:32 +00:00
Tom de Vries
694e5e4bae Handle BUILT_IN_GOACC_PARALLEL in ipa-pta
2015-12-02  Tom de Vries  <tom@codesourcery.com>

	* tree-ssa-structalias.c (find_func_aliases_for_builtin_call)
	(find_func_clobbers, ipa_pta_execute): Handle BUILT_IN_GOACC_PARALLEL.

	* c-c++-common/goacc/kernels-alias-ipa-pta-2.c: New test.
	* c-c++-common/goacc/kernels-alias-ipa-pta-3.c: New test.
	* c-c++-common/goacc/kernels-alias-ipa-pta.c: New test.

From-SVN: r231169
2015-12-02 13:32:51 +00:00