xref: /netbsd-src/external/apache2/llvm/dist/clang/lib/Headers/rdseedintrin.h (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1*7330f729Sjoerg /*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------===
2*7330f729Sjoerg  *
3*7330f729Sjoerg  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*7330f729Sjoerg  * See https://llvm.org/LICENSE.txt for license information.
5*7330f729Sjoerg  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*7330f729Sjoerg  *
7*7330f729Sjoerg  *===-----------------------------------------------------------------------===
8*7330f729Sjoerg  */
9*7330f729Sjoerg 
10*7330f729Sjoerg #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
11*7330f729Sjoerg #error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
12*7330f729Sjoerg #endif
13*7330f729Sjoerg 
14*7330f729Sjoerg #ifndef __RDSEEDINTRIN_H
15*7330f729Sjoerg #define __RDSEEDINTRIN_H
16*7330f729Sjoerg 
17*7330f729Sjoerg /* Define the default attributes for the functions in this file. */
18*7330f729Sjoerg #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rdseed")))
19*7330f729Sjoerg 
20*7330f729Sjoerg static __inline__ int __DEFAULT_FN_ATTRS
_rdseed16_step(unsigned short * __p)21*7330f729Sjoerg _rdseed16_step(unsigned short *__p)
22*7330f729Sjoerg {
23*7330f729Sjoerg   return __builtin_ia32_rdseed16_step(__p);
24*7330f729Sjoerg }
25*7330f729Sjoerg 
26*7330f729Sjoerg static __inline__ int __DEFAULT_FN_ATTRS
_rdseed32_step(unsigned int * __p)27*7330f729Sjoerg _rdseed32_step(unsigned int *__p)
28*7330f729Sjoerg {
29*7330f729Sjoerg   return __builtin_ia32_rdseed32_step(__p);
30*7330f729Sjoerg }
31*7330f729Sjoerg 
32*7330f729Sjoerg #ifdef __x86_64__
33*7330f729Sjoerg static __inline__ int __DEFAULT_FN_ATTRS
_rdseed64_step(unsigned long long * __p)34*7330f729Sjoerg _rdseed64_step(unsigned long long *__p)
35*7330f729Sjoerg {
36*7330f729Sjoerg   return __builtin_ia32_rdseed64_step(__p);
37*7330f729Sjoerg }
38*7330f729Sjoerg #endif
39*7330f729Sjoerg 
40*7330f729Sjoerg #undef __DEFAULT_FN_ATTRS
41*7330f729Sjoerg 
42*7330f729Sjoerg #endif /* __RDSEEDINTRIN_H */
43