Commit | Line | Data |
---|---|---|
519a9ea1 PC |
1 | .data 16 |
2 | ok: | |
3 | .c "ok" | |
4 | ||
5 | .code | |
6 | jmpi main | |
7 | ||
8 | check_r0: | |
9 | prolog | |
10 | movi %v0 exit_r0 | |
11 | movi %r0 1 | |
12 | movi %r2 10 | |
13 | // on x86 this changes %rax on other arches could use %r0 as temporary | |
14 | divi %r1 %r2 3 | |
15 | live %r0 | |
16 | // %r0 must still be 1 | |
17 | jmpr %v0 | |
18 | exit_r0: | |
19 | retr %r0 | |
20 | epilog | |
21 | ||
22 | main: | |
23 | prolog | |
24 | calli check_r0 | |
25 | retval %r1 | |
26 | beqi r0_ok %r1 1 | |
27 | calli @abort | |
28 | r0_ok: | |
29 | prepare | |
30 | pushargi ok | |
31 | finishi @puts | |
32 | ret | |
33 | epilog |