Commit Graph

32 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 cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +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
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Nathan Sidwell a2e2a4e427 nvptx.h (NVPTX_RETURN_REGNUM, [...]): Renumber.
* config/nvptx/nvptx.h (NVPTX_RETURN_REGNUM, FRAME_POINTER_REGNUM,
	ARG_POINTER_REGNUM, STATIC_CHAIN_REGNUM): Renumber.
	(REGISTER_NAMES): Update and rename.
	(FIXED_REGISTERS, CALL_USED_REGISTERS): Update.
	(enum_reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS): Reformat.

From-SVN: r231771
2015-12-17 15:06:03 +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 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 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
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
Nathan Sidwell 69823d7678 nvptx-protos.h (nvptx_output_aligned_decl): Declare.
gcc/
	* config/nvptx/nvptx-protos.h (nvptx_output_aligned_decl): Declare.
	* config/nvptx/nvptx.h (ASM_OUTPUT_ALIGNED_DECL_COMMON,
	ASM_OUTPUT_ALIGNED_DECL_LOCAL): Forward to nvptx_output_aligned_decl.
	* config/nvptx/nvptx.c (write_fn_marker, write_var_marker): New.
	(write_fn_proto, write_fn_proto_from_insn): Call write_fn_marker.
	(init_output_initializer): Call write_var_marker.
	(nvptx_output_aligned_decl): New.
	(nvptx_assemble_undefined_decl, nvptx_file_end): Call write_var_marker.

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

From-SVN: r231127
2015-12-01 20:13:02 +00:00
Nathan Sidwell 01be58559c nvptx.h (FIRST_PARM_OFFSET): Add void cast.
* config/nvptx/nvptx.h (FIRST_PARM_OFFSET): Add void cast.
	(FRAME_POINTER_CFA_OFFSET): Define.
	(struct nvptx_args): Use 'tree' type.
	(INIT_CUMULATIVE_ARGS): Remove unnecessary do...while.

From-SVN: r231038
2015-11-28 23:24:20 +00:00
Nathan Sidwell cf08c34456 nvptx.c (write_function_decl_and_comment): Print leading blank line.
* config/nvptx/nvptx.c (write_function_decl_and_comment): Print
	leading blank line.
	(write_func_decl_from_insn): Likewise.
	(init_output_initializer, nvptx_assemble_undefined_decl): Likewise.
	(nvptx_file_end): Likewise.
	(nvptx_function_end): Undent output.
	(nvptx_expand_call): Fix formatting.
	(nvptx_output_call_insn): Indent output.
	* config/nvptx/nvptx.h (ASM_OUTPUT_ALIGNED_DECL_COMMON,
	ASM__OUTPUT_ALIGNED_DECL_LOCAL): Print leading blank line.

From-SVN: r230705
2015-11-21 13:57:09 +00:00
Nathan Sidwell 0766660bf9 nvptx.h (SUPPORTS_WEAK): Define.
gcc/
	* config/nvptx/nvptx.h (SUPPORTS_WEAK): Define.
	* config/nvptx/nvptx.c (nvptx_write_function_decl): Support
	DECL_WEAK.
	(nvptx_declare_objec_name): Likewise.

	gcc/testsuite/
	* lib/target-supports.exp (check_weak_available): Add nvptx-*-*.
	* gcc.dg/attr-weakref-1.c: Skip for nvptx-*-*
	* gcc.dg/special/weak-2.c: Likewise.
	* gcc.dg/weak/weak-12.c: Likewise.
	* gcc.dg/weak/weak-15.c: Likewise.
	* gcc.dg/weak/weak-16.c: Likewise.
	* gcc.dg/weak/weak-1.c: Likewise.
	* gcc.dg/weak/weak-2.c: Likewise.
	* gcc.dg/weak/weak-4.c: Likewise.
	* gcc.dg/torture/pr53922.c: Likewise.
	* gcc.dg/torture/pr60092.c: Likewise.

From-SVN: r230628
2015-11-19 22:05:03 +00:00
Jeff Law 9251aec67d nvptx.h (HARD_REGNO_NREGS): Avoid warning on unused args.
* config/nvptx/nvptx.h (HARD_REGNO_NREGS): Avoid warning on unused
	args.
	(MOVE_MAX): Set to 8.

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

