2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sgx.c
blob9f3ab670d47aff5efb93e75067ffb26fd76828ce
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -msgx" } */
3 /* { dg-final { scan-assembler-times "enclu" 2 } } */
4 /* { dg-final { scan-assembler-times "encls" 2 } } */
5 /* { dg-final { scan-assembler-times "enclv" 2 } } */
7 #include <x86intrin.h>
9 extern unsigned int leaf;
11 #define SGX_EENTER 0x02
12 #define SGX_EBLOCK 0x09
13 #define SGX_EINCVIRTCHILD 0x01
15 int foo ()
17 size_t test[3];
18 test[0] = 4;
19 test[1] = 5;
20 test[2] = 6;
22 unsigned int res1 = _encls_u32 (leaf, test);
23 unsigned int res2 = _enclu_u32 (leaf, test);
24 unsigned int res5 = _enclv_u32 (leaf, test);
26 unsigned int res3 = _encls_u32 (SGX_EBLOCK, test);
27 unsigned int res4 = _enclu_u32 (SGX_EENTER, test);
28 unsigned int res6 = _enclv_u32 (SGX_EINCVIRTCHILD, test);
30 return 0;