From: Tom de Vries Date: Wed, 19 Jul 2017 13:05:09 +0000 (+0000) Subject: Add generic v2 vector mode support for nvptx X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1310ff035d548056ad4a0def038a6c5dedd98b47;p=gcc.git Add generic v2 vector mode support for nvptx 2017-07-19 Tom de Vries * config/nvptx/nvptx.c (nvptx_print_operand): Handle v2 vector mode. From-SVN: r250339 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6e7f9d01b1..c09e0f10e75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-07-19 Tom de Vries + + * config/nvptx/nvptx.c (nvptx_print_operand): Handle v2 vector mode. + 2017-07-19 Jakub Jelinek PR tree-optimization/81346 diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 78ce1213497..ebfa1e7b00e 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -2405,9 +2405,15 @@ nvptx_print_operand (FILE *file, rtx x, int code) case 'u': if (x_code == SUBREG) { - mode = GET_MODE (SUBREG_REG (x)); - if (split_mode_p (mode)) - mode = maybe_split_mode (mode); + machine_mode inner_mode = GET_MODE (SUBREG_REG (x)); + if (VECTOR_MODE_P (inner_mode) + && (GET_MODE_SIZE (mode) + <= GET_MODE_SIZE (GET_MODE_INNER (inner_mode)))) + mode = GET_MODE_INNER (inner_mode); + else if (split_mode_p (inner_mode)) + mode = maybe_split_mode (inner_mode); + else + mode = inner_mode; } fprintf (file, "%s", nvptx_ptx_type_from_mode (mode, code == 't')); break; @@ -2508,7 +2514,14 @@ nvptx_print_operand (FILE *file, rtx x, int code) machine_mode inner_mode = GET_MODE (inner_x); machine_mode split = maybe_split_mode (inner_mode); - if (split_mode_p (inner_mode) + if (VECTOR_MODE_P (inner_mode) + && (GET_MODE_SIZE (mode) + <= GET_MODE_SIZE (GET_MODE_INNER (inner_mode)))) + { + output_reg (file, REGNO (inner_x), VOIDmode); + fprintf (file, ".%s", SUBREG_BYTE (x) == 0 ? "x" : "y"); + } + else if (split_mode_p (inner_mode) && (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (mode))) output_reg (file, REGNO (inner_x), split); else @@ -2550,6 +2563,22 @@ nvptx_print_operand (FILE *file, rtx x, int code) fprintf (file, "0d%08lx%08lx", vals[1], vals[0]); break; + case CONST_VECTOR: + { + unsigned n = CONST_VECTOR_NUNITS (x); + fprintf (file, "{ "); + for (unsigned i = 0; i < n; ++i) + { + if (i != 0) + fprintf (file, ", "); + + rtx elem = CONST_VECTOR_ELT (x, i); + output_addr_const (file, elem); + } + fprintf (file, " }"); + } + break; + default: output_addr_const (file, x); }