From-SVN: r229610
2015-10-30 22:30:20 +00:00
Nathan Sidwell d88cd9c424 nvptx.h (struct machine_function): Add axis_predicate.
* config/nvptx/nvptx.h (struct machine_function): Add
	axis_predicate.
	* config/nvptx/nvptx-protos.h (nvptx_expand_oacc_fork,
	nvptx_expand_oacc_join): Declare.
	* config/nvptx/nvptx.md (UNSPEC_NTID, UNSPEC_TID): Delete.
	(UNSPEC_DIM_SIZE, UNSPEC_SHARED_DATA, UNSPEC_BIT_CONV,
	UNSPEC_SHUFFLE, UNSPEC_BR_UNIFIED): New.
	(UNSPECV_BARSYNC, UNSPECV_DIM_POS, UNSPECV_FORK, UNSPECV_FORKED,
	UNSPECV_JOINING, UNSPECV_JOIN): New.
	(BITS, BITD): New mode iterators.
	(br_true_uni, br_false_uni): New.
	(*oacc_ntid_insn, oacc_ntid, *oacc_tid_insn, oacc_tid): Delete.
	(oacc_dim_size, oacc_dim_pos): New.
	(nvptx_fork, nvptx_forked, nvptx_joining, nvptx_join): New.
	(oacc_fork, oacc_join): New.
	(nvptx_shuffle<mode>, unpack<mode>si2, packsi<mode>2): New.
	(worker_load<mode>, worker_store<mode>): New.
	(nvptx_barsync): New.
	* config/nvptx/nvptx.c: Include gimple.h & dumpfile.h.
	(SHUFFLE_UP, SHUFFLE_DOWN, SHUFFLE_BFLY, SHUFFLE_IDX): Define.
	(worker_bcast_hwm, worker_bcast_align, worker_bcast_name,
	worker_bcast_sym): New.
	(nvptx_option_override): Initialize worker broadcast buffer.
	(nvptx_emit_forking, nvptx_emit_joining): New.
	(nvptx_init_axis_predicate): New.
	(nvptx_declare_function_name): Init axis predicates.
	(nvptx_expand_call): Add fork/join markers around routine call.
	(nvptx_expand_oacc_fork, nvptx_expand_oacc_join): New.
	(nvptx_gen_unpack, nvptx_gen_pack, nvptx_gen_shuffle): New.
	(nvptx_gen_vcast): New.
	(struct wcast_data_t): New.
	(enum propagate_mask): New.
	(nvptx_gen_wcast): New.
	(nvptx_print_operand): Add 'S' case.
	(struct parallel): New.
	(parallel::parallel, parallel::~parallel): New.
	(bb_insn_map_t, insn_bb_t, insn_bb_vec_t): New typedefs.
	(nvptx_split_blocks, nvptx_discover_pre, nvptx_dump_pars,
	nvptx_find_par, nvptx_discover_pars): New.
	(nvptx_propagate): New.
	(vprop_gen, nvptx_vpropagate): New.
	(wprop_gen, nvptx_wpropagate): New.
	(nvptx_wsync): New.
	(nvptx_single, nvptx_skip_par): New.
	(nvptx_process_pars, nvptx_neuter_pars): New.
	(ntptx_reorg): Split blocks, generate parallel structure, apply
	neutering.
	(nvptx_cannot_copy_insn_p): New.
	(nvptx_file_end): Emit worker broadcast decl.
	(nvptx_goacc_fork_join): New.
	(TARGET_CANNOT_COPY_INSN_P): Override.
	(TARGET_GOACC_FORK_JOIN): Override.

From-SVN: r229486
2015-10-28 14:24:39 +00:00
Nathan Sidwell 25662751d1 nvptx.h (struct machine_function): Add comment.
* config/nvptx/nvptx.h (struct machine_function): Add comment.
	* config/nvptx/nvptx.c (nvptx_declare_function_name): Functions
	may return pointer as well as in memory.
	(nvptx_output_return): Likewise.

