[HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (#117017)
[llvm-project.git] / clang / lib / Headers / hresetintrin.h
blob646f6c130961dcbd2af15b54e8760e19ee6869af
1 /*===---------------- hresetintrin.h - HRESET intrinsics -------------------===
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
7 *===-----------------------------------------------------------------------===
8 */
9 #ifndef __X86GPRINTRIN_H
10 #error "Never use <hresetintrin.h> directly; include <x86gprintrin.h> instead."
11 #endif
13 #ifndef __HRESETINTRIN_H
14 #define __HRESETINTRIN_H
16 #if __has_extension(gnu_asm)
18 /* Define the default attributes for the functions in this file. */
19 #define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, __target__("hreset")))
22 /// Provides a hint to the processor to selectively reset the prediction
23 /// history of the current logical processor specified by a 32-bit integer
24 /// value \a __eax.
25 ///
26 /// This intrinsic corresponds to the <c> HRESET </c> instruction.
27 ///
28 /// \code{.operation}
29 /// IF __eax == 0
30 /// // nop
31 /// ELSE
32 /// FOR i := 0 to 31
33 /// IF __eax[i]
34 /// ResetPredictionFeature(i)
35 /// FI
36 /// ENDFOR
37 /// FI
38 /// \endcode
39 static __inline void __DEFAULT_FN_ATTRS
40 _hreset(int __eax)
42 __asm__ ("hreset $0" :: "a"(__eax));
45 #undef __DEFAULT_FN_ATTRS
47 #endif /* __has_extension(gnu_asm) */
49 #endif /* __HRESETINTRIN_H */