xref: /freebsd/contrib/llvm-project/clang/lib/Headers/rdseedintrin.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1 /*===---- rdseedintrin.h - RDSEED 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 && !defined __IMMINTRIN_H
11 #error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
12 #endif
13 
14 #ifndef __RDSEEDINTRIN_H
15 #define __RDSEEDINTRIN_H
16 
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rdseed")))
19 
20 static __inline__ int __DEFAULT_FN_ATTRS
21 _rdseed16_step(unsigned short *__p)
22 {
23   return (int) __builtin_ia32_rdseed16_step(__p);
24 }
25 
26 static __inline__ int __DEFAULT_FN_ATTRS
27 _rdseed32_step(unsigned int *__p)
28 {
29   return (int) __builtin_ia32_rdseed32_step(__p);
30 }
31 
32 #ifdef __x86_64__
33 static __inline__ int __DEFAULT_FN_ATTRS
34 _rdseed64_step(unsigned long long *__p)
35 {
36   return (int) __builtin_ia32_rdseed64_step(__p);
37 }
38 #endif
39 
40 #undef __DEFAULT_FN_ATTRS
41 
42 #endif /* __RDSEEDINTRIN_H */
43