aboutsummaryrefslogtreecommitdiff
path: root/deps/lightning/check/alux_add.tst
blob: ddc4e578c3629ab9a4288f7f74a87fd7a5e71546 (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
#include "alu.inc"

.code
	prolog

#define ADDX(N, I0, I1, V)	ALUX(N, add, I0, I1, V)

	/* nothing */
	ADDX(0,	0,		0,		0)
#if __WORDSIZE == 32
	/* carry */
	ADDX(1,	0xffffffff,	0xffffffff,	1)
	/* overflow */
	ADDX(2,	0x7fffffff,	1,		0)
	/* overflow */
	ADDX(3,	0x7fffffff,	0x7fffffff,	0)
	/* carry */
	ADDX(4,	0x7fffffff,	0x80000000,	0)
	/* carry+overflow */
	ADDX(5,	0x80000000,	0x80000000,	1)
#else
	/* nothing */
	ADDX(1,	0xffffffff,		0xffffffff,		0)
	/* nothing */
	ADDX(2,	0x7fffffff,		1,			0)
	/* nothing */
	ADDX(3,	0x7fffffff,		0x7fffffff,		0)
	/* nothing */
	ADDX(4,	0x7fffffff,		0x80000000,		0)
	/* nothing */
	ADDX(5,	0x80000000,		0x80000000,		0)
	/* carry */
	ADDX(6,	0xffffffffffffffff,	0xffffffffffffffff,	1)
	/* overflow */
	ADDX(7,	0x7fffffffffffffff,	1,			0)
	/* overflow */
	ADDX(8,	0x7fffffffffffffff,	0x7fffffffffffffff,	0)
	/* overflow */
	ADDX(9,	0x7fffffffffffffff,	0x8000000000000000,	0)
	/* carry+overflow */
	ADDX(10,0x8000000000000000,	0x8000000000000000,	1)
#endif

	prepare
		pushargi ok
		ellipsis
	finishi @printf
	ret
	epilog