From patchwork Tue Jul 14 08:25:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 494929 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 438101402AE for ; Tue, 14 Jul 2015 18:26:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ACHKSIAf; 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=M88OyBdCs59HPeJP G9Y17G4xoZssas6iTwn6mVUGMDpUL4PNuRNamPsYFHPCmVLZGrSfb4uP0WEYutoX oiiGG62l8yDb1phdYR4IEPuGUmWIFSG2UUwK0ZmBQCiR2SE+cWL7YH3FGssgLGCo Vu+PQKhi2FclMVoaS+m+anahhwM= 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=jbNKBp/MFPuJFNumeFpYFN g/GPY=; b=ACHKSIAfJSF+IZ/EvOWm790f3qfUAnP8pHrL3AELIG/tZ7QSFwICg1 yiT/FpVuggT8imiCWP8YwTfTrsbng3fQjKguHBAZ8RyxRnSzcE+ZzRc+anUsyCEt TQaZ/YSIFpyXychFurFtyQ7OpJ4Vr4AIK/MnyjCcmG7xDZtil+5zo= Received: (qmail 42901 invoked by alias); 14 Jul 2015 08:26:01 -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 42888 invoked by uid 89); 14 Jul 2015 08:26:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 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, 14 Jul 2015 08:25:58 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZEvXG-00000b-7q from Thomas_Schwinge@mentor.com ; Tue, 14 Jul 2015 01:25:54 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Tue, 14 Jul 2015 09:25:52 +0100 From: Thomas Schwinge To: Nathan Sidwell CC: GCC Patches , Jakub Jelinek Subject: Re: [gomp] Move openacc vector& worker single handling to RTL In-Reply-To: <559F10F2.9050102@acm.org> References: <5597120D.2080308@acm.org> <20150703231159.GP10247@tucnak.redhat.com> <559844EF.6010208@acm.org> <559AD85B.2050102@acm.org> <20150707095408.GD10247@tucnak.redhat.com> <559BDE68.9010302@acm.org> <20150707142229.GG10247@tucnak.redhat.com> <559D381C.7020804@acm.org> <20150708145822.GB10247@tucnak.redhat.com> <559D9A29.2020409@acm.org> <559F10F2.9050102@acm.org> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Tue, 14 Jul 2015 10:25:31 +0200 Message-ID: <87mvyzywlg.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! It's me, again. ;-) On Thu, 09 Jul 2015 20:25:22 -0400, Nathan Sidwell wrote: > This is the patch I committed. [...] > --- config/nvptx/nvptx.c (revision 225323) > +++ config/nvptx/nvptx.c (working copy) > +/* Direction of the spill/fill and looping setup/teardown indicator. */ > + > +enum propagate_mask > + { > + PM_read = 1 << 0, > + PM_write = 1 << 1, > + PM_loop_begin = 1 << 2, > + PM_loop_end = 1 << 3, > + > + PM_read_write = PM_read | PM_write > + }; > + > +/* Generate instruction(s) to spill or fill register REG to/from the > + worker broadcast array. PM indicates what is to be done, REP > + how many loop iterations will be executed (0 for not a loop). */ > + > +static rtx > +nvptx_gen_wcast (rtx reg, propagate_mask pm, unsigned rep, wcast_data_t *data) > +{ > + rtx res; > + machine_mode mode = GET_MODE (reg); > + > + switch (mode) > + { > + case BImode: > + { > + rtx tmp = gen_reg_rtx (SImode); > + > + start_sequence (); > + if (pm & PM_read) > + emit_insn (gen_sel_truesi (tmp, reg, GEN_INT (1), const0_rtx)); > + emit_insn (nvptx_gen_wcast (tmp, pm, rep, data)); > + if (pm & PM_write) > + emit_insn (gen_rtx_SET (BImode, reg, > + gen_rtx_NE (BImode, tmp, const0_rtx))); > + res = get_insns (); > + end_sequence (); > + } > + break; > + > + default: > + { > + rtx addr = data->ptr; > + > + if (!addr) > + { > + unsigned align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; > + > + if (align > worker_bcast_align) > + worker_bcast_align = align; > + data->offset = (data->offset + align - 1) & ~(align - 1); > + addr = data->base; > + if (data->offset) > + addr = gen_rtx_PLUS (Pmode, addr, GEN_INT (data->offset)); > + } > + > + addr = gen_rtx_MEM (mode, addr); > + addr = gen_rtx_UNSPEC (mode, gen_rtvec (1, addr), UNSPEC_SHARED_DATA); > + if (pm & PM_read) > + res = gen_rtx_SET (mode, addr, reg); > + if (pm & PM_write) > + res = gen_rtx_SET (mode, reg, addr); > + > + if (data->ptr) > + { > + /* We're using a ptr, increment it. */ > + start_sequence (); > + > + emit_insn (res); > + emit_insn (gen_adddi3 (data->ptr, data->ptr, > + GEN_INT (GET_MODE_SIZE (GET_MODE (res))))); > + res = get_insns (); > + end_sequence (); > + } > + else > + rep = 1; > + data->offset += rep * GET_MODE_SIZE (GET_MODE (reg)); > + } > + break; > + } > + return res; > +} OK to commit the following, or should other PM_* combinations be handled here, such as (PM_read | PM_write)? (But I don't think so.) commit a1909fecb28267aa76df538ad9e01e4d228f5f9a Author: Thomas Schwinge Date: Tue Jul 14 09:59:48 2015 +0200 nvptx: Avoid -Wuninitialized diagnostic [...]/source-gcc/gcc/config/nvptx/nvptx.c: In function 'rtx_def* nvptx_gen_wcast(rtx, propagate_mask, unsigned int, wcast_data_t*)': [...]/source-gcc/gcc/config/nvptx/nvptx.c:1258:8: warning: 'res' may be used uninitialized in this function [-Wuninitialized] gcc/ * config/nvptx/nvptx.c (nvptx_gen_wcast): Mark unreachable code path. --- gcc/config/nvptx/nvptx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Grüße, Thomas diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c index 0e1e764..dfe5d34 100644 --- gcc/config/nvptx/nvptx.c +++ gcc/config/nvptx/nvptx.c @@ -1253,10 +1253,12 @@ nvptx_gen_wcast (rtx reg, propagate_mask pm, unsigned rep, wcast_data_t *data) addr = gen_rtx_MEM (mode, addr); addr = gen_rtx_UNSPEC (mode, gen_rtvec (1, addr), UNSPEC_SHARED_DATA); - if (pm & PM_read) + if (pm == PM_read) res = gen_rtx_SET (addr, reg); - if (pm & PM_write) + else if (pm == PM_write) res = gen_rtx_SET (reg, addr); + else + gcc_unreachable (); if (data->ptr) {