1
/* Test of division. Simple cases.
2
$Id: div-01.c,v 1.1 2007/02/05 21:35:58 dmix Exp $
13
volatile union lofl_u v = { .lo = 1 };
15
PROGMEM const struct { /* Table of test cases: x / y = z */
20
{ { 0x00000000 }, { 0x00000001 }, { 0x00000000 } },
21
{ { 0x00000000 }, { 0x007fffff }, { 0x00000000 } },
22
{ { 0x00000000 }, { 0x00800000 }, { 0x00000000 } },
23
{ { 0x00000000 }, { 0x7f7fffff }, { 0x00000000 } },
24
{ { 0x00000000 }, { 0x80000001 }, { 0x80000000 } },
25
{ { 0x00000000 }, { 0x807fffff }, { 0x80000000 } },
26
{ { 0x00000000 }, { 0x80800000 }, { 0x80000000 } },
27
{ { 0x00000000 }, { 0xff7fffff }, { 0x80000000 } },
30
{ { 0x80000000 }, { 0x3f800000 }, { 0x80000000 } },
31
{ { 0x80000000 }, { 0xbf800000 }, { 0x00000000 } },
34
{ { 0x00000000 }, { .fl = +1.0 }, { 0x00000000 } },
35
{ { 0x00000001 }, { .fl = +1.0 }, { 0x00000001 } },
36
{ { 0x00000100 }, { .fl = +1.0 }, { 0x00000100 } },
37
{ { 0x00010000 }, { .fl = +1.0 }, { 0x00010000 } },
38
{ { 0x007fffff }, { .fl = +1.0 }, { 0x007fffff } },
39
{ { 0x00800000 }, { .fl = +1.0 }, { 0x00800000 } },
40
{ { 0x3f800000 }, { .fl = +1.0 }, { 0x3f800000 } },
41
{ { 0x7f7fffff }, { .fl = +1.0 }, { 0x7f7fffff } },
42
{ { 0x80000000 }, { .fl = +1.0 }, { 0x80000000 } },
43
{ { 0x80000001 }, { .fl = +1.0 }, { 0x80000001 } },
44
{ { 0x80000100 }, { .fl = +1.0 }, { 0x80000100 } },
45
{ { 0x80010000 }, { .fl = +1.0 }, { 0x80010000 } },
46
{ { 0x807fffff }, { .fl = +1.0 }, { 0x807fffff } },
47
{ { 0x80800000 }, { .fl = +1.0 }, { 0x80800000 } },
48
{ { 0xbf800000 }, { .fl = +1.0 }, { 0xbf800000 } },
49
{ { 0xff7fffff }, { .fl = +1.0 }, { 0xff7fffff } },
52
{ { 0x00000000 }, { .fl = -1.0 }, { 0x80000000 } },
53
{ { 0x00000001 }, { .fl = -1.0 }, { 0x80000001 } },
54
{ { 0x00000100 }, { .fl = -1.0 }, { 0x80000100 } },
55
{ { 0x00010000 }, { .fl = -1.0 }, { 0x80010000 } },
56
{ { 0x007fffff }, { .fl = -1.0 }, { 0x807fffff } },
57
{ { 0x00800000 }, { .fl = -1.0 }, { 0x80800000 } },
58
{ { 0x3f800000 }, { .fl = -1.0 }, { 0xbf800000 } },
59
{ { 0x7f7fffff }, { .fl = -1.0 }, { 0xff7fffff } },
60
{ { 0x80000000 }, { .fl = -1.0 }, { 0x00000000 } },
61
{ { 0x80000001 }, { .fl = -1.0 }, { 0x00000001 } },
62
{ { 0x80000100 }, { .fl = -1.0 }, { 0x00000100 } },
63
{ { 0x80010000 }, { .fl = -1.0 }, { 0x00010000 } },
64
{ { 0x807fffff }, { .fl = -1.0 }, { 0x007fffff } },
65
{ { 0x80800000 }, { .fl = -1.0 }, { 0x00800000 } },
66
{ { 0xbf800000 }, { .fl = -1.0 }, { 0x3f800000 } },
67
{ { 0xff7fffff }, { .fl = -1.0 }, { 0x7f7fffff } },
70
{ { 0x00000001 }, { 0x00000001 }, { .fl = +1.0 } },
71
{ { 0x00000100 }, { 0x00000100 }, { .fl = +1.0 } },
72
{ { 0x00010000 }, { 0x00010000 }, { .fl = +1.0 } },
73
{ { 0x007fffff }, { 0x007fffff }, { .fl = +1.0 } },
74
{ { 0x00800000 }, { 0x00800000 }, { .fl = +1.0 } },
75
{ { 0x3f800000 }, { 0x3f800000 }, { .fl = +1.0 } },
76
{ { 0x7f7fffff }, { 0x7f7fffff }, { .fl = +1.0 } },
77
{ { 0x80000001 }, { 0x80000001 }, { .fl = +1.0 } },
78
{ { 0x80000100 }, { 0x80000100 }, { .fl = +1.0 } },
79
{ { 0x80010000 }, { 0x80010000 }, { .fl = +1.0 } },
80
{ { 0x807fffff }, { 0x807fffff }, { .fl = +1.0 } },
81
{ { 0x80800000 }, { 0x80800000 }, { .fl = +1.0 } },
82
{ { 0xbf800000 }, { 0xbf800000 }, { .fl = +1.0 } },
83
{ { 0xff7fffff }, { 0xff7fffff }, { .fl = +1.0 } },
86
void x_exit (int index)
89
fprintf (stderr, "t[%d]: %#lx\n", index - 1, v.lo);
91
exit (index ? index : -1);
99
for (i = 0; i < (int) (sizeof(t) / sizeof(t[0])); i++) {
100
x.lo = pgm_read_dword (& t[i].x);
101
y.lo = pgm_read_dword (& t[i].y);
102
z.lo = pgm_read_dword (& t[i].z);
104
/* Comparison is integer to verify the zero sign. */