PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_priv_comp_ia64.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
17 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * This file is part of libpfm, a performance monitoring support library for
23 * applications on Linux/ia64.
24 */
25#ifndef __PFMLIB_PRIV_COMP_IA64_H__
26#define __PFMLIB_PRIV_COMP_IA64_H__
27
28#include <perfmon/pfmlib_comp.h>
29
30#ifdef LIBPFM_USING_INTEL_ECC_COMPILER
31
32#define ia64_get_cpuid(regnum) __getIndReg(_IA64_REG_INDR_CPUID, (regnum))
33#define ia64_getf(d) __getf_exp(d)
34
35#elif defined(__GNUC__)
36
37static inline unsigned long
38ia64_get_cpuid (unsigned long regnum)
39{
40 unsigned long r;
41
42 asm ("mov %0=cpuid[%r1]" : "=r"(r) : "rO"(regnum));
43 return r;
44}
45
46static inline unsigned long
47ia64_getf(double d)
48{
49 unsigned long exp;
50
51 __asm__ ("getf.exp %0=%1" : "=r"(exp) : "f"(d));
52 return exp;
53}
54#else /* !GNUC nor INTEL_ECC */
55#error "need to define a set of compiler-specific macros"
56#endif
57
58#endif /* __PFMLIB_PRIV_COMP_IA64_H__ */