From-SVN: r228618
2015-10-08 17:31:36 +00:00
Nathan Sidwell 18c05628a6 nvptx.md (allocate_stack): Emit sorry during expansion.
* config/nvptx/nvptx.md (allocate_stack): Emit sorry during
	expansion.
	* config/nvptx/nvptx.c (nvptx_declare_function_name): Look at
	crtl->stack_alignment_needed to determine alignment.
	(nvptx_get_drap_rtx): New.
	(TARGET_GET_DRAP_RTX): Override.
	* config/nvptx/nvptx.h (MAX_STACK_ALIGNMENT): Set.

From-SVN: r227084
2015-08-21 19:34:34 +00:00
Thomas Schwinge c9665100d6 Add DWARF2_LINENO_DEBUGGING_INFO, and use it for nvptx
gcc/
	* config/nvptx/nvptx.c (nvptx_option_override): Don't override
	debug options.
	* config/nvptx/nvptx.h (DWARF2_LINENO_DEBUGGING_INFO): Define.
	(DWARF2_DEBUGGING_INFO): Don't define.
	* debug.h (dwarf2_lineno_debug_hooks): Declare.
	* toplev.c (process_options): Add a case for it.
	* dwarf2out.c (dwarf2_lineno_debug_hooks): New variable.
	(dwarf2out_init): Skip most initializations if
	DWARF2_LINENO_DEBUGGING_INFO, but set cur_line_info_table in that
	case.
	* defaults.h (PREFERRED_DEBUGGING_TYPE): Also use DWARF2_DEBUG if
	DWARF2_LINENO_DEBUGGING_INFO.
	* opts.c (set_debug_level): Likewise.

Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>

From-SVN: r226890
2015-08-14 12:37:14 +02:00
Nathan Sidwell c56df3e924 nvptx.h (struct nvptx_pseudo_info): Delete.
* config/nvptx/nvptx.h (struct nvptx_pseudo_info): Delete.
	(machine_function): Remove pseudos field.

From-SVN: r226573
2015-08-04 13:14:14 +00:00
Trevor Saunders 62f9f30bfb always define STACK_GROWS_DOWNWARD
gcc/c-family/ChangeLog:

2015-05-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* c-cppbuiltin.c (c_cpp_builtins): Check the value of
	STACK_GROWS_DOWNWARD rather than if it is defined.

gcc/ChangeLog:

2015-05-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
	is defined.
	* config/**/*.h: Define STACK_GROWS_DOWNWARD to an integer.
	* defaults.h: Provide default for STACK_GROWS_DOWNWARD.
	* doc/tm.texi.in: Update references to STACK_GROWS_DOWNWARD.
	* doc/tm.texi: Regenerate.

From-SVN: r223513
2015-05-22 01:03:11 +00:00
Jason Merrill 1699809426 bitmap.c, [...]: Add space between string literal and macro name.
* bitmap.c, c/c-aux-info.c, cfg.c, cfghooks.c, cgraph.c,
	config/aarch64/aarch64.md config/alpha/vms.h, config/darwin.c,
	config/darwin.h, config/darwin9.h, config/elfos.h,
	config/i386/bsd.h, config/ia64/ia64.c, config/lm32/lm32.h,
	config/microblaze/microblaze.h, config/mips/mips.h,
	config/mmix/mmix.c, config/msp430/msp430.c, config/nios2/nios2.h,
	config/nvptx/nvptx.c, config/nvptx/nvptx.h, config/pa/pa.c,
	config/pa/pa.h, config/rs6000/rs6000.c, config/rs6000/sysv4.h,
	config/rs6000/xcoff.h, config/rx/rx.h, config/s390/s390.h,
	config/sparc/sol2.h, config/sparc/sparc.h, config/visium/visium.h,
	cppbuiltin.c, defaults.h, doc/invoke.texi, dwarf2cfi.c,
	dwarf2out.c, final.c, gcc.c, gcov-dump.c, gcov.c, ipa-cp.c,
	ipa-inline.c, ipa-polymorphic-call.c, ipa-profile.c, ipa-prop.c,
	ira-color.c, ira.c, loop-doloop.c, loop-iv.c, mcf.c,
	modulo-sched.c, predict.c, profile.c, stor-layout.c, toplev.c,
	tree-ssa-reassoc.c, value-prof.c, wide-int-print.cc: Add space
	between string literal and macro name.

