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: 116821 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4895171qgn; Mon, 23 Oct 2017 10:31:20 -0700 (PDT) X-Received: by 10.98.70.137 with SMTP id o9mr13679293pfi.19.1508779880079; Mon, 23 Oct 2017 10:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779880; cv=none; d=google.com; s=arc-20160816; b=O/tSlaUUQVv6KdXyRAgiE1JrF2HRco+tD4cQ5GrFBwDV0RIvTeGvamDBSdklsKpVnx UINGed/A0zu2CZ7rqq7pi3DoENaevm468SS+XC2C8bqnfPBNgKdzAdwJ/Zq5nD2tgNFD GHPtlbGmXAWXLpiBCvObEpucNlPgU7cthDxpm7P8lUPEF/tBNi86L32RH25FiEBgS0z4 T0ynR52QC67ruNBvRG928Ok/z7sFWfVtWa/6XwLthxAvKxki+8u6LSf6Q643qSbo5A1H oxyMdjGMak8W5VJh+/H5GKH4fHRhClAFyQcyCks+ndJ7z2H91L9NnR8dizEaQD0KvB/l XXuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=nvyGXVzwuCfBqWPcYdgt/HkrxxPGry6BdtxGpps0DC4=; b=Pyb5oKW7I+ZtcQ9DixeILOqA+Nwqq/hAOy61O6tzroarjD5W2OlkaAYF470ZPbf+Jp 9pdhtq0Z4AgLbhiQw9oRjBTsj6/CtbDFSBHxzH40pwmBG9QUbtjMI+MFCZJuvMxcqNq5 h/u33AWaHGM4ocHYaJEW4aYuwJ+0D73wTQqAKLSERf+xjGpOuVFJRs2BXCmA6VHnMVYA 6T3qbx9BjKC0ITlGtKTQh/tb/vtNeWVj8zPwPolONhqv1xKBuwlsgeqlKowR9XrjSqJ9 d/sFBHWyER9V2rm5dlFhv936zOGV0K8pE9LBDJYRVbJ+nKmaNyDwYlM1Baz8PJQPrB2y XYuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Rsv10zQ6; spf=pass (google.com: domain of gcc-patches-return-464852-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464852-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o61si4294277plb.647.2017.10.23.10.31.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:31:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464852-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Rsv10zQ6; spf=pass (google.com: domain of gcc-patches-return-464852-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464852-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=Z1VqNcMRLa2jfusyHHqDyv1upy4UT JYDRpwaGQJvY0CwU+K6q2joB7uPPqlIFKm7IIGWQ1CoJsxVHsEWUXUbGHJvnYE4T wrYCD1aEVgYiEYLpRJaJ7vuViv8CLlaPxDOybHOim6q8Vss5W5KpqZDURY2Og+SX dKIavWxW8ctU/c= 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=Rsv 10zQ6lIPUQVAfUkq217RANaiUYXyadiUhyNFTJ5fEapAL0L1vBkkyBa9juZNUH0b jVAIDYa8Wr3FmPPOoTC0hqE+DJS8q/iWcvhvKJDtlxLpx6wO6PLTbrxWe2DruQLO m0cqnLV5LxF1l4IcxfKYbp9+7V6NVcwdD6Hwl5yg= 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