Blame sysdeps/ia64/hp-timing.h

Packit Service 82fcde
/* High precision, low overhead timing functions.  IA-64 version.
Packit Service 82fcde
   Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
   Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#ifndef _HP_TIMING_H
Packit Service 82fcde
#define _HP_TIMING_H	1
Packit Service 82fcde
Packit Service 82fcde
/* We always assume having the timestamp register.  */
Packit Service 82fcde
#define HP_TIMING_AVAIL		(1)
Packit Service 82fcde
#define HP_SMALL_TIMING_AVAIL	(1)
Packit Service 82fcde
Packit Service 82fcde
/* We indeed have inlined functions.  */
Packit Service 82fcde
#define HP_TIMING_INLINE	(1)
Packit Service 82fcde
Packit Service 82fcde
/* We use 64bit values for the times.  */
Packit Service 82fcde
typedef unsigned long int hp_timing_t;
Packit Service 82fcde
Packit Service 82fcde
/* The Itanium/Merced has a bug where the ar.itc register value read
Packit Service 82fcde
   is not correct in some situations.  The solution is to read again.
Packit Service 82fcde
   For now we always do this until we know how to recognize a fixed
Packit Service 82fcde
   processor implementation.  */
Packit Service 82fcde
#define REPEAT_READ(val) __builtin_expect ((long int) val == -1, 0)
Packit Service 82fcde
Packit Service 82fcde
/* That's quite simple.  Use the `ar.itc' instruction.  */
Packit Service 82fcde
#define HP_TIMING_NOW(Var) \
Packit Service 82fcde
  ({ unsigned long int __itc;						      \
Packit Service 82fcde
     do									      \
Packit Service 82fcde
       asm volatile ("mov %0=ar.itc" : "=r" (__itc) : : "memory");	      \
Packit Service 82fcde
     while (REPEAT_READ (__itc));					      \
Packit Service 82fcde
     Var = __itc; })
Packit Service 82fcde
Packit Service 82fcde
#include <hp-timing-common.h>
Packit Service 82fcde
Packit Service 82fcde
#endif	/* hp-timing.h */