From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47795 invoked by alias); 9 Dec 2016 13:31:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 47723 invoked by uid 89); 9 Dec 2016 13:31:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 13:31:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EBCAB707; Fri, 9 Dec 2016 05:30:58 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 988203F477 for ; Fri, 9 Dec 2016 05:30:58 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [53/67] Pass a mode to const_scalar_mask_from_tree References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:31:00 -0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <874m2dgrfz.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-12/txt/msg00829.txt.bz2 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. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * expr.c (const_scalar_mask_from_tree): Add a mode argument. Expand commentary. (expand_expr_real_1): Update call accordingly. diff --git a/gcc/expr.c b/gcc/expr.c index ec88d35..465326c 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -97,7 +97,7 @@ static void emit_single_push_insn (machine_mode, rtx, tree); #endif static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx, int); 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); @@ -9893,7 +9893,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, 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 @@ -11646,12 +11646,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;