[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / lib / Headers / sgxintrin.h
blob303a21f6b2e9fd6bcadbf060d3676445cd5c2da3
1 /*===---- sgxintrin.h - X86 SGX intrinsics configuration -------------------===
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 */
10 #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
11 #error "Never use <sgxintrin.h> directly; include <x86intrin.h> instead."
12 #endif
14 #ifndef __SGXINTRIN_H
15 #define __SGXINTRIN_H
17 #if __has_extension(gnu_asm)
19 /* Define the default attributes for the functions in this file. */
20 #define __DEFAULT_FN_ATTRS \
21 __attribute__((__always_inline__, __nodebug__, __target__("sgx")))
23 static __inline unsigned int __DEFAULT_FN_ATTRS
24 _enclu_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
26 unsigned int __result;
27 __asm__ ("enclu"
28 : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
29 : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
30 : "cc");
31 return __result;
34 static __inline unsigned int __DEFAULT_FN_ATTRS
35 _encls_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
37 unsigned int __result;
38 __asm__ ("encls"
39 : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
40 : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
41 : "cc");
42 return __result;
45 static __inline unsigned int __DEFAULT_FN_ATTRS
46 _enclv_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
48 unsigned int __result;
49 __asm__ ("enclv"
50 : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
51 : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
52 : "cc");
53 return __result;
56 #undef __DEFAULT_FN_ATTRS
58 #endif /* __has_extension(gnu_asm) */
60 #endif