Commit Graph

109 Commits

Author SHA1 Message Date
Alexander Monakov 0c6b03b515 OpenMP/PTX privatization in SIMD regions
* config/nvptx/nvptx-protos.h (nvptx_output_simt_enter): Declare.
	(nvptx_output_simt_exit): Declare.
	* config/nvptx/nvptx.c (nvptx_init_unisimt_predicate): Use
	cfun->machine->unisimt_location.  Handle NULL unisimt_predicate.
	(init_softstack_frame): Move initialization of crtl->is_leaf to...
	(nvptx_declare_function_name): ...here.  Emit declaration of local
	memory space buffer for omp_simt_enter insn.
	(nvptx_output_unisimt_switch): New.
	(nvptx_output_softstack_switch): New.
	(nvptx_output_simt_enter): New.
	(nvptx_output_simt_exit): New.
	* config/nvptx/nvptx.h (struct machine_function): New fields
	has_simtreg, unisimt_location, simt_stack_size, simt_stack_align.
	* config/nvptx/nvptx.md (UNSPECV_SIMT_ENTER): New unspec.
	(UNSPECV_SIMT_EXIT): Ditto.
	(omp_simt_enter_insn): New insn.
	(omp_simt_enter): New expansion.
	(omp_simt_exit): New insn.
	* config/nvptx/nvptx.opt (msoft-stack-reserve-local): New option.

	* internal-fn.c (expand_GOMP_SIMT_ENTER): New.
	(expand_GOMP_SIMT_ENTER_ALLOC): New.
	(expand_GOMP_SIMT_EXIT): New.
	* internal-fn.def (GOMP_SIMT_ENTER): New internal function.
	(GOMP_SIMT_ENTER_ALLOC): Ditto.
	(GOMP_SIMT_EXIT): Ditto.
	* target-insns.def (omp_simt_enter): New insn.
	(omp_simt_exit): Ditto.
	* omp-low.c (struct omplow_simd_context): New fields simt_eargs,
	simt_dlist.
	(lower_rec_simd_input_clauses): Implement SIMT privatization.
	(lower_rec_input_clauses): Likewise.
	(lower_lastprivate_clauses): Handle SIMT privatization.

	* omp-offload.c: Include langhooks.h, tree-nested.h, stor-layout.h.
	(ompdevlow_adjust_simt_enter): New.
	(find_simtpriv_var_op): New.
	(execute_omp_device_lower): Handle IFN_GOMP_SIMT_ENTER,
	IFN_GOMP_SIMT_ENTER_ALLOC, IFN_GOMP_SIMT_EXIT.

	* tree-inline.h (struct copy_body_data): New field dst_simt_vars.
	* tree-inline.c (expand_call_inline): Handle SIMT privatization.
	(copy_decl_for_dup_finish): Ditto.

	* tree-ssa.c (execute_update_addresses_taken): Handle GOMP_SIMT_ENTER.

From-SVN: r246550
2017-03-28 20:24:57 +03:00
Jakub Jelinek 50c620cad9 * config/nvptx/nvptx.c: Include intl.h.
From-SVN: r245806
2017-03-01 11:25:49 +01:00
Jakub Jelinek 324ff1a07f i386.c: Include intl.h.
* config/i386/i386.c: Include intl.h.
	(ix86_option_override_internal): Use cond ? G_("...") : G_("...")
	instead of just cond ? "..." : "...".
	* config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Likewise.
	* coverage.c (read_counts_file): Likewise.
	* omp-offload.c: Include intl.h.
	(oacc_loop_fixed_partitions): Use cond ? G_("...") : G_("...") instead
	of just cond ? "..." : "...".
	* gcov.c (read_count_file): Use cond ? N_("...") : N_("...") instead
	of just cond ? "..." : "...".
c/
	* c-parser.c (c_parser_asm_statement): Use cond ? G_("...") : G_("...")
	instead of just cond ? "..." : "...".
	(c_parser_oacc_enter_exit_data): Use %s and ternary operator only
	for "enter"/"exit" keyword.
	(c_finish_oacc_routine): Don't use %s to supply portions of the
	message.
