From: Tom de Vries Date: Tue, 18 Jun 2019 09:19:41 +0000 (+0000) Subject: [nvptx] Use define_insn parametrization X-Git-Tag: upstream/12.2.0~23872 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b72af17038e9b2451f4ded5d7a96e31825c412c;p=platform%2Fupstream%2Fgcc.git [nvptx] Use define_insn parametrization Parametrize some define_insn to simplify code in define_expands generating those insns. Build and reg-tested on x86_64 with nvptx accelerator. 2019-06-18 Tom de Vries * config/nvptx/nvptx-protos.h (gen_set_softstack_insn): Remove. * config/nvptx/nvptx.c (gen_set_softstack_insn): Remove. * config/nvptx/nvptx.md (define_insn "set_softstack_"): Rename to ... (define_insn "@set_softstack_"): ... this. (define_insn "omp_simt_enter_"): Rename to ... (define_insn "@omp_simt_enter_"): ... this. (define_insn "omp_simt_exit_"): Rename to ... (define_insn "@omp_simt_exit_"): ... this. From-SVN: r272413 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15bc6d7..cdfaa5f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-06-18 Tom de Vries + + * config/nvptx/nvptx-protos.h (gen_set_softstack_insn): Remove. + * config/nvptx/nvptx.c (gen_set_softstack_insn): Remove. + * config/nvptx/nvptx.md (define_insn "set_softstack_"): Rename to ... + (define_insn "@set_softstack_"): ... this. + (define_insn "omp_simt_enter_"): Rename to ... + (define_insn "@omp_simt_enter_"): ... this. + (define_insn "omp_simt_exit_"): Rename to ... + (define_insn "@omp_simt_exit_"): ... this. + 2019-06-18 Richard Sandiford * tree-vect-loop-manip.c (vect_set_loop_masks_directly): Remove diff --git a/gcc/config/nvptx/nvptx-protos.h b/gcc/config/nvptx/nvptx-protos.h index 061897a..be09a15 100644 --- a/gcc/config/nvptx/nvptx-protos.h +++ b/gcc/config/nvptx/nvptx-protos.h @@ -57,6 +57,5 @@ extern const char *nvptx_output_set_softstack (unsigned); extern const char *nvptx_output_simt_enter (rtx, rtx, rtx); extern const char *nvptx_output_simt_exit (rtx); extern const char *nvptx_output_red_partition (rtx, rtx); -extern rtx gen_set_softstack_insn (rtx); #endif #endif diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index aa4a67f..c53a1ae 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -112,18 +112,6 @@ enum nvptx_data_area DATA_AREA_MAX }; -rtx -gen_set_softstack_insn (rtx op) -{ - gcc_assert (GET_MODE (op) == Pmode); - if (GET_MODE (op) == DImode) - return gen_set_softstack_di (op); - else if (GET_MODE (op) == SImode) - return gen_set_softstack_si (op); - else - gcc_unreachable (); -} - /* We record the data area in the target symbol flags. */ #define SYMBOL_DATA_AREA(SYM) \ (nvptx_data_area)((SYMBOL_REF_FLAGS (SYM) >> SYMBOL_FLAG_MACH_DEP_SHIFT) \ diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index 84c0ea4..58a18fe 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -1025,8 +1025,8 @@ "" { if (TARGET_SOFT_STACK) - emit_insn (gen_set_softstack_insn (gen_rtx_REG (Pmode, - SOFTSTACK_PREV_REGNUM))); + emit_insn (gen_set_softstack (Pmode, gen_rtx_REG (Pmode, + SOFTSTACK_PREV_REGNUM))); emit_jump_insn (gen_return ()); DONE; }) @@ -1059,7 +1059,7 @@ { emit_move_insn (stack_pointer_rtx, gen_rtx_MINUS (Pmode, stack_pointer_rtx, operands[1])); - emit_insn (gen_set_softstack_insn (stack_pointer_rtx)); + emit_insn (gen_set_softstack (Pmode, stack_pointer_rtx)); emit_move_insn (operands[0], virtual_stack_dynamic_rtx); DONE; } @@ -1071,7 +1071,7 @@ DONE; }) -(define_insn "set_softstack_" +(define_insn "@set_softstack_" [(unspec [(match_operand:P 0 "nvptx_register_operand" "R")] UNSPEC_SET_SOFTSTACK)] "TARGET_SOFT_STACK" @@ -1087,7 +1087,7 @@ if (TARGET_SOFT_STACK) { emit_move_insn (operands[0], operands[1]); - emit_insn (gen_set_softstack_insn (operands[0])); + emit_insn (gen_set_softstack (Pmode, operands[0])); } DONE; }) @@ -1237,7 +1237,7 @@ ;; Patterns for OpenMP SIMD-via-SIMT lowering -(define_insn "omp_simt_enter_" +(define_insn "@omp_simt_enter_" [(set (match_operand:P 0 "nvptx_register_operand" "=R") (unspec_volatile:P [(match_operand:P 1 "nvptx_nonmemory_operand" "Ri") (match_operand:P 2 "nvptx_nonmemory_operand" "Ri")] @@ -1261,13 +1261,7 @@ cfun->machine->simt_stack_align = MAX (UINTVAL (operands[2]), cfun->machine->simt_stack_align); cfun->machine->has_simtreg = true; - gcc_assert (GET_MODE (operands[0]) == Pmode); - if (GET_MODE (operands[0]) == DImode) - emit_insn (gen_omp_simt_enter_di (operands[0], operands[1], operands[2])); - else if (GET_MODE (operands[0]) == SImode) - emit_insn (gen_omp_simt_enter_si (operands[0], operands[1], operands[2])); - else - gcc_unreachable (); + emit_insn (gen_omp_simt_enter (Pmode, operands[0], operands[1], operands[2])); DONE; }) @@ -1275,17 +1269,11 @@ [(match_operand 0 "nvptx_register_operand" "R")] "" { - gcc_assert (GET_MODE (operands[0]) == Pmode); - if (GET_MODE (operands[0]) == DImode) - emit_insn (gen_omp_simt_exit_di (operands[0])); - else if (GET_MODE (operands[0]) == SImode) - emit_insn (gen_omp_simt_exit_si (operands[0])); - else - gcc_unreachable (); + emit_insn (gen_omp_simt_exit (Pmode, operands[0])); DONE; }) -(define_insn "omp_simt_exit_" +(define_insn "@omp_simt_exit_" [(unspec_volatile [(match_operand:P 0 "nvptx_register_operand" "R")] UNSPECV_SIMT_EXIT)] ""