aboutsummaryrefslogtreecommitdiff
path: root/deps/lightning/check/alux_sub.tst
blob: 8a2838d215881c842f4891509a9524650d3accc2 (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 SUBX(N, I0, I1, V)	ALUX(N, sub, I0, I1, V)

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

	prepare
		pushargi ok
		ellipsis
	finishi @printf
	ret
	epilog