cp/
	* decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
	instead of just cond ? "..." : "...".
	(grokdeclarator): Likewise.
	(build_enumerator): Likewise.
	* init.c (build_new_1): Likewise.
	* call.c (build_new_method_call_1): Likewise.
	* parser.c: Include intl.h.
	(cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
	"enter"/"exit" keyword.
	(cp_finalize_oacc_routine): Don't use %s to supply portions of the
	message.
fortran/
	* parse.c (parse_critical_block): Use cond ? G_("...") : G_("...")
	instead of just cond ? "..." : "...".
	* scanner.c (gfc_next_char_literal): Likewise.
	* match.c (match_exit_cycle): Likewise.

From-SVN: r245778
2017-02-28 16:25:19 +01:00
Thomas Schwinge 3c5b4c6dd9 [PR translation/79638] "%ntid.y" confuses gcc.pot generation
gcc/
	* config/nvptx/nvptx.c (ENTRY_TEMPLATE): Single out "%ntid.y".

From-SVN: r245623
2017-02-21 11:42:07 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Alexander Monakov 40829cb8f5 nvptx: do not assume that crtl->is_leaf is unset
PR target/78831
	* config/nvptx/nvptx.c (init_softstack_frame): Remove assert.  Compute
	crtl->is_leaf only if unset.  Adjust comment.

From-SVN: r243855
2016-12-21 17:20:09 +03:00
Martin Jambor 629b3d75c8 Split omp-low into multiple files
2016-12-14  Martin Jambor  <mjambor@suse.cz>

	* omp-general.h: New file.
	* omp-general.c: New file.
	* omp-expand.h: Likewise.
	* omp-expand.c: Likewise.
	* omp-offload.h: Likewise.
	* omp-offload.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-low.h: Include omp-general.h and omp-grid.h.  Removed includes
	of params.h, symbol-summary.h, lto-section-names.h, cilk.h, tree-eh.h,
	ipa-prop.h, tree-cfgcleanup.h, cfgloop.h, except.h, expr.h, stmt.h,
	varasm.h, calls.h, explow.h, dojump.h, flags.h, tree-into-ssa.h,
	tree-cfg.h, cfganal.h, alias.h, emit-rtl.h, optabs.h, expmed.h,
	alloc-pool.h, cfghooks.h, rtl.h and memmodel.h.
	(omp_find_combined_for): Declare.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.h.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.h.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.h.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.h.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.h.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.h.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.h.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(omp_expand_local): Moved to omp-expand.h.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.h.
	(omp_finish_file): Moved to omp-offload.h.
	(default_goacc_validate_dims): Renamed to
	oacc_default_goacc_validate_dims and moved to omp-offload.h.
	(offload_funcs, offload_vars): Moved to omp-offload.h.
	* omp-low.c: Include omp-general.h, omp-offload.h and omp-grid.h.
	(omp_region): Moved to omp-expand.c.
	(omp_for_data_loop): Moved to omp-general.h.
	(omp_for_data): Likewise.
	(oacc_loop): Moved to omp-offload.c.
	(oacc_loop_flags): Moved to omp-general.h.
	(offload_funcs, offload_vars): Moved to omp-offload.c.
	(root_omp_region): Moved to omp-expand.c.
	(omp_any_child_fn_dumped): Likewise.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.c.
	(is_combined_parallel): Moved to omp-expand.c.
	(is_reference): Renamed to omp_is_reference and and moved to
	omp-general.c.
	(adjust_for_condition): Renamed to omp_adjust_for_condition and moved
	to omp-general.c.
	(get_omp_for_step_from_incr): Renamed to omp_get_for_step_from_incr
	and moved to omp-general.c.
	(extract_omp_for_data): Renamed to omp_extract_for_data and moved to
	omp-general.c.
	(workshare_safe_to_combine_p): Moved to omp-expand.c.
	(omp_adjust_chunk_size): Likewise.
	(get_ws_args_for): Likewise.
	(get_base_type): Removed.
	(dump_omp_region): Moved to omp-expand.c.
	(debug_omp_region): Likewise.
	(debug_all_omp_regions): Likewise.
	(new_omp_region): Likewise.
	(free_omp_region_1): Likewise.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.c.
	(find_combined_for): Renamed to omp_find_combined_for, made global.
	(build_omp_barrier): Renamed to omp_build_barrier and moved to
	omp-general.c.
	(omp_max_vf): Moved to omp-general.c.
	(omp_max_simt_vf): Likewise.
	(gimple_build_cond_empty): Moved to omp-expand.c.
	(parallel_needs_hsa_kernel_p): Likewise.
	(expand_omp_build_assign): Moved declaration to omp-expand.c.
	(expand_parallel_call): Moved to omp-expand.c.
	(expand_cilk_for_call): Likewise.
	(expand_task_call): Likewise.
	(vec2chain): Likewise.
	(remove_exit_barrier): Likewise.
	(remove_exit_barriers): Likewise.
	(optimize_omp_library_calls): Likewise.
	(expand_omp_regimplify_p): Likewise.
	(expand_omp_build_assign): Likewise.
	(expand_omp_taskreg): Likewise.
	(oacc_collapse): Likewise.
	(expand_oacc_collapse_init): Likewise.
	(expand_oacc_collapse_vars): Likewise.
	(expand_omp_for_init_counts): Likewise.
	(expand_omp_for_init_vars): Likewise.
	(extract_omp_for_update_vars): Likewise.
	(expand_omp_ordered_source): Likewise.
	(expand_omp_ordered_sink): Likewise.
	(expand_omp_ordered_source_sink): Likewise.
	(expand_omp_for_ordered_loops): Likewise.
	(expand_omp_for_generic): Likewise.
	(expand_omp_for_static_nochunk): Likewise.
	(find_phi_with_arg_on_edge): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	(expand_cilk_for): Likewise.
	(expand_omp_simd): Likewise.
	(expand_omp_taskloop_for_outer): Likewise.
	(expand_omp_taskloop_for_inner): Likewise.
	(expand_oacc_for): Likewise.
	(expand_omp_for): Likewise.
	(expand_omp_sections): Likewise.
	(expand_omp_single): Likewise.
	(expand_omp_synch): Likewise.
	(expand_omp_atomic_load): Likewise.
	(expand_omp_atomic_store): Likewise.
	(expand_omp_atomic_fetch_op): Likewise.
	(expand_omp_atomic_pipeline): Likewise.
	(expand_omp_atomic_mutex): Likewise.
	(expand_omp_atomic): Likewise.
	(oacc_launch_pack): and moved to omp-general.c, made public.
	(OACC_FN_ATTRIB): Likewise.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.c.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.c.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.c.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.c.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.c.
	(oacc_fn_attrib_level): Moved to omp-offload.c.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(get_oacc_ifn_dim_arg): Renamed to oacc_get_ifn_dim_arg and moved to
	omp-general.c.
	(mark_loops_in_oacc_kernels_region): Moved to omp-expand.c.
	(grid_launch_attributes_trees): Likewise.
	(grid_attr_trees): Likewise.
	(grid_create_kernel_launch_attr_types): Likewise.
	(grid_insert_store_range_dim): Likewise.
	(grid_get_kernel_launch_attributes): Likewise.
	(get_target_argument_identifier_1): Likewise.
	(get_target_argument_identifier): Likewise.
	(get_target_argument_value): Likewise.
	(push_target_argument_according_to_value): Likewise.
	(get_target_arguments): Likewise.
	(expand_omp_target): Likewise.
	(grid_expand_omp_for_loop): Moved to omp-grid.c.
	(grid_arg_decl_map): Likewise.
	(grid_remap_kernel_arg_accesses): Likewise.
	(grid_expand_target_grid_body): Likewise.
	(expand_omp): Renamed to omp_expand and moved to omp-expand.c.
	(build_omp_regions_1): Moved to omp-expand.c.
	(build_omp_regions_root): Likewise.
	(omp_expand_local): Likewise.
	(build_omp_regions): Likewise.
	(execute_expand_omp): Likewise.
	(pass_data_expand_omp): Likewise.
	(pass_expand_omp): Likewise.
	(make_pass_expand_omp): Likewise.
	(pass_data_expand_omp_ssa): Likewise.
	(pass_expand_omp_ssa): Likewise.
	(make_pass_expand_omp_ssa): Likewise.
	(grid_lastprivate_predicate): Renamed to
	omp_grid_lastprivate_predicate and moved to omp-grid.c, made public.
	(grid_prop): Moved to omp-grid.c.
	(GRID_MISSED_MSG_PREFIX): Likewise.
	(grid_safe_assignment_p): Likewise.
	(grid_seq_only_contains_local_assignments): Likewise.
	(grid_find_single_omp_among_assignments_1): Likewise.
	(grid_find_single_omp_among_assignments): Likewise.
	(grid_find_ungridifiable_statement): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
	(grid_inner_loop_gridifiable_p): Likewise.
	(grid_dist_follows_simple_pattern): Likewise.
	(grid_gfor_follows_tiling_pattern): Likewise.
	(grid_call_permissible_in_distribute_p): Likewise.
	(grid_handle_call_in_distribute): Likewise.
	(grid_dist_follows_tiling_pattern): Likewise.
	(grid_target_follows_gridifiable_pattern): Likewise.
	(grid_remap_prebody_decls): Likewise.
	(grid_var_segment): Likewise.
	(grid_mark_variable_segment): Likewise.
	(grid_copy_leading_local_assignments): Likewise.
	(grid_process_grid_body): Likewise.
	(grid_eliminate_combined_simd_part): Likewise.
	(grid_mark_tiling_loops): Likewise.
	(grid_mark_tiling_parallels_and_loops): Likewise.
	(grid_process_kernel_body_copy): Likewise.
	(grid_attempt_target_gridification): Likewise.
	(grid_gridify_all_targets_stmt): Likewise.
	(grid_gridify_all_targets): Renamed to omp_grid_gridify_all_targets
	and moved to omp-grid.c, made public.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.c.
	(add_decls_addresses_to_decl_constructor): Moved to omp-offload.c.
	(omp_finish_file): Likewise.
	(oacc_thread_numbers): Likewise.
	(oacc_xform_loop): Likewise.
	(oacc_default_dims, oacc_min_dims): Likewise.
	(oacc_parse_default_dims): Likewise.
	(oacc_validate_dims): Likewise.
	(new_oacc_loop_raw): Likewise.
	(new_oacc_loop_outer): Likewise.
	(new_oacc_loop): Likewise.
	(new_oacc_loop_routine): Likewise.
	(finish_oacc_loop): Likewise.
	(free_oacc_loop): Likewise.
	(dump_oacc_loop_part): Likewise.
	(dump_oacc_loop): Likewise.
	(debug_oacc_loop): Likewise.
	(oacc_loop_discover_walk): Likewise.
	(oacc_loop_sibling_nreverse): Likewise.
	(oacc_loop_discovery): Likewise.
	(oacc_loop_xform_head_tail): Likewise.
	(oacc_loop_xform_loop): Likewise.
	(oacc_loop_process): Likewise.
	(oacc_loop_fixed_partitions): Likewise.
	(oacc_loop_auto_partitions): Likewise.
	(oacc_loop_partition): Likewise.
	(default_goacc_fork_join): Likewise.
	(default_goacc_reduction): Likewise.
	(execute_oacc_device_lower): Likewise.
	(default_goacc_validate_dims): Likewise.
	(default_goacc_dim_limit): Likewise.
	(pass_data_oacc_device_lower): Likewise.
	(pass_oacc_device_lower): Likewise.
	(make_pass_oacc_device_lower): Likewise.
	(execute_omp_device_lower): Likewise.
	(pass_data_omp_device_lower): Likewise.
	(pass_omp_device_lower): Likewise.
	(make_pass_omp_device_lower): Likewise.
	(pass_data_omp_target_link): Likewise.
	(pass_omp_target_link): Likewise.
	(find_link_var_op): Likewise.
	(pass_omp_target_link::execute): Likewise.
	(make_pass_omp_target_link): Likewise.

	* Makefile.in (OBJS): Added omp-offload.o, omp-expand.o, omp-general.o
	and omp-grid.o.
	(GTFILES): Added omp-offload.h, omp-offload.c and omp-expand.c, removed
	omp-low.h.
	* gimple-fold.c: Include omp-general.h instead of omp-low.h.
	(fold_internal_goacc_dim): Adjusted calls to
	get_oacc_ifn_dim_arg and get_oacc_fn_dim_size to use their new names.
	* gimplify.c: Include omp-low.h.
	(omp_notice_variable): Adjust the call to get_oacc_fn_attrib to use
	its new name.
	(gimplify_omp_task): Adjusted calls to find_omp_clause to use its new
	name.
	(gimplify_omp_for): Likewise.
	* lto-cgraph.c: Include omp-offload.h instead of omp-low.h.
	* toplev.c: Include omp-offload.h instead of omp-low.h.
	* tree-cfg.c: Include omp-general.h instead of omp-low.h.  Also
	include omp-expand.h.
	(make_edges_bb): Adjusted the call to make_gimple_omp_edges to use its
	new name.
	(make_edges): Adjust the call to free_omp_regions to use its new name.
	* tree-parloops.c: Include omp-general.h.
	(create_parallel_loop): Adjusted the call to set_oacc_fn_attrib to use
	its new name.
	(parallelize_loops): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-ssa-loop.c: Include omp-general.h instead of omp-low.h.
	(gate_oacc_kernels): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-vrp.c: Include omp-general.h instead of omp-low.h.
	(extract_range_basic): Adjusted calls to get_oacc_ifn_dim_arg and
	get_oacc_fn_dim_size to use their new names.
	* varpool.c: Include omp-offload.h instead of omp-low.h.
	* gengtype.c (open_base_files): Replace omp-low.h with omp-offload.h in
	ifiles.
	* config/nvptx/nvptx.c: Include omp-general.c.
	(nvptx_expand_call): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	(nvptx_reorg): Likewise.
	(nvptx_record_offload_symbol): Likewise.

gcc/c-family:
	* c-omp.c: Include omp-general.h instead of omp-low.h.
	(c_finish_oacc_wait): Adjusted call to find_omp_clause to use its new
	name.

gcc/c/
	* c-parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(c_finish_oacc_routine): Adjusted call to
	get_oacc_fn_attrib, build_oacc_routine_dims and replace_oacc_fn_attrib
	to use their new names.
	(c_parser_oacc_enter_exit_data): Adjusted call to find_omp_clause to
	use its new name.
	(c_parser_oacc_update): Likewise.
	(c_parser_omp_simd): Likewise.
	(c_parser_omp_target_update): Likewise.
	* c-typeck.c: Include omp-general.h instead of omp-low.h.
	(c_finish_omp_cancel): Adjusted call to find_omp_clause to use its new
	name.
	(c_finish_omp_cancellation_point): Likewise.
	* gimple-parser.c: Do not include omp-low.h

gcc/cp/
	* parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(cp_parser_omp_simd): Adjusted calls to find_omp_clause to use its new
	name.
	(cp_parser_omp_target_update): Likewise.
	(cp_parser_oacc_declare): Likewise.
	(cp_parser_oacc_enter_exit_data): Likewise.
	(cp_parser_oacc_update): Likewise.
	(cp_finalize_oacc_routine): Adjusted call to get_oacc_fn_attrib,
	build_oacc_routine_dims and replace_oacc_fn_attrib to use their new
	names.
	* semantics.c: Include omp-general insteda of omp-low.h.
	(finish_omp_for): Adjusted calls to find_omp_clause to use its new
	name.
	(finish_omp_cancel): Likewise.
	(finish_omp_cancellation_point): Likewise.

fortran/
	* trans-openmp.c: Include omp-general.h.

From-SVN: r243673
2016-12-14 23:30:41 +01:00
Alexander Monakov 5012919d0b nvptx backend prerequisites for OpenMP offloading
gcc/
	* config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP
	is selected.  Pass -mgomp to offload compiler in OpenMP case.
	* config/nvptx/nvptx-protos.h (nvptx_shuffle_kind): Move enum
	declaration from nvptx.c.
	(nvptx_gen_shuffle): Declare.
	(nvptx_output_set_softstack): Declare.
	* config/nvptx/nvptx.c (nvptx_shuffle_kind): Move to nvptx-protos.h.
	(need_softstack_decl): New variable.
	(need_unisimt_decl): New variable.
	(diagnose_openacc_conflict): New.  Use it...
	(nvptx_option_override): ...here.  Handle TARGET_GOMP.
	(nvptx_encode_section_info): Handle "shared" attribute.
	(write_as_kernel): Restrict to OpenACC target regions.
	(init_softstack_frame): New.
	(nvptx_init_unisimt_predicate): New.
	(write_omp_entry): New.  Use it...
	(nvptx_declare_function_name): ...here to emit OpenMP target region
	entrypoints.  Handle TARGET_SOFT_STACK.  Call
	nvptx_init_unisimt_predicate.
	(nvptx_output_set_softstack): New.
	(nvptx_get_drap_rtx): Return %argp as the DRAP if needed.
	(nvptx_gen_shuffle): Export.
	(nvptx_output_call_insn): Handle COND_EXEC patterns.  Emit instruction
	predicate.
	(nvptx_print_operand): Fix handling of instruction predicates.
	(nvptx_get_unisimt_master): New helper function.
	(nvptx_get_unisimt_predicate): Ditto.
	(nvptx_call_insn_is_syscall_p): Ditto.
	(nvptx_unisimt_handle_set): Ditto.
	(nvptx_reorg_uniform_simt): New.  Transform code for -muniform-simt.
	(nvptx_reorg): Call nvptx_reorg_uniform_simt.
	(nvptx_handle_shared_attribute): New.  Use it...
	(nvptx_attribute_table): ... here (new entry).
	(nvptx_record_offload_symbol): Handle NULL attributes.
	(nvptx_file_end): Handle need_softstack_decl and need_unisimt_decl.
	(nvptx_simt_vf): New.
	(TARGET_SIMT_VF): Define.
	* config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Define
	__nvptx_softstack or __nvptx_unisimt__ when -msoft-stack, or resp.
	-muniform-simt option is active.
	(STACK_SIZE_MODE): Define.
	(FIXED_REGISTERS): Adjust.
	(SOFTSTACK_SLOT_REGNUM): New.
	(SOFTSTACK_PREV_REGNUM): New.
	(REGISTER_NAMES): Adjust.
	(struct machine_function): New fields.
	* config/nvptx/nvptx.md (UNSPEC_SET_SOFTSTACK): New.
	(UNSPEC_VOTE_BALLOT): Ditto.
	(UNSPEC_LANEID): Ditto.
	(UNSPECV_NOUNROLL): Ditto.
	(atomic): New attribute.
	(predicable): New attribute.  Generate predicated forms via
	define_cond_exec.
	(br_true): Mark as not predicable.
	(br_false): Ditto.
	(br_true_uni): Ditto.
	(br_false_uni): Ditto.
	(return): Ditto.
	(trap_if_true): Ditto.
	(trap_if_false): Ditto.
	(nvptx_fork): Ditto.
	(nvptx_forked): Ditto.
	(nvptx_joining): Ditto.
	(nvptx_join): Ditto.
	(nvptx_barsync): Ditto.
	(epilogue): Emit stack restore if TARGET_SOFT_STACK.
	(allocate_stack): Implement for TARGET_SOFT_STACK.  Remove unused code.
	(allocate_stack_<mode>): Remove unused pattern.
	(set_softstack_insn): New pattern.
	(restore_stack_block): Handle for TARGET_SOFT_STACK.
	(nvptx_vote_ballot): New pattern.
	(omp_simt_lane): Ditto.
	(omp_simt_last_lane): Ditto.
	(omp_simt_ordered): Ditto.
	(omp_simt_vote_any): Ditto.
	(omp_simt_xchg_bfly): Ditto.
	(omp_simt_xchg_idx): Ditto.
	(nvptx_nounroll): Ditto.
	(atomic_compare_and_swap<mode>_1): Mark with atomic attribute.
	(atomic_exchange<mode>): Ditto.
	(atomic_fetch_add<mode>): Ditto.
	(atomic_fetch_addsf): Ditto.
	(atomic_fetch_<logic><mode>): Ditto.
	* config/nvptx/nvptx.opt: (msoft-stack): New option.
	(muniform-simt): Ditto.
	(mgomp): Ditto.
	* config/nvptx/t-nvptx (MULTILIB_OPTIONS): New.
	* doc/extend.texi (Nvidia PTX Variable Attributes): New section.
	* doc/invoke.texi (msoft-stack): Document.
	(muniform-simt): Document
	(mgomp): Document.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in: (TARGET_SIMT_VF): New hook.
	* target.def: Define it.
	* target-insns.def (omp_simt_lane): New.
	(omp_simt_last_lane): New.
	(omp_simt_ordered): New.
	(omp_simt_vote_any): New.
	(omp_simt_xchg_bfly): New.
	(omp_simt_xchg_idx): New.

libgcc/
	* config/nvptx/crt0.c (__main): Setup __nvptx_stacks and __nvptx_uni.
	* config/nvptx/mgomp.c: New file.
	* config/nvptx/t-nvptx: Add mgomp.c

gcc/testsuite/
	* lib/target-supports.exp (check_effective_target_alloca): Use a
	compile test.
	* gcc.target/nvptx/softstack.c: New test.
	* gcc.target/nvptx/decl-shared.c: New test.
	* gcc.target/nvptx/decl-shared-init.c: New test.

From-SVN: r242503
2016-11-16 20:17:00 +03:00
Cesar Philippidis 6668eb4593 nvptx.c (PTX_GANG_DEFAULT): Set to zero.
gcc/
	* config/nvptx/nvptx.c (PTX_GANG_DEFAULT): Set to zero.

	libgomp/
	* plugin/plugin-nvptx.c (nvptx_exec): Interrogate board attributes
	to determine default geometry.
	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Set gang
	dimension.


Co-Authored-By: Nathan Sidwell <nathan@acm.org>

From-SVN: r241803
2016-11-02 15:10:02 -07:00
Thomas Schwinge 2300c332eb Use FOR_ALL_BB_FN in a few more places
gcc/
	* cfg.c (clear_bb_flags): Use FOR_ALL_BB_FN.
	* config/nvptx/nvptx.c (nvptx_find_sese): Likewise.

From-SVN: r241315
2016-10-18 21:36:45 +02:00
Thomas Preud'homme 4d0cdd0ce6 Move MEMMODEL_* from coretypes.h to memmodel.h
2016-10-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * coretypes.h: Move MEMMODEL_* macros and enum memmodel definition
    into ...
    * memmodel.h: This file.
    * alias.c, asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
      caller-save.c, calls.c, ccmp.c, cfgbuild.c, cfgcleanup.c,
      cfgexpand.c, cfgloopanal.c, cfgrtl.c, cilk-common.c, combine.c,
      combine-stack-adj.c, common/config/aarch64/aarch64-common.c,
      common/config/arm/arm-common.c, common/config/bfin/bfin-common.c,
      common/config/c6x/c6x-common.c, common/config/i386/i386-common.c,
      common/config/ia64/ia64-common.c, common/config/nvptx/nvptx-common.c,
      compare-elim.c, config/aarch64/aarch64-builtins.c,
      config/aarch64/aarch64-c.c, config/aarch64/cortex-a57-fma-steering.c,
      config/arc/arc.c, config/arc/arc-c.c, config/arm/arm-builtins.c,
      config/arm/arm-c.c, config/avr/avr.c, config/avr/avr-c.c,
      config/avr/avr-log.c, config/bfin/bfin.c, config/c6x/c6x.c,
      config/cr16/cr16.c, config/cris/cris.c, config/darwin-c.c,
      config/darwin.c, config/epiphany/epiphany.c,
      config/epiphany/mode-switch-use.c,
      config/epiphany/resolve-sw-modes.c, config/fr30/fr30.c,
      config/frv/frv.c, config/ft32/ft32.c, config/h8300/h8300.c,
      config/i386/i386-c.c, config/i386/winnt.c, config/iq2000/iq2000.c,
      config/lm32/lm32.c, config/m32c/m32c.c, config/m32r/m32r.c,
      config/m68k/m68k.c, config/mcore/mcore.c,
      config/microblaze/microblaze.c, config/mmix/mmix.c,
      config/mn10300/mn10300.c, config/moxie/moxie.c,
      config/msp430/msp430.c, config/nds32/nds32-cost.c,
      config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
      config/nds32/nds32-memory-manipulation.c,
      config/nds32/nds32-predicates.c, config/nds32/nds32.c,
      config/nios2/nios2.c, config/nvptx/nvptx.c, config/pa/pa.c,
      config/pdp11/pdp11.c, config/rl78/rl78.c, config/rs6000/rs6000-c.c,
      config/rx/rx.c, config/s390/s390-c.c, config/s390/s390.c,
      config/sh/sh.c, config/sh/sh-c.c, config/sh/sh-mem.cc,
      config/sh/sh_treg_combine.cc, config/sol2.c, config/spu/spu.c,
      config/stormy16/stormy16.c, config/tilegx/tilegx.c,
      config/tilepro/tilepro.c, config/v850/v850.c, config/vax/vax.c,
      config/visium/visium.c, config/vms/vms-c.c, config/xtensa/xtensa.c,
      coverage.c, cppbuiltin.c, cprop.c, cse.c, cselib.c, dbxout.c, dce.c,
      df-core.c, df-problems.c, df-scan.c, dojump.c, dse.c, dwarf2asm.c,
      dwarf2cfi.c, dwarf2out.c, emit-rtl.c, except.c, explow.c, expmed.c,
      expr.c, final.c, fold-const.c, function.c, fwprop.c, gcse.c,
      ggc-page.c, haifa-sched.c, hsa-brig.c, hsa-gen.c, hw-doloop.c,
      ifcvt.c, init-regs.c, internal-fn.c, ira-build.c, ira-color.c,
      ira-conflicts.c, ira-costs.c, ira-emit.c, ira-lives.c, ira.c, jump.c,
      loop-doloop.c, loop-invariant.c, loop-iv.c, loop-unroll.c,
      lower-subreg.c, lra.c, lra-assigns.c, lra-coalesce.c,
      lra-constraints.c, lra-eliminations.c, lra-lives.c, lra-remat.c,
      lra-spills.c, mode-switching.c, modulo-sched.c, omp-low.c, passes.c,
      postreload-gcse.c, postreload.c, predict.c, print-rtl-function.c,
      recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c,
      reload.c, reload1.c, reorg.c, resource.c, rtl-chkp.c, rtl-tests.c,
      rtlanal.c, rtlhooks.c, sched-deps.c, sched-rgn.c, sdbout.c,
      sel-sched-ir.c, sel-sched.c, shrink-wrap.c, simplify-rtx.c,
      stack-ptr-mod.c, stmt.c, stor-layout.c, target-globals.c,
      targhooks.c, toplev.c, tree-nested.c, tree-outof-ssa.c,
      tree-profile.c, tree-ssa-coalesce.c, tree-ssa-ifcombine.c,
      tree-ssa-loop-ivopts.c, tree-ssa-loop.c, tree-ssa-reassoc.c,
      tree-ssa-sccvn.c, tree-vect-data-refs.c, ubsan.c, valtrack.c,
      var-tracking.c, varasm.c: Include memmodel.h.
    * genattrtab.c (write_header): Include memmodel.h in generated file.
    * genautomata.c (main): Likewise.
    * gengtype.c (open_base_files): Likewise.
    * genopinit.c (main): Likewise.
    * genconditions.c (write_header): Include memmodel.h earlier in
    generated file.
    * genemit.c (main): Likewise.
    * genoutput.c (output_prologue): Likewise.
    * genpeep.c (main): Likewise.
    * genpreds.c (write_insn_preds_c): Likewise.
    * genrecog.c (write_header): Likewise.
    * Makefile.in (PLUGIN_HEADERS): Include memmodel.h

    gcc/ada/
    * gcc-interface/utils2.c: Include memmodel.h.

    gcc/c-family/
    * c-cppbuiltin.c: Include memmodel.h.
    * c-opts.c: Likewise.
    * c-pragma.c: Likewise.
    * c-warn.c: Likewise.

    gcc/c/
    * c-typeck.c: Include memmodel.h.

    gcc/cp/
    * decl2.c: Include memmodel.h.
    * rtti.c: Likewise.

    gcc/fortran/
    * trans-intrinsic.c: Include memmodel.h.

    gcc/go/
    * go-backend.c: Include memmodel.h.

    libgcc/
    * libgcov-profiler.c: Replace MEMMODEL_* macros by their __ATOMIC_*
    equivalent.
    * config/tilepro/atomic.c: Likewise and stop casting model to
    enum memmodel.

From-SVN: r241121
2016-10-13 14:17:52 +00:00
Segher Boessenkool d81db63616 Put a TARGET_LRA_P into every target
This patch adds a TARGET_LRA_P (defined to hook_bool_void_false) to
every target that didn't yet override the hook.  No functional change.


2016-09-14  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/alpha/alpha.c (TARGET_LRA_P): New macro, defined to
	hook_bool_void_false.
	* config/avr/avr.c: Ditto.
	* config/bfin/bfin.c: Ditto.
	* config/c6x/c6x.c: Ditto.
	* config/cr16/cr16.c: Ditto.
	* config/cris/cris.c: Ditto.
	* config/epiphany/epiphany.c: Ditto.
	* config/fr30/fr30.c: Ditto.
	* config/frv/frv.c: Ditto.
	* config/h8300/h8300.c: Ditto.
	* config/ia64/ia64.c: Ditto.
	* config/iq2000/iq2000.c: Ditto.
	* config/lm32/lm32.c: Ditto.
	* config/m32c/m32c.c: Ditto.
	* config/m32r/m32r.c: Ditto.
	* config/m68k/m68k.c: Ditto.
	* config/mcore/mcore.c: Ditto.
	* config/microblaze/microblaze.c: Ditto.
	* config/mmix/mmix.c: Ditto.
	* config/mn10300/mn10300.c: Ditto.
	* config/moxie/moxie.c: Ditto.
	* config/msp430/msp430.c: Ditto.
	* config/nios2/nios2.c: Ditto.
	* config/nvptx/nvptx.c: Ditto.
	* config/pa/pa.c: Ditto.
	* config/pdp11/pdp11.c: Ditto.
	* config/rl78/rl78.c: Ditto.
	* config/sparc/sparc.c: Ditto.
	* config/spu/spu.c: Ditto.
	* config/stormy16/stormy16.c: Ditto.
	* config/tilegx/tilegx.c: Ditto.
	* config/tilepro/tilepro.c: Ditto.
	* config/v850/v850.c: Ditto.
	* config/vax/vax.c: Ditto.
	* config/visium/visium.c: Ditto.
	* config/xtensa/xtensa.c: Ditto.

From-SVN: r240130
2016-09-14 12:46:12 +02:00
Nathan Sidwell f2d4d8390e * config/nvptx/nvptx.c: #include tree-vrp.h.
From-SVN: r239820
2016-08-29 12:49:10 +00:00
Nathan Sidwell c1311c86c0 nvptx.c (nvptx_declare_function_name): Round frame size to DImode boundary.
gcc/
	* config/nvptx/nvptx.c (nvptx_declare_function_name): Round frame
	size to DImode boundary.
	(nvptx_propagate): Likewise.

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/crash-1.c: New.

From-SVN: r239086
2016-08-03 17:26:51 +00:00
Alexander Monakov 3d339d5ed0 revert: nvptx: do not implicitly enable -ftoplevel-reorder
Revert
2016-07-20  Alexander Monakov  <amonakov@ispras.ru>

* config/nvptx/nvptx.c (nvptx_option_override): Do not set
flag_toplevel_reorder.

From-SVN: r238710
2016-07-25 15:37:29 +03:00
Alexander Monakov b25ea150b6 nvptx: do not implicitly enable -ftoplevel-reorder
* config/nvptx/nvptx.c (nvptx_option_override): Do not set
flag_toplevel_reorder.

From-SVN: r238518
2016-07-20 16:47:12 +03:00
Nathan Sidwell 721547cd0d nvptx.c (nvptx_assemble_undefined_decl): Reject undefined weak.
* config/nvptx/nvptx.c (nvptx_assemble_undefined_decl): Reject
	undefined weak.

	testsuite/
	* c-c++-common/torture/pr57945.c: Add expected PTX error.
	* gcc.target/nvptx/weak.c: New.

From-SVN: r236990
2016-06-01 13:41:19 +00:00
Nathan Sidwell ae578943c0 nptx.c (nvptx_option_override): Only set flag_toplevel_reorder, if not explicitly specified.
* config/nvptx/nptx.c (nvptx_option_override): Only set
	flag_toplevel_reorder, if not explicitly specified.  Set
	flag_no_common, unless explicitly specified.

	testsuite/
	* gcc.target/nvptx/uninit-decl.c: Force common storage,  add
	non-common cases.
	* gcc.dg/tree-ssa/ssa-store-ccp-2.c: Add -fcommon.

From-SVN: r236532
2016-05-20 19:52:50 +00:00
Nathan Sidwell 1988b2c22a nvptx.c (nvptx_function_arg_boundary): New.
* config/nvptx/nvptx.c (nvptx_function_arg_boundary): New.
	(TARGET_FUNCTION_ARG_BOUNDARY): Override.

	testsuite/
	* gcc.target/nvptx/abi-vararg-3.c: New.

From-SVN: r236345
2016-05-17 21:16:49 +00:00
Nathan Sidwell b434610704 nvptx.c (nvptx_mangle_decl_assembler_name): Revert.
* config/nvptx/nvptx.c (nvptx_mangle_decl_assembler_name): Revert.
	(nvptx_name_replacement): Restore.  Add comment.
	(write_fn_proto, write_fn_proto_from_insn,
	nvptx_output_call_insn): Restore
	(TARGET_MANGLE_DECL_ASSEMBLER_NAME): Delete.

From-SVN: r236286
2016-05-16 13:16:28 +00:00
Nathan Sidwell 72b1108c3e nvptx.c (nvptx_mangle_decl_assembler_name): New.
* config/nvptx/nvptx.c (nvptx_mangle_decl_assembler_name): New.
	(nvptx_name_replacement): Delete.
	(write_fn_proto, write_fn_proto_from_insn,
	nvptx_output_call_insn): Remove nvptx_name_replacement call.
	(TARGET_MANGLE_DECL_ASSEMBLER_NAME): Override.
	* langhooks.c (add_builtin_funcction_common): Call
	targetm.mangle_decl_assembler_name.

From-SVN: r236212
2016-05-13 15:51:24 +00:00
Nathan Sidwell ac3d02e247 nvptx.c (write_fn_proto): Handle BUILT_IN_ATOMIC_COMPARE_EXCHANGE_n oddity.
gcc/
	* config/nvptx/nvptx.c (write_fn_proto): Handle
	BUILT_IN_ATOMIC_COMPARE_EXCHANGE_n oddity.

	gcc/testsuite/
	* gcc.dg/atomic-noinline-aux.c: Include stddef.h. Fix
	__atomic_is_lock_free declaration.

From-SVN: r236209
2016-05-13 12:57:50 +00:00
Thomas Schwinge e91cacaedb [PR target/70860] [nvptx] Handle NULL cfun in nvptx_libcall_value
gcc/
	PR target/70860
	* config/nvptx/nvptx.c (nvptx_libcall_value): Handle NULL cfun.
	(nvptx_function_value): Assert non-NULL cfun.

From-SVN: r235748
2016-05-02 13:25:17 +02:00
Thomas Schwinge c600d691f3 [nvptx] Don't emit sorry for the stabs debug format
* config/nvptx/nvptx.c (nvptx_option_override): Don't emit sorry
	for the stabs debug format.

Co-Authored-By: Alexander Monakov <amonakov@ispras.ru>

From-SVN: r234370
2016-03-21 16:31:50 +01:00
Nathan Sidwell 8e80c4d476 * config/nvptx/nvptx.c (nvptx_option_override): Don't kill debug level.
From-SVN: r234083
2016-03-09 13:33:03 +00:00
Cesar Philippidis d5ace3b55d nvptx.c (nvptx_gen_shuffle): Add support for QImode and HImode registers.
gcc/
	* config/nvptx/nvptx.c (nvptx_gen_shuffle): Add support for QImode
	and HImode registers.

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/vprop.c: New test.

From-SVN: r233607
2016-02-22 08:28:25 -08:00
Jakub Jelinek 9c58255170 cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor.
* cgraph.c: Spelling fixes - behaviour -> behavior and
	neighbour -> neighbor.
	* target.def: Likewise.
	* sel-sched.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/arc/arc.md: Likewise.
	* config/arm/cortex-a57.md: Likewise.
	* config/arm/arm.c: Likewise.
	* config/arm/neon.md: Likewise.
	* config/arm/arm-c.c: Likewise.
	* config/vms/vms-c.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/i386/znver1.md: Likewise.
	* config/i386/i386.c: Likewise.
	* config/ia64/hpux-unix2003.h: Likewise.
	* config/msp430/msp430.md: Likewise.
	* config/rx/rx.c: Likewise.
	* config/rx/rx.md: Likewise.
	* config/aarch64/aarch64-simd.md: Likewise.
	* config/aarch64/aarch64.c: Likewise.
	* config/nvptx/nvptx.c: Likewise.
	* config/bfin/bfin.c: Likewise.
	* config/cris/cris.opt: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* target.h: Likewise.
	* spellcheck.c: Likewise.
	* ira-build.c: Likewise.
	* tree-inline.c: Likewise.
	* builtins.c: Likewise.
	* lra-constraints.c: Likewise.
	* explow.c: Likewise.
	* hwint.h: Likewise.
	* targhooks.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* expr.c: Likewise.
	* doc/tm.texi: Likewise.
	* doc/extend.texi: Likewise.
	* doc/install.texi: Likewise.
	* doc/md.texi: Likewise.
	* tree-ssa-tail-merge.c: Likewise.
	* sched-int.h: Likewise.
	* match.pd: Likewise.
	* sched-ebb.c: Likewise.
	* target.def (omit_struct_return_reg): Likewise.
	* gimple-ssa-isolate-paths.c: Likewise.
	(find_implicit_erroneous_behaviour): Renamed to...
	(find_implicit_erroneous_behavior): ... this.
	(find_explicit_erroneous_behaviour): Renamed to...
	(find_explicit_erroneous_behavior): ... this.
	(gimple_ssa_isolate_erroneous_paths): Adjust caller.
gcc/cp/
	* error.c: Spelling fixes - behaviour -> behavior and
	neighbour -> neighbor.
	* decl.c: Likewise.
	* typeck.c (cp_build_binary_op): Fix up behavior spelling in
	diagnostics.
	* init.c (build_delete): Likewise.
gcc/objc/
	* objc-act.c: Spelling fixes - behaviour -> behavior and
	neighbour -> neighbor.
	* objc-map.h: Likewise.
gcc/go/
	* gofrontend/lex.cc: Spelling fixes - behaviour -> behavior and
	neighbour -> neighbor.
	* gccgo.texi: Likewise.
gcc/ada/
	* prj-tree.ads: Spelling fixes - behaviour -> behavior and
	neighbour -> neighbor.
	* prep.adb: Likewise.
	* prj.ads: Likewise.
	* prepcomp.adb: Likewise.
	* g-socket.ads: Likewise.
	* s-imgrea.adb: Likewise.
	* a-calend.adb: Likewise.
	* exp_disp.adb: Likewise.
	* doc/gnat_ugn/gnat_utility_programs.rst: Likewise.
	* g-socket.adb: Likewise.
	* sem_ch12.adb: Likewise.
	* terminals.c: Likewise.
gcc/testsuite/
	* objc.dg/gnu-api-2-method.m: Spelling fixes - behaviour -> behavior
	and neighbour -> neighbor.
	* objc.dg/attributes/method-nonnull-1.m: Likewise.
	* objc.dg/gnu-api-2-class-meta.m: Likewise.
	* c-c++-common/Wvarargs.c: Likewise.
	* c-c++-common/goacc/host_data-5.c: Likewise.
	* obj-c++.dg/gnu-api-2-class-meta.mm: Likewise.
	* obj-c++.dg/attributes/method-nonnull-1.mm: Likewise.
	* obj-c++.dg/gnu-api-2-method.mm: Likewise.
	* gcc.target/aarch64/pr60697.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vqshl.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vshuffle.inc: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vrshl.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vqrshl.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vldX.c: Likewise.
	* gcc.target/aarch64/aapcs64/ice_2.c: Likewise.
	* gcc.target/aarch64/aapcs64/test_23.c: Likewise.
	* gcc.target/aarch64/vrnd_f64_1.c: Likewise.
	* g++.dg/warn/Wconversion-real-integer-3.C: Likewise.
	* g++.dg/lookup/koenig5.C: Likewise.
	* g++.dg/ext/no-asm-2.C: Likewise.
	* gfortran.dg/bounds_check_array_ctor_3.f90: Likewise.
	* gfortran.dg/bounds_check_array_ctor_7.f90: Likewise.
	* gfortran.dg/used_types_16.f90: Likewise.
	* gfortran.dg/assumed_rank_bounds_1.f90: Likewise.
	* gfortran.dg/bounds_check_array_ctor_1.f90: Likewise.
	* gfortran.dg/assumed_rank_bounds_2.f90: Likewise.
	* gfortran.dg/bounds_check_array_ctor_4.f90: Likewise.
	* gfortran.dg/abstract_type_6.f03: Likewise.
	* gfortran.dg/bounds_check_array_ctor_5.f90: Likewise.
	* gfortran.dg/used_types_15.f90: Likewise.
	* gfortran.dg/bounds_check_array_ctor_8.f90: Likewise.
	* gfortran.dg/exit_3.f08: Likewise.
	* gfortran.dg/open_status_2.f90: Likewise.
	* gfortran.dg/derived_pointer_recursion_2.f90: Likewise.
	* gfortran.dg/intrinsic_std_1.f90: Likewise.
	* gfortran.dg/associate_1.f03: Likewise.
	* gfortran.dg/bounds_check_array_ctor_2.f90: Likewise.
	* gfortran.dg/intrinsic_std_6.f90: Likewise.
	* gfortran.dg/bounds_check_array_ctor_6.f90: Likewise.
	* gcc.dg/builtin-object-size-1.c: Likewise.
	* gcc.dg/noreturn-6.c: Likewise.
	* gcc.dg/builtin-stringop-chk-1.c: Likewise.
	* gcc.dg/globalalias.c: Likewise.
	* gcc.dg/builtins-config.h: Likewise.
	* gcc.dg/pr30457.c: Likewise.
	* gcc.c-torture/compile/volatile-1.c: Likewise.
	* gcc.c-torture/execute/20101011-1.c: Likewise.
	* c-c++-common/Waddress-1.c: Likewise.

From-SVN: r233358
2016-02-12 00:53:54 +01:00
Alexander Monakov 578fb2259b nvptx: do not use alternative spelling of unsigned comparisons
gcc/ChangeLog:
	* config/nvptx/nvptx.c (nvptx_print_operand): Treat LEU, GEU, LTU, GTU
        like LE, GE, LT, GT when emitting relational operator.

gcc/testsuite/ChangeLog:
	* gcc.target/nvptx/unsigned-cmp.c: New test.

From-SVN: r233088
2016-02-02 21:24:25 +03:00
Nathan Sidwell b6adbb9faa nvptx.c (PTX_GANG_DEFAULT): New.
gcc/
	* config/nvptx/nvptx.c (PTX_GANG_DEFAULT): New.
	(nvptx_goacc_validate_dims): Extend to handle global defaults.
	* target.def (OACC_VALIDATE_DIMS): Extend documentation.
	* doc/tm.texti: Rebuilt.
	* doc/invoke.texi (fopenacc-dim): Document.
	* lto-wrapper.c (merge_and_complain): Add OPT_fopenacc_dim_ case.
	(append_compiler_options): Likewise.
	* omp-low.c (oacc_default_dims, oacc_min_dims): New.
	(oacc_parse_default_dims): New.
	(oacc_validate_dims): Add USED arg.  Select non-unity default when
	possible.
	(oacc_loop_fixed_partitions): Return mask of used partitions.
	(oacc_loop_auto_partitions): Emit dump info.
	(oacc_loop_partition): Return mask of used partitions.
	(execute_oacc_device_lower): Parse default dimension arg.  Adjust
	loop partitioning and validation calls.

	gcc/c-family/
	* c.opt (fopenacc-dim=): New option.

	gcc/fortran/
	* lang.opt (fopenacc-dim=): New option.

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c: New.
	* testsuite/libgomp.oacc-fortran/routine-7.f90: Serialize loop.

From-SVN: r233041
2016-02-01 16:20:13 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Nathan Sidwell 0a0f74aaf1 nvptx.c (nvptx_assemble_undefined_decl): Check it's not a constant pool object.
* config/nvptx/nvptx.c (nvptx_assemble_undefined_decl): Check
	it's not a constant pool object.

From-SVN: r232003
2015-12-30 15:52:59 +00:00
Nathan Sidwell a02d84b6f8 nvptx.c (nvptx_output_call_insn): Expect hard regs.
* config/nvptx/nvptx.c (nvptx_output_call_insn): Expect hard regs.
	* config/nvptx/nvptx.md (nvptx_reg_or_mem_operand): Rename to ...
	(nvptx_nonimmediate_operand): ... here.  Update all uses.
	(call_insn_operand): Use REG_P.
	(call_operation): Allow hard regs.

From-SVN: r231972
2015-12-28 13:38:10 +00:00
Nathan Sidwell bd602b7fcb * config/nvptx/nvptx-protos.h
(nvptx_maybe_convert_symbolic_operand): Delete prototype.
	* config/nvptx/nvptx.c (nvptx_maybe_convert_symbolic_operand): Delete.
	(nvptx_output_mov_insn): Record fnsym here.
	(nvptx_wpropagate): Don't create UNSPEC_TO_GENERIC unspec.
	* config/nvptx/nvptx.md (UNSPEC_TO_GENERIC): Delete.
	(symbolic_operand): Delete predicate.
	(nvptx_nonimmediate_operand): Delete predicate.
	(mov<mode>): Hard regs are perfectly ok here.
	(convaddr_<mode>): Delete.

From-SVN: r231930
2015-12-23 16:55:31 +00:00
Nathan Sidwell 15113b03f1 nvptx.c (nvptx_maybe_convert_symbolic_operand): Remove UNSPEC_TO_GENERIC generation.
* config/nvptx/nvptx.c (nvptx_maybe_convert_symbolic_operand):
	Remove UNSPEC_TO_GENERIC generation.
	(nvptx_output_mov_insn): Generate cvta for symbolic src.
	* config/nvptx/nvptx.md (nvptx_register_operand): Allow hard reg.
	(nvptx_reg_or_mem_operand): Likewise.
	(nvptx_nonmemory_operand): Likewise.
	(nvptx_general_operand): Delete.
	(*mov<mode>_insn): Use nonimmediate_operand, permit hardregs.
	(oacc_fork, oacc_join): Use general_operand.

From-SVN: r231837
2015-12-18 20:18:42 +00:00
Nathan Sidwell 1e5154e768 nvptx.c (nvptx_option_override): Emit sorry for stabs debug.
* config/nvptx/nvptx.c (nvptx_option_override): Emit sorry for
	stabs debug.
	(nvptx_assemble_undefined_decl): Use nvptx_assemble_decl_end.

From-SVN: r231822
2015-12-18 17:43:11 +00:00
Nathan Sidwell 15ab6f00bc nvptx.c (worker_bcast_name, [...]): Delete.
* config/nvptx/nvptx.c (worker_bcast_name, worker_red_name): Delete.
	(nvptx_option_override): Adjust worker symbol creation.
	(nvptx_gen_wcast): Wrap worker address in UNSPEC_TO_GENERIC.
	(write_worker_buffer): New.
	(nvptx_file_end): Call write_worker_buffer.
	* config/nvptx/nvptx.md (UNSPEC_SHARED_DATA): Delete.
	(worker_load<mode>, worker_store<mode>): Delete.

From-SVN: r231818
2015-12-18 14:39:52 +00:00
Nathan Sidwell 5563d5c09a nvptx.h (OUTGOING_STATIC_CHAIN_REGNUM): Remove.
* config/nvptx/nvptx.h (OUTGOING_STATIC_CHAIN_REGNUM): Remove.
	(REGISTER_NAMES): Adjust.
	* config/nvptx/nvptx.c (nvptx_pass_by_reference): Avoid long line.
	(nvptx_static_hain): Delete.
	(write_arg_mode): Don't emit initializer if argno < 0.
	(write_arg_type): Fix whitespace.
	(init_frame): Initialize reg to zero if frame is zero-sized.
	(nvptx_declare_function_name):  Use write_arg_type to emit chain
	decl.
	(nvptx_output_call_insn): Adjust static chain emission.
	(nvptx_goacc_reduction): Make static.
	(TARGET_STATIC_CHAIN): Don't override.

From-SVN: r231718
2015-12-16 20:02:02 +00:00
Nathan Sidwell 44c068aecb nvptx-protos.h (nvptx_hard_regno_mode_ok): Delete.
* config/nvptx/nvptx-protos.h (nvptx_hard_regno_mode_ok): Delete.
	* config/nvptx/nvptx.h (struct machine_function):
	Reimplement. Adjust all users.
	* config/nvptx/nvptx.c (nvptx_declare_function_name): Move stack
	and frame array generation earlier.
	(nvptx_call_args): Reimplement.
	(nvptx_expand_call): Adjust.
	(nvptx_hard_reno_mode_ok): Delete.
	(nvptx_reorg): Revert scan of hard regs.

From-SVN: r231691
2015-12-16 13:51:36 +00:00
Nathan Sidwell 1f0659546b nvptx.c (write_one_arg): Rename to ...
* config/nvptx/nvptx.c (write_one_arg): Rename to ...
	(write_arg_mode): ... here.  Update callers.
	(write_arg): Rename to ...
	(write__arg_type): ... here.  Update callers.
	(write_return_mode): New fn, broken out of ...
	(write_return): ... here.  Rename to ...
	(write_return_type): ... here.  Call it. Update callers.
	(write_fn_proto_from_insn): Use write_arg_mode and
	write_return_mode.
	(init_frame): New fn.
	(nvptx_declare_function_name): Call it for frame and varargs. Only
	emit outgoing static chain, if it's live.
	(nvptx_output_return): Use reg_names for return reg name.
	(nvptx_output_call_insn): Likewise.
	(nvptx_reorg): Mark unused hard regs too.

From-SVN: r231663
2015-12-15 20:46:37 +00:00
Nathan Sidwell bd5d4b6538 nvptx.md (nvptx_register_operand): Don't accept and then reject subregs.
* config/nvptx/nvptx.md (nvptx_register_operand): Don't accept and
	then reject subregs.
	(nvptx_reg_or_mem_operand): Likewise.
	(nvptx_nonmemory_operand): Likewise.
	(call_insn_operand): A regular predicate, check	SYMBOL_REF_FUNCTION_P.
	(call_insn, call_value_insn): Address is not SImode.
	* config/nvptx/nvptx.h (FIXED_REGISTERS): Make return reg fixed.
	(enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS): Remove
	RETURN_REG class.
	(REGNO_REG_CLASS): Alwaus ALL_REGS.
	(PROMOTE_MODE): QI and HI are the only smaller than SI int modes.
	(HARD_FRAME_POINTER_REGNUM): Delete.
	(REGISTER_NAMES): Move earlier.
	(struct nvptx_args): Remove 'off'.
	(INIT_CUMULATIVE_ARGS): Don't initialize 'off'.
	(ELIMINABLE_REGS): Remove HARD_FRAME_POINTER_REGNUM.
	* config/nvptx/nvptx.c (arg_promotion): Delete.
	(nvptx_expand_call): Remove check for funtype being an fntype.

From-SVN: r231659
2015-12-15 17:05:01 +00:00
Nathan Sidwell 5c036f3f0a nvptx.h (HARD_REGNO_NREGS): Reformat.
* config/nvptx/nvptx.h (HARD_REGNO_NREGS): Reformat.
	(CANNOT_CHANGE_MODE_CLASS): Always return true.
	(HARD_REGNO_MODE_OK): Reformat.
	* config/nvptx/nvptx.md (define_expand mov<mode>): No
	RETURN_REGNUM handling here.
	* config/nvptx/nvptx.c (nvptx_function_value): Set ret_reg_mode
	here.
	(write_one_arg): No QI or HI mode args.
	(write_fn_proto_from_insn): No argument promotion here.
	(nvptx_output_return_insn): No return promotion here.
	(nvptx_output_mov_insn): No RETURN_REGNUM handling needed.
	(nvptx_output_call_insn): No return promotion here.

From-SVN: r231651
2015-12-15 13:32:48 +00:00
Nathan Sidwell 44eba92d0a nvptx.h (PARM_BOUNDARY): Set to 32.
gcc/
	* config/nvptx/nvptx.h (PARM_BOUNDARY): Set to 32.
	* config/nvptx/nvptx.c (PASS_IN_REG_P, RETURN_IN_REG_P): Delete.
	(pass_in_memory, promote_arg, promote_return): New.
	(nvptx_function_arg_boundary): Delete.
	(nvptx_function_value): Use promote_return.
	(nvptx_pass_by_reference): Use pass_in_memory.
	(nvptx_return_in_memory): Use pass_in_memory.
	(nvptx_promote_function_mode): Use promote_arg.
	(write_arg): Adjust arg splitting logic.
	(write_return): Check and clear ret_reg_mode, if needed.
	(write_fn_proto, nvptx_declare_function_name): Adust write_return
	calls.
	(TARGET_RUNCTION_ARG_BOUNDARY,
	TARGET_FUNCTION_ARG_ROUND_BOUNDARY): Don't override.

	gcc/testsuite/
	* g++.dg/abi/nvptx-nrv1.C: New.
	* g++.dg/abi/nvptx-ptrmem1.C: New.
	* gcc.target/nvptx/abi-complex-arg.c: New.
	* gcc.target/nvptx/abi-complex-ret.c: New.
	* gcc.target/nvptx/abi-enum-arg.c: New.
	* gcc.target/nvptx/abi-enum-ret.c: New.
	* gcc.target/nvptx/abi-knr-arg.c: New.
	* gcc.target/nvptx/abi-knr-ret.c: New.
	* gcc.target/nvptx/abi-scalar-arg.c: New.
	* gcc.target/nvptx/abi-scalar-ret.c: New.
	* gcc.target/nvptx/abi-struct-arg.c: New.
	* gcc.target/nvptx/abi-struct-ret.c: New.
	* gcc.target/nvptx/abi-vararg-1.c: New.
	* gcc.target/nvptx/abi-vararg-2.c: New.
	* gcc.target/nvptx/abi-vect-arg.c: New.
	* gcc.target/nvptx/abi-vect-ret.c: New.

From-SVN: r231628
2015-12-14 19:26:49 +00:00
Nathan Sidwell b49e35a94a nvptx.h (RETURN_ADDR_REGNO): Delete.
* config/nvptx/nvptx.h (RETURN_ADDR_REGNO): Delete.
	(OUTGOING_ARG_POINTER_REGNUM): Delete.
	(ASM_OUTPUT_COMMON, ASM_OUTPUT_LOCAL): Delete.
	(REGISTER_NAMES): Name static chain regs.
	* config/nvptx/nvptx.c (nvptx_function_arg): Add ARG_UNUSED, merge
	ifs.
	(nvptx_incoming_arg): Merge ifs.
	(nvptx_function_arg_boundary): Reimplement to avoid mixing units.
	(nvptx_function_value): Tail call nvptx_libcall_value.
	(nvptx_pass_by_reference): Add ARG_UNUSED.
	(nvptx_static_chain): Use conditional op.
	(nvptx_handle_kernel_attribute): Use VOID_TYPE_P.

From-SVN: r231572
2015-12-11 18:06:37 +00:00
Nathan Sidwell a9000e1e2f nvptx.h (TARGET_SUPPORTS_WIDE_INT): Define.
gcc/
	* config/nvptx/nvptx.h (TARGET_SUPPORTS_WIDE_INT): Define.
	* config/nvptx/nvptx.c (nvptxx_assemble_integer): Return false for
	unrecognizable RTX.

	gcc/testsuite/
	* gcc.target/nvptx/ary-init.c: Repair dg_final syntax.
	* gcc.target/nvptx/decl-init.c: Likewise.  Add TI case.

From-SVN: r231564
2015-12-11 13:52:05 +00:00
Nathan Sidwell e74f7152e8 nvptx.c (nvptx_function_arg, [...]): Move earlier.
* config/nvptx/nvptx.c (nvptx_function_arg,
	nvptx_function_incoming_arg, nvptx_function_arg_advance,
	nvptx_strict_argument_naming, nvptx_function_arg_boundary,
	nvptx_libcall_value, nvptx_function_value,
	nvptx_function_value_regno_p, nvptx_pass_by_reference,
	nvptx_return_in_memory, nvptx_promote_function_mode,
	nvptx_static_chain): Move earlier.
	(write_one_arg): Break out as helper fn for ...
	(write_arg): ... this new function.  Adjust all callers.

From-SVN: r231543
2015-12-10 20:13:14 +00:00
Nathan Sidwell 4d5438cd3c nvptx.c (decl_chunk_size, [...]): Replace with ...
gcc/
	* config/nvptx/nvptx.c (decl_chunk_size, decl_chunk_mode,
	decl_offset, init_part, object_size, object_finished): Replace
	with ...
	(struct init_frag): ... this new struct variable.
	(begin_decl_field, output_decl_chunk): Replace with ...
	(output_init_frag): ... this new function.
	(nvptx_assemble_value): Reimplement.
	(nvptx_assemble_integer, nvptx_output_skip): Adjust.
	(nvptx_assemble_decl_begin, nvptx_assemble_decl_end): Adjust.
	(nvptx_output_aligned_decl): Call nvptx_assemble_decl_end.

	gcc/testsuite/
	* gcc.target/nvptx/trailing-init.c: New.

From-SVN: r231426
2015-12-08 21:06:42 +00:00
Nathan Sidwell 0beb7c71f1 nvptx.c (write_return): New.
* config//nvptx/nvptx.c (write_return): New.
	(write_fn_proto, nvptx_declare_function_name): Call it.

From-SVN: r231375
2015-12-07 17:53:09 +00:00
Nathan Sidwell 51baf85ab6 nvptx.c (nvptx_output_call_insn): Emit trap after no return call.
gcc/
	* config/nvptx/nvptx.c (nvptx_output_call_insn): Emit trap after no
	return call.

	gcc/testsuite/
	* gcc.target/nvptx/abort.c: New.

From-SVN: r231368
2015-12-07 16:08:42 +00:00
Nathan Sidwell fc0efeeab3 nvptx.c (nvptx_assemble_decl_begin): Look inside complex and vector types.
gcc/
	* config/nvptx/nvptx.c (nvptx_assemble_decl_begin): Look inside
	complex and vector types.  Cope with packed structs.

	gcc/testsuite/
	* gcc.target/nvptx/decl-init.c: New.

From-SVN: r231362
2015-12-07 13:46:07 +00:00
Nathan Sidwell 4ff3145ae1 nvptx.c (nvptx_assemble_decl_begin): New, replacing ...
gcc/
	* config/nvptx/nvptx.c (nvptx_assemble_decl_begin): New,
	replacing ...
	(init_output_initializer): ... this.
	(nvptx_output_aligned_decl, nvptx_asm_declare_constant_name,
	nvptx_declare_object_name, nvptx_assemble_undefined_decl): Use
	nvptx_assemble_decl_begin.

	gcc/testsuite/
	* gcc.target/nvptx/ary-init.c: New.

From-SVN: r231298
2015-12-04 18:41:46 +00:00