From patchwork Fri Jul 21 12:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Malcomson X-Patchwork-Id: 123828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp159589vqg; Fri, 21 Jul 2023 05:13:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/hXZKuwQNjzdQ2NPWQ+QUr38WaiVTQGsiZtT+UCwyginRhE8MZE6emeJcRSZdU3521gcr X-Received: by 2002:a17:907:2bda:b0:97d:2bcc:47d5 with SMTP id gv26-20020a1709072bda00b0097d2bcc47d5mr1317493ejc.49.1689941606138; Fri, 21 Jul 2023 05:13:26 -0700 (PDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y20-20020a170906915400b00991b9b54b2asi2091198ejw.135.2023.07.21.05.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 05:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="B2/Q4Aoh"; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 474E03870885 for ; Fri, 21 Jul 2023 12:12:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 474E03870885 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689941569; bh=Q4u9SH7nztoXLKS6otl9PbBBlyyoWlK8eLPy8nPxOYE=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=B2/Q4AohTjY8qLrPBgyFBsdTZDBXk8X5uD6tCjC5OBM9utwMoTASbIYv/PBipvnwU wqFnqsxVWPFzmdCIf/KLTA4JOFabVSPsxUB5xutRQnhnK63KAxslNX6ApyblzlfXSH yLNpG7ewkaCTKL6vmOBCS8a58/HlDJMpjcdExs14= 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-db8eur05on2049.outbound.protection.outlook.com [40.107.20.49]) by sourceware.org (Postfix) with ESMTPS id BC5AB3858D3C for ; Fri, 21 Jul 2023 12:11:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC5AB3858D3C Received: from DBBPR09CA0013.eurprd09.prod.outlook.com (2603:10a6:10:c0::25) by AM0PR08MB5380.eurprd08.prod.outlook.com (2603:10a6:208:183::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 12:11:49 +0000 Received: from DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::af) by DBBPR09CA0013.outlook.office365.com (2603:10a6:10:c0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Fri, 21 Jul 2023 12:11:49 +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 DBAEUR03FT054.mail.protection.outlook.com (100.127.142.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.16 via Frontend Transport; Fri, 21 Jul 2023 12:11:49 +0000 Received: ("Tessian outbound f9124736ff4f:v145"); Fri, 21 Jul 2023 12:11:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3b1162eafc83146e X-CR-MTA-TID: 64aa7808 Received: from 9013ef41b49f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 90EC4AC0-BF2A-4839-951E-FD70F5BF040A.1; Fri, 21 Jul 2023 12:11:41 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9013ef41b49f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 21 Jul 2023 12:11:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLuYdmtPuLviHcpJbbZo2ywmHFW871Ls3Hvv2/s71/pv/bZibINMaDDmBqibMcSjUMHfvUnCAG5rl66v4OGKJ8lbDkfE1fxn622YAFy99BlImu/YvzpuTTEQL+n0XDK7ihaoavJZJA4UvwELFtxYVNpl8lZhcSYqkFjt7t75rmFM3vzwCoDkMMLGOFrjTbtVItTx/GhLn3oQOZa+bK85T8R9eKMLZOTJ8GssXsNA96nniZ9nWzk7TDrsOMtuzz6/dHceWaY4KE1yVuxf4XjcaC+5O50ub+TAn12i4hmPSuNG41p5OqwMBT1CKNdaQaXmTELYXObJY3ZzlSWN2fLJjA== 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=Q4u9SH7nztoXLKS6otl9PbBBlyyoWlK8eLPy8nPxOYE=; b=jjQVhGihldy/BISdsFPbCVCrG5YpOzDmkQIXF3uNUbf3LatWirTJP788fjy23gjt5GGDDbTq9X3VfhOjZZkF75GqPSTilgh8EHtHF377jtxd2g4F8L4L8mOMMpkENXgw5ENPc7l1FRkcc3SQ4+SbYDhC48fTCzYi7jCJ4/7NoVdHbFuVnljl4yanlRb1bj4YOOo2FeGBOtnO0XIB0BkEwDF35ItnY0tqMACyYV6ChYo7MMardV1VAxbkojnMTa1D8Es6rWhTFFdmbomYgvpsznbyCVHa8JibPa21BRbSIj4tHs4otNH6pDJCHyI7wCqvYlGi9P4SfKIwdLpe+uvyRw== 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 Received: from AM0PR10CA0003.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::13) by DB4PR08MB8101.eurprd08.prod.outlook.com (2603:10a6:10:387::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Fri, 21 Jul 2023 12:11:40 +0000 Received: from AM7EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:17c:cafe::9c) by AM0PR10CA0003.outlook.office365.com (2603:10a6:208:17c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25 via Frontend Transport; Fri, 21 Jul 2023 12:11:40 +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 AM7EUR03FT044.mail.protection.outlook.com (100.127.140.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6609.28 via Frontend Transport; Fri, 21 Jul 2023 12:11:40 +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, 21 Jul 2023 12:11:38 +0000 Received: from e120487.cambridge.arm.com (10.2.78.49) 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, 21 Jul 2023 12:11:38 +0000 MIME-Version: 1.0 To: CC: , Subject: [PATCH] Reduce floating-point difficulties in timevar.cc Date: Fri, 21 Jul 2023 13:11:38 +0100 Message-ID: X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT044:EE_|DB4PR08MB8101:EE_|DBAEUR03FT054:EE_|AM0PR08MB5380:EE_ X-MS-Office365-Filtering-Correlation-Id: 16f719b6-ed36-4717-9228-08db89e3a943 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: pqBMUbaILcPNOcXZPLbGPJyGygmW1WcxzB3x1pxWRey6yHTOIV2nAYkOe0w6tILQxBwpucZ2SsZBSS3w5KzGx/C5dROk/HNhPbFgDeUdkqMsWrUe9GptlLM2AsuqpdO21pLi5XL/elIXCVDnK+ROzJkIR+xIxfh8cB3rtq4C6l902y0cG8k6j9aLJPhaBfk/gbKPFTpa0eWZZONXU4ZCeld2B7YhKCJ1sDOXj49CZfxeNEG9JXm+SBQRiRPhpxVuwPmBJiPUVdlDd66ZF0g6S25pf2f/HMQTY5dq5NI/uUDTcLMYxz1dITat2S4FiBuhGJyzBZZDaHmMOlrY+6PFj+G4O9pp4dBPeRYXzo+OWK+gpflhOHHfyaZxMrTt8mz0g/YEYAwkmM9THP7tcaiocwVkcBa61RVVYTPun92oQ4maGt0CAD+0HRELLgRz9/6mMrg4jbjeSdEuZb6lBKkKYG7pEle4A8RmVja5M1MgrIm4+IPeg/7vF0Y31Wp5iSPCLUZ75RdrfG9oiKfpZrMVnFHENbBT/W73UBTCWL5LZXkKY2yldS5K7GMk44GJW9g4ka3eN6JEkh7D4ohjfpClYfsxvj8Wa/5A2oG+iRwQ6FCx9og72hSUFx2txw/kmUJ51fFGZjRiWIMm6wmaABjaJ6Ox52klc7oXMCmNND0OYc04ENWXcdC2zoL1c+zDejutVHfAfHJzPWCyl2OJvMRtwlVi5Zr+jao4uY7b/8PeDz5Y96X6o/yqoinP0zFlaVZ+foVzqQs7vsVFAWeWNuDIig== 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)(396003)(346002)(39860400002)(376002)(136003)(82310400008)(451199021)(46966006)(36840700001)(40470700004)(478600001)(31686004)(81166007)(82740400003)(356005)(31696002)(86362001)(4326008)(6916009)(316002)(47076005)(70206006)(36860700001)(70586007)(33964004)(426003)(54906003)(2906002)(41300700001)(44832011)(8676002)(40480700001)(40460700003)(8936002)(235185007)(186003)(26005)(5660300002)(336012)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8101 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c04d69f0-446a-440b-449a-08db89e3a3de X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SxdPjlpA6JiCNonCQ4+/Nfn1A5Fq4M8RXIpKdQh4dl/GD7IZ9DuweY658izM7o0SGFhy5O6xDwp5R/aRSt3HNa8t/EnpQ6kmMYkcGvv/s6iBfJZWXS+lG4JgadD5sJP+VvFHZkOnkZdPStr0KavvprgSnAB+/lawzcVP6RmP66+zaJp5Af/ZotmcTY/dHf7lqsSUAqbUhA/Ln2UqAzPXuK8UXM0o0EYVsNeHIteQkewpwHYhw+NYJ6FPGgi0/I1ZgS5LmlkV/KPFWQSaL3n/Cof2Pk5ylPGwzJU9nYDc5VIFQCtsLd0mjsKnefD+6+kFf5lNjlDfC8kWfF1mGZZURtw4ZNtqH9jZc1SENaGb2WIXzlh8l0taNT1jsQvgdv9UbDg3yCdwNRO3iL9fim2VagCAHDmGbZ/idhUub+IcWaA90Kp0Z/VR4BX9Ao3++OxadQyaN+0SiUVH7KI9ioSW5+QXGYl+7OEdlaKwT4U7ZMZ7g1n7NZhGnv7Va5LHbEZvqD9SzU1nATa+U247whB+6bf+bXOo3MGIsy4Dw9ygTO1eIaZwOgogOuwMfSqQq5v9r6waDhMbj4nFbRANNzP79BHG27C3CxwLv8GhK2wTXt5RR3WqfC/r9F7cqKN/GP5DHbn3nzhbUchnAVBA+z2HuQxWlB+hv5OdRQ0un0uhHF0wNeJPk6jMAOjdpvifnxyUuuNYex38CMJUmddq3s93WqJdgd2FSBZYio4v/OtndgpScS38gvMmcTwPwT2kLswh 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)(346002)(396003)(39860400002)(136003)(376002)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(31686004)(54906003)(33964004)(478600001)(36860700001)(40460700003)(86362001)(31696002)(40480700001)(2906002)(426003)(107886003)(186003)(26005)(336012)(47076005)(82740400003)(81166007)(70586007)(4326008)(316002)(6916009)(44832011)(70206006)(41300700001)(8676002)(235185007)(5660300002)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 12:11:49.3260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16f719b6-ed36-4717-9228-08db89e3a943 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: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5380 X-Spam-Status: No, score=-12.5 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, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Matthew Malcomson via Gcc-patches From: Matthew Malcomson Reply-To: Matthew Malcomson Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772032209668531041 X-GMAIL-MSGID: 1772032209668531041 On some AArch64 bootstrapped builds, we were getting a flaky test because the floating point operations in `get_time` were being fused with the floating point operations in `timevar_accumulate`. This meant that the rounding behaviour of our multiplication with `ticks_to_msec` was different when used in `timer::start` and when performed in `timer::stop`. These extra inaccuracies led to the testcase `g++.dg/ext/timevar1.C` being flaky on some hardware. This change ensures those operations are not fused and hence stops the test being flaky on that particular machine. There is no expected change in the generated code. Bootstrap & regtest on AArch64 passes with no regressions. gcc/ChangeLog: * timevar.cc (get_time): Make this noinline to avoid fusing behaviour and associated test flakyness. N.b. I didn't know who to include as reviewer -- guessed Richard Biener as the global reviewer that had the most contributions to this file and Richard Sandiford since I've asked him for reviews a lot in the past. ############### Attachment also inlined for ease of reply ############### diff --git a/gcc/timevar.cc b/gcc/timevar.cc index d695297aae7f6b2a6de01a37fe86c2a232338df0..5ea4ec259e114f31f611e7105cd102f4c9552d18 100644 --- a/gcc/timevar.cc +++ b/gcc/timevar.cc @@ -212,6 +212,7 @@ timer::named_items::print (FILE *fp, const timevar_time_def *total) HAVE_WALL_TIME macros. */ static void +__attribute__((noinline)) get_time (struct timevar_time_def *now) { now->user = 0; diff --git a/gcc/timevar.cc b/gcc/timevar.cc index d695297aae7f6b2a6de01a37fe86c2a232338df0..5ea4ec259e114f31f611e7105cd102f4c9552d18 100644 --- a/gcc/timevar.cc +++ b/gcc/timevar.cc @@ -212,6 +212,7 @@ timer::named_items::print (FILE *fp, const timevar_time_def *total) HAVE_WALL_TIME macros. */ static void +__attribute__((noinline)) get_time (struct timevar_time_def *now) { now->user = 0;