Commit | Line | Data |
---|---|---|
4a71579b PC |
1 | #include "alu.inc" |
2 | ||
3 | .code | |
4 | prolog | |
5 | ||
6 | #define ADDX(N, I0, I1, V) ALUX(N, add, I0, I1, V) | |
7 | ||
8 | /* nothing */ | |
9 | ADDX(0, 0, 0, 0) | |
10 | #if __WORDSIZE == 32 | |
11 | /* carry */ | |
12 | ADDX(1, 0xffffffff, 0xffffffff, 1) | |
13 | /* overflow */ | |
14 | ADDX(2, 0x7fffffff, 1, 0) | |
15 | /* overflow */ | |
16 | ADDX(3, 0x7fffffff, 0x7fffffff, 0) | |
17 | /* carry */ | |
18 | ADDX(4, 0x7fffffff, 0x80000000, 0) | |
19 | /* carry+overflow */ | |
20 | ADDX(5, 0x80000000, 0x80000000, 1) | |
21 | #else | |
22 | /* nothing */ | |
23 | ADDX(1, 0xffffffff, 0xffffffff, 0) | |
24 | /* nothing */ | |
25 | ADDX(2, 0x7fffffff, 1, 0) | |
26 | /* nothing */ | |
27 | ADDX(3, 0x7fffffff, 0x7fffffff, 0) | |
28 | /* nothing */ | |
29 | ADDX(4, 0x7fffffff, 0x80000000, 0) | |
30 | /* nothing */ | |
31 | ADDX(5, 0x80000000, 0x80000000, 0) | |
32 | /* carry */ | |
33 | ADDX(6, 0xffffffffffffffff, 0xffffffffffffffff, 1) | |
34 | /* overflow */ | |
35 | ADDX(7, 0x7fffffffffffffff, 1, 0) | |
36 | /* overflow */ | |
37 | ADDX(8, 0x7fffffffffffffff, 0x7fffffffffffffff, 0) | |
38 | /* overflow */ | |
39 | ADDX(9, 0x7fffffffffffffff, 0x8000000000000000, 0) | |
40 | /* carry+overflow */ | |
41 | ADDX(10,0x8000000000000000, 0x8000000000000000, 1) | |
42 | #endif | |
43 | ||
44 | prepare | |
45 | pushargi ok | |
46 | ellipsis | |
47 | finishi @printf | |
48 | ret | |
49 | epilog |