1e8d8bef9SDimitry Andric /*===---------------- hresetintrin.h - HRESET intrinsics -------------------=== 2e8d8bef9SDimitry Andric * 3e8d8bef9SDimitry Andric * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4e8d8bef9SDimitry Andric * See https://llvm.org/LICENSE.txt for license information. 5e8d8bef9SDimitry Andric * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e8d8bef9SDimitry Andric * 7e8d8bef9SDimitry Andric *===-----------------------------------------------------------------------=== 8e8d8bef9SDimitry Andric */ 9e8d8bef9SDimitry Andric #ifndef __X86GPRINTRIN_H 10e8d8bef9SDimitry Andric #error "Never use <hresetintrin.h> directly; include <x86gprintrin.h> instead." 11e8d8bef9SDimitry Andric #endif 12e8d8bef9SDimitry Andric 13e8d8bef9SDimitry Andric #ifndef __HRESETINTRIN_H 14e8d8bef9SDimitry Andric #define __HRESETINTRIN_H 15e8d8bef9SDimitry Andric 16e8d8bef9SDimitry Andric #if __has_extension(gnu_asm) 17e8d8bef9SDimitry Andric 18e8d8bef9SDimitry Andric /* Define the default attributes for the functions in this file. */ 19e8d8bef9SDimitry Andric #define __DEFAULT_FN_ATTRS \ 20e8d8bef9SDimitry Andric __attribute__((__always_inline__, __nodebug__, __target__("hreset"))) 21e8d8bef9SDimitry Andric 22e8d8bef9SDimitry Andric /// Provides a hint to the processor to selectively reset the prediction 23e8d8bef9SDimitry Andric /// history of the current logical processor specified by a 32-bit integer 24e8d8bef9SDimitry Andric /// value \a __eax. 25e8d8bef9SDimitry Andric /// 26e8d8bef9SDimitry Andric /// This intrinsic corresponds to the <c> HRESET </c> instruction. 27e8d8bef9SDimitry Andric /// 28*81ad6265SDimitry Andric /// \code{.operation} 29e8d8bef9SDimitry Andric /// IF __eax == 0 30e8d8bef9SDimitry Andric /// // nop 31e8d8bef9SDimitry Andric /// ELSE 32e8d8bef9SDimitry Andric /// FOR i := 0 to 31 33e8d8bef9SDimitry Andric /// IF __eax[i] 34e8d8bef9SDimitry Andric /// ResetPredictionFeature(i) 35e8d8bef9SDimitry Andric /// FI 36e8d8bef9SDimitry Andric /// ENDFOR 37e8d8bef9SDimitry Andric /// FI 38*81ad6265SDimitry Andric /// \endcode 39e8d8bef9SDimitry Andric static __inline void __DEFAULT_FN_ATTRS _hreset(int __eax)40e8d8bef9SDimitry Andric_hreset(int __eax) 41e8d8bef9SDimitry Andric { 42e8d8bef9SDimitry Andric __asm__ ("hreset $0" :: "a"(__eax)); 43e8d8bef9SDimitry Andric } 44e8d8bef9SDimitry Andric 45e8d8bef9SDimitry Andric #undef __DEFAULT_FN_ATTRS 46e8d8bef9SDimitry Andric 47e8d8bef9SDimitry Andric #endif /* __has_extension(gnu_asm) */ 48e8d8bef9SDimitry Andric 49e8d8bef9SDimitry Andric #endif /* __HRESETINTRIN_H */ 50