From patchwork Mon Oct 23 17:30:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116820 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4894966qgn; Mon, 23 Oct 2017 10:31:06 -0700 (PDT) X-Received: by 10.98.194.193 with SMTP id w62mr13454884pfk.67.1508779866696; Mon, 23 Oct 2017 10:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779866; cv=none; d=google.com; s=arc-20160816; b=XboAlmzsviMy5W1PB+rtWaegjbLNLbXvGM4snzB17FWpDgmqaZZsFC/c3FHXh/NyBp NI6hIGOzE1xLtkxUwV32d1g0HtER7w6ufcS1l3wSB615JeUIoBldQCnbL0k4Pje3F/XZ A+XtuAU3bY50717A5zc2T3GjKkXnl9OVMeOiyzGgDgf1BsCzKGBHvA2uB0mgWvhYTbU2 AqXkJa2Zf7Z5C8S10UcUd3JNedP/ltAXo142JGGBrFi5gk99lIQ5fOuzgjjZXTnqBT7V Vb1QeQlDujbPl8y6Xt47zA7wimG2/vUvZr9nQr3at154CUqbB87996brckGHIcTzmx+j BM9A== 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=vH3m0+laVSYVXHuy6vGw9QBFKElOiVhSTSffTXO1/d0=; b=sN31hiA3vECns6iNChrx2Q2RcLYSRafKTlLN0REsWLFYAaaztIuCrD95EgMUaJyAzZ 37NPSakAA3kHkQh1d9ZhA59ObovIiU2jA2Hk6Uc/uLAXyAXhnPl7q/IgqL/0bbmfDq3o 388w9cbEaNx/naGz/FXaWsWa1yD58PSclJ9TA35S9NA33nVQNSriuLgujerywkXM0U9a DvSIMA1uGp3YFRWnPVOr8SXmZakM4XYVpGPYKn80nELofiF070EjOJ5WDs6pn059crjo 9WadVPxBwcEdpBXm/t+p264Mz959boZPmZ3OacxaxSn0wZ+0im0zEvK7CUagKcM9xiOc Pidg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=N2rLV4AB; spf=pass (google.com: domain of gcc-patches-return-464851-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464851-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 r8si4263405plo.828.2017.10.23.10.31.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464851-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=N2rLV4AB; spf=pass (google.com: domain of gcc-patches-return-464851-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464851-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=hpFuVNE92oA09PF5Vo057hRQ2Ovtr VAHM1D0T7pXTIOEBTmNA1gGf98Y4Xe2/QkCDnKxI5Vtkm5T8L/onZIPMOpta/aJE pGI4P/+AoJPEgK1uSeT/XGOvgCB4GZ21bwCKaTWunyaTXH1magfNda9kPWnntHUk rQUMC+iYOinAbU= 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=ht5ZrpsYBHh+noJAbvHeaESp3F4=; b=N2r LV4ABi6oblGsdJ1DNYGZNDv+FMlLFbSEBgi1sKM9bNJ5E0aG226vsKPOoOf3HvwQ GXv4Ps9jk2N7Zz27xhnmDyLLpP68OUz5nt3UxrWgI1iDB5Yi24jH+KgHeW/DFC8G ryTP5P5DwKFf1W0vRPDOS4Z9hKDOLenWqRWyVUFE= Received: (qmail 116060 invoked by alias); 23 Oct 2017 17:30:45 -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 115122 invoked by uid 89); 23 Oct 2017 17:30:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f44.google.com Received: from mail-wm0-f44.google.com (HELO mail-wm0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:30:41 +0000 Received: by mail-wm0-f44.google.com with SMTP id q132so11281886wmd.2 for ; Mon, 23 Oct 2017 10:30:41 -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=vH3m0+laVSYVXHuy6vGw9QBFKElOiVhSTSffTXO1/d0=; b=cYQIA6Q+FXISxc/hEnUNO09wzlAiT9kjbKtVTOuvPcIiF2bg6ZK7mu7/ne5qcNH7eQ MXE3l3jxniG11ububhoKFak2eYy7BKc84y/pAiihaIrMAhyYQf5fJ/MlopSPrQUl1rnB teKlGrtbXHMyHPxRvzfFL8jFaRMicY/k2SKT3BLWvm8RcHYC5LNKfqZ3Z/SMF4w9+FA/ WQoGSGj6hAFgDFGw3xwWl33xfaHLc7lP/arIEjVrbK4U0Xi6feKb+eH8Lcc1kfYtxvI7 Nem3Pdh3NQHlaQ3w4SFVPgdm8Xm4ZUpcu2d7Ol9UvmlBf7/Emjc+K9YGqtM6c2/brafi 2hXw== X-Gm-Message-State: AMCzsaXX74PPwgT3IrNRW/Kd9mkf8FdOWvLGdz9yLUyrQjlT1KbonMol GacBr09ryNALuaZCu8XhDHN4a+Rudao= X-Google-Smtp-Source: ABhQp+SYEIPUYE1IWXTYqce5RXZysdRkVcU2tg6Wj2iE87SFIi/UIZ1jOh2HAhEtwTUIjYIZAMc+XQ== X-Received: by 10.28.63.134 with SMTP id m128mr6599812wma.137.1508779839441; Mon, 23 Oct 2017 10:30:39 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id w190sm648526wmf.40.2017.10.23.10.30.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:30:38 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [075/nnn] poly_int: vectorizable_simd_clone_call References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:30:38 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87vaj5hiv5.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes vectorizable_simd_clone_call cope with variable-length vectors. For now we don't support SIMD clones for variable-length vectors; this will be post GCC 8 material. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-stmts.c (simd_clone_subparts): New function. (vectorizable_simd_clone_call): Use it instead of TYPE_VECTOR_SUBPARTS. Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2017-10-23 17:22:39.943478586 +0100 +++ gcc/tree-vect-stmts.c 2017-10-23 17:22:40.906378704 +0100 @@ -3206,6 +3206,16 @@ vect_simd_lane_linear (tree op, struct l } } +/* Return the number of elements in vector type VECTYPE, which is associated + with a SIMD clone. At present these vectors always have a constant + length. */ + +static unsigned HOST_WIDE_INT +simd_clone_subparts (tree vectype) +{ + return TYPE_VECTOR_SUBPARTS (vectype); +} + /* Function vectorizable_simd_clone_call. Check if STMT performs a function call that can be vectorized @@ -3474,7 +3484,7 @@ vectorizable_simd_clone_call (gimple *st = get_vectype_for_scalar_type (TREE_TYPE (gimple_call_arg (stmt, i))); if (arginfo[i].vectype == NULL - || (TYPE_VECTOR_SUBPARTS (arginfo[i].vectype) + || (simd_clone_subparts (arginfo[i].vectype) > bestn->simdclone->simdlen)) return false; } @@ -3561,15 +3571,15 @@ vectorizable_simd_clone_call (gimple *st { case SIMD_CLONE_ARG_TYPE_VECTOR: atype = bestn->simdclone->args[i].vector_type; - o = nunits / TYPE_VECTOR_SUBPARTS (atype); + o = nunits / simd_clone_subparts (atype); for (m = j * o; m < (j + 1) * o; m++) { - if (TYPE_VECTOR_SUBPARTS (atype) - < TYPE_VECTOR_SUBPARTS (arginfo[i].vectype)) + if (simd_clone_subparts (atype) + < simd_clone_subparts (arginfo[i].vectype)) { unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (atype)); - k = (TYPE_VECTOR_SUBPARTS (arginfo[i].vectype) - / TYPE_VECTOR_SUBPARTS (atype)); + k = (simd_clone_subparts (arginfo[i].vectype) + / simd_clone_subparts (atype)); gcc_assert ((k & (k - 1)) == 0); if (m == 0) vec_oprnd0 @@ -3595,8 +3605,8 @@ vectorizable_simd_clone_call (gimple *st } else { - k = (TYPE_VECTOR_SUBPARTS (atype) - / TYPE_VECTOR_SUBPARTS (arginfo[i].vectype)); + k = (simd_clone_subparts (atype) + / simd_clone_subparts (arginfo[i].vectype)); gcc_assert ((k & (k - 1)) == 0); vec *ctor_elts; if (k != 1) @@ -3714,11 +3724,11 @@ vectorizable_simd_clone_call (gimple *st new_stmt = gimple_build_call_vec (fndecl, vargs); if (vec_dest) { - gcc_assert (ratype || TYPE_VECTOR_SUBPARTS (rtype) == nunits); + gcc_assert (ratype || simd_clone_subparts (rtype) == nunits); if (ratype) new_temp = create_tmp_var (ratype); - else if (TYPE_VECTOR_SUBPARTS (vectype) - == TYPE_VECTOR_SUBPARTS (rtype)) + else if (simd_clone_subparts (vectype) + == simd_clone_subparts (rtype)) new_temp = make_ssa_name (vec_dest, new_stmt); else new_temp = make_ssa_name (rtype, new_stmt); @@ -3728,11 +3738,11 @@ vectorizable_simd_clone_call (gimple *st if (vec_dest) { - if (TYPE_VECTOR_SUBPARTS (vectype) < nunits) + if (simd_clone_subparts (vectype) < nunits) { unsigned int k, l; unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (vectype)); - k = nunits / TYPE_VECTOR_SUBPARTS (vectype); + k = nunits / simd_clone_subparts (vectype); gcc_assert ((k & (k - 1)) == 0); for (l = 0; l < k; l++) { @@ -3767,16 +3777,16 @@ vectorizable_simd_clone_call (gimple *st } continue; } - else if (TYPE_VECTOR_SUBPARTS (vectype) > nunits) + else if (simd_clone_subparts (vectype) > nunits) { - unsigned int k = (TYPE_VECTOR_SUBPARTS (vectype) - / TYPE_VECTOR_SUBPARTS (rtype)); + unsigned int k = (simd_clone_subparts (vectype) + / simd_clone_subparts (rtype)); gcc_assert ((k & (k - 1)) == 0); if ((j & (k - 1)) == 0) vec_alloc (ret_ctor_elts, k); if (ratype) { - unsigned int m, o = nunits / TYPE_VECTOR_SUBPARTS (rtype); + unsigned int m, o = nunits / simd_clone_subparts (rtype); for (m = 0; m < o; m++) { tree tem = build4 (ARRAY_REF, rtype, new_temp,