| Michael Liao | ffaae35 | 2013-03-29 05:17:55 +0000 | [diff] [blame] | 1 | /*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------=== |
| 2 | * |
| Chandler Carruth | 4cf5743 | 2019-04-08 20:51:30 +0000 | [diff] [blame] | 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 |
| Michael Liao | ffaae35 | 2013-03-29 05:17:55 +0000 | [diff] [blame] | 6 | * |
| 7 | *===-----------------------------------------------------------------------=== |
| 8 | */ |
| 9 | |
| Craig Topper | 664af9b | 2018-05-23 18:32:58 +0000 | [diff] [blame] | 10 | #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H |
| Michael Liao | ffaae35 | 2013-03-29 05:17:55 +0000 | [diff] [blame] | 11 | #error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead." |
| 12 | #endif |
| 13 | |
| Richard Smith | 49e5644 | 2013-07-14 05:41:45 +0000 | [diff] [blame] | 14 | #ifndef __RDSEEDINTRIN_H |
| 15 | #define __RDSEEDINTRIN_H |
| 16 | |
| Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 17 | /* Define the default attributes for the functions in this file. */ |
| Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 18 | #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rdseed"))) |
| Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 19 | |
| Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 20 | static __inline__ int __DEFAULT_FN_ATTRS |
| Michael Liao | ffaae35 | 2013-03-29 05:17:55 +0000 | [diff] [blame] | 21 | _rdseed16_step(unsigned short *__p) |
| 22 | { |
| 23 | return __builtin_ia32_rdseed16_step(__p); |
| 24 | } |
| 25 | |
| Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 26 | static __inline__ int __DEFAULT_FN_ATTRS |
| Michael Liao | ffaae35 | 2013-03-29 05:17:55 +0000 | [diff] [blame] | 27 | _rdseed32_step(unsigned int *__p) |
| 28 | { |
| 29 | return __builtin_ia32_rdseed32_step(__p); |
| 30 | } |
| 31 | |
| 32 | #ifdef __x86_64__ |
| Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 33 | static __inline__ int __DEFAULT_FN_ATTRS |
| Michael Liao | ffaae35 | 2013-03-29 05:17:55 +0000 | [diff] [blame] | 34 | _rdseed64_step(unsigned long long *__p) |
| 35 | { |
| 36 | return __builtin_ia32_rdseed64_step(__p); |
| 37 | } |
| 38 | #endif |
| Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 39 | |
| Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 40 | #undef __DEFAULT_FN_ATTRS |
| Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 41 | |
| Richard Smith | 49e5644 | 2013-07-14 05:41:45 +0000 | [diff] [blame] | 42 | #endif /* __RDSEEDINTRIN_H */ |