git subrepo pull --force deps/lightrec
[pcsx_rearmed.git] / deps / lightning / check / alu_div.tst
1 #include "alu.inc"
2
3 .code
4         prolog
5
6 #define DIV(N, I0, I1, V)       ALU(N, , div, I0, I1, V)
7 #define UDIV(N, I0, I1, V)      ALU(N, _u, div, I0, I1, V)
8
9         DIV(0,  0x7fffffff, 1,          0x7fffffff)
10         DIV(1,  1,          0x7fffffff, 0)
11         DIV(2,  0x80000000, 1,          0x80000000)
12         DIV(3,  1,          0x80000000, 0)
13         DIV(4,  0x7fffffff, 2,          0x3fffffff)
14         DIV(5,  2,          0x7fffffff, 0)
15         DIV(6,  2,          0x80000000, 0)
16         DIV(7,  0x7fffffff, 0x80000000, 0)
17         DIV(8,  0,          0x7fffffff, 0)
18         DIV(9,  0xffffffff, 0xffffffff, 1)
19         UDIV(0, 0x7fffffff, 1,          0x7fffffff)
20         UDIV(1, 1,          0x7fffffff, 0)
21         UDIV(2, 0x80000000, 1,          0x80000000)
22         UDIV(3, 1,          0x80000000, 0)
23         UDIV(4, 0x7fffffff, 2,          0x3fffffff)
24         UDIV(5, 2,          0x7fffffff, 0)
25         UDIV(6, 0x80000000, 2,          0x40000000)
26         UDIV(7, 2,          0x80000000, 0)
27         UDIV(8, 0x7fffffff, 0x80000000, 0)
28         UDIV(9, 0x80000000, 0x7fffffff, 1)
29         UDIV(10,0,          0x7fffffff, 0)
30         UDIV(11,0x7fffffff, 0xffffffff, 0)
31         UDIV(12,0xffffffff, 0x7fffffff, 2)
32         UDIV(13,0xffffffff, 0xffffffff, 1)
33 #if __WORDSIZE == 32
34         DIV(10, 0x80000000, 2,          0xc0000000)
35         DIV(11, 0x80000000, 0x7fffffff, 0xffffffff)
36         DIV(12, 0x7fffffff, 0xffffffff, 0x80000001)
37         DIV(13, 0xffffffff, 0x7fffffff, 0)
38 #else
39         DIV(10, 0x80000000,         2,                  0x40000000)
40         DIV(11, 0x80000000,         0x7fffffff,         1)
41         DIV(12, 0x7fffffff,         0xffffffff,         0)
42         DIV(13, 0xffffffff,         0x7fffffff,         2)
43         DIV(14, 0x7fffffffffffffff, 1,                  0x7fffffffffffffff)
44         DIV(15, 1,                  0x7fffffffffffffff, 0)
45         DIV(16, 0x8000000000000000, 1,                  0x8000000000000000)
46         DIV(17, 1,                  0x8000000000000000, 0)
47         DIV(18, 0x7fffffffffffffff, 2,                  0x3fffffffffffffff)
48         DIV(19, 2,                  0x7fffffffffffffff, 0)
49         DIV(20, 0x8000000000000000, 2,                  0xc000000000000000)
50         DIV(21, 2,                  0x8000000000000000, 0)
51         DIV(22, 0x7fffffffffffffff, 0x8000000000000000, 0)
52         DIV(23, 0x8000000000000000, 0x7fffffffffffffff, 0xffffffffffffffff)
53         DIV(24, 0x7fffffffffffffff, 0xffffffffffffffff, 0x8000000000000001)
54         DIV(25, 0xffffffffffffffff, 0x7fffffffffffffff, 0)
55         DIV(26, 0xffffffffffffffff, 0xffffffffffffffff, 1)
56         UDIV(14,0x7fffffffffffffff, 1,                  0x7fffffffffffffff)
57         UDIV(15,1,                  0x7fffffffffffffff, 0)
58         UDIV(16,0x8000000000000000, 1,                  0x8000000000000000)
59         UDIV(17,1,                  0x8000000000000000, 0)
60         UDIV(18,0x7fffffffffffffff, 2,                  0x3fffffffffffffff)
61         UDIV(19,2,                  0x7fffffffffffffff, 0)
62         UDIV(20,0x8000000000000000, 2,                  0x4000000000000000)
63         UDIV(21,2,                  0x8000000000000000, 0)
64         UDIV(22,0x7fffffffffffffff, 0x8000000000000000, 0)
65         UDIV(23,0x8000000000000000, 0x7fffffffffffffff, 1)
66         UDIV(24,0x7fffffffffffffff, 0xffffffffffffffff, 0)
67         UDIV(25,0xffffffffffffffff, 0x7fffffffffffffff, 2)
68         UDIV(26,0xffffffffffffffff, 0xffffffffffffffff, 1)
69 #endif
70
71 #undef DIV
72 #define DIV(N, T, I0, I1, V)    FOP(N, T, div, I0, I1, V)
73         DIV(0, _f,      -0.5,       0.5,        -1.0)
74         DIV(1, _f,       1.25,      0.5,         2.5)
75         DIV(0, _d,      -0.5,       0.5,        -1.0)
76         DIV(1, _d,       1.25,      0.5,         2.5)
77
78         prepare
79                 pushargi ok
80                 ellipsis
81         finishi @printf
82         ret
83         epilog