From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 02CA23858421 for ; Wed, 5 Jul 2023 17:01:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02CA23858421 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36578Pls029943 for ; Wed, 5 Jul 2023 10:01:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=VB/JXWXJZWOHEBFyYTaP32YLKfKjNkUhR1QN6/coudo=; b=TZwruHa+AJlzPdnDaOY5KskHQEEaEMBVjIWZzZzVF9nxFjBe/vlux73PgFF5sYrKP5Fd 7KNSFT9jaG7k74EBSSpPKJqc2W+R/diGAuYyfvIE2tK20IfRhJ7WHu0aeWOH3vpo8j83 WPnqxpotSPfVX93UvLhkQcs0iziiMgkfjTEK2g9E0v7TgU++wLbiTPKmI+5kajvz19Rp JHOKDyn8nW/jtOdlfUnhnJgr+UuhFxJ66kLbvK0kHsehQVRviY5Bk6rBbwisZdQ6dpxB b/UAoO+SirpPUmOqNdrT5lxhXSKHWXWioDLa3GJYVUWYHdpvinqZX2r9DzblSlhCjK9d Xg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3rn3v91ysk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 05 Jul 2023 10:01:47 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 5 Jul 2023 10:01:45 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 5 Jul 2023 10:01:45 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 7D87A3F7070; Wed, 5 Jul 2023 10:01:45 -0700 (PDT) From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] Fix PR 110554: vec lowering introduces scalar signed-boolean:32 comparisons Date: Wed, 5 Jul 2023 10:01:36 -0700 Message-ID: <20230705170136.581584-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: vhcNVIW_p-jktjUWCR_ETWhLF5o76JNj X-Proofpoint-ORIG-GUID: vhcNVIW_p-jktjUWCR_ETWhLF5o76JNj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-05_08,2023-07-05_01,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: So the problem is vector generic decided to do comparisons in signed-boolean:32 types but the rest of the middle-end was not ready for that. Since we are building the comparison which will feed into a cond_expr here, using boolean_type_node is better and also correct. The rest of the compiler thinks the ranges for comparison is always [0,1] too. Note this code does not currently lowers bigger vector sizes into smaller vector sizes so using boolean_type_node here is better. OK? bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR middle-end/110554 * tree-vect-generic.cc (expand_vector_condition): For comparisons, just build using boolean_type_node instead of the cond_type. For non-comparisons/non-scalar-bitmask, build a ` != 0` gimple that will feed into the COND_EXPR. --- gcc/tree-vect-generic.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index df04a0db68d..a7e6cb87a5e 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -1121,7 +1121,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) comp_width, comp_index); tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2, comp_width, comp_index); - aa = gimplify_build2 (gsi, code, cond_type, aa1, aa2); + aa = gimplify_build2 (gsi, code, boolean_type_node, aa1, aa2); } else if (a_is_scalar_bitmask) { @@ -1132,7 +1132,11 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) build_zero_cst (TREE_TYPE (a))); } else - aa = tree_vec_extract (gsi, cond_type, a, comp_width, comp_index); + { + result = tree_vec_extract (gsi, cond_type, a, comp_width, comp_index); + aa = gimplify_build2 (gsi, NE_EXPR, boolean_type_node, result, + build_zero_cst (cond_type)); + } result = gimplify_build3 (gsi, COND_EXPR, inner_type, aa, bb, cc); if (!CONSTANT_CLASS_P (result)) constant_p = false; -- 2.31.1