From patchwork Sun Jun 16 07:28:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Xue OS X-Patchwork-Id: 1948267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.a=rsa-sha256 header.s=selector2 header.b=IpHzoklc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W24QB1dLQz20Pb for ; Sun, 16 Jun 2024 17:29:06 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 71C4B385C6C7 for ; Sun, 16 Jun 2024 07:29:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20728.outbound.protection.outlook.com [IPv6:2a01:111:f403:2412::728]) by sourceware.org (Postfix) with ESMTPS id A85273858CDA for ; Sun, 16 Jun 2024 07:28:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A85273858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=os.amperecomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=os.amperecomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A85273858CDA Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2412::728 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718522926; cv=pass; b=DHjYfMjRHXygv2vnUtsKC6GGiQ7iJWSULYm/bn839osJv0TMgnVv67kaNtvsS5/rknKOby0cc0qlkGAaiBHsxvtb5AbVxKNBdwSmwUJSKuGqUBC8DLnYS7/KN1Xwk45bA6sCfBamPORV85YGQ3H4Hs6EdU8F2rzBs+zEumVSa94= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718522926; c=relaxed/simple; bh=T0KMC0U299jhAddZo7Om+yWBt1skA4vf7JDYtFA4msQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lpqs4VyG8JB5EyrZzEcNYtZNOZJawufOFFUqdRqglDvMJBzYaiul15ZecbCa6JsEMx7+vMIYWMKt9eIXoiLGwDmsqePObq8oT3gIEHi2y8DGkYVNf/fiIhV99MV3ZL9gJyvPyJQZPfG6R4L2AyZCIEtb5F2SGG0nEjQshfxkz28= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pc5tSP5UKIDViKO2GayXmnpvR65hfGgB5GjZBmcstjWzCnQQmpC/DwSHc4kY1v3alxjeRmYD2xixhWjm4HTqZdKfv/D/hZWkMKDR5BwjEpgCkLRhK8ORIoWHQLQwMJ/w2hB07W3QcGNZUuBqUk/zmpjJHwTcnC1oQpm604mb8a1L5mOF8AVIRcb0+JRqJChp7Z25kH74yBx2DxUDLMI5LuWGdE0BccNhjE0Hp6fSeIPGYqFxd14uOZYsd2B424AqfZ471Ka2vy3DuGnrEvgsLzcIjjhTYpnKoi1S377xZeqRLTqc0I8pdqbYLqHhZ83CrB3XgcRpMkfGr0WSR8PzVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UdZp8SrxS1iZyGZpYwtjcp1SQP25fizcyNYwuTmvH/U=; b=GnL2khL5JTPJq+mY5zA6DVDfu9j/YAwzX9nD6BZwsCRQABSOnZ+M014zIKxvr3dFLlmHQ+ep8q57lghlbnZQvPVWxFLZ9BxMd6KP/SD58qzzNIpr37IS97I2Orp3GOUtyLmIWeJzDDzZpjaOtkgn277vwECVcCDkszqFVPU3B0Zf+fT58oaIvcn6Vx9R4abw2t/YnWuKFpAIh2Onp3d/moEi2Y/svncR0x/opMH+Fp2QYw26Ta/3/IahbHHaG6XHgJAdXSmt5Hi6o1FTGhCtXv1pYN87xKK7b9ST6sXS0NpWOyXZ6JM6tBz5ReB8IRBpH0vqEsC9jqyao5OQ2t0BqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UdZp8SrxS1iZyGZpYwtjcp1SQP25fizcyNYwuTmvH/U=; b=IpHzoklcUw4NmIiJt/ThrJ6ojjRL2WR7HxE8lx+Jy4cke25a4YJB13QqDUXKFLXKePOVxK72NZFeDKoYhQKhKtVqUO7X5e3xUoovMMCm5OvN+2U3DI0qsv/RZsP9gfDApP74LcboubKMiD7bG/Dy6WQjlfmTFZMxtURGRL5YipE= Received: from LV2PR01MB7839.prod.exchangelabs.com (2603:10b6:408:14f::13) by SA1PR01MB8592.prod.exchangelabs.com (2603:10b6:806:383::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.25; Sun, 16 Jun 2024 07:28:41 +0000 Received: from LV2PR01MB7839.prod.exchangelabs.com ([fe80::2ac3:5a77:36fd:9c63]) by LV2PR01MB7839.prod.exchangelabs.com ([fe80::2ac3:5a77:36fd:9c63%4]) with mapi id 15.20.7677.029; Sun, 16 Jun 2024 07:28:41 +0000 From: Feng Xue OS To: Richard Biener CC: "gcc-patches@gcc.gnu.org" Subject: [PATCH 6/8] vect: Tighten an assertion for lane-reducing in transform Thread-Topic: [PATCH 6/8] vect: Tighten an assertion for lane-reducing in transform Thread-Index: AQHav763B3aXyBkSJ0WCVeBwLMcO8w== Date: Sun, 16 Jun 2024 07:28:41 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: msip_labels: MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Enabled=True; MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SiteId=3bc2b170-fd94-476d-b0ce-4229bdc904a7; MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SetDate=2024-06-16T07:28:41.075Z; MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Name=Confidential; MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_ContentBits=0; MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Method=Standard; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR01MB7839:EE_|SA1PR01MB8592:EE_ x-ms-office365-filtering-correlation-id: 48250ff8-c83d-44e4-9f86-08dc8dd5f263 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230037|1800799021|366013|376011|38070700015; x-microsoft-antispam-message-info: =?iso-8859-1?q?F1FuJ7YnkeX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?q?bQuQIrSBiMkeENqDe8s2etKjEQg6lfPsEMOelrAqHUSfFvXsMRc5wGANFVI0?= =?iso-8859-1?q?+tbxf1mDkOsApzuH3f2LxRXyToFs1jYMkM7fkJGbuac0RNKLScHLBsfStT+8?= =?iso-8859-1?q?Z+B3gHuXWdTFJ5ARQPn9A3uF70TweRr8v7h3Z0uxG6RAjUY7q6A1T+kGvaYG?= =?iso-8859-1?q?xhL6fFGNSxPu78tY7uZ3ZSt01pbrV0ohL8hvOA0EuzrxpUQAOmpkEIbkf8dZ?= =?iso-8859-1?q?7RnS6vIOMDqAMUHxE3HzGQq6Xk9I7+0u1HJhnNjC+BYOFSDkpCelGCb/dtFW?= =?iso-8859-1?q?G0+UIbEH43zmD1Mpoog8LvvY6c8F4BbFv7pNk8qYjJzmCChZz5oRcniuui+g?= =?iso-8859-1?q?eOXpmgOEUoPtQtvELWslQg10/PKg4UYQqFkGwY8ItYRSRrlgL07OW1cutE0g?= =?iso-8859-1?q?rv5L23r8ogm79GeOXRKX2u8kKMC62spMsVzCK1L8kYK7EPpzx3zTqYPKZJfA?= =?iso-8859-1?q?VyOu4WXeU/BrJ9qmliKn6sZV82MW8/Vum0CiOZsFDxymaLwOVOxg6vx6Cz3f?= =?iso-8859-1?q?UA?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR01MB7839.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230037)(1800799021)(366013)(376011)(38070700015); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?K0p/8QTz0BxURoU6qV0D5XZ?= =?iso-8859-1?q?cIyqg+YKjM1UuyCoQSgHdKXeueMdauFo3pfwCjexApvxmoRjweMsS+4/ZSrH?= =?iso-8859-1?q?CbUM6uzUWpovHQThMBBjxL/xzLOVBh1QT4UvD7HLYGYAT4Hop3iTUgpKbLbb?= =?iso-8859-1?q?TUdqmatkbT49f588K3p4Xs6mrMKAueN5DNLXoXhxP7mkGYdFZN0/0y1wVe8m?= =?iso-8859-1?q?csNjmr9NR6Z3iivS6VEkqbUaqtUEQwutzzK55cpqgMWRefe2SMOkMTWXzO8Q?= =?iso-8859-1?q?YIhzKkzk46TxEy2gNcB5tP6HBhLZ82QLEeR7oBZmuI8Q46jRAAOi9GVQp/zI?= =?iso-8859-1?q?hIl8SPrfXXUAlzPWV642Pg7/MKFiBbXL1hdrYScUZi1mJ64O1Rh8+bwpKFRr?= =?iso-8859-1?q?c9NQT8ydd9t7lSId8Qt1SAIFM1WjAr5xdgiVl929yNuO1P9uvT6ZfaV40DoM?= =?iso-8859-1?q?1XHSr9NF7lXukMMkfDvjAosrrbEEbKBRqQTu/IVnoPtBS0bbhQQiHf3o2BcH?= =?iso-8859-1?q?z1xz21JxHDkSDXh2b1A29HP3GTodVC0nBfrquPhUTxyLzdVmLEqP/+JggpCW?= =?iso-8859-1?q?T73WX/fN/MGyLIT6YnpbyyQPai3mvx/dWLxrir6ZuC/lGA73uOPEgJr6y8oB?= =?iso-8859-1?q?4cKzqz2srOWLXXGcE45oJGLyNmt/AewDfBdBjiv53RS0ijXW321dhLcUsKaO?= =?iso-8859-1?q?+qUThyouYoFu+RBa5n76gHVn6A1THyl0uUdYSfgRT9NFBW10GdbUqhFnofzl?= =?iso-8859-1?q?iMLm185rUJ4XN31jq0EAcRRX+KaLQ7hmdmgtXVbcBZTNWc63Ia9b+9/obcnR?= =?iso-8859-1?q?qyd7R3BdcROHGG3KHhOMGQdnj/iLZPXsX7HixUyB5Vq4aWoScuJBMXRBXKY3?= =?iso-8859-1?q?ytpxCq+MZG79fcJ46MOabWy69kJCkhCAqcOPlL12vOjIl3fYtprOeao/PK6/?= =?iso-8859-1?q?PG0w40uwxGc516mk3SxMYpnWBTiiIR7bPARFS9ikyjdWk0VrlxnoimLMXsUV?= =?iso-8859-1?q?q6ha1EfLWu8flbQXnnUqsSCoHC1gJ5Sv+l+7qRatMiCZtyxokkwcR8Ox27Fy?= =?iso-8859-1?q?nPt4l95Yz947S1KlYS5Ro2D87pW8wtJnCLqRD1UjowQDr3B2mEKWYR3JyyB0?= =?iso-8859-1?q?I4nDtdgR7+FRjqkr6gqDt6dv0uVVga91fp8BLoruxqNPSfEmfZHsLbs1GCIi?= =?iso-8859-1?q?IZO3QHXuO9M2wOoSJAoYoc1vlN+tdNZjgQ9/pL8RfVhRt2UHtH08CjpwNtbG?= =?iso-8859-1?q?liow5OpyPJWuyHfkET4/2tjAA4T/QKSgZP2Fa/rONNkpc/sJbTQh8s5pSrio?= =?iso-8859-1?q?sgCx9nzZP5hXf9X65JLpUIZtYFl5ZVBMDA2XDJbUdn7byvmLfuOPdhkRW9YT?= =?iso-8859-1?q?m+b66nKwpjA24zCsU9mU89zIdCePYNYXTss0WBAkMqk2k+8UjFU5v7Q7hplo?= =?iso-8859-1?q?Hp+HmLabBMTpovD6YCYvEwsiXq60xTOwzn/AOvyXJAIoefp9U6N71GiSdzqm?= =?iso-8859-1?q?4gHoH6uaY5SIfQ8Klkw04eEUpNv4SrTmd8L4OH1XJCHnaCdatgrVwk1V4t/Z?= =?iso-8859-1?q?gIOmzkR5s8LIZi3UEtTFflgd9Bp7HAeg3dkZFEIXX3qsBixMm4AJXef3Eh7/?= =?iso-8859-1?q?v8ifYe4u5Fjmhj7jD?= MIME-Version: 1.0 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR01MB7839.prod.exchangelabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48250ff8-c83d-44e4-9f86-08dc8dd5f263 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2024 07:28:41.3303 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nD2WEXfvo4ZsBX0POUkLQoQpPd75N3ylte3DZ3LOUwQpoQYhCxI2A2tk+3q9SaObScyqpDZEc7LN50BHwswlJlWYU6NyHQo1ZIJrtF8wmqw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB8592 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_PASS, 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 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+incoming=patchwork.ozlabs.org@gcc.gnu.org According to logic of code nearby the assertion, all lane-reducing operations should not appear, not just DOT_PROD_EXPR. Since "use_mask_by_cond_expr_p" treats SAD_EXPR same as DOT_PROD_EXPR, and WIDEN_SUM_EXPR should not be allowed by the following assertion "gcc_assert (commutative_binary_op_p (...))", so tighten the assertion. Thanks, Feng --- gcc/ * tree-vect-loop.cc (vect_transform_reduction): Change assertion to cover all lane-reducing ops. --- gcc/tree-vect-loop.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) From d348e63c001e65067876a80dfae75abefe10c240 Mon Sep 17 00:00:00 2001 From: Feng Xue Date: Sun, 16 Jun 2024 13:33:52 +0800 Subject: [PATCH 6/8] vect: Tighten an assertion for lane-reducing in transform According to logic of code nearby the assertion, all lane-reducing operations should not appear, not just DOT_PROD_EXPR. Since "use_mask_by_cond_expr_p" treats SAD_EXPR same as DOT_PROD_EXPR, and WIDEN_SUM_EXPR should not be allowed by the following assertion "gcc_assert (commutative_binary_op_p (...))", so tighten the assertion. 2024-06-16 Feng Xue gcc/ * tree-vect-loop.cc (vect_transform_reduction): Change assertion to cover all lane-reducing ops. --- gcc/tree-vect-loop.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 7909d63d4df..e0561feddce 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -8643,7 +8643,8 @@ vect_transform_reduction (loop_vec_info loop_vinfo, } bool single_defuse_cycle = STMT_VINFO_FORCE_SINGLE_CYCLE (reduc_info); - gcc_assert (single_defuse_cycle || lane_reducing_op_p (code)); + bool lane_reducing = lane_reducing_op_p (code); + gcc_assert (single_defuse_cycle || lane_reducing); /* Create the destination vector */ tree scalar_dest = gimple_get_lhs (stmt_info->stmt); @@ -8698,8 +8699,9 @@ vect_transform_reduction (loop_vec_info loop_vinfo, tree vop[3] = { vec_oprnds[0][i], vec_oprnds[1][i], NULL_TREE }; if (masked_loop_p && !mask_by_cond_expr) { - /* No conditional ifns have been defined for dot-product yet. */ - gcc_assert (code != DOT_PROD_EXPR); + /* No conditional ifns have been defined for lane-reducing op + yet. */ + gcc_assert (!lane_reducing); /* Make sure that the reduction accumulator is vop[0]. */ if (reduc_index == 1) -- 2.17.1