| 1 |
/* Test the TME intrinsics. */ |
| 2 |
|
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-save-temps -O2 -march=armv8-a+tme" } */ |
| 5 |
|
| 6 |
#include "arm_acle.h" |
| 7 |
|
| 8 |
#define tcancel_reason 0x234 |
| 9 |
|
| 10 |
unsigned |
| 11 |
check_tme (void) |
| 12 |
{ |
| 13 |
unsigned status = __tstart (); |
| 14 |
if (status == 0) |
| 15 |
{ |
| 16 |
if (__ttest () == 2) |
| 17 |
{ |
| 18 |
__tcancel (tcancel_reason & _TMFAILURE_REASON); |
| 19 |
return tcancel_reason; |
| 20 |
} |
| 21 |
|
| 22 |
__tcommit (); |
| 23 |
return 0; |
| 24 |
} |
| 25 |
else if (status & _TMFAILURE_NEST) |
| 26 |
return _TMFAILURE_NEST; |
| 27 |
else if (status & _TMFAILURE_TRIVIAL) |
| 28 |
return _TMFAILURE_TRIVIAL; |
| 29 |
} |
| 30 |
|
| 31 |
/* { dg-final { scan-assembler "tstart\tx..?\n" } } */ |
| 32 |
/* { dg-final { scan-assembler "tcancel\t#564\n" } } */ |
| 33 |
/* { dg-final { scan-assembler "ttest\tx..?\n" } } */ |
| 34 |
/* { dg-final { scan-assembler "tcommit\n" } } */ |