| 1 |
/* { dg-do run { target { aarch64*-linux-gnu* && aarch64_sme_hw } } } */ |
| 2 |
|
| 3 |
#include <signal.h> |
| 4 |
#include <arm_sme.h> |
| 5 |
|
| 6 |
static bool caught; |
| 7 |
|
| 8 |
[[gnu::noipa]] void thrower(int) |
| 9 |
{ |
| 10 |
throw 1; |
| 11 |
} |
| 12 |
|
| 13 |
[[gnu::noipa]] void bar() |
| 14 |
{ |
| 15 |
*(volatile int *)0 = 0; |
| 16 |
} |
| 17 |
|
| 18 |
[[gnu::noipa]] void foo() |
| 19 |
{ |
| 20 |
try |
| 21 |
{ |
| 22 |
bar(); |
| 23 |
} |
| 24 |
catch (int) |
| 25 |
{ |
| 26 |
caught = true; |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
__arm_new("za") __arm_locally_streaming void sme_user() |
| 31 |
{ |
| 32 |
svbool_t all = svptrue_b8(); |
| 33 |
for (unsigned int i = 0; i < svcntb(); ++i) |
| 34 |
{ |
| 35 |
svint8_t expected = svindex_s8(i + 1, i); |
| 36 |
svwrite_hor_za8_m(0, i, all, expected); |
| 37 |
} |
| 38 |
foo(); |
| 39 |
for (unsigned int i = 0; i < svcntb(); ++i) |
| 40 |
{ |
| 41 |
svint8_t expected = svindex_s8(i + 1, i); |
| 42 |
svint8_t actual = svread_hor_za8_m(svdup_s8(0), all, 0, i); |
| 43 |
if (svptest_any(all, svcmpne(all, expected, actual))) |
| 44 |
__builtin_abort(); |
| 45 |
} |
| 46 |
if (!caught) |
| 47 |
__builtin_abort(); |
| 48 |
} |
| 49 |
|
| 50 |
int main() |
| 51 |
{ |
| 52 |
signal(SIGSEGV, thrower); |
| 53 |
sme_user(); |
| 54 |
return 0; |
| 55 |
} |