From patchwork Tue Oct 29 10:17:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 99758 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D1703858433 for ; Tue, 29 Oct 2024 10:18:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 8E02D3858C60 for ; Tue, 29 Oct 2024 10:17:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E02D3858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8E02D3858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730197085; cv=none; b=CjtMx8CMFUQ0ne7b7nAoMdohoaRySccz+EMAs1YZFEOoda3NZ3/eTJkOeWx1zMiFqmgaTlin6rfYYhVaTHMdcQvT1iEOrH8uXmW6RJgMwrJ0CI5KEvEdwsTjCNsM6dJBz2iFgidFF3XH+JLPOm+D6cYFH6agdmmCMjJUdGHNXLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730197085; c=relaxed/simple; bh=A3xIL3qMJZpcZ+WVI42nsl9kOwFgmpa50sK1XjFxxiE=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version:Message-Id; b=DG10OhVWvvvW7G1i56Y0FmHC+G7T61XLT6wf3P7GXubgjwNns/n6sM6yj7BYyjVJ9xkyQh7fpjMFpPiO/9jlj662l/bR1V0u2/gmJGY2MePG7ovC4k76cTp2d6QfnmeBEcPPZMg+NK4GifBJUJ9mHVLQDGhEUHeyPWH1b/2ECT8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 923CD1F769 for ; Tue, 29 Oct 2024 10:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730197077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=Ia9GMXUYdkylt1kkp0IUpfxuNXb/5+3FwDW6tIF/enY=; b=X6tVzNPeGTmkwiUUaXcr5TkU+7RdpBKblAeDis17O1rfn2SFqZcoLy8cbP7RUtapO9CkVd wkLXcFJr5s4+f0gnzFs1Hg4KARFZ0wF+4ZeEHYRtQ+1THSymDaQV/UDvg3PMklvve+6hrh 7OTQzV/86suJ5DSa8ZXtVIYg9xOIBkg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730197077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=Ia9GMXUYdkylt1kkp0IUpfxuNXb/5+3FwDW6tIF/enY=; b=JAgt9fswt/B7BaqL6GYQUWNTaJn28G3coQUF9PBQrXhxDurdeJC9us55nLz7IhXah8hDVR LVxg6jeIAbZ/7XCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730197077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=Ia9GMXUYdkylt1kkp0IUpfxuNXb/5+3FwDW6tIF/enY=; b=X6tVzNPeGTmkwiUUaXcr5TkU+7RdpBKblAeDis17O1rfn2SFqZcoLy8cbP7RUtapO9CkVd wkLXcFJr5s4+f0gnzFs1Hg4KARFZ0wF+4ZeEHYRtQ+1THSymDaQV/UDvg3PMklvve+6hrh 7OTQzV/86suJ5DSa8ZXtVIYg9xOIBkg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730197077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=Ia9GMXUYdkylt1kkp0IUpfxuNXb/5+3FwDW6tIF/enY=; b=JAgt9fswt/B7BaqL6GYQUWNTaJn28G3coQUF9PBQrXhxDurdeJC9us55nLz7IhXah8hDVR LVxg6jeIAbZ/7XCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7714F139A2 for ; Tue, 29 Oct 2024 10:17:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 3oxzG1W2IGfNLwAAD6G6ig (envelope-from ) for ; Tue, 29 Oct 2024 10:17:57 +0000 Date: Tue, 29 Oct 2024 11:17:42 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] Remove dead code in vectorizer pattern recog MIME-Version: 1.0 Message-Id: <20241029101757.7714F139A2@imap1.dmz-prg2.suse.org> X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; PREVIOUSLY_DELIVERED(0.00)[gcc-patches@gcc.gnu.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:mid] X-Spam-Score: -4.30 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org The following removes the code path in vect_recog_mask_conversion_pattern dealing with comparisons in COND_EXPRs. That can no longer happen. * tree-vect-patterns.cc (vect_recog_mask_conversion_pattern): Remove COMPARISON_CLASS_P rhs1 of COND_EXPR case and assert it doesn't happen. --- gcc/tree-vect-patterns.cc | 99 +-------------------------------------- 1 file changed, 2 insertions(+), 97 deletions(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index a6d246f570c..46f439fb8a3 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -6240,8 +6240,6 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo, tree lhs = NULL_TREE, rhs1, rhs2, tmp, rhs1_type, rhs2_type; tree vectype1, vectype2; stmt_vec_info pattern_stmt_info; - tree rhs1_op0 = NULL_TREE, rhs1_op1 = NULL_TREE; - tree rhs1_op0_type = NULL_TREE, rhs1_op1_type = NULL_TREE; /* Check for MASK_LOAD and MASK_STORE as well as COND_OP calls requiring mask conversion. */ @@ -6331,60 +6329,13 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo, { vectype1 = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs)); + gcc_assert (! COMPARISON_CLASS_P (rhs1)); if (TREE_CODE (rhs1) == SSA_NAME) { rhs1_type = integer_type_for_mask (rhs1, vinfo); if (!rhs1_type) return NULL; } - else if (COMPARISON_CLASS_P (rhs1)) - { - /* Check whether we're comparing scalar booleans and (if so) - whether a better mask type exists than the mask associated - with boolean-sized elements. This avoids unnecessary packs - and unpacks if the booleans are set from comparisons of - wider types. E.g. in: - - int x1, x2, x3, x4, y1, y1; - ... - bool b1 = (x1 == x2); - bool b2 = (x3 == x4); - ... = b1 == b2 ? y1 : y2; - - it is better for b1 and b2 to use the mask type associated - with int elements rather bool (byte) elements. */ - rhs1_op0 = TREE_OPERAND (rhs1, 0); - rhs1_op1 = TREE_OPERAND (rhs1, 1); - if (!rhs1_op0 || !rhs1_op1) - return NULL; - rhs1_op0_type = integer_type_for_mask (rhs1_op0, vinfo); - rhs1_op1_type = integer_type_for_mask (rhs1_op1, vinfo); - - if (!rhs1_op0_type) - rhs1_type = TREE_TYPE (rhs1_op0); - else if (!rhs1_op1_type) - rhs1_type = TREE_TYPE (rhs1_op1); - else if (TYPE_PRECISION (rhs1_op0_type) - != TYPE_PRECISION (rhs1_op1_type)) - { - int tmp0 = (int) TYPE_PRECISION (rhs1_op0_type) - - (int) TYPE_PRECISION (TREE_TYPE (lhs)); - int tmp1 = (int) TYPE_PRECISION (rhs1_op1_type) - - (int) TYPE_PRECISION (TREE_TYPE (lhs)); - if ((tmp0 > 0 && tmp1 > 0) || (tmp0 < 0 && tmp1 < 0)) - { - if (abs (tmp0) > abs (tmp1)) - rhs1_type = rhs1_op1_type; - else - rhs1_type = rhs1_op0_type; - } - else - rhs1_type = build_nonstandard_integer_type - (TYPE_PRECISION (TREE_TYPE (lhs)), 1); - } - else - rhs1_type = rhs1_op0_type; - } else return NULL; @@ -6400,55 +6351,9 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo, its vector type) and behave as though the comparison was an SSA name from the outset. */ if (known_eq (TYPE_VECTOR_SUBPARTS (vectype1), - TYPE_VECTOR_SUBPARTS (vectype2)) - && !rhs1_op0_type - && !rhs1_op1_type) + TYPE_VECTOR_SUBPARTS (vectype2))) return NULL; - /* If rhs1 is invariant and we can promote it leave the COND_EXPR - in place, we can handle it in vectorizable_condition. This avoids - unnecessary promotion stmts and increased vectorization factor. */ - if (COMPARISON_CLASS_P (rhs1) - && INTEGRAL_TYPE_P (rhs1_type) - && known_le (TYPE_VECTOR_SUBPARTS (vectype1), - TYPE_VECTOR_SUBPARTS (vectype2))) - { - enum vect_def_type dt; - if (vect_is_simple_use (TREE_OPERAND (rhs1, 0), vinfo, &dt) - && dt == vect_external_def - && vect_is_simple_use (TREE_OPERAND (rhs1, 1), vinfo, &dt) - && (dt == vect_external_def - || dt == vect_constant_def)) - { - tree wide_scalar_type = build_nonstandard_integer_type - (vector_element_bits (vectype1), TYPE_UNSIGNED (rhs1_type)); - tree vectype3 = get_vectype_for_scalar_type (vinfo, - wide_scalar_type); - if (expand_vec_cond_expr_p (vectype1, vectype3, TREE_CODE (rhs1))) - return NULL; - } - } - - /* If rhs1 is a comparison we need to move it into a - separate statement. */ - if (TREE_CODE (rhs1) != SSA_NAME) - { - tmp = vect_recog_temp_ssa_var (TREE_TYPE (rhs1), NULL); - if (rhs1_op0_type - && TYPE_PRECISION (rhs1_op0_type) != TYPE_PRECISION (rhs1_type)) - rhs1_op0 = build_mask_conversion (vinfo, rhs1_op0, - vectype2, stmt_vinfo); - if (rhs1_op1_type - && TYPE_PRECISION (rhs1_op1_type) != TYPE_PRECISION (rhs1_type)) - rhs1_op1 = build_mask_conversion (vinfo, rhs1_op1, - vectype2, stmt_vinfo); - pattern_stmt = gimple_build_assign (tmp, TREE_CODE (rhs1), - rhs1_op0, rhs1_op1); - rhs1 = tmp; - append_pattern_def_seq (vinfo, stmt_vinfo, pattern_stmt, vectype2, - rhs1_type); - } - if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype1), TYPE_VECTOR_SUBPARTS (vectype2))) tmp = build_mask_conversion (vinfo, rhs1, vectype1, stmt_vinfo); From patchwork Tue Oct 29 10:18:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 99759 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52A5F385843F for ; Tue, 29 Oct 2024 10:19:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 875C1385840A for ; Tue, 29 Oct 2024 10:18:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 875C1385840A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 875C1385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730197099; cv=none; b=WFP+RKrySGCp+9f4+kX+TkWgC4i/1s6pXk7yXDUi/n080CJDjd8A3C6ZvX188wNmRMZoMcSo3g8VpaMEJTzgt8/ZL6qp4PMJHVHVzSNgOagkXGA350lKlTUJmHxB/PzsPYn5MQ3u34sdfYLy66qje79feJO9Wa+IkP4043CTCls= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730197099; c=relaxed/simple; bh=IF6qlcr3w1hzX6rM3AQgau78dZiDH7cPn1+MtlENid4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version:Message-Id; b=ZpQuo0FPY8MUtkLtJcTF+Bn8Ji4wrsxcxBhuicZ4WtGxUbVznkzuSTmP/8tCNrc1oEYiW7sT9e4hzvsZ9almvJapyQGQI6+wImvtowhGFqsR7tiMaWcF/OAGv9kpTd0acgrX4/fEwXgJnZaejezlZ/dRQZnIh6qEN5BjhLELNO0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 730091F769; Tue, 29 Oct 2024 10:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730197087; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=yPZXroAhJgnVmP8pJPnTKdtgQy0kOU9TOTXGCTyA1es=; b=AlMODuqwwDJuBbcFwIvgCBT1qdfgmSaCna1YSRrIJKJHpEpIS4sl4pPCPOpZP9JeWdOjgb rETy59V1fUBTPg+2YzFwbHus1n78xVHKZJOmiKkEtr21j7Q66cJto+lTwnZXjtHWk7mSRt FvvOUMoi6zrUe23eC2J1xj263WXV9Zk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730197087; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=yPZXroAhJgnVmP8pJPnTKdtgQy0kOU9TOTXGCTyA1es=; b=P8tmcfzfjkaMAQUCtsnBKUbbFKJOHd/qnEAKGtwDdtUhhfuTSkxseOnFIrIzzKK+x0i+6x JLnqMJK5JdXp2ACw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=AlMODuqw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=P8tmcfzf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730197087; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=yPZXroAhJgnVmP8pJPnTKdtgQy0kOU9TOTXGCTyA1es=; b=AlMODuqwwDJuBbcFwIvgCBT1qdfgmSaCna1YSRrIJKJHpEpIS4sl4pPCPOpZP9JeWdOjgb rETy59V1fUBTPg+2YzFwbHus1n78xVHKZJOmiKkEtr21j7Q66cJto+lTwnZXjtHWk7mSRt FvvOUMoi6zrUe23eC2J1xj263WXV9Zk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730197087; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=yPZXroAhJgnVmP8pJPnTKdtgQy0kOU9TOTXGCTyA1es=; b=P8tmcfzfjkaMAQUCtsnBKUbbFKJOHd/qnEAKGtwDdtUhhfuTSkxseOnFIrIzzKK+x0i+6x JLnqMJK5JdXp2ACw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 53B06139A2; Tue, 29 Oct 2024 10:18:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id rprKEl+2IGfgLwAAD6G6ig (envelope-from ); Tue, 29 Oct 2024 10:18:07 +0000 Date: Tue, 29 Oct 2024 11:18:02 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: RISC-V Subject: [PATCH 2/2] Remove dead vect_recog_mixed_size_cond_pattern MIME-Version: 1.0 Message-Id: <20241029101807.53B06139A2@imap1.dmz-prg2.suse.org> X-Rspamd-Queue-Id: 730091F769 X-Spam-Level: X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ASN(0.00)[asn:25478, ipnet:::/0, country:RU]; MISSING_XM_UA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.51 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org vect_recog_mixed_size_cond_pattern only applies to COMPARISON_CLASS_P rhs1 COND_EXPRs which no longer appear - the following removes it. Its testcases still pass, I believe the situation is mitigated by bool pattern handling of the compare use in COND_EXPRs. * tree-vect-patterns.cc (type_conversion_p): Remove. (vect_recog_mixed_size_cond_pattern): Likewise. (vect_vect_recog_func_ptrs): Remove vect_recog_mixed_size_cond_pattern entry. --- gcc/tree-vect-patterns.cc | 198 -------------------------------------- 1 file changed, 198 deletions(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 46f439fb8a3..302101fa6a0 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -313,55 +313,6 @@ vect_get_internal_def (vec_info *vinfo, tree op) return NULL; } -/* Check whether NAME, an ssa-name used in STMT_VINFO, - is a result of a type promotion, such that: - DEF_STMT: NAME = NOP (name0) - If CHECK_SIGN is TRUE, check that either both types are signed or both are - unsigned. */ - -static bool -type_conversion_p (vec_info *vinfo, tree name, bool check_sign, - tree *orig_type, gimple **def_stmt, bool *promotion) -{ - tree type = TREE_TYPE (name); - tree oprnd0; - enum vect_def_type dt; - - stmt_vec_info def_stmt_info; - if (!vect_is_simple_use (name, vinfo, &dt, &def_stmt_info, def_stmt)) - return false; - - if (dt != vect_internal_def - && dt != vect_external_def && dt != vect_constant_def) - return false; - - if (!*def_stmt) - return false; - - if (!is_gimple_assign (*def_stmt)) - return false; - - if (!CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (*def_stmt))) - return false; - - oprnd0 = gimple_assign_rhs1 (*def_stmt); - - *orig_type = TREE_TYPE (oprnd0); - if (!INTEGRAL_TYPE_P (type) || !INTEGRAL_TYPE_P (*orig_type) - || ((TYPE_UNSIGNED (type) != TYPE_UNSIGNED (*orig_type)) && check_sign)) - return false; - - if (TYPE_PRECISION (type) >= (TYPE_PRECISION (*orig_type) * 2)) - *promotion = true; - else - *promotion = false; - - if (!vect_is_simple_use (oprnd0, vinfo, &dt)) - return false; - - return true; -} - /* Holds information about an input operand after some sign changes and type promotions have been peeled away. */ class vect_unpromoted_value { @@ -5408,154 +5359,6 @@ vect_recog_mod_var_pattern (vec_info *vinfo, return pattern_stmt; } -/* Function vect_recog_mixed_size_cond_pattern - - Try to find the following pattern: - - type x_t, y_t; - TYPE a_T, b_T, c_T; - loop: - S1 a_T = x_t CMP y_t ? b_T : c_T; - - where type 'TYPE' is an integral type which has different size - from 'type'. b_T and c_T are either constants (and if 'TYPE' is wider - than 'type', the constants need to fit into an integer type - with the same width as 'type') or results of conversion from 'type'. - - Input: - - * STMT_VINFO: The stmt from which the pattern search begins. - - Output: - - * TYPE_OUT: The type of the output of this pattern. - - * Return value: A new stmt that will be used to replace the pattern. - Additionally a def_stmt is added. - - a_it = x_t CMP y_t ? b_it : c_it; - a_T = (TYPE) a_it; */ - -static gimple * -vect_recog_mixed_size_cond_pattern (vec_info *vinfo, - stmt_vec_info stmt_vinfo, tree *type_out) -{ - gimple *last_stmt = stmt_vinfo->stmt; - tree cond_expr, then_clause, else_clause; - tree type, vectype, comp_vectype, itype = NULL_TREE, vecitype; - gimple *pattern_stmt, *def_stmt; - tree orig_type0 = NULL_TREE, orig_type1 = NULL_TREE; - gimple *def_stmt0 = NULL, *def_stmt1 = NULL; - bool promotion; - tree comp_scalar_type; - - if (!is_gimple_assign (last_stmt) - || gimple_assign_rhs_code (last_stmt) != COND_EXPR - || STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_internal_def) - return NULL; - - cond_expr = gimple_assign_rhs1 (last_stmt); - then_clause = gimple_assign_rhs2 (last_stmt); - else_clause = gimple_assign_rhs3 (last_stmt); - - if (!COMPARISON_CLASS_P (cond_expr)) - return NULL; - - comp_scalar_type = TREE_TYPE (TREE_OPERAND (cond_expr, 0)); - comp_vectype = get_vectype_for_scalar_type (vinfo, comp_scalar_type); - if (comp_vectype == NULL_TREE) - return NULL; - - type = TREE_TYPE (gimple_assign_lhs (last_stmt)); - if (types_compatible_p (type, comp_scalar_type) - || ((TREE_CODE (then_clause) != INTEGER_CST - || TREE_CODE (else_clause) != INTEGER_CST) - && !INTEGRAL_TYPE_P (comp_scalar_type)) - || !INTEGRAL_TYPE_P (type)) - return NULL; - - if ((TREE_CODE (then_clause) != INTEGER_CST - && !type_conversion_p (vinfo, then_clause, false, - &orig_type0, &def_stmt0, &promotion)) - || (TREE_CODE (else_clause) != INTEGER_CST - && !type_conversion_p (vinfo, else_clause, false, - &orig_type1, &def_stmt1, &promotion))) - return NULL; - - if (orig_type0 && orig_type1 - && !types_compatible_p (orig_type0, orig_type1)) - return NULL; - - if (orig_type0) - { - if (!types_compatible_p (orig_type0, comp_scalar_type)) - return NULL; - then_clause = gimple_assign_rhs1 (def_stmt0); - itype = orig_type0; - } - - if (orig_type1) - { - if (!types_compatible_p (orig_type1, comp_scalar_type)) - return NULL; - else_clause = gimple_assign_rhs1 (def_stmt1); - itype = orig_type1; - } - - - HOST_WIDE_INT cmp_mode_size - = GET_MODE_UNIT_BITSIZE (TYPE_MODE (comp_vectype)); - - scalar_int_mode type_mode = SCALAR_INT_TYPE_MODE (type); - if (GET_MODE_BITSIZE (type_mode) == cmp_mode_size) - return NULL; - - vectype = get_vectype_for_scalar_type (vinfo, type); - if (vectype == NULL_TREE) - return NULL; - - if (expand_vec_cond_expr_p (vectype, comp_vectype, TREE_CODE (cond_expr))) - return NULL; - - if (itype == NULL_TREE) - itype = build_nonstandard_integer_type (cmp_mode_size, - TYPE_UNSIGNED (type)); - - if (itype == NULL_TREE - || GET_MODE_BITSIZE (SCALAR_TYPE_MODE (itype)) != cmp_mode_size) - return NULL; - - vecitype = get_vectype_for_scalar_type (vinfo, itype); - if (vecitype == NULL_TREE) - return NULL; - - if (!expand_vec_cond_expr_p (vecitype, comp_vectype, TREE_CODE (cond_expr))) - return NULL; - - if (GET_MODE_BITSIZE (type_mode) > cmp_mode_size) - { - if ((TREE_CODE (then_clause) == INTEGER_CST - && !int_fits_type_p (then_clause, itype)) - || (TREE_CODE (else_clause) == INTEGER_CST - && !int_fits_type_p (else_clause, itype))) - return NULL; - } - - def_stmt = gimple_build_assign (vect_recog_temp_ssa_var (itype, NULL), - COND_EXPR, unshare_expr (cond_expr), - fold_convert (itype, then_clause), - fold_convert (itype, else_clause)); - pattern_stmt = gimple_build_assign (vect_recog_temp_ssa_var (type, NULL), - NOP_EXPR, gimple_assign_lhs (def_stmt)); - - append_pattern_def_seq (vinfo, stmt_vinfo, def_stmt, vecitype); - *type_out = vectype; - - vect_pattern_detected ("vect_recog_mixed_size_cond_pattern", last_stmt); - - return pattern_stmt; -} - /* Helper function of vect_recog_bool_pattern. Called recursively, return true if bool VAR can and should be optimized that way. Assume it shouldn't @@ -7398,7 +7201,6 @@ static vect_recog_func vect_vect_recog_func_ptrs[] = { { vect_recog_sat_add_pattern, "sat_add" }, { vect_recog_sat_sub_pattern, "sat_sub" }, { vect_recog_sat_trunc_pattern, "sat_trunc" }, - { vect_recog_mixed_size_cond_pattern, "mixed_size_cond" }, { vect_recog_gcond_pattern, "gcond" }, { vect_recog_bool_pattern, "bool" }, /* This must come before mask conversion, and includes the parts