From patchwork Wed Oct 12 17:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1689259 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=N06XLf48; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mnfp35yLpz20cX for ; Thu, 13 Oct 2022 04:31:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B3AC63858D38 for ; Wed, 12 Oct 2022 17:31:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3AC63858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665595878; bh=Q7QlmZMsXM5GC2lN9HJZDvmTXCeheAmP2aS24nN/EmA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=N06XLf48zpAtNeY553PVsS+OKAhHpmXdhuXy6wu8CJT9DESi1vFlm6oIFKCFOUXSm yaL57ahwt+Uf6gmAW05ota7dixMEqaL3OEfUuhqbPfEDiVXZwDHHeA5mxsghDO3g14 7kzy43piPYEsxZCiD2PDlTIG13m0reSc6lJCwgMw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id D7DF23858D38 for ; Wed, 12 Oct 2022 17:30:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D7DF23858D38 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B51DD165C; Wed, 12 Oct 2022 10:30:50 -0700 (PDT) Received: from [10.57.1.129] (unknown [10.57.1.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 91CE43F766; Wed, 12 Oct 2022 10:30:43 -0700 (PDT) Message-ID: <3fd8eef5-213d-23bd-4bcd-de7157d2de18@arm.com> Date: Wed, 12 Oct 2022 18:29:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Subject: vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226] X-Spam-Status: No, score=-19.1 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Cc: Richard Sandiford , Richard Biener Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, The original patch supported matching the vect_recog_bitfield_ref_pattern for BITFIELD_REF's where the first operand didn't have a INTEGRAL_TYPE_P type. That means it would also match vectors, leading to regressions in targets that supported vectorization of those. Bootstrappend and regression tested on aarch64-none-linux-gnu and x86_64-pc-linux-gnu. gcc/ChangeLog:         PR tree-optimization/107226         * tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Reject         BITFIELD_REF's with non integral typed first operands. diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 0cc315d312667c05a27df4cdf435f0d0e6fd4a52..6afd57a50c4bcb5aec7ccca6e5dc069caa4a5a30 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -1913,6 +1913,7 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info, return NULL; if (!INTEGRAL_TYPE_P (TREE_TYPE (bf_ref)) + || !INTEGRAL_TYPE_P (TREE_TYPE (container)) || TYPE_MODE (TREE_TYPE (container)) == E_BLKmode) return NULL; @@ -1921,25 +1922,7 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info, tree ret = gimple_assign_lhs (first_stmt); tree ret_type = TREE_TYPE (ret); bool shift_first = true; - tree vectype; - - /* If the first operand of the BIT_FIELD_REF is not an INTEGER type, convert - it to one of the same width so we can perform the necessary masking and - shifting. */ - if (!INTEGRAL_TYPE_P (TREE_TYPE (container))) - { - unsigned HOST_WIDE_INT container_size = - tree_to_uhwi (TYPE_SIZE (TREE_TYPE (container))); - tree int_type = build_nonstandard_integer_type (container_size, true); - pattern_stmt - = gimple_build_assign (vect_recog_temp_ssa_var (int_type), - VIEW_CONVERT_EXPR, container); - vectype = get_vectype_for_scalar_type (vinfo, int_type); - container = gimple_assign_lhs (pattern_stmt); - append_pattern_def_seq (vinfo, stmt_info, pattern_stmt, vectype); - } - else - vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (container)); + tree vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (container)); /* We move the conversion earlier if the loaded type is smaller than the return type to enable the use of widening loads. */