summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips/save-restore-1.c
blob: 721d60122718fc849a5680c61ecf457c55d0a3ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Check that we can use the save instruction to save varargs.  */
/* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
/* { dg-add-options mips16_attribute } */

#include <stdarg.h>

int bar (int, va_list ap);

MIPS16 int
foo (int n, ...)
{
  va_list ap;
  int i;

  va_start (ap, n);
  i = bar (n, ap);
  va_end (ap);
  return i + 1;
}
/* { dg-final { scan-assembler "\tsave\t\\\$4-\\\$7" } } */
/* { dg-final { scan-assembler "\trestore\t" } } */