standalone: fix w/h confusion
[pcsx_rearmed.git] / deps / lightning / check / allocai.tst
CommitLineData
4a71579b
PC
1.data 128
2idfmt:
3.c "received %d\n"
4failure_message:
5.c "numbers don't add up to zero\n"
6report_message:
7.c "failed: got %i instead of %i\n"
8succeeded_message:
9.c "succeeded\n"
10
11.code
12 jmpi main
13
14/*
15static int
16identity (int arg)
17{
18 printf ("received %i\n", arg);
19 return arg;
20}
21 */
22 name identify
23identify:
24 prolog
25 arg $i
26 getarg %v0 $i
27 prepare
28 pushargi idfmt
29 ellipsis
30 pushargr %v0
31 finishi @printf
32 retr %v0
33 epilog
34
35 name identity_func
36identity_func:
37 prolog
38 arg $i
39 getarg %r1 $i
40
41 /* Store the argument on the stack. */
42 allocai $(__WORDSIZE >> 3) $off
43 stxi $off %fp %r1
44
45 /* Store the negative of the argument on the stack. */
46 allocai $(__WORDSIZE >> 3) $neg
47 negr %r2 %r1
48 stxi $neg %fp %r2
49
50 /* Invoke FUNC. */
51 prepare
52 pushargr %r1
53 finishi identify
54
55 /* Ignore the result. */
56
57 /* Restore the negative and the argument from the stack. */
58 ldxi %r2 %fp $neg
59 ldxi %v1 %fp $off
60
61 /* Make sure they still add to zero. */
62 addr %r0 %v1 %r2
63 bnei branch %r0 0
64
65 /* Return it. */
66 retr %v1
67
68 /* Display a failure message. */
69branch:
70 prepare
71 pushargi failure_message
72 ellipsis
73 finishi @printf
74
75 /* Leave. */
76 retr %v1
77 epilog
78
79 name main
80main:
81 prolog
82 prepare
83 pushargi 7777
84 finishi identity_func
85 retval %r0
86 beqi succeeded %r0 7777
87 prepare
88 pushargi report_message
89 ellipsis
90 pushargr %r0
91 pushargi 7777
92 finishi @printf
93 reti 1
94succeeded:
95 prepare
96 pushargi succeeded_message
97 ellipsis
98 finishi @printf
99 reti 0
100 epilog