From-SVN: r222960
2015-05-09 00:50:05 -04:00
Thomas Schwinge d94fae044d No libstdc++ for nvptx.
The C++ front end insists to link against libstdc++ -- which we don't build:

    $ < build-gcc/gcc/testsuite/g++/g++.log grep -o 'error opening [^[:cntrl:]]*' | sort | uniq -c
          2 error opening libasan.a
          2 error opening libssp.a
      12075 error opening libstdc++.a

Based on GCC trunk r220892:

                    === g++ Summary ===

    # of expected passes            [-63221-]{+68841+}
    # of unexpected failures        [-11751-]{+8764+}
    # of unexpected successes       6
    # of expected failures          [-246-]{+249+}
    # of unresolved testcases       [-5950-]{+3353+}
    # of unsupported tests          [-4160-]{+4143+}

	gcc/
	* config/nvptx/nvptx.h (LIBSTDCXX): Define to "gcc".

From-SVN: r221362
2015-03-11 22:42:50 +01:00
Thomas Schwinge 8747dd6e13 nvptx-none: Define empty GOMP_SELF_SPECS.
Otherwise, offloading with -fopenacc or -fopenmp active will run into:

    x86_64-unknown-linux-gnu-accel-nvptx-none-gcc: error: unrecognized command line option '-pthread'

	gcc/
	* config/nvptx/nvptx.h (GOMP_SELF_SPECS): Define macro.

From-SVN: r220780
2015-02-18 08:45:42 +01:00
Joseph Myers 40fecdd62f Always pass explicit location to fatal_error.
The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html>
adding an overload for fatal_error that passes an explicit location
broke gcc.pot regeneration because xgettext cannot handle function
overloads with the diagnostic string argument in different positions.

As the desired direction is for all diagnostics to have explicit
locations, this patch addresses the regression by removing the version
of fatal_error that does not pass a location, passing explicit
input_location everywhere (in the hope that those will incrementally
be changed to other locations, much as with the addition of a location
argument to pedwarn some time ago - a lot of cases aren't meaningfully
associated with a source file so UNKNOWN_LOCATION may be better).

Note that this patch does not attempt to fix any existing issues with
these diagnostics (such as wrongly starting with capital letters or
ending with '.' or '\n'); it just adds the input_location argument.

Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go
excluded).

gcc:
	* diagnostic.c (fatal_error (const char *, ...)): Remove function.
	* diagnostic-core.h (fatal_error (const char *, ...)): Remove
	prototype.
	* toplev.h (init_asm_output): Update comment on use of
	UNKNOWN_LOCATION with fatal_error.
	* cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c,
	config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h,
	config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c,
	config/i386/intelmic-mkoffload.c, config/nios2/nios2.c,
	config/nvptx/mkoffload.c, config/nvptx/nvptx.h,
	config/rs6000/host-darwin.c, config/rs6000/rs6000.c,
	config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c,
	ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c,
	lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c,
	lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c,
	tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of
	fatal_error changed to pass input_location as first argument.

gcc/c-family:
	* c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed
	to pass input_location as first argument.

gcc/cp:
	* class.c, except.c, parser.c, pt.c: All callers of fatal_error
	changed to pass input_location as first argument.

gcc/fortran:
	* f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All
	callers of fatal_error changed to pass input_location as first
	argument.

gcc/java:
	* class.c, expr.c, jcf-parse.c, jvspec.c: All callers of
	fatal_error changed to pass input_location as first argument.

gcc/lto:
	* lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error
	changed to pass input_location as first argument.

libcc1:
	* plugin.cc: All callers of fatal_error changed to pass
	input_location as first argument.

