brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 89732bb Raw
58 lines · c
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-exception6 *7 *===-----------------------------------------------------------------------===8 */9 10#if !defined __X86INTRIN_H11#error "Never use <rdpruintrin.h> directly; include <x86intrin.h> instead."12#endif13 14#ifndef __RDPRUINTRIN_H15#define __RDPRUINTRIN_H16 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_id29///    A processor register identifier.30static __inline__ unsigned long long __DEFAULT_FN_ATTRS31__rdpru (int reg_id)32{33  return __builtin_ia32_rdpru(reg_id);34}35 36#define __RDPRU_MPERF 037#define __RDPRU_APERF 138 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 of44/// 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 of52/// register APERF.53#define __aperf() __builtin_ia32_rdpru(__RDPRU_APERF)54 55#undef __DEFAULT_FN_ATTRS56 57#endif /* __RDPRUINTRIN_H */58