From patchwork Thu Jul 13 08:57:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107639 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1939115qge; Thu, 13 Jul 2017 01:59:08 -0700 (PDT) X-Received: by 10.84.247.15 with SMTP id n15mr9118312pll.296.1499936348365; Thu, 13 Jul 2017 01:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936348; cv=none; d=google.com; s=arc-20160816; b=yrQ25D/V6ZWeXrE6MPz0MAmTwU6ZnmljCckzYoDCnD8kGupiFvs//jsCj+arcfEzkH i1Z+MiYdjAPt0OTWZJ88JBlmXmSahvPrngc+W6eIQXj9UhXZvpBEdXi0wO6zK6DCyNXw e67ZuhfBcPtc4qH/EEMcQBkJhaLQ2Zud8OHa0fp30MsL0r3HvRb91k3BagEQV5G3T9uP kA/AK0KTroui88D+atVLUTGq5rhOdd3cpXfQcgFe75ArFQ6vWz/33OUQEScTvDWBfFJ9 VlqZ9IppjEXUSgp2MjjNBDycyr68EIMk6WJte78NNJw5IhcD9nlgiD8Ko7iZrsXbcBb6 e8Iw== 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=3YtU3Adj/l2E339VubgqZD3n+AK5l55ZjAbDjXzRwAs=; b=Nu0xFtUx87AFyS23RvGrHvMrIAUYOM58ibM6q+RRLI2sz67g2ZDUXumHBNoqKmEHng ey3an2yqla2ldZehucDQDZgmzhVV2u88brnrYbk3d7qypjdzToqUNwqwmnHy4CMmoBlz xkdfWcSiSPSrTbfsWUqfKOqzaeD+ksyljy+i+MQLKUINGMjOp9uzUL6yBYWV4cNu904n nW7y5TSNTzubtf6EfeXZ41+bB5Ps/PA0Vpdc37cdXhwi2Scr+HSy3yv1rQ8ezR4S3znd bLHJAybl20M0Pol9pE9pow6YvjWuDvIwadrPhd7ifafRaC2YuUA6wfCdB9Z5x49ol4Ni MxYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=MFFGu6DX; spf=pass (google.com: domain of gcc-patches-return-458044-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458044-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 p7si3972021pli.398.2017.07.13.01.59.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458044-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.b=MFFGu6DX; spf=pass (google.com: domain of gcc-patches-return-458044-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458044-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=yi7VIzdxBzXAw8zQ3gQR0P6nRda27 2AZtoTir/Yl+8UQTo+9LgmFnKl5MeZaT4iPuNZsSban9XoJJrLtnhiaqy/ZvToMx W2yjw0/+zOsj+PzUSytfheLWn/v5PoGik0Ks9nCIQT1crV04OdhuhycPAuRg1u2e NcRjetTe1qm0Nk= 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=pxzooOvz6Q2IHQn9FgGTxzO8Av8=; b=MFF Gu6DX6YMMuz6PoFaLT6RzG37zd8sbAd1PtLrX0dGULerUyAUxwRkiXpxbiBCD3ZD AVwl0t6XZbH9/OPPT2fRbyfrNTjf5Y7S2Tm3q7pAo706hPoJcTbVmXeqGogf6qUD JzMqz7OXJVQojTOXPNWttRD+DoK7uQ8RPH4cxvmg= Received: (qmail 72902 invoked by alias); 13 Jul 2017 08:57:30 -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 72209 invoked by uid 89); 13 Jul 2017 08:57:29 -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=Hx-languages-length:1949 X-HELO: mail-wm0-f46.google.com Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:57:27 +0000 Received: by mail-wm0-f46.google.com with SMTP id i127so18415801wma.0 for ; Thu, 13 Jul 2017 01:57:27 -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=3YtU3Adj/l2E339VubgqZD3n+AK5l55ZjAbDjXzRwAs=; b=CD8NXP6zzlbEMlH470OeZhC7z84n9zU1V3NXLZbw1grFbWNAUqg+GN/HaOngFWgspF kwEQfRAcic1+uyHWht6K+k3wtYTp92q5v8udofuOfiQGdXViUehj2p2mFZP9w1FVUqoY WUUA1RgeGYIbXZzJh6zTicK/CU1P4ZMsalWmzzftWCUiu62zdt5HqjFxshhrBrIM0O82 Iy+tB4O1L57Hakq2b7u/aNQNMZ6TTvBWTM+278i9ygjJEv4RqjOmbugFEOatTpLMMvhW Zpg340sVN5SiYkNuDrEuJHhPtp7oE+i8IIiZp7XtooWzZtePOHpYNbbvFaq7J3/QkhIZ LkSA== X-Gm-Message-State: AIVw113glYYhH3wWrJQ1eWqb7y6oDSVocovNgxV33F8Pwzid317exlUH MK0OXb3zPu5ezfEoW8uhiQ== X-Received: by 10.28.94.201 with SMTP id s192mr1154388wmb.100.1499936245374; Thu, 13 Jul 2017 01:57:25 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id b30sm5079725wra.42.2017.07.13.01.57.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:57:24 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [53/77] Pass a mode to const_scalar_mask_from_tree References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:57:23 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87shi0emto.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 The caller of const_scalar_mask_from_tree has proven that the mode is a MODE_INT, so this patch passes it down as a scalar_int_mode. It also expands the comment a little. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * expr.c (const_scalar_mask_from_tree): Add a mode argument. Expand commentary. (expand_expr_real_1): Update call accordingly. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-07-13 09:18:46.702152995 +0100 +++ gcc/expr.c 2017-07-13 09:18:47.609081780 +0100 @@ -99,7 +99,7 @@ static void emit_single_push_insn (machi static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx, profile_probability); static rtx const_vector_from_tree (tree); -static rtx const_scalar_mask_from_tree (tree); +static rtx const_scalar_mask_from_tree (scalar_int_mode, tree); static tree tree_expr_size (const_tree); static HOST_WIDE_INT int_expr_size (tree); @@ -9962,7 +9962,7 @@ expand_expr_real_1 (tree exp, rtx target if (is_int_mode (mode, &int_mode)) { if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (exp))) - return const_scalar_mask_from_tree (exp); + return const_scalar_mask_from_tree (int_mode, exp); else { tree type_for_mode @@ -11717,12 +11717,12 @@ const_vector_mask_from_tree (tree exp) return gen_rtx_CONST_VECTOR (mode, v); } -/* Return a CONST_INT rtx representing vector mask for - a VECTOR_CST of booleans. */ +/* EXP is a VECTOR_CST in which each element is either all-zeros or all-ones. + Return a constant scalar rtx of mode MODE in which bit X is set if element + X of EXP is nonzero. */ static rtx -const_scalar_mask_from_tree (tree exp) +const_scalar_mask_from_tree (scalar_int_mode mode, tree exp) { - machine_mode mode = TYPE_MODE (TREE_TYPE (exp)); wide_int res = wi::zero (GET_MODE_PRECISION (mode)); tree elt; unsigned i;