From patchwork Fri Apr 19 13:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 88730 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 121C63849AE5 for ; Fri, 19 Apr 2024 13:29:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by sourceware.org (Postfix) with ESMTPS id BA666384AB7E for ; Fri, 19 Apr 2024 13:29:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA666384AB7E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA666384AB7E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.20.64 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1713533348; cv=pass; b=DyLgQA8l7FasUExqGFnaf5COfMGUS7TGS6e4K0OX5XysfebqlxFvcbARzb+wKpD0EgB6FD0z7joQjt5QDCIu2242VQ8nJHCVZrXISW21kasDR54ktxDl0ZbSyuKfjizP74vOh0OfYvGy4sB/6rleSXKuhcxPYsKNYxRnm3yIuRc= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1713533348; c=relaxed/simple; bh=+23UHcBlddy7NvuyifaGrX/yR7GDd5Fe2SK5z25EHiI=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=p/P0IErY9/9eAaklqC2fzLdNLzfN94tq9bvjIx3zR6Q7wDus2+eZ7tn9R2ntvIReQh5eM4ESfaBTG0z+uWW7aUs3rXwhWlvyyQG4Pc8FTzGJp/B3d8OjzdD10IW+UTzFh2SFR26L/NwLS9gKxkDwpAzY2BJqJ79xDYnoduZyBLQ= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=NjFLn0LT2QYMbOmO5Ia+tFU0FfRHe6w/MNVjtowCceJruVjpINY+WLdxfV1qoB0XKN5yYS4eRX5XThNttvlJjRgdWKkG22jqtZoEjlkt3Exet2U5xwcLWmEbmw1iL0Yinh7/xka16p7FnPOjldwfq8YB4/jkY8Mw/xH9smhiYg6kFK4NvfyYbqiDsSkK6/SDIh+VAxgyNgvFt6rKF/BunZeU5CzXunWaAaYiFrYMI3mb2LL+X/MKwd6mtnIjsrXX0Iho0iV25BXY03CcEB81bJvOPfI0oZxEnlQx4MSOMdZDQ7LcwHc0U8FscQ11tU89jvj6PYiWLT2VSpnXowgquQ== ARC-Message-Signature: i=2; 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=zpcYtfz5IEfihtD/rdDNUTeQLnWRQDCFs14BCS3O4A4=; b=Nv9BrD4hBDxCtkI3mDYmf4Cp3/WxClMd+rSqNxkNa0NoYCORVAHwVjAvQFpxhoOm/402U6CP+Mj88SU9KzPziUyOCBfhqXIZdQc39cjKTfkJr6nPCRdHuwKirgbbA2jdkXjbnFU63jpY7aV8HEqSdf+nHzpgSwn9vW/2XB8V55eSfccMNSCa4Ah77KaCmiTj2PW1Idp15vZH+EWRIKFHQQqBcMQOjOVfL/S88Ma66+q5uYxskMUE51m0SNCnzxnjBXIjMtiaqZYclCKS6F9tWOs1BjZe7xLC8Jn2cHYHz4IFito0NfRE96rqudU3iCTY8PeWU8DpQaH9J/8d2oFhZg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=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=zpcYtfz5IEfihtD/rdDNUTeQLnWRQDCFs14BCS3O4A4=; b=v9IPwpQ0eFeCHeMyayejaDboa4NT1O0avYZAdZPDAh5LpCsOJmx+YhMw817PaIixgWd7AmmyXC+CqTOvjP81cN+j58BYEHlFZ4Cj9ID+elRies+4I6G0v2613QmRnTI4+ZeKiemKyHcp6e8E+cK2Pic9bzZnxE2+nTPTmpHfFOg= Received: from AM9P192CA0006.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::11) by DU2PR08MB7342.eurprd08.prod.outlook.com (2603:10a6:10:2f1::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.27; Fri, 19 Apr 2024 13:29:04 +0000 Received: from AM3PEPF00009B9E.eurprd04.prod.outlook.com (2603:10a6:20b:21d:cafe::19) by AM9P192CA0006.outlook.office365.com (2603:10a6:20b:21d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.26 via Frontend Transport; Fri, 19 Apr 2024 13:29:04 +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 AM3PEPF00009B9E.mail.protection.outlook.com (10.167.16.23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Fri, 19 Apr 2024 13:29:02 +0000 Received: ("Tessian outbound 93e51b94fd50:v313"); Fri, 19 Apr 2024 13:29:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d68ae75533bfd9f7 X-CR-MTA-TID: 64aa7808 Received: from 1cc5cadc4ac1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 619F3F04-7C29-4167-80D1-3A17B9DC0BE6.1; Fri, 19 Apr 2024 13:28:56 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1cc5cadc4ac1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 Apr 2024 13:28:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FGdAJnKtkEBHvI1ASdqqpICmlR3mn7CxG0QU4pSgUc9cC/D6qYzSyKGxNzRm2k/c03XolUJIZEdx/EJlKB4nSLx41uwUxgt6RWbZfI4byljBb3xpdinXdeB9UmofJu/zhwj+I/7hDOZhmyvd3cwHH3SXMiUGLf452/PtoF8Kp/6AS1rXHWiAxeR016V9H+JsbNTDyQhzmiH4u+mt2n6CviJanpawm8OTy90bNvfvCcUNOBePTqydxxpn0SFt1VFL75F1Dv2P8hApAYgsssZIKPft+thZzFa9RMQK9b7qDGsnT5UXzJGqwpczB80oYViIit0K6VpAx7CbyzhwuCMZhw== 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=zpcYtfz5IEfihtD/rdDNUTeQLnWRQDCFs14BCS3O4A4=; b=C7MjgDBrot+3ap7epCEyNpaJiXfJQTm14hXLcaJmV/g0IA1Sye+DgKq4L7arnzRm1+Dxcq9+b2fl3BWtPC+kTqnlyC6itB2j5Ku01kFdxU6/haHXqpBy+MeQMiBKXo37wnSO6nUojmllK8CsIjr2M3q/1RRn9EoKtJqunNAFrNG9r/JOsY3d2qQF8pAh43LqRnZ9XOmfQPeNNCAGhvMxoZLvC5e16Mnjl1j8awdc2UsgJjS9+EcbHH2Ul58nF6MKTrIP06EwjkkGx+se660M+c+0LDj9EuzaLcSFejTd6sdjARlC/RKzeDEkPUtFmAEOnfnP9ey9GMufevtnEkzGZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=zpcYtfz5IEfihtD/rdDNUTeQLnWRQDCFs14BCS3O4A4=; b=v9IPwpQ0eFeCHeMyayejaDboa4NT1O0avYZAdZPDAh5LpCsOJmx+YhMw817PaIixgWd7AmmyXC+CqTOvjP81cN+j58BYEHlFZ4Cj9ID+elRies+4I6G0v2613QmRnTI4+ZeKiemKyHcp6e8E+cK2Pic9bzZnxE2+nTPTmpHfFOg= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by PAVPR08MB9860.eurprd08.prod.outlook.com (2603:10a6:102:2f4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.43; Fri, 19 Apr 2024 13:28:53 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::a0e:800c:c8b2:5ff0]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::a0e:800c:c8b2:5ff0%4]) with mapi id 15.20.7472.042; Fri, 19 Apr 2024 13:28:53 +0000 Date: Fri, 19 Apr 2024 14:28:51 +0100 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH]middle-end: refactory vect_recog_absolute_difference to simplify flow [PR114769] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0335.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::16) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|PAVPR08MB9860:EE_|AM3PEPF00009B9E:EE_|DU2PR08MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: c69e918d-8663-4d14-fc55-08dc6074aded 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: YstVaHUwHk4d8aJrM7n4yktd6Je/KSwG57pBkdEFREi87a/vtYorPx861ybHBTYSO0iMLFx6MwDniEiwDXi+UL1JKMbHhJU/qoUuvntVJrMggD+Z68+PnQabPrFOu+HDdfdMB4m113YSmfqtOYhoQrlceAy3zeuPXkz1LDM3RdB8WjJSbCF3Eg414WF2TV207miedxYKpAy1Y1lMWzsObUvsIjHbrQIHXGvbeU2dxPR3wx2MVK8nBBRtpnaqzUsMxhdkLWU/QV4LsDr9B2exexTZk0TFg4+ryRX8YkL/SS82Gxu8AHqJ1QZMAG3NIRToMF5UohLXgghtq57K0frp+H5iaxU4su883SM0rlUMh8qR83Jx9t6s9Axi+1IOPaaKQPcybUjYs22dgnB40bbw+jMedVm47pnOM6VxhuR5GuP7+/Uzo7gKBWgaX3uKgA9FljYW5NartX6I4rb0beC36OIdRrhuzD9PsvmqgCFhcstsPSHNRVD/FzaN6y3iVYfK5Lts5R725XPoy4YXAOT+k9R1c2TPK8Lue5B6eeDP8IJTVW2l19y2FZ/Q0RKlcYyyAAmPzioGixSYm5qXPUnVDj9c8XV14nXp8PBxhZj1MDKsAHbG1lnmWsIfRAUG69zLMWtGRsjteU1lbBfh7hCdpGYp7DTrz0y+bpBrIqWt7qM= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9860 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF00009B9E.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a97d98b6-beab-4305-e241-08dc6074a83d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K0+pnfZ5ZKBcyM8XB93lIeIiT3MArzTwh+TIBh8NVLPFmRIcjwRl++hQYdIYy1R2j8DMUIsPkdGpNGnpxxFUo+m7BWEKzDgCrqd4TZkNg4nL92b/7mbZqESiMXv73zcvrHNsOOVkRkNFP/XKzUSpaVuhwToZ9kk0ftUffuukxwFGy0mDU/+I0iQiKKDt/Ea25nZGUJ+HQIs2IF1SmcVNz2AeFH6sOqrkz1DI6CzKSZg0uRcjA8aOBgGgs3hSaqvD1B245mVD2mHzAxPPBl/HmuOhiK5fV+YU7XrrsxW7Z9HFM1hLlVki26YNJVNE2YAwo+lX4HIGwRuXz9QTXmujeTm+SidrBm6AE/mjvEn02BYopI+0ugIKTrwNIdkh7RG232szbV5yaXFfxnf68lsX+DRYEBbo4/x4SM5bsF/XJbhnk+6TmZKw4Cl0bH7GUIN4Y4AcXC7DH20BXZSHj9HUQVxxPnGVoLPvcgn7ZKNjtm8VTAjCpPWblhx5iJT7WkXM7mMXQNW0fBG4Ggj07UwF0hjy9Mm3BeK/5glTWMAYHarftwS3qEM3yBr/EpSTQAp66vUUmFJAEXIkj0RxvNF5gUPDiYSDbw2uZVWe2b2gS5HEhus2ikbF0Au8KBM9J/BtqWn0RmGlPaiQPGx8y+ACJqj/eVG/69uJ4mxZKu9ra+IvU6cCkrhvhT+DUYtDcAF1JKqaguFhgJRs9t/EKRZL9z3q5rG035FgCIdacnD1d5GO2oN79mHCQbfgvXixO0wW 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:(13230031)(1800799015)(82310400014)(376005)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2024 13:29:02.9358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c69e918d-8663-4d14-fc55-08dc6074aded 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: AM3PEPF00009B9E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB7342 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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 Hi All, As the reporter in PR114769 points out the control flow for the abd detection is hard to follow. This is because vect_recog_absolute_difference has two different ways it can return true. 1. It can return true when the widening operation is matched, in which case unprom is set, half_type is not NULL and diff_stmt is not set. 2. It can return true when the widening operation is not matched, but the stmt being checked is a minus. In this case unprom is not set, half_type is set to NULL and diff_stmt is set. This because to get to diff_stmt you have to dig through the abs statement and any possible promotions. This however leads to complicated uses of the function at the call sites as the exact semantic needs to be known to use it safely. vect_recog_absolute_difference has two callers: 1. vect_recog_sad_pattern where if you return true with unprom not set, then *half_type will be NULL. The call to vect_supportable_direct_optab_p will always reject it since there's no vector mode for NULL. Note that if looking at the dump files, the convention in the dump files have always been that we first indicate that a pattern could possibly be recognize and then check that it's supported. This change somewhat incorrectly makes the diagnostic message get printed for "invalid" patterns. 2. vect_recog_abd_pattern, where if half_type is NULL, it then uses diff_stmt to set them. So while the note in the dump file is misleading, the code is safe. This refactors the code, it now only has 1 success condition, and diff_stmt is always set to the minus statement in the abs if there is one. The function now only returns success if the widening minus is found, in which case unprom and half_type set. This then leaves it up to the caller to decide if they want to do anything with diff_stmt. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/114769 * tree-vect-patterns.cc: (vect_recog_absolute_difference): Have only one success condition. (vect_recog_abd_pattern): Handle further checks if vect_recog_absolute_difference fails. --- -- diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 4f491c6b8336f8710c3519dec1fa7e0f49387d2b..87c2acff386d91d22a3b2d6e6443d1f2f2326ea6 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -797,8 +797,7 @@ vect_split_statement (vec_info *vinfo, stmt_vec_info stmt2_info, tree new_rhs, HALF_TYPE and UNPROM will be set should the statement be found to be a widened operation. DIFF_STMT will be set to the MINUS_EXPR - statement that precedes the ABS_STMT unless vect_widened_op_tree - succeeds. + statement that precedes the ABS_STMT if it is a MINUS_EXPR.. */ static bool vect_recog_absolute_difference (vec_info *vinfo, gassign *abs_stmt, @@ -843,6 +842,12 @@ vect_recog_absolute_difference (vec_info *vinfo, gassign *abs_stmt, if (!diff_stmt_vinfo) return false; + gassign *diff = dyn_cast (STMT_VINFO_STMT (diff_stmt_vinfo)); + if (diff_stmt && diff + && gimple_assign_rhs_code (diff) == MINUS_EXPR + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd))) + *diff_stmt = diff; + /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi inside the loop (in case we are analyzing an outer-loop). */ if (vect_widened_op_tree (vinfo, diff_stmt_vinfo, @@ -850,17 +855,6 @@ vect_recog_absolute_difference (vec_info *vinfo, gassign *abs_stmt, false, 2, unprom, half_type)) return true; - /* Failed to find a widen operation so we check for a regular MINUS_EXPR. */ - gassign *diff = dyn_cast (STMT_VINFO_STMT (diff_stmt_vinfo)); - if (diff_stmt && diff - && gimple_assign_rhs_code (diff) == MINUS_EXPR - && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd))) - { - *diff_stmt = diff; - *half_type = NULL_TREE; - return true; - } - return false; } @@ -1499,27 +1493,22 @@ vect_recog_abd_pattern (vec_info *vinfo, tree out_type = TREE_TYPE (gimple_assign_lhs (last_stmt)); vect_unpromoted_value unprom[2]; - gassign *diff_stmt; - tree half_type; - if (!vect_recog_absolute_difference (vinfo, last_stmt, &half_type, + gassign *diff_stmt = NULL; + tree abd_in_type; + if (!vect_recog_absolute_difference (vinfo, last_stmt, &abd_in_type, unprom, &diff_stmt)) - return NULL; - - tree abd_in_type, abd_out_type; - - if (half_type) - { - abd_in_type = half_type; - abd_out_type = abd_in_type; - } - else { + /* We cannot try further without having a non-widening MINUS. */ + if (!diff_stmt) + return NULL; + unprom[0].op = gimple_assign_rhs1 (diff_stmt); unprom[1].op = gimple_assign_rhs2 (diff_stmt); abd_in_type = signed_type_for (out_type); - abd_out_type = abd_in_type; } + tree abd_out_type = abd_in_type; + tree vectype_in = get_vectype_for_scalar_type (vinfo, abd_in_type); if (!vectype_in) return NULL;