From patchwork Mon Oct 23 17:27:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116812 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4892104qgn; Mon, 23 Oct 2017 10:28:04 -0700 (PDT) X-Received: by 10.98.68.213 with SMTP id m82mr13853710pfi.243.1508779684179; Mon, 23 Oct 2017 10:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779684; cv=none; d=google.com; s=arc-20160816; b=iZG3IEfAlVBGw4U9J0oh3yv3/OqduSmJj7bMr6Cc4wTARJIGpBEoFxx0VyeOnkY2FD VeMWlHXHijUtJf0o8pPBK/Qt577PZWys8iWCNbGhi/L6H63mCIHR+wVFuEIQ3JGUyi0Y vh+icnh9lCuYT0gI/rE7ScBIM38GsRin58CqVmGh22KydXwz2bDnj4sFJCUIstse1Voo Elkx/pykBZz2H9B3KxytFdd3hyvwxqfu6WVAljp4ITr+LjzvL7ZXEHAUpir/mPzXYY2C Wep5VY14AR786Z9ajeS3bqTieYbNSeQW6F3q33wqEGBzb+kgsPqL8Zc6QZzMtEtl6jZg EbEQ== 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=to4Lol1gpTGv5C6aSi0t7qB5EY77YQGWmH3gIPzn3Ls=; b=gyM+QXkHVfJvO84v0ZV6Jq2vo5oVhsw1v6n9KNgts1+S4KJKM3EmHaPNXku2CdFJla CSC4J3+i8an0+fgfDMrYUUckVLRhszAh82WOG3Ivh6t9tC9FSfZH7+biWH9/UwWtn67M MNfLyS8j9pKJITrnp0stLVTVYw+64dSIWX0mA7FtRcbIvLzxx8Y6UivEn5xfwEEF8Cnr VKJUcfawycO/AF/zy8tWOsmNhNj/Nm0ddBR/1aP0smsr9T1qynk9eUmJycgfaxYyJbgA bFtbDOQaWgpKoiQ60HPmKn3B2pxMy/Fxu/m5FQIUCcAVY0c/sXzYAbrm77q+PeuZfrPC wcGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LP4zzR+t; spf=pass (google.com: domain of gcc-patches-return-464843-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464843-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 185si5134853pgd.438.2017.10.23.10.28.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464843-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=LP4zzR+t; spf=pass (google.com: domain of gcc-patches-return-464843-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464843-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=B+dolk30di2HdxN3UAC6qzMTNeJBr 55VVvJwzWwRUb7YCrFuiZHjQIzSOsd8N3w+W+M9uYyCIBNl3rs3dn9VLXNadbE7h HQBcLy+zPR0goYv02QnTdFVt1XO4h67m7hU418OkF5mVrPcqp6PPr6dzaT9MBANt 8lnC871VVdt+R8= 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=FUP7c6x3pP6zOjQI7FwIuX+v2sE=; b=LP4 zzR+tPL7yG3yOtndg+8ZIuVC7YTuzIbtWpSEjxp/eLbRj5t4nMNPdC0jT6Kc68qN eBUHEGVH42grQZ1I3kPVtvuxNBwKO7ZatCZ8D+/0jhbjkqoVMq6o0ZEpxw3qysZ9 FRFiraiL7tMngVGCtAwIa79OzKoO85HzHqD7zjxw= Received: (qmail 33766 invoked by alias); 23 Oct 2017 17:27:51 -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 32005 invoked by uid 89); 23 Oct 2017 17:27:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f182.google.com Received: from mail-wr0-f182.google.com (HELO mail-wr0-f182.google.com) (209.85.128.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:27:46 +0000 Received: by mail-wr0-f182.google.com with SMTP id 15so4347281wrb.5 for ; Mon, 23 Oct 2017 10:27:45 -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=to4Lol1gpTGv5C6aSi0t7qB5EY77YQGWmH3gIPzn3Ls=; b=Dq+ZORb+1wUJr4IVau04/JWEc77t7AtHbk/K9Lmdtvk8ukW7iKDzmOSukJ3fubWEN5 zl5UiDSwVV+fB7Qz8ugCpejtnvwd+XNPTan3vS1VcgF2zOAdCC2gnfMe7wTsFvpXIlM5 9QqeTzVxXRlU4ZRQYnAGY+iA1/5mtVJmEI7lo9hmVj7lC4Gx1NysL1YYyIcghEhUApRU Rj/WKgZGK+xBd/amOQzQuKWsfP1nwdTIeAhTE4C2pvoBve9jS+J4IwDiqBlKe94/7DmV /AATgWrinHpLaz0Ug6AtcVR08c3NvHbFklzGqFi6WX02kCzu0HdzdA+K1ug/HOCyIWvJ 6bEQ== X-Gm-Message-State: AMCzsaWpo3IfYVqcLYACCg8EqaZjeBu4ZJNc2jpip02OFFKHVsksLuzG MSOGhpUbpHD4jtNvnMH+Lc/PlCq64LU= X-Google-Smtp-Source: ABhQp+TKqAsTSlfTXIBuDSpIBEzX+Xm3r9XG4Cc2vdC0nxaQUmxGh2bQ9BKprqdB3POKeeVONDy1IA== X-Received: by 10.223.167.7 with SMTP id c7mr12000647wrd.274.1508779663841; Mon, 23 Oct 2017 10:27:43 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id e17sm17210402wmf.46.2017.10.23.10.27.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:27:43 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [067/nnn] poly_int: get_mask_mode References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:27:42 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87tvypixkh.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes TARGET_GET_MASK_MODE take polynomial nunits and vector_size arguments. The gcc_assert in default_get_mask_mode is now handled by the exact_div call in vector_element_size. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * target.def (get_mask_mode): Take the number of units and length as poly_uint64s rather than unsigned ints. * targhooks.h (default_get_mask_mode): Update accordingly. * targhooks.c (default_get_mask_mode): Likewise. * config/i386/i386.c (ix86_get_mask_mode): Likewise. * doc/tm.texi: Regenerate. Index: gcc/target.def =================================================================== --- gcc/target.def 2017-10-23 17:19:01.411170305 +0100 +++ gcc/target.def 2017-10-23 17:22:30.980383601 +0100 @@ -1901,7 +1901,7 @@ The default implementation returns the m is @var{length} bytes long and that contains @var{nunits} elements,\n\ if such a mode exists.", opt_machine_mode, - (unsigned nunits, unsigned length), + (poly_uint64 nunits, poly_uint64 length), default_get_mask_mode) /* Target builtin that implements vector gather operation. */ Index: gcc/targhooks.h =================================================================== --- gcc/targhooks.h 2017-10-23 17:19:01.411170305 +0100 +++ gcc/targhooks.h 2017-10-23 17:22:30.980383601 +0100 @@ -107,7 +107,7 @@ default_builtin_support_vector_misalignm int, bool); extern machine_mode default_preferred_simd_mode (scalar_mode mode); extern unsigned int default_autovectorize_vector_sizes (void); -extern opt_machine_mode default_get_mask_mode (unsigned, unsigned); +extern opt_machine_mode default_get_mask_mode (poly_uint64, poly_uint64); extern void *default_init_cost (struct loop *); extern unsigned default_add_stmt_cost (void *, int, enum vect_cost_for_stmt, struct _stmt_vec_info *, int, Index: gcc/targhooks.c =================================================================== --- gcc/targhooks.c 2017-10-23 17:19:01.411170305 +0100 +++ gcc/targhooks.c 2017-10-23 17:22:30.980383601 +0100 @@ -1254,17 +1254,17 @@ default_autovectorize_vector_sizes (void return 0; } -/* By defaults a vector of integers is used as a mask. */ +/* By default a vector of integers is used as a mask. */ opt_machine_mode -default_get_mask_mode (unsigned nunits, unsigned vector_size) +default_get_mask_mode (poly_uint64 nunits, poly_uint64 vector_size) { - unsigned elem_size = vector_size / nunits; + unsigned int elem_size = vector_element_size (vector_size, nunits); scalar_int_mode elem_mode = smallest_int_mode_for_size (elem_size * BITS_PER_UNIT); machine_mode vector_mode; - gcc_assert (elem_size * nunits == vector_size); + gcc_assert (must_eq (elem_size * nunits, vector_size)); if (mode_for_vector (elem_mode, nunits).exists (&vector_mode) && VECTOR_MODE_P (vector_mode) Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c 2017-10-23 17:19:01.404170211 +0100 +++ gcc/config/i386/i386.c 2017-10-23 17:22:30.978383200 +0100 @@ -48121,7 +48121,7 @@ ix86_autovectorize_vector_sizes (void) /* Implemenation of targetm.vectorize.get_mask_mode. */ static opt_machine_mode -ix86_get_mask_mode (unsigned nunits, unsigned vector_size) +ix86_get_mask_mode (poly_uint64 nunits, poly_uint64 vector_size) { unsigned elem_size = vector_size / nunits; Index: gcc/doc/tm.texi =================================================================== --- gcc/doc/tm.texi 2017-10-23 17:19:01.408170265 +0100 +++ gcc/doc/tm.texi 2017-10-23 17:22:30.979383401 +0100 @@ -5846,7 +5846,7 @@ mode returned by @code{TARGET_VECTORIZE_ The default is zero which means to not iterate over other vector sizes. @end deftypefn -@deftypefn {Target Hook} opt_machine_mode TARGET_VECTORIZE_GET_MASK_MODE (unsigned @var{nunits}, unsigned @var{length}) +@deftypefn {Target Hook} opt_machine_mode TARGET_VECTORIZE_GET_MASK_MODE (poly_uint64 @var{nunits}, poly_uint64 @var{length}) A vector mask is a value that holds one boolean result for every element in a vector. This hook returns the machine mode that should be used to represent such a mask when the vector in question is @var{length} bytes