From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-fw-33001.amazon.com (smtp-fw-33001.amazon.com [207.171.190.10]) by sourceware.org (Postfix) with ESMTPS id C84FD385438C for ; Thu, 12 Jan 2023 14:38:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C84FD385438C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=amazon.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1673534308; x=1705070308; h=from:to:cc:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:subject; bh=NB7c6TZMi0GeZcS2a1J91MkKDkaXg2N261xKP5VieAg=; b=BpJxuhSI3s+MIS/DpgbYKw5qDSHsO/+tU/orlM8gyjMEmHOYroD4DQq4 /f1sn4OZ6OdRtWFGPrEbuqXLMpOQuHkOHrFUGhr1UpjuegCkbOuaOC5RQ em58zRn2+F/5dbW1CArAzxDu/xHucZdkyZ+BmQigJoaDlwWYw6+Mvb+PS c=; X-IronPort-AV: E=Sophos;i="5.97,211,1669075200"; d="scan'208";a="254650179" Subject: RE: bug fix for hp-timing.h (aarch64) Thread-Topic: bug fix for hp-timing.h (aarch64) Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-iad-1e-m6i4x-3e1fab07.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-33001.sea14.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 14:38:26 +0000 Received: from EX13MTAUWA001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1e-m6i4x-3e1fab07.us-east-1.amazon.com (Postfix) with ESMTPS id 9496A83424; Thu, 12 Jan 2023 14:38:25 +0000 (UTC) Received: from EX19D044UWA003.ant.amazon.com (10.13.139.43) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 12 Jan 2023 14:38:25 +0000 Received: from EX19D044UWA004.ant.amazon.com (10.13.139.7) by EX19D044UWA003.ant.amazon.com (10.13.139.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.7; Thu, 12 Jan 2023 14:38:24 +0000 Received: from EX19D044UWA004.ant.amazon.com ([fe80::781f:7190:c095:c260]) by EX19D044UWA004.ant.amazon.com ([fe80::781f:7190:c095:c260%5]) with mapi id 15.02.1118.020; Thu, 12 Jan 2023 14:38:24 +0000 From: "Tang, Jun" To: Wilco Dijkstra , "zack@owlfolio.org" CC: 'GNU C Library' Thread-Index: AQHZJg3QVFAnSPDyTkassNg7m1D9266a2aDg Date: Thu, 12 Jan 2023 14:38:24 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.106.179.8] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Zack, Wilco, Thanks for the suggestions, Hp-timing.h is used for glibc bench timing, and calculating in float is to = avoid any future overflowing (the chance is probably very small).=20 Regards, Jun -----Original Message----- From: Wilco Dijkstra =20 Sent: Wednesday, January 11, 2023 4:49 PM To: zack@owlfolio.org; Tang, Jun Cc: 'GNU C Library' Subject: [EXTERNAL] bug fix for hp-timing.h (aarch64) CAUTION: This email originated from outside of the organization. Do not cli= ck links or open attachments unless you can confirm the sender and know the= content is safe. Hi Zack, > - (Diff) =3D ((End) - (Start)) * (UINT64_C(1000000000) / freq); \ > + (Diff) =3D (((End) - (Start)) * UINT64_C(1000000000)) / freq; \ > > This avoids using floating-point arithmetic but should still do the resca= le correctly. > (The multiplier and divisor are both guaranteed to be less than 2**32,=20 > so, as long as we do the multiplication in 64-bit arithmetic, we=20 > cannot lose bits via overflow.) However this will overflow after about 16 seconds - and that's short even f= or basic benchmarking. Since this code is not performance critical, using f= loating point here is reasonable. Cheers, Wilco