| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mmwait" } */ |
| 3 |
|
| 4 |
/* Test calling MWAIT intrinsics from functions with general-regs-only |
| 5 |
target attribute. */ |
| 6 |
|
| 7 |
#include <x86gprintrin.h> |
| 8 |
|
| 9 |
#define _CONCAT(x,y) x ## y |
| 10 |
|
| 11 |
#define test_2(func, type, op1_type, op2_type) \ |
| 12 |
__attribute__ ((target("general-regs-only"))) \ |
| 13 |
type _CONCAT(do_,func) (op1_type A, op2_type B) \ |
| 14 |
{ return func (A, B); } |
| 15 |
|
| 16 |
#define test_3(func, type, op1_type, op2_type, op3_type) \ |
| 17 |
__attribute__ ((target("general-regs-only"))) \ |
| 18 |
type _CONCAT(do_,func) (op1_type A, op2_type B, op3_type C) \ |
| 19 |
{ return func (A, B, C); } |
| 20 |
|
| 21 |
#ifndef __iamcu__ |
| 22 |
/* mwaitintrin.h */ |
| 23 |
test_3 (_mm_monitor, void, void const *, unsigned int, unsigned int) |
| 24 |
test_2 (_mm_mwait, void, unsigned int, unsigned int) |
| 25 |
#endif |