From patchwork Fri Dec 29 14:43:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1881093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Z1pXWrfb; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Z1pXWrfb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4T1p6x3DgYz20R0 for ; Sat, 30 Dec 2023 01:44:25 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43C5A385840B for ; Fri, 29 Dec 2023 14:44:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2042.outbound.protection.outlook.com [40.107.22.42]) by sourceware.org (Postfix) with ESMTPS id 61203385840D for ; Fri, 29 Dec 2023 14:44:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61203385840D 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 61203385840D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.22.42 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1703861045; cv=pass; b=OAwAlkiDaMO48ZAAWtV+/YoInyGeFNp0E4OlRhNLFk0D7w1/NwN+6e8zI+rqXdOTZQ7+KKnc4t5bdXBCSmamCOZKMm8hjMYff+KJVzMVI0pWS9+uWr4HaNV2b5zh0vJMmgrdjsukIzR7b2/j0GsK2EDK0B5dybJOosAs3f3t56Y= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1703861045; c=relaxed/simple; bh=CKNKWtzlusXaF74qCjDY2S85SWzxy0j2H7IxKT/i7C4=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=nVBYY/hGqFn4qDuJt1u/Fx++amJwqk8U4q8LIQQMVDzIXs1mK2A3jlyqg4Ou2c+ZU2YrhLpvCuLahjIKaxrjOQJ3ygUMtBmockPfAv7nPs1jPG1sDuBuG5wBmTq0OLIPWMYlDqUpiyr746AgU3WyjOpHyrTProBRvfETkgFzBbo= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=bY5ILxQ5iyfZuyNbSPwuro/u+8saEXQlqXMgaKVZ5SOVCV1ffurFRlVcGbvB3AUAm1BjaI9ackX6kzbAJXSI2N7ZpFdgetWjLlq2EZbF9EuJeueaiu3MFGhX33u+a1LDQCTXPrnG2jI05xVI0oUcIlukBIFN0vI3W3jA3JFynEOKEROH0FnEzG7vfGD5vWRzj7bZwmmAE5pfnBbTvWuAnwibphUdexaXoQbBoJlgeqq5Umk68biCzfOV91M6Q6I70PCmECc5cajMWapUk8BNSHbSSJpg7ivesSM1UCUvVd7eF3Q+gFiwO48cwEClZd6UN1iLa/VaFCDR0VtNZiLvnw== 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=Lc8pzJC4YNWxaAS/o6oizgUlLO4mD4/2KrgYwNv+Ey8=; b=oBPjqu3EIUOSbdRkESZ+KiZwSGQn9DVN2ux1MA7u5YuvjKwq4yT5HB5S+yH62yHxWrowHN0WT+kTG1qnUWn+uCzlcQ48hhaJ4J0hK8mbUJICQfFhGA14zNQOL1REf73RDpVKzOUe1joOReK2TWkONNRcxcll7RFiCOowqM8dIBNI0rvD+ZZNsw/wyyP+o2tMPQtyyk46Qx0fy8vZLE3prNyf84D3E2Hj7TQlZw+czpX8qAOV8GALxitKd8lV2Z0hMzXVYi5GPg7yD5pREw27nUabvXLtrUBxYfqPwY8NHKE8GtS7e/2V03n7O15tfVRn4MK0WoVq1Trzn21pS2Ebig== 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=Lc8pzJC4YNWxaAS/o6oizgUlLO4mD4/2KrgYwNv+Ey8=; b=Z1pXWrfbK5d7Yac1g4VVYTfqRKWs6ritVlMVf0kGFBJp52p34yPr5aoxf30F6zZyktRpPTMOZtrearcxEdTBxzERL+4XJtLzAKVFX5K1B/IV/synd/yC/o9Vs2Agc9DM3NiNtIdU/S5xsmOJMZcT3LWcKH17bO9cVCZL8nNifIU= Received: from AS9PR05CA0013.eurprd05.prod.outlook.com (2603:10a6:20b:488::6) by AS8PR08MB8037.eurprd08.prod.outlook.com (2603:10a6:20b:573::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Fri, 29 Dec 2023 14:43:59 +0000 Received: from AMS1EPF0000004E.eurprd04.prod.outlook.com (2603:10a6:20b:488:cafe::3a) by AS9PR05CA0013.outlook.office365.com (2603:10a6:20b:488::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21 via Frontend Transport; Fri, 29 Dec 2023 14:43:59 +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 AMS1EPF0000004E.mail.protection.outlook.com (10.167.16.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Fri, 29 Dec 2023 14:43:59 +0000 Received: ("Tessian outbound 385ad2f98d71:v228"); Fri, 29 Dec 2023 14:43:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c417c23a091ae5d5 X-CR-MTA-TID: 64aa7808 Received: from 489af2d0f957.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0DA70F99-9F01-47AA-8060-3D53742B723A.1; Fri, 29 Dec 2023 14:43:51 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 489af2d0f957.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 29 Dec 2023 14:43:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mtTCSvBM4/FIupiwiCFTj7wqbsMbUesTMKzR13/FUOO6C3ubuNWzdKC6FNua6eWa3rkBHk3vpdwMs2FRt5AM0NVJxn3zoRUY1IX3EydRvJBpBlUaFsm5N7rTMQitetwe206gABUa63XzJDLyJkrdUitzWHq4+LThAiwU3qGs08Cc/1XKtmRC46zPvgsDDT3AKFUit5rWFWYrl9/OCDlrHhaOXi1nF6ilBpdCg8brrujJqKsPiKqKmUljUfJo18CQtmzp227JaPayBb2+sGSMg8g8Qgl0RIML983/Cmp1coHHyPV99C4EV1j7C86kTMJVhrmuVQBRcTXFPpjwMr8rhw== 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=Lc8pzJC4YNWxaAS/o6oizgUlLO4mD4/2KrgYwNv+Ey8=; b=NU1VVWh2TQBdyP7eNybeHz4VkVH4pZtnSuARR8dSfVzW3QMhTIqobaMqghwKKb5NIsYzWKQHEksAcg1jKXoxQhVwT+tJLLZ+pJRG3jpzo3kYxKHa3KMW6okIPormUUvehJkKc1a2yuMMhAz1+5r1BESP1VfXFeSFNFUUYEBIUyCbEhxrX9aunTw4WdtTorqwFH3PQ50d/B5me8z3uIOAyEMiRncp0YiymTejKmMv+1PB0qQMXIsBVAaiIXm0ey1ZXXuKZftZCIo6I0xf72MTpuA98LTWIr09RIKNonEv+SxxVGmuWAQGyI0p/h5EDEBnPKo09+AutWYNCyah36j1Iw== 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=Lc8pzJC4YNWxaAS/o6oizgUlLO4mD4/2KrgYwNv+Ey8=; b=Z1pXWrfbK5d7Yac1g4VVYTfqRKWs6ritVlMVf0kGFBJp52p34yPr5aoxf30F6zZyktRpPTMOZtrearcxEdTBxzERL+4XJtLzAKVFX5K1B/IV/synd/yC/o9Vs2Agc9DM3NiNtIdU/S5xsmOJMZcT3LWcKH17bO9cVCZL8nNifIU= 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 PAXPR08MB6653.eurprd08.prod.outlook.com (2603:10a6:102:15f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21; Fri, 29 Dec 2023 14:43:49 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::9679:2ab0:99c6:54a3]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::9679:2ab0:99c6:54a3%6]) with mapi id 15.20.7135.019; Fri, 29 Dec 2023 14:43:49 +0000 Date: Fri, 29 Dec 2023 14:43:47 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH]middle-end: rejects loops with nonlinear inductions and early breaks [PR113163] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P265CA0300.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::24) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|PAXPR08MB6653:EE_|AMS1EPF0000004E:EE_|AS8PR08MB8037:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c7ee08f-a74d-4782-3b12-08dc087c979f 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: 6ccepoyPPDKsR8ODe32ZlJ/qtLkYRbXyPJAPDRmUx4bcvLQg3qipgKjbS4NeCN2ofIVwVb4lTjVFXV0uln2QnGmTTxH7WcOMhjvt/IQQXIfaWlAbPl/blzShPwYeHR7YfDo/ylLTAdbJa1m4sk4GDpFkzqfIFW+/WvgrR+NpZkATQlAYQP2HkMiMz1ef9vsYZwSjXBabZdoQ37JAbsmyhT2gGKq/0BX273ARIGjlr4TbLIW6lM/qTLKzQR0bsSjYsI+ThNT5gWcX6JY4EOUtG16LLzI1kpGMHIjU2tMOgPI61eCFmX7ga0HuAWcaSDK7j6Ad6WaM7X/QG351l/VD28Vx6dD8x5+FkSUQTSSCDTZ9p/FxKIyKEQxo1tSdgnHWmV5IRjfoG2xovYvijCV8vfGjUIBavtHsH/aL3i3O7Taw27d7r3fG3ceqyjrJghs8doi9mdJKRZlpKeQZwri3LQeptYbF7lPSzxKwSMAkJlNVdQTPF0I3YSBMb6nuPZw3hEOfKG0BALOZtcXiyoRAivywr/S8arVP1ZjzCc80LwG0FbuYUyhaqGZl/oZ4GMT392TsM1Mn+Zw0TiDFv+CrhBSxr0GYnmu3ewwkxLc2UKtlKxZVDHIGJ0HZx+mSRNZx 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)(376002)(366004)(346002)(136003)(396003)(39860400002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(44832011)(5660300002)(235185007)(8676002)(8936002)(4326008)(2906002)(478600001)(6486002)(44144004)(6506007)(6512007)(33964004)(6916009)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(2616005)(26005)(36756003)(38100700002)(83380400001)(4743002)(84970400001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6653 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: AMS1EPF0000004E.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 00279bf6-35cb-4c95-8640-08dc087c91d6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ew7bum6uptMS2K6dBJsznYkNM9AZp4+HogLLdPC7cJxqQxa14otfG380DSVBwN6N11dT2EpSrIJsLV2IQpW7cnEa9karJYm3snNpQw4zugY+Bax1uz1vLdSnrJsqJdx1lNwOYMl+AKf5tTVGHdRPJnV76PcK07KluIemOPjbzlqVYZ6dsi/ZayxrQzfqvh6K/0XrkTja3VZxqUBPAtqgHCKLXMv9y1YtG2BxVQfH5/a3L8es4X4DxFxFaC6NYkpXSyka72ebSTECoGrWqwRUi8siFo8dsdG2KnXENpd1cnEuigr18XIt8e252sSCn617TbiRSyHRXfjQ5Zsb/cTYtIFJiXpZzVtuaGOFGBi6Ta7F8rU0F4GEK4A8SkeeIFKjZAgHhFZ12YZjCrtyLYolN/wzPd77DneKC/42TYlt2RL67Gv0GVx0ov94udUDh3B8yr/MWJCbXm7dpC6FlILrnWvqb6bjc4LQsK+8wtfwwSOzACmRU4ZdD2tavgmmmG0LU781MVYqFK+nLZpmNr0ExiPxB3sI6wgSKSFXbO5HF2khaOEXQWDss3J04/WUAuuTKGJmMHBONxXJyjAVR+JWClp5BwuwqhGOGRCXVLSUXCBvTlyGBrtsl4QXMCts2RPjvXBbMM93A6T+J5W2jFxH6BhVEu2BlsNhResaL0qWYOcT0tRr6UVoIQYkiF0gvYhomYzcBbGl/NDXbcqBKLnRxZ/92s5DQlTD78aFH0wfhgY+X0CsOJvKcLPNUJ8cLfumha8uiLSHIR/lozcIWXUU3w== 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)(4636009)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(82310400011)(186009)(1800799012)(451199024)(64100799003)(46966006)(36840700001)(40470700004)(6486002)(84970400001)(8676002)(8936002)(86362001)(4326008)(70206006)(70586007)(6916009)(44832011)(40480700001)(33964004)(44144004)(6512007)(6506007)(235185007)(40460700003)(2906002)(5660300002)(478600001)(316002)(41300700001)(26005)(81166007)(356005)(107886003)(82740400003)(2616005)(336012)(47076005)(83380400001)(36756003)(4743002)(36860700001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2023 14:43:59.1748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c7ee08f-a74d-4782-3b12-08dc087c979f 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: AMS1EPF0000004E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8037 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, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi All, We can't support nonlinear inductions other than neg when vectorizing early breaks and iteration count is known. For early break we currently require a peeled epilog but in these cases we can't compute the remaining values. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. tested on cross cc1 for amdgcn-amdhsa and issue fixed. Ok for master? Thanks, Tamar gcc/ChangeLog: PR middle-end/113163 * tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p): gcc/testsuite/ChangeLog: PR middle-end/113163 * gcc.target/gcn/pr113163.c: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/gcc.target/gcn/pr113163.c b/gcc/testsuite/gcc.target/gcn/pr113163.c new file mode 100644 index 0000000000000000000000000000000000000000..99b0fdbaf3a3152ca008b5109abf6e80d8cb3d6a --- diff --git a/gcc/testsuite/gcc.target/gcn/pr113163.c b/gcc/testsuite/gcc.target/gcn/pr113163.c new file mode 100644 index 0000000000000000000000000000000000000000..99b0fdbaf3a3152ca008b5109abf6e80d8cb3d6a --- /dev/null +++ b/gcc/testsuite/gcc.target/gcn/pr113163.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O2 -ftree-vectorize" } */ + +struct _reent { union { struct { char _l64a_buf[8]; } _reent; } _new; }; +static const char R64_ARRAY[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +char * +_l64a_r (struct _reent *rptr, + long value) +{ + char *ptr; + char *result; + int i, index; + unsigned long tmp = (unsigned long)value & 0xffffffff; + result = + (( + rptr + )->_new._reent._l64a_buf) + ; + ptr = result; + for (i = 0; i < 6; ++i) + { + if (tmp == 0) + { + *ptr = '\0'; + break; + } + *ptr++ = R64_ARRAY[index]; + tmp >>= 6; + } +} diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 3810983a80c8b989be9fd9a9993642069fd39b99..f1bf43b3731868e7b053c186302fbeaf515be8cf 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -2075,6 +2075,22 @@ vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo, return false; } + /* We can't support partial vectors and early breaks with an induction + type other than add or neg since we require the epilog and can't + perform the peeling. PR113163. */ + if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo) + && LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant () + && LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) + && induction_type != vect_step_op_neg) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Peeling for epilogue is not supported" + " for nonlinear induction except neg" + " when iteration count is known and early breaks.\n"); + return false; + } + return true; } --- /dev/null +++ b/gcc/testsuite/gcc.target/gcn/pr113163.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O2 -ftree-vectorize" } */ + +struct _reent { union { struct { char _l64a_buf[8]; } _reent; } _new; }; +static const char R64_ARRAY[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +char * +_l64a_r (struct _reent *rptr, + long value) +{ + char *ptr; + char *result; + int i, index; + unsigned long tmp = (unsigned long)value & 0xffffffff; + result = + (( + rptr + )->_new._reent._l64a_buf) + ; + ptr = result; + for (i = 0; i < 6; ++i) + { + if (tmp == 0) + { + *ptr = '\0'; + break; + } + *ptr++ = R64_ARRAY[index]; + tmp >>= 6; + } +} diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 3810983a80c8b989be9fd9a9993642069fd39b99..f1bf43b3731868e7b053c186302fbeaf515be8cf 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -2075,6 +2075,22 @@ vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo, return false; } + /* We can't support partial vectors and early breaks with an induction + type other than add or neg since we require the epilog and can't + perform the peeling. PR113163. */ + if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo) + && LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant () + && LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) + && induction_type != vect_step_op_neg) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Peeling for epilogue is not supported" + " for nonlinear induction except neg" + " when iteration count is known and early breaks.\n"); + return false; + } + return true; }