From patchwork Tue Jun 6 13:02:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 771853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3whsKb14H2z9rxm for ; Tue, 6 Jun 2017 23:02:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="r9qAh7n8"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=UxOMAyYdAmavJ4lbnFkuAx9hGGRuh02qv5C74pfS90tZ51L41A rAoaC1kx/+yrS3a83Vs77g6gzgGC1RQuwHbca4fZq1SOiUXHO4py80jzfb6zEUdO tAxdVIJv4p6GgIBoURhb+ddIepDWTkph955yxQh83JgxwJNVI2FG8w7qY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=ugAA0NHxEVntzua12w+519ZxAAQ=; b=r9qAh7n8TJc0/nGoFR1R PbvHZz27Bl8Yghye6yaRC7iKQeI68JvkcdomyhQeKK42j1XdAgRX84Yw5l5Q1+wm cC1x/k282CTq7/sxpYto4XDiX+P9H8R3O390P+k4a5IrysbYpcGg7jVkKQLNJxZB dwrR7uDtyFvMKop51otukFs= Received: (qmail 109043 invoked by alias); 6 Jun 2017 13:02:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 109030 invoked by uid 89); 6 Jun 2017 13:02:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jun 2017 13:02:12 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1dIE7i-0001L4-NX from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Tue, 06 Jun 2017 06:02:14 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 6 Jun 2017 14:02:10 +0100 To: GCC Patches From: Tom de Vries Subject: [nvptx, PATCH, 1/3] Add generic v2 vector mode support Message-ID: <2942f8f0-b883-b62e-9498-361863fa7348@mentor.com> Date: Tue, 6 Jun 2017 15:02:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Hi, this patch adds generic v2 vector mode support for nvptx. Tested in nvptx mainkernel mode and x86_64 accelerator mode. OK for trunk? Thanks, - Tom Add generic v2 vector mode support 2017-06-06 Tom de Vries * config/nvptx/nvptx.c (nvptx_print_operand): Handle v2 vector mode. --- gcc/config/nvptx/nvptx.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 2eb5570..beaad2c 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -2403,9 +2403,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; @@ -2506,7 +2512,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 @@ -2548,6 +2561,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); }