aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/msp430/rtx-cost-Os-default.c
blob: 8f3d1b28049253551b6005e3d4257d4315514c08 (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
/* { dg-do compile } */
/* { dg-options "-Os" } */
/* { dg-final { check-function-bodies "**" "" } } */

/* Verify the MSP430 cost model is working as expected for the default ISA
   (msp430x) and hwmult (none), when compiling at -Os.  */

char arr[2];
char a;
char *ptr;

/*
** foo:
** ...
**	MOV.B	\&a, \&arr\+1
**	MOV.*	#arr\+2, \&ptr
** ...
*/

void
foo (void)
{
  arr[1] = a;
  ptr = arr + 2;
}

extern void ext (void);

/*
** bar:
** ...
**	MOV.*	#ext, R10
**	CALL.*	R10
**	CALL.*	R10
** ...
*/

void
bar (void)
{
  ext ();
  ext ();
}