| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mbranch-protection=none" } */ |
| 3 |
/* { dg-final { check-function-bodies "**" "" "" } } */ |
| 4 |
|
| 5 |
/* |
| 6 |
**foo1: |
| 7 |
** sysl xzr, #3, c7, c7, #1 // gcspopm |
| 8 |
** ret |
| 9 |
*/ |
| 10 |
void |
| 11 |
foo1 (void) |
| 12 |
{ |
| 13 |
__builtin_aarch64_gcspopm (); |
| 14 |
} |
| 15 |
|
| 16 |
/* |
| 17 |
**foo2: |
| 18 |
** mov x0, 0 |
| 19 |
** sysl x0, #3, c7, c7, #1 // gcspopm |
| 20 |
** ret |
| 21 |
*/ |
| 22 |
unsigned long long |
| 23 |
foo2 (void) |
| 24 |
{ |
| 25 |
return __builtin_aarch64_gcspopm (); |
| 26 |
} |
| 27 |
|
| 28 |
/* |
| 29 |
**foo3: |
| 30 |
** mov x16, 1 |
| 31 |
** hint 40 // chkfeat x16 |
| 32 |
** cbz x16, .* |
| 33 |
** ret |
| 34 |
** mov x0, (0|x16) |
| 35 |
** sysl x0, #3, c7, c7, #1 // gcspopm |
| 36 |
** ret |
| 37 |
*/ |
| 38 |
unsigned long long |
| 39 |
foo3 (unsigned long long x) |
| 40 |
{ |
| 41 |
if (__builtin_aarch64_chkfeat (1) == 0) |
| 42 |
return __builtin_aarch64_gcspopm (); |
| 43 |
return x; |
| 44 |
} |
| 45 |
|
| 46 |
/* |
| 47 |
**foo4: |
| 48 |
** sysl xzr, #3, c7, c7, #1 // gcspopm |
| 49 |
** mov x0, 0 |
| 50 |
** sysl x0, #3, c7, c7, #1 // gcspopm |
| 51 |
** sysl xzr, #3, c7, c7, #1 // gcspopm |
| 52 |
** ret |
| 53 |
*/ |
| 54 |
unsigned long long |
| 55 |
foo4 (void) |
| 56 |
{ |
| 57 |
unsigned long long a = __builtin_aarch64_gcspopm (); |
| 58 |
unsigned long long b = __builtin_aarch64_gcspopm (); |
| 59 |
unsigned long long c = __builtin_aarch64_gcspopm (); |
| 60 |
(void) a; |
| 61 |
(void) c; |
| 62 |
return b; |
| 63 |
} |