From patchwork Mon Oct 23 17:30:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 829501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464852-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="llBEf7Yq"; dkim-atps=neutral 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 3yLNjb1Yg0z9t6C for ; Tue, 24 Oct 2017 04:31:15 +1100 (AEDT) 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=I1GvsT9fwGwkHksxpI/tnYp2yQGSF fuf2BoTdfT1LO5dYJdvI59+1iN667PBfl3rvTPdLKe+IhAyGGZCt4fzWHcWgyTlf RAFP6QOdAQFBaRb/mniXSpiUPFXEAfZuUCxlGPZMwSs7YYh0J8tEe/V/FC5HNVT0 zuxrcGuTlFLpIw= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=g1vfxGduUzm6auNqu0qF8e6y+Bg=; b=llB Ef7Yq9rVJDJtioHW9NSEDoDRm3rLbXfzxZyiueCR0X99ham8hKS6rhSbbSzJ7YQJ Ecg/hp3TIbj3Ti1MDJKGn8ojRgvf6ktw2mxHp1yfD77wtnkv5ZIbJ6Uiz/AEUjVD zjEbctjZzeYFc5K6UhhLAZufZzf0+zwH+ctZ+8eE= Received: (qmail 123381 invoked by alias); 23 Oct 2017 17:31:05 -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 123206 invoked by uid 89); 23 Oct 2017 17:31:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:31:02 +0000 Received: by mail-wm0-f49.google.com with SMTP id m72so9361006wmc.0 for ; Mon, 23 Oct 2017 10:31:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=nvyGXVzwuCfBqWPcYdgt/HkrxxPGry6BdtxGpps0DC4=; b=bnynTChrHCR5lt/Qm5J4sB+YR0FBKG75u8WoZIl8PvGW5zEClx2lmv0nx2s4nM2+V7 8fh/YzspKq/fkNMhg/P3s00jbIusFy9dEUfwQ3+72lVdiD3ZOhH1/D5BwRX06jonRdVr MccLH2MUz7iDjM8C9SMOf6vOpBRRF7VC1x2rcOhh8kHZo2tyYKc48OQU/9l3nUyRbH5C Hv+ciYg3MDsMBMmRDD4FT28hJ/c0LQdx5+C6SetL+T5azkObivp8difwopK4DtDBR69Y n3Hn6jzKyFJRLF/CC7231qaAz3RHhBeh8nku64EzbZ/sN+1OjrikC5z08YDF4B211aRe hI1Q== X-Gm-Message-State: AMCzsaVB92EBLlWj3vKOl/9cgw/VmOe1w6z0lHHar+kODZKFs85Attz1 sKN4vm91HD1wGh/bpP5Cy8yz7OWuiLw= X-Google-Smtp-Source: ABhQp+QM/sNOoL/KLsoZpLa/NB22UVMEFNBROORnHrWEfV+630PIE65AoXvGbn7955MO8ZEYmYhF+A== X-Received: by 10.28.215.4 with SMTP id o4mr5926421wmg.0.1508779860502; Mon, 23 Oct 2017 10:31:00 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id 69sm6269012wmp.11.2017.10.23.10.30.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:30:59 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [076/nnn] poly_int: vectorizable_conversion References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:30:59 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87r2tthiuk.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes vectorizable_conversion cope with variable-length vectors. We already require the number of elements in one vector to be a multiple of the number of elements in the other vector, so the patch uses that to choose between widening and narrowing. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-stmts.c (vectorizable_conversion): Treat the number of units as polynomial. Choose between WIDE and NARROW based on multiple_p. Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2017-10-23 17:22:40.906378704 +0100 +++ gcc/tree-vect-stmts.c 2017-10-23 17:22:41.879277786 +0100 @@ -4102,8 +4102,8 @@ vectorizable_conversion (gimple *stmt, g int ndts = 2; gimple *new_stmt = NULL; stmt_vec_info prev_stmt_info; - int nunits_in; - int nunits_out; + poly_uint64 nunits_in; + poly_uint64 nunits_out; tree vectype_out, vectype_in; int ncopies, i, j; tree lhs_type, rhs_type; @@ -4238,12 +4238,15 @@ vectorizable_conversion (gimple *stmt, g nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in); nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out); - if (nunits_in < nunits_out) - modifier = NARROW; - else if (nunits_out == nunits_in) + if (must_eq (nunits_out, nunits_in)) modifier = NONE; + else if (multiple_p (nunits_out, nunits_in)) + modifier = NARROW; else - modifier = WIDEN; + { + gcc_checking_assert (multiple_p (nunits_in, nunits_out)); + modifier = WIDEN; + } /* Multiple types in SLP are handled by creating the appropriate number of vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in