| 1 |
/* This test is executed only if the execution engine supports CMSE instructions. */ |
| 2 |
/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ |
| 3 |
|
| 4 |
typedef struct |
| 5 |
{ |
| 6 |
short a; |
| 7 |
signed char b : 2; |
| 8 |
short : 1; |
| 9 |
signed char c : 3; |
| 10 |
} test_st; |
| 11 |
|
| 12 |
test_st __attribute__ ((cmse_nonsecure_entry)) foo (void) |
| 13 |
{ |
| 14 |
test_st t; |
| 15 |
t.a = -32768; |
| 16 |
t.b = -2; |
| 17 |
t.c = -4; |
| 18 |
return t; |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
main (void) |
| 23 |
{ |
| 24 |
test_st t; |
| 25 |
t = foo (); |
| 26 |
if (t.a != -32768 |
| 27 |
|| t.b != -2 |
| 28 |
|| t.c != -4) |
| 29 |
__builtin_abort (); |
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-assembler "vstr\tFPCXTNS, \\\[sp, #-4\\\]!" { target arm_cmse_clear_ok } } } */ |
| 34 |
/* { dg-final { scan-assembler "movw\tr1, #65535" } } */ |
| 35 |
/* { dg-final { scan-assembler "movt\tr1, 63" } } */ |
| 36 |
/* { dg-final { scan-assembler "ands\tr0(, r0)?, r1" } } */ |
| 37 |
/* { dg-final { scan-assembler "vscclrm\t\{s0-s15, VPR\}" { target arm_cmse_clear_ok } } } */ |
| 38 |
/* { dg-final { scan-assembler "clrm\t\{r1, r2, r3, ip, APSR\}" { target arm_cmse_clear_ok } } } */ |
| 39 |
/* { dg-final { scan-assembler "vldr\tFPCXTNS, \\\[sp\\\], #4" { target arm_cmse_clear_ok } } } */ |
| 40 |
/* { dg-final { scan-assembler "bxns" } } */ |