aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c
blob: a89de4850a60bdd589768f4ff4b51b550a0bd37b (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
93
/* { dg-do run } */
/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* s390*-*-* loongarch64*-*-* } } } */
/* { dg-options "-O2" } */

#include <assert.h>
int result = 0;

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("skip")))
foo1 (int x)
{
  return (x + 1);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("used-gpr-arg")))
foo2 (int x)
{
  return (x + 2);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("used-gpr")))
foo3 (int x)
{
  return (x + 3);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("used-arg")))
foo4 (int x)
{
  return (x + 4);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("used")))
foo5 (int x)
{
  return (x + 5);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("all-gpr-arg")))
foo6 (int x)
{
  return (x + 6);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("all-gpr")))
foo7 (int x)
{
  return (x + 7);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("all-arg")))
foo8 (int x)
{
  return (x + 8);
}

int 
__attribute__((noipa))
__attribute__ ((zero_call_used_regs("all")))
foo9 (int x)
{
  return (x + 9);
}

int main()
{
  result = foo1 (1);
  result += foo2 (1);
  result += foo3 (1);
  result += foo4 (1);
  result += foo5 (1);
  result += foo6 (1);
  result += foo7 (1);
  result += foo8 (1);
  result += foo9 (1);
  assert (result == 54);
  return 0;
}