From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1971) id 7E8473857BB5; Thu, 13 Oct 2022 09:35:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E8473857BB5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665653731; bh=7Q4vFFNz3T/f9xIwP1SB/nTZMtlz8/juCRG2o05m2lk=; h=From:To:Subject:Date:From; b=d9b6rfRhPfwS+uIsiUYbtb/rd8evuGECuIXkGlavU8slzfJTgQWnpqYCu7goklv1D qGb8AvIK+e3XxtOtoO8jTe5gviiLNChOcCD2EN7o3uF5irNpSzOjIBniyqpce4/ASy HbOukugQlcKoRAAzaoExG/sVkcJcKo+5WcyhwYn0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andre Simoes Dias Vieira To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3268] vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226] X-Act-Checkin: gcc X-Git-Author: Andre Vieira X-Git-Refname: refs/heads/master X-Git-Oldrev: 7c059880fca175589efc8e06ef458020a005658d X-Git-Newrev: 7f9a7465c863e482708d2a00f5f7ff91ae3a7e0b Message-Id: <20221013093531.7E8473857BB5@sourceware.org> Date: Thu, 13 Oct 2022 09:35:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:7f9a7465c863e482708d2a00f5f7ff91ae3a7e0b commit r13-3268-g7f9a7465c863e482708d2a00f5f7ff91ae3a7e0b Author: Andre Vieira Date: Thu Oct 13 10:34:27 2022 +0100 vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226] 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. 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: --- gcc/tree-vect-patterns.cc | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 0cc315d3126..6afd57a50c4 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. */