annotate clang/lib/Headers/lwpintrin.h @ 176:de4ac79aef9d

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 17:13:11 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 /*===---- lwpintrin.h - LWP intrinsics -------------------------------------===
anatofuz
parents:
diff changeset
2 *
anatofuz
parents:
diff changeset
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 * See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 *
anatofuz
parents:
diff changeset
7 *===-----------------------------------------------------------------------===
anatofuz
parents:
diff changeset
8 */
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 #ifndef __X86INTRIN_H
anatofuz
parents:
diff changeset
11 #error "Never use <lwpintrin.h> directly; include <x86intrin.h> instead."
anatofuz
parents:
diff changeset
12 #endif
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #ifndef __LWPINTRIN_H
anatofuz
parents:
diff changeset
15 #define __LWPINTRIN_H
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 /* Define the default attributes for the functions in this file. */
anatofuz
parents:
diff changeset
18 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("lwp")))
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 /// Parses the LWPCB at the specified address and enables
anatofuz
parents:
diff changeset
21 /// profiling if valid.
anatofuz
parents:
diff changeset
22 ///
anatofuz
parents:
diff changeset
23 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
24 ///
anatofuz
parents:
diff changeset
25 /// This intrinsic corresponds to the <c> LLWPCB </c> instruction.
anatofuz
parents:
diff changeset
26 ///
anatofuz
parents:
diff changeset
27 /// \param __addr
anatofuz
parents:
diff changeset
28 /// Address to the new Lightweight Profiling Control Block (LWPCB). If the
anatofuz
parents:
diff changeset
29 /// LWPCB is valid, writes the address into the LWP_CBADDR MSR and enables
anatofuz
parents:
diff changeset
30 /// Lightweight Profiling.
anatofuz
parents:
diff changeset
31 static __inline__ void __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
32 __llwpcb (void *__addr)
anatofuz
parents:
diff changeset
33 {
anatofuz
parents:
diff changeset
34 __builtin_ia32_llwpcb(__addr);
anatofuz
parents:
diff changeset
35 }
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 /// Flushes the LWP state to memory and returns the address of the LWPCB.
anatofuz
parents:
diff changeset
38 ///
anatofuz
parents:
diff changeset
39 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
40 ///
anatofuz
parents:
diff changeset
41 /// This intrinsic corresponds to the <c> SLWPCB </c> instruction.
anatofuz
parents:
diff changeset
42 ///
anatofuz
parents:
diff changeset
43 /// \return
anatofuz
parents:
diff changeset
44 /// Address to the current Lightweight Profiling Control Block (LWPCB).
anatofuz
parents:
diff changeset
45 /// If LWP is not currently enabled, returns NULL.
anatofuz
parents:
diff changeset
46 static __inline__ void* __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
47 __slwpcb (void)
anatofuz
parents:
diff changeset
48 {
anatofuz
parents:
diff changeset
49 return __builtin_ia32_slwpcb();
anatofuz
parents:
diff changeset
50 }
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 /// Inserts programmed event record into the LWP event ring buffer
anatofuz
parents:
diff changeset
53 /// and advances the ring buffer pointer.
anatofuz
parents:
diff changeset
54 ///
anatofuz
parents:
diff changeset
55 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
56 ///
anatofuz
parents:
diff changeset
57 /// This intrinsic corresponds to the <c> LWPINS </c> instruction.
anatofuz
parents:
diff changeset
58 ///
anatofuz
parents:
diff changeset
59 /// \param DATA2
anatofuz
parents:
diff changeset
60 /// A 32-bit value is zero-extended and inserted into the 64-bit Data2 field.
anatofuz
parents:
diff changeset
61 /// \param DATA1
anatofuz
parents:
diff changeset
62 /// A 32-bit value is inserted into the 32-bit Data1 field.
anatofuz
parents:
diff changeset
63 /// \param FLAGS
anatofuz
parents:
diff changeset
64 /// A 32-bit immediate value is inserted into the 32-bit Flags field.
anatofuz
parents:
diff changeset
65 /// \returns If the ring buffer is full and LWP is running in Synchronized Mode,
anatofuz
parents:
diff changeset
66 /// the event record overwrites the last record in the buffer, the MissedEvents
anatofuz
parents:
diff changeset
67 /// counter in the LWPCB is incremented, the head pointer is not advanced, and
anatofuz
parents:
diff changeset
68 /// 1 is returned. Otherwise 0 is returned.
anatofuz
parents:
diff changeset
69 #define __lwpins32(DATA2, DATA1, FLAGS) \
anatofuz
parents:
diff changeset
70 (__builtin_ia32_lwpins32((unsigned int) (DATA2), (unsigned int) (DATA1), \
anatofuz
parents:
diff changeset
71 (unsigned int) (FLAGS)))
anatofuz
parents:
diff changeset
72
anatofuz
parents:
diff changeset
73 /// Decrements the LWP programmed value sample event counter. If the result is
anatofuz
parents:
diff changeset
74 /// negative, inserts an event record into the LWP event ring buffer in memory
anatofuz
parents:
diff changeset
75 /// and advances the ring buffer pointer.
anatofuz
parents:
diff changeset
76 ///
anatofuz
parents:
diff changeset
77 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
78 ///
anatofuz
parents:
diff changeset
79 /// This intrinsic corresponds to the <c> LWPVAL </c> instruction.
anatofuz
parents:
diff changeset
80 ///
anatofuz
parents:
diff changeset
81 /// \param DATA2
anatofuz
parents:
diff changeset
82 /// A 32-bit value is zero-extended and inserted into the 64-bit Data2 field.
anatofuz
parents:
diff changeset
83 /// \param DATA1
anatofuz
parents:
diff changeset
84 /// A 32-bit value is inserted into the 32-bit Data1 field.
anatofuz
parents:
diff changeset
85 /// \param FLAGS
anatofuz
parents:
diff changeset
86 /// A 32-bit immediate value is inserted into the 32-bit Flags field.
anatofuz
parents:
diff changeset
87 #define __lwpval32(DATA2, DATA1, FLAGS) \
anatofuz
parents:
diff changeset
88 (__builtin_ia32_lwpval32((unsigned int) (DATA2), (unsigned int) (DATA1), \
anatofuz
parents:
diff changeset
89 (unsigned int) (FLAGS)))
anatofuz
parents:
diff changeset
90
anatofuz
parents:
diff changeset
91 #ifdef __x86_64__
anatofuz
parents:
diff changeset
92
anatofuz
parents:
diff changeset
93 /// Inserts programmed event record into the LWP event ring buffer
anatofuz
parents:
diff changeset
94 /// and advances the ring buffer pointer.
anatofuz
parents:
diff changeset
95 ///
anatofuz
parents:
diff changeset
96 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
97 ///
anatofuz
parents:
diff changeset
98 /// This intrinsic corresponds to the <c> LWPINS </c> instruction.
anatofuz
parents:
diff changeset
99 ///
anatofuz
parents:
diff changeset
100 /// \param DATA2
anatofuz
parents:
diff changeset
101 /// A 64-bit value is inserted into the 64-bit Data2 field.
anatofuz
parents:
diff changeset
102 /// \param DATA1
anatofuz
parents:
diff changeset
103 /// A 32-bit value is inserted into the 32-bit Data1 field.
anatofuz
parents:
diff changeset
104 /// \param FLAGS
anatofuz
parents:
diff changeset
105 /// A 32-bit immediate value is inserted into the 32-bit Flags field.
anatofuz
parents:
diff changeset
106 /// \returns If the ring buffer is full and LWP is running in Synchronized Mode,
anatofuz
parents:
diff changeset
107 /// the event record overwrites the last record in the buffer, the MissedEvents
anatofuz
parents:
diff changeset
108 /// counter in the LWPCB is incremented, the head pointer is not advanced, and
anatofuz
parents:
diff changeset
109 /// 1 is returned. Otherwise 0 is returned.
anatofuz
parents:
diff changeset
110 #define __lwpins64(DATA2, DATA1, FLAGS) \
anatofuz
parents:
diff changeset
111 (__builtin_ia32_lwpins64((unsigned long long) (DATA2), (unsigned int) (DATA1), \
anatofuz
parents:
diff changeset
112 (unsigned int) (FLAGS)))
anatofuz
parents:
diff changeset
113
anatofuz
parents:
diff changeset
114 /// Decrements the LWP programmed value sample event counter. If the result is
anatofuz
parents:
diff changeset
115 /// negative, inserts an event record into the LWP event ring buffer in memory
anatofuz
parents:
diff changeset
116 /// and advances the ring buffer pointer.
anatofuz
parents:
diff changeset
117 ///
anatofuz
parents:
diff changeset
118 /// \headerfile <x86intrin.h>
anatofuz
parents:
diff changeset
119 ///
anatofuz
parents:
diff changeset
120 /// This intrinsic corresponds to the <c> LWPVAL </c> instruction.
anatofuz
parents:
diff changeset
121 ///
anatofuz
parents:
diff changeset
122 /// \param DATA2
anatofuz
parents:
diff changeset
123 /// A 64-bit value is and inserted into the 64-bit Data2 field.
anatofuz
parents:
diff changeset
124 /// \param DATA1
anatofuz
parents:
diff changeset
125 /// A 32-bit value is inserted into the 32-bit Data1 field.
anatofuz
parents:
diff changeset
126 /// \param FLAGS
anatofuz
parents:
diff changeset
127 /// A 32-bit immediate value is inserted into the 32-bit Flags field.
anatofuz
parents:
diff changeset
128 #define __lwpval64(DATA2, DATA1, FLAGS) \
anatofuz
parents:
diff changeset
129 (__builtin_ia32_lwpval64((unsigned long long) (DATA2), (unsigned int) (DATA1), \
anatofuz
parents:
diff changeset
130 (unsigned int) (FLAGS)))
anatofuz
parents:
diff changeset
131
anatofuz
parents:
diff changeset
132 #endif
anatofuz
parents:
diff changeset
133
anatofuz
parents:
diff changeset
134 #undef __DEFAULT_FN_ATTRS
anatofuz
parents:
diff changeset
135
anatofuz
parents:
diff changeset
136 #endif /* __LWPINTRIN_H */