1 /*===---- rdpruintrin.h - RDPRU intrinsics ---------------------------------=== 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 *===-----------------------------------------------------------------------=== 8 */ 9 10 #if !defined __X86INTRIN_H 11 #error "Never use <rdpruintrin.h> directly; include <x86intrin.h> instead." 12 #endif 13 14 #ifndef __RDPRUINTRIN_H 15 #define __RDPRUINTRIN_H 16 17 /* Define the default attributes for the functions in this file. */ 18 #define __DEFAULT_FN_ATTRS \ 19 __attribute__((__always_inline__, __nodebug__, __target__("rdpru"))) 20 21 22 /// Reads the content of a processor register. 23 /// 24 /// \headerfile <x86intrin.h> 25 /// 26 /// This intrinsic corresponds to the <c> RDPRU </c> instruction. 27 /// 28 /// \param reg_id 29 /// A processor register identifier. 30 static __inline__ unsigned long long __DEFAULT_FN_ATTRS __rdpru(int reg_id)31__rdpru (int reg_id) 32 { 33 return __builtin_ia32_rdpru(reg_id); 34 } 35 36 #define __RDPRU_MPERF 0 37 #define __RDPRU_APERF 1 38 39 /// Reads the content of processor register MPERF. 40 /// 41 /// \headerfile <x86intrin.h> 42 /// 43 /// This intrinsic generates instruction <c> RDPRU </c> to read the value of 44 /// register MPERF. 45 #define __mperf() __builtin_ia32_rdpru(__RDPRU_MPERF) 46 47 /// Reads the content of processor register APERF. 48 /// 49 /// \headerfile <x86intrin.h> 50 /// 51 /// This intrinsic generates instruction <c> RDPRU </c> to read the value of 52 /// register APERF. 53 #define __aperf() __builtin_ia32_rdpru(__RDPRU_APERF) 54 55 #undef __DEFAULT_FN_ATTRS 56 57 #endif /* __RDPRUINTRIN_H */ 58