blob: ccb3d2dd2294b4850fb51bc645f4f9a397c5c15a [file] [log] [blame]
Yi Kong4e9417d2022-10-12 11:48:30 +09001/*===---- 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
20static __inline__ int __DEFAULT_FN_ATTRS
21_rdseed16_step(unsigned short *__p)
22{
23 return __builtin_ia32_rdseed16_step(__p);
24}
25
26static __inline__ int __DEFAULT_FN_ATTRS
27_rdseed32_step(unsigned int *__p)
28{
29 return __builtin_ia32_rdseed32_step(__p);
30}
31
32#ifdef __x86_64__
33static __inline__ int __DEFAULT_FN_ATTRS
34_rdseed64_step(unsigned long long *__p)
35{
36 return __builtin_ia32_rdseed64_step(__p);
37}
38#endif
39
40#undef __DEFAULT_FN_ATTRS
41
42#endif /* __RDSEEDINTRIN_H */