| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mwaitpkg" } */ |
| 3 |
/* { dg-final { scan-assembler-times "umonitor\[ \\t\]+\[^\{\n\]*%" 3 } } */ |
| 4 |
/* { dg-final { scan-assembler-times "umwait" 3 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "setc\[ \\t\]+\[^\{\n\]*%" 3 } } */ |
| 6 |
|
| 7 |
/* Verify that they work in both 32bit and 64bit. */ |
| 8 |
|
| 9 |
#include <x86intrin.h> |
| 10 |
|
| 11 |
unsigned char |
| 12 |
foo (void *p, unsigned x, unsigned y) |
| 13 |
{ |
| 14 |
_umonitor (p); |
| 15 |
return _umwait (x, y); |
| 16 |
} |
| 17 |
|
| 18 |
unsigned char |
| 19 |
bar (void *p, unsigned x, unsigned long long y) |
| 20 |
{ |
| 21 |
_umonitor (p); |
| 22 |
return _umwait (x, y); |
| 23 |
} |
| 24 |
|
| 25 |
unsigned char |
| 26 |
foo1 (char *p) |
| 27 |
{ |
| 28 |
_umonitor (p); |
| 29 |
return _umwait (0, 0); |
| 30 |
} |