| 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 |
unsigned short a : 6; |
| 7 |
unsigned char b : 3; |
| 8 |
unsigned char c; |
| 9 |
unsigned short d : 8; |
| 10 |
} test_st; |
| 11 |
|
| 12 |
test_st __attribute__ ((cmse_nonsecure_entry)) foo (void) |
| 13 |
{ |
| 14 |
test_st t; |
| 15 |
t.a = 63u; |
| 16 |
t.b = 7u; |
| 17 |
t.c = 255u; |
| 18 |
t.d = 255u; |
| 19 |
return t; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
main (void) |
| 24 |
{ |
| 25 |
test_st t; |
| 26 |
t = foo (); |
| 27 |
if (t.a != 63u |
| 28 |
|| t.b != 7u |
| 29 |
|| t.c != 255u |
| 30 |
|| t.d != 255u) |
| 31 |
__builtin_abort (); |
| 32 |
return 0; |
| 33 |
} |
| 34 |
|
| 35 |
/* { dg-final { scan-assembler "vstr\tFPCXTNS, \\\[sp, #-4\\\]!" { target arm_cmse_clear_ok } } } */ |
| 36 |
/* { dg-final { scan-assembler "movw\tr1, #1855" } } */ |
| 37 |
/* { dg-final { scan-assembler "movt\tr1, 65535" } } */ |
| 38 |
/* { dg-final { scan-assembler "ands\tr0(, r0)?, r1" } } */ |
| 39 |
/* { dg-final { scan-assembler "vscclrm\t\{s0-s15, VPR\}" { target arm_cmse_clear_ok } } } */ |
| 40 |
/* { dg-final { scan-assembler "clrm\t\{r1, r2, r3, ip, APSR\}" { target arm_cmse_clear_ok } } } */ |
| 41 |
/* { dg-final { scan-assembler "vldr\tFPCXTNS, \\\[sp\\\], #4" { target arm_cmse_clear_ok } } } */ |
| 42 |
/* { dg-final { scan-assembler "bxns" } } */ |
| 43 |
|