elf: Take into account ${sysconfdir} in elf/tst-ldconfig-p.sh
[glibc.git] / sysdeps / ia64 / hp-timing.h
blob8b3a2ad717e328086bfc9e2204309f1e2ddd92c9
1 /* High precision, low overhead timing functions. IA-64 version.
2 Copyright (C) 2001-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef _HP_TIMING_H
20 #define _HP_TIMING_H 1
22 /* We indeed have inlined functions. */
23 #define HP_TIMING_INLINE (1)
25 /* We use 64bit values for the times. */
26 typedef unsigned long int hp_timing_t;
28 /* The Itanium/Merced has a bug where the ar.itc register value read
29 is not correct in some situations. The solution is to read again.
30 For now we always do this until we know how to recognize a fixed
31 processor implementation. */
32 #define REPEAT_READ(val) __builtin_expect ((long int) val == -1, 0)
34 /* That's quite simple. Use the `ar.itc' instruction. */
35 #define HP_TIMING_NOW(Var) \
36 ({ unsigned long int __itc; \
37 do \
38 asm volatile ("mov %0=ar.itc" : "=r" (__itc) : : "memory"); \
39 while (REPEAT_READ (__itc)); \
40 Var = __itc; })
42 #include <hp-timing-common.h>
44 #endif /* hp-timing.h */