aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/umonitor-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/umonitor-1.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/umonitor-1.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/umonitor-1.c b/gcc/testsuite/gcc.target/i386/umonitor-1.c
new file mode 100644
index 0000000..d58e1e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/umonitor-1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mwaitpkg" } */
+/* { dg-final { scan-assembler-times "umonitor\[ \\t\]+\[^\{\n\]*%" 3 } } */
+/* { dg-final { scan-assembler-times "umwait" 3 } } */
+/* { dg-final { scan-assembler-times "setc\[ \\t\]+\[^\{\n\]*%" 3 } } */
+
+/* Verify that they work in both 32bit and 64bit. */
+
+#include <x86intrin.h>
+
+unsigned char
+foo (void *p, unsigned x, unsigned y)
+{
+ _umonitor (p);
+ return _umwait (x, y);
+}
+
+unsigned char
+bar (void *p, unsigned x, unsigned long long y)
+{
+ _umonitor (p);
+ return _umwait (x, y);
+}
+
+unsigned char
+foo1 (char *p)
+{
+ _umonitor (p);
+ return _umwait (0, 0);
+}