aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/cmse/extend-return.c
blob: 081de0d699f839970e82b5836891d8eb11286ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* { dg-do compile } */
/* { dg-options "-mcmse -fshort-enums" } */
/* { dg-final { check-function-bodies "**" "" "" } } */

#include <arm_cmse.h>
#include <stdbool.h>

enum offset
{
    zero = 0,
    one = 1,
    two = 2
};

typedef unsigned char __attribute__ ((cmse_nonsecure_call)) ns_unsign_foo_t (void);
typedef signed char __attribute__ ((cmse_nonsecure_call)) ns_sign_foo_t (void);
typedef unsigned short __attribute__ ((cmse_nonsecure_call)) ns_short_unsign_foo_t (void);
typedef signed short __attribute__ ((cmse_nonsecure_call)) ns_short_sign_foo_t (void);
typedef enum offset __attribute__ ((cmse_nonsecure_call)) ns_enum_foo_t (void);
typedef bool __attribute__ ((cmse_nonsecure_call)) ns_bool_foo_t (void);

/*
**unsignNonsecure0:
**	...
**	bl	__gnu_cmse_nonsecure_call
**	uxtb	r0, r0
**	...
*/
unsigned char unsignNonsecure0 (ns_unsign_foo_t * ns_foo_p)
{
  return ns_foo_p ();
}

/*
**signNonsecure0:
**	...
**	bl	__gnu_cmse_nonsecure_call
**	sxtb	r0, r0
**	...
*/
signed char signNonsecure0 (ns_sign_foo_t * ns_foo_p)
{
  return ns_foo_p ();
}

/*
**shortUnsignNonsecure0:
**	...
**	bl	__gnu_cmse_nonsecure_call
**	uxth	r0, r0
**	...
*/
unsigned short shortUnsignNonsecure0 (ns_short_unsign_foo_t * ns_foo_p)
{
  return ns_foo_p ();
}

/*
**shortSignNonsecure0:
**	...
**	bl	__gnu_cmse_nonsecure_call
**	sxth	r0, r0
**	...
*/
signed short shortSignNonsecure0 (ns_short_sign_foo_t * ns_foo_p)
{
  return ns_foo_p ();
}

/*
**enumNonsecure0:
**	...
**	bl	__gnu_cmse_nonsecure_call
**	uxtb	r0, r0
**	...
*/
unsigned char __attribute__((noipa)) enumNonsecure0 (ns_enum_foo_t * ns_foo_p)
{
  return ns_foo_p ();
}

/*
**boolNonsecure0:
**	...
**	bl	__gnu_cmse_nonsecure_call
**	uxtb	r0, r0
**	...
*/
unsigned char boolNonsecure0 (ns_bool_foo_t * ns_foo_p)
{
  return ns_foo_p ();
}