gcc/testsuite/gcc.target/i386/pr53315.c
raw| 1 | /* PR target/53315 and PR target/53291 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-O2 -mrtm" } */ |
| 4 | /* { dg-require-effective-target rtm } */ |
| 5 | |
| 6 | #include <x86intrin.h> |
| 7 | #include "rtm-check.h" |
| 8 | |
| 9 | static void |
| 10 | rtm_test (void) |
| 11 | { |
| 12 | int flag = -1; |
| 13 | unsigned status; |
| 14 | |
| 15 | if ((status = _xbegin ()) == _XBEGIN_STARTED) |
| 16 | { |
| 17 | flag = _xtest (); |
| 18 | _xend (); |
| 19 | } |
| 20 | else |
| 21 | return; |
| 22 | |
| 23 | if (flag != 1) |
| 24 | abort (); |
| 25 | if (_xtest () != 0) |
| 26 | abort (); |
| 27 | } |