PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_comp_ia64.h
Go to the documentation of this file.
1/*
2 * IA-64 compiler specific macros
3 *
4 * Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
5 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11 * of the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef __PFMLIB_COMP_IA64_H__
25#define __PFMLIB_COMP_IA64_H__
26
27#ifndef __PFMLIB_COMP_H__
28#error "you should never include this file directly, use pfmlib_comp.h"
29#endif
30
31#ifndef __ia64__
32#error "you should not be including this file"
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/*
40 * this header file contains all the macros, inline assembly, instrinsics needed
41 * by the library and which are compiler-specific
42 */
43
44#if defined(__ECC) && defined(__INTEL_COMPILER)
45#define LIBPFM_USING_INTEL_ECC_COMPILER 1
46/* if you do not have this file, your compiler is too old */
47#include <ia64intrin.h>
48#endif
49
50
51#ifdef LIBPFM_USING_INTEL_ECC_COMPILER
52
53#define ia64_sum(void) __sum(1<<2)
54#define ia64_rum(void) __rum(1<<2)
55#define ia64_get_pmd(regnum) __getIndReg(_IA64_REG_INDR_PMD, (regnum))
56#define pfmlib_popcnt(v) _m64_popcnt(v)
57
58#elif defined(__GNUC__)
59
60static inline void
61ia64_sum(void)
62{
63 __asm__ __volatile__("sum psr.up;;" ::: "memory" );
64}
65
66static inline void
67ia64_rum(void)
68{
69 __asm__ __volatile__("rum psr.up;;" ::: "memory" );
70}
71static inline unsigned long
72ia64_get_pmd(int regnum)
73{
74 unsigned long value;
75 __asm__ __volatile__ ("mov %0=pmd[%1]" : "=r"(value) : "r"(regnum));
76 return value;
77}
78
79static inline unsigned long
80pfmlib_popcnt(unsigned long v)
81{
82 unsigned long ret;
83 __asm__ __volatile__ ("popcnt %0=%1" : "=r"(ret) : "r"(v));
84 return ret;
85}
86#else /* !GNUC nor INTEL_ECC */
87#error "need to define a set of compiler-specific macros"
88#endif
89
90#ifdef __cplusplus /* extern C */
91}
92#endif
93
94#endif /* __PFMLIB_COMP_IA64_H__ */
#define pfmlib_popcnt