From fdc07525f4c210ab6a394ce52955dbf279fff311 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 15 Mar 2005 22:31:32 +0000 Subject: [BZ #789] 2005-03-15 Jakub Jelinek [BZ #789] * sysdeps/i386/i686/hp-timing.h (HP_TIMING_ACCUM): Fix asm constraints. Remove memory clobber. * sysdeps/x86_64/hp-timing.h (HP_TIMING_ACCUM): Make the addition thread-safe. Subtract GLRO(dl_hp_timing_overhead) from Diff. --- sysdeps/x86_64/hp-timing.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sysdeps/x86_64') diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h index e015ff79db..59a29abd45 100644 --- a/sysdeps/x86_64/hp-timing.h +++ b/sysdeps/x86_64/hp-timing.h @@ -1,5 +1,5 @@ /* High precision, low overhead timing functions. x86-64 version. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,7 +31,11 @@ /* The funny business for 32-bit mode is not required here. */ # undef HP_TIMING_ACCUM -# define HP_TIMING_ACCUM(Sum, Diff) ((Sum) += (Diff)) - +# define HP_TIMING_ACCUM(Sum, Diff) \ + do { \ + hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \ + __asm__ __volatile__ ("lock; addq %1, %0" \ + : "=m" (Sum) : "r" (__diff), "m" (Sum)); \ + } while (0) #endif /* hp-timing.h */ -- cgit 1.4.1