public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329]
@ 2023-02-22 17:17 Wilco Dijkstra
  0 siblings, 0 replies; only message in thread
From: Wilco Dijkstra @ 2023-02-22 17:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=311a7e0256975275d97077f1af338bc9caf0c837

commit 311a7e0256975275d97077f1af338bc9caf0c837
Author: Jun Tang <juntangc@amazon.com>
Date:   Wed Feb 22 16:45:59 2023 +0000

    AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329]
    
    Fix the computation to allow for cntfrq_el0 being larger than 1GHz.
    Assume cntfrq_el0 is a multiple of 1MHz to increase the maximum
    interval (1024 seconds at 1GHz).
    
    Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Diff:
---
 sysdeps/aarch64/hp-timing.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/hp-timing.h b/sysdeps/aarch64/hp-timing.h
index c8469e3011..b97e878f7b 100644
--- a/sysdeps/aarch64/hp-timing.h
+++ b/sysdeps/aarch64/hp-timing.h
@@ -41,7 +41,7 @@ typedef uint64_t hp_timing_t;
 #define HP_TIMING_DIFF(Diff, Start, End)			\
 ({  hp_timing_t freq;						\
     __asm__ __volatile__ ("mrs %0, cntfrq_el0" : "=r" (freq));	\
-   (Diff) = ((End) - (Start)) * (UINT64_C(1000000000) / freq);	\
+   (Diff) = (((End) - (Start)) * UINT64_C(1000000000 >> 6)) / (freq >> 6); \
 })
 
 #endif	/* hp-timing.h */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-22 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 17:17 [glibc] AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329] Wilco Dijkstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).