From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2053.outbound.protection.outlook.com [40.107.8.53]) by sourceware.org (Postfix) with ESMTPS id C8580385DC0C for ; Fri, 30 Jun 2023 08:23:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8580385DC0C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZPinyAbwUgZ0joVqebrLldsmnhBUSQWsIv/M3d1xZPs=; b=L3Rd6FuAO2VILJdWBdC9tZOO+LpTewAevqeDLhlUixPrtimvv5HURavx/lCU2z53rM8Pzafiq4gn3MMh/XQFJW93WKJaN3Aawcqc91jdZOmB6jh9iiZPH7cGWMt4f5HzsEm6OcUKU4b39QNATZzOn89Wlip/lbn5jNq7WVeLL+o= Received: from DUZPR01CA0138.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bc::14) by DU0PR08MB7592.eurprd08.prod.outlook.com (2603:10a6:10:311::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Fri, 30 Jun 2023 08:23:24 +0000 Received: from DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:4bc:cafe::be) by DUZPR01CA0138.outlook.office365.com (2603:10a6:10:4bc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 08:23:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT044.mail.protection.outlook.com (100.127.142.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 08:23:24 +0000 Received: ("Tessian outbound e2424c13b707:v142"); Fri, 30 Jun 2023 08:23:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 765be3ac9ca118fa X-CR-MTA-TID: 64aa7808 Received: from 6b08c4783040.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 47BDF5D3-1E1F-48E4-BBA5-D639F9C8CEB5.1; Fri, 30 Jun 2023 08:23:16 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6b08c4783040.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 30 Jun 2023 08:23:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yi5hncRPeZSNNsWcOBhf1ZwF2gpKvgaj38N78kgfEOgbpALHk2pxFWFwVyHP2JSCHNAEtABqRSUUGtjyR+8g89OugO0zmATUHjTjh4vh+j9W2Hhkd5BRsxkGHcGKhwKUU7JdjdabHdYnhWn25BdTONFuCt48vA3rZPs1I2PphqpGSEeDs91fI7AuUZaba2W4w8drjnMDXEBU7FLCHJA2Tu7idwEBegezzeVtBox8WBZSSdeRAMMXM4fdRH/ss/IHSVkdL9GTKiULm+Qx34nzaA7pd0MnhbRg3cUCFEgT32Ggt/bA+tlG4hWhGCYrBEpO+yk5ivrKvnog2K7ZL2joAA== 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=ZPinyAbwUgZ0joVqebrLldsmnhBUSQWsIv/M3d1xZPs=; b=N/qNfx1g9ZfLIoT72+EHz5TGqxJjb0kORToUjbRk5ZuDsj7MNirbOhkuMkPWOWO2fqes39lfqmzoGvLRYAp6RIn8iwOvcaQnl14zh3NVKl6OdyETi+6UeN03c0d9w7aF79VfFMeB/xOR57lMR3QNVDlxfFA8u010iovCW8wR7sKbshLcqoAPVR/9TP52quU5BychJ7LuMPv9Tht8/VwslgE+0jQIrCX6L3YF8emNvRThP5k11glRcPdHpcNdVHPLGU2YPW6gu3DysDYTd8CHTF9KA/tKjn1vhnAXlReNhEmDQtUPKIo/Ow8in8AgcV9N+zAZEnZaXs/XVG72w3eZ6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZPinyAbwUgZ0joVqebrLldsmnhBUSQWsIv/M3d1xZPs=; b=L3Rd6FuAO2VILJdWBdC9tZOO+LpTewAevqeDLhlUixPrtimvv5HURavx/lCU2z53rM8Pzafiq4gn3MMh/XQFJW93WKJaN3Aawcqc91jdZOmB6jh9iiZPH7cGWMt4f5HzsEm6OcUKU4b39QNATZzOn89Wlip/lbn5jNq7WVeLL+o= Received: from DU2PR04CA0225.eurprd04.prod.outlook.com (2603:10a6:10:2b1::20) by PAWPR08MB9613.eurprd08.prod.outlook.com (2603:10a6:102:2e4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Fri, 30 Jun 2023 08:23:15 +0000 Received: from DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::4) by DU2PR04CA0225.outlook.office365.com (2603:10a6:10:2b1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 08:23:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT052.mail.protection.outlook.com (100.127.142.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6565.13 via Frontend Transport; Fri, 30 Jun 2023 08:23:15 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 30 Jun 2023 08:23:14 +0000 Received: from e119885.cambridge.arm.com (10.2.78.55) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Fri, 30 Jun 2023 08:23:13 +0000 From: Oluwatamilore Adebayo To: CC: , , Subject: Re: [PATCH 1/2] Mid engine setup [SU]ABDL Date: Fri, 30 Jun 2023 09:23:08 +0100 Message-ID: <20230630082308.112217-1-oluwatamilore.adebayo@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT052:EE_|PAWPR08MB9613:EE_|DBAEUR03FT044:EE_|DU0PR08MB7592:EE_ X-MS-Office365-Filtering-Correlation-Id: 72b13d94-ca57-4a7d-08cd-08db794345a5 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: vYucu/2RJtHMOnSsafmSOFr69AYOfN79+XvP6UGjH8++ab4XgAqr00O2QRI3p89NqdqgBKSHWaGKB6YXjWD7sJbkgJw0YyEluq/Jef79GfLGjCGym+ThWcBYNUfwMFYfz22C6V8Jp2ZpxtERs2CpuK1y9lVqLEj3w32dCQamVhPIh0XqXwvMF74Iu39i++EZ7kWfhKZ/OQtbxJE1MpqiyNHjlJ7RZyA071Zd4704xnuRvWgWxwDOBCLOJCb61HVT7abHE8rg2xqHRQfefcI1FwUr5tQbCKLyMmyyg7xFVWpJc8iLldMt/j1YrNS60/l7Xj+kIHC2AkzKtbpq9SpHZj4McOko702pGOW34SlJrzsPvKYcbBJfaLTqKXnbGp0uQ9RVSOKVLkgnGp3/Qoayc3yHbu9BpR0jK91K7CwI5C8seBIceDfxkFDiqpsqsgMxbhXT0mPCx5eAlfPiwcpqP3/FOwkkPuUN8NA3/tAgFuYw5EFm+1Mj9fV5ziFb1A4cpRIMeqccApPsgBBmOIsYxrD9CjHrmR1AZMyaE7LMYVWDhLU+LvWfrPOhqrrxhEB9RyzHf6tzN/cwUD5ShKw78PBUu1DhqYWZfmAolpGmQVPoi1dHDovcd2OSdRyh4s2GtnkwAQ/hk2svzIoLcP2PiNca80XKLDNEvh+NdZqhuK7nAmPG5+XhzfApGNIoH5rRzj9dEO71vVdkR3bdQK+zlQSwM9W5va2gqE6kGUhy3EUyr5VlMYCBAG89GB12Ro0S0xbsKIyiMw7yxIdd5+mW5g== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199021)(46966006)(36840700001)(40470700004)(26005)(82310400005)(36860700001)(5660300002)(2616005)(478600001)(7696005)(1076003)(37006003)(336012)(54906003)(426003)(6666004)(2906002)(83380400001)(186003)(86362001)(70206006)(41300700001)(44832011)(356005)(47076005)(36756003)(82740400003)(6862004)(81166007)(8676002)(4326008)(40480700001)(316002)(70586007)(40460700003)(8936002)(6636002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9613 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 105a7a4f-8bc5-4403-c0da-08db7943403b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Eg97HZYe+mOUvcvGk2VG/U4BvgX86MBGyyT7Z2VPaqZMbW09xg9gtSx4kV1UVIq1nw5VvZjbfwZsCKN2zSlXzxk/o/03tvb0R8OGbGyhzD/plZSm8Fj7fj2FXPzkrBk9Eg+M/fZDmPPrtwdBzgr///tuk6Pk/l/KX3cACWAMy96ZINw7OYvKI7WSL37go+iz/jsOA9sSN5g560fV9R5By4p3dvfv6JOom7gFOcZNy88BGswOb7O695DDqv5u4zvGGqbyrvLXJ2HF1Nmj0t9b25hV3Wm6lqVD6cujcMCUbIltoyjbKmqcyp0MbczAyi2bx/MCUxpDuyE/BE+CXISP/YY68uhoGbE7UYKSEPRzpPOgMGsozW5ltY4B3phDlx6iGiEwNHbY8QEQagYG2mXVTkj7zAP8XXIfjLe2VVekkqeLn+V8FMBygYVgC+Ed5NTWaxvW2FBm8mZGgZr4vJiJ4S8jXhDdpvt2DpiOXcqR8ndL7FdYLLjetfKAT1qCDf9JxDtOwfO1QJJMjiZDmpU1K9OBbHcVk5gNHg+nBMFvrVJf7G3QACXxFLC5GPnl9Mz9E5j7IL2OkykDEzGHjj6+21Jta2CppR5mM1bJBWR+CmdRl07sR1mO0qrcO3xRt4EjktMStMqEZqyGn4EkDELmLf1yu5Iko3px7IBtbv6ngXxt3hLpR5kpgL6MoezAbpSdESr6Tr39Tbpl1+KvjpkoYNte47I7fFTVa6rimfXuCP6MGPR4KI6KHU/10BB0YqtR X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(346002)(396003)(376002)(451199021)(46966006)(36840700001)(40470700004)(26005)(2906002)(86362001)(82310400005)(7696005)(6666004)(83380400001)(81166007)(2616005)(107886003)(186003)(336012)(426003)(47076005)(82740400003)(40460700003)(54906003)(41300700001)(36860700001)(40480700001)(37006003)(4326008)(478600001)(36756003)(70586007)(316002)(6636002)(70206006)(1076003)(5660300002)(44832011)(8936002)(8676002)(6862004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 08:23:24.1114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72b13d94-ca57-4a7d-08cd-08db794345a5 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7592 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Sorry, my fault. I was using the original type names in this > suggestion, rather than the TYPE1…TYPE5 ones. Should be: > > WIDEN_ABD exists to optimize the case where TYPE4 is at least > twice as wide as TYPE3. Change made. > Lingering use of “L” suffixes here. Maybe: > > stmts that constitute the pattern, principally: > out = IFN_ABD (x, y) > out = IFN_WIDEN_ABD (x, y) Change made. > > + if (TYPE_PRECISION (out_type) >= TYPE_PRECISION (abd_in_type) * 2 > > + && TYPE_PRECISION (abd_out_type) != stmt_vinfo->min_output_precision) > > Sorry for not noticing last time, but I think the second condition > would be more natural as: > > && stmt_vinfo->min_output_precision >= TYPE_PRECISION (abd_in_type) * 2) > > (There's no distinction between abs_in_type and abs_out_type at this point, > so it seems clearer to use the same value in both conditions.) Change made. > > + gassign *last_stmt = dyn_cast (STMT_VINFO_STMT (stmt_vinfo)); > > + if (!last_stmt || !gimple_assign_cast_p (last_stmt)) > > I think this should be: > > if (!last_stmt || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (last_stmt))) > > gimple_assign_cast_p is more general, and allows conversions > between integral and non-integral types. Change made. > > + tree in_type = TREE_TYPE (last_rhs); > > + tree out_type = TREE_TYPE (gimple_assign_lhs (last_stmt)); > > + if (TYPE_PRECISION (in_type) * 2 != TYPE_PRECISION (out_type)) > > + return NULL; > > I think this also needs to require TYPE_UNSIGNED (in_type): > > if (TYPE_PRECISION (in_type) * 2 != TYPE_PRECISION (out_type) > || !TYPE_UNSIGNED (in_type)) > return NULL; > > That is, the extension has to be a zero extension rather than > a sign extension. > > For example: > > int32_t a, b, c; > int64_t d; > > c = IFN_ABD (a, b); > d = (int64_t) c; > > sign-extends the ABD result to 64 bits, and so a == INT_MAX > && b == INT_MIN gives: > > c = -1 (UINT_MAX converted to signed) > d = -1 > > But IFN_WIDEN_ABD would give d == UINT_MAX instead. Change made. > > + gimple *pattern_stmt = STMT_VINFO_STMT (abd_pattern_vinfo); > > + if (gimple_assign_cast_p (pattern_stmt)) > > + { > > + tree op = gimple_assign_rhs1 (pattern_stmt); > > + vect_unpromoted_value unprom; > > + op = vect_look_through_possible_promotion (vinfo, op, &unprom); > > + > > + if (!op) > > + return NULL; > > + > > + abd_pattern_vinfo = vect_get_internal_def (vinfo, op); > > + if (!abd_pattern_vinfo) > > + return NULL; > > + > > + pattern_stmt = STMT_VINFO_STMT (abd_pattern_vinfo); > > + } > > I think the code quoted above reduces to: > > vect_unpromoted_value unprom; > tree op = vect_look_through_possible_promotion (vinfo, last_rhs, &unprom); > if (!op || TYPE_PRECISION (TREE_TYPE (op)) != TYPE_PRECISION (in_type)) > return NULL; > > stmt_vec_info abd_pattern_vinfo = vect_get_internal_def (vinfo, op); > if (!abd_pattern_vinfo) > return NULL; > abd_pattern_vinfo = vect_stmt_to_vectorize (abd_pattern_vinfo); > > ... > > > + tree abd_oprnd0 = gimple_call_arg (abd_stmt, 0); > > + tree abd_oprnd1 = gimple_call_arg (abd_stmt, 1); > > + if (TYPE_PRECISION (TREE_TYPE (abd_oprnd0)) != TYPE_PRECISION (in_type)) > > + return NULL; > > With the changes above, this check would not be necessary. Both changes made. Updated patch will be in the next email.