From-SVN: r220293
2015-01-30 16:15:00 +00:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Thomas Schwinge e0dd6391cd nvptx: Define valid ASM_OUTPUT_ALIGN.
gcc/
	* config/nvptx/nvptx.h (ASM_OUTPUT_ALIGN): Define as a C statment.

    gcc/doc/tm.texi:@defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
    gcc/doc/tm.texi-A C statement to output to the stdio stream @var{stream} an assembler
    gcc/doc/tm.texi-command to advance the location counter to a multiple of 2 to the
    gcc/doc/tm.texi-@var{power} bytes.  @var{power} will be a C expression of type @code{int}.
    gcc/doc/tm.texi-@end defmac

    gcc/config/nvptx/nvptx.h:#define ASM_OUTPUT_ALIGN(FILE, POWER)

"Empty" is not a C statement, and so in code such as:

    gcc/dwarf2out.c-              if (lsda_encoding == DW_EH_PE_aligned)
    gcc/dwarf2out.c:                ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
    gcc/dwarf2out.c-              dw2_asm_output_data (size_of_encoded_value (lsda_encoding), 0,
    gcc/dwarf2out.c-                                   "Language Specific Data Area (none)");

    gcc/varasm.c-      if (align > BITS_PER_UNIT)
    gcc/varasm.c:        ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
    gcc/varasm.c-      assemble_variable_contents (decl, name, dont_output_data);

    gcc/varasm.c-  if (align > 0)
    gcc/varasm.c:    ASM_OUTPUT_ALIGN (asm_out_file, align);
    gcc/varasm.c-
    gcc/varasm.c-  targetm.asm_out.internal_label (asm_out_file, "LTRAMP", 0);

    gcc/varasm.c-      if (align > BITS_PER_UNIT)
    gcc/varasm.c:        ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
    gcc/varasm.c-      assemble_constant_contents (exp, XSTR (symbol, 0), align);

..., GCC warns:

    [...]/source-gcc/gcc/dwarf2out.c: In function 'void output_fde(dw_fde_ref, bool, bool, char*, int, char*, bool, int)':
    [...]/source-gcc/gcc/dwarf2out.c:665:3: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
       ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
       ^

    [...]/source-gcc/gcc/varasm.c: In function 'void assemble_variable(tree, int, int, int)':
    [...]/source-gcc/gcc/varasm.c:2217:2: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
      ^
    [...]/source-gcc/gcc/varasm.c: In function 'rtx_def* assemble_trampoline_template()':
    [...]/source-gcc/gcc/varasm.c:2603:5: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
         ASM_OUTPUT_ALIGN (asm_out_file, align);
         ^
    [...]/source-gcc/gcc/varasm.c: In function 'void output_constant_def_contents(rtx)':
    [...]/source-gcc/gcc/varasm.c:3413:2: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
      ^

Also, "use" the values, to get rid of that one:

    [...]/source-gcc/gcc/final.c: In function 'rtx_insn* final_scan_insn(rtx_insn*, FILE*, int, int, int*)':
    [...]/source-gcc/gcc/final.c:2450:12: warning: variable 'log_align' set but not used [-Wunused-but-set-variable]
            int log_align;
                ^

From-SVN: r218689
2014-12-12 21:14:10 +01:00
Bernd Schmidt 738f25224b Add the nvptx port.
* configure.ac: Handle nvptx-*-*.
	* configure: Regenerate.

	gcc/
	* config/nvptx/nvptx.c: New file.
	* config/nvptx/nvptx.h: New file.
	* config/nvptx/nvptx-protos.h: New file.
	* config/nvptx/nvptx.md: New file.
	* config/nvptx/t-nvptx: New file.
	* config/nvptx/nvptx.opt: New file.
	* common/config/nvptx/nvptx-common.c: New file.
	* config.gcc: Handle nvptx-*-*.

	libgcc/
	* config.host: Handle nvptx-*-*.
	* shared-object.mk (as-flags-$o): Define.
	($(base)$(objext), $(base)_s$(objext)): Use it instead of
	-xassembler-with-cpp.
	* static-object.mk: Identical changes.
	* config/nvptx/t-nvptx: New file.
	* config/nvptx/crt0.s: New file.
	* config/nvptx/free.asm: New file.
	* config/nvptx/malloc.asm: New file.
	* config/nvptx/realloc.c: New file.

From-SVN: r217295
2014-11-10 16:12:42 +00:00