|
|
|
@ -843,6 +843,158 @@ int fpu_test_12(void)
|
|
|
|
|
return trapit(0, test12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct addvals {
|
|
|
|
|
unsigned long val_a;
|
|
|
|
|
unsigned long val_b;
|
|
|
|
|
unsigned long sum;
|
|
|
|
|
unsigned long diff;
|
|
|
|
|
} addvals[] = {
|
|
|
|
|
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x3fdfffffffffffff, 0x0000000000000000, 0x3fdfffffffffffff, 0x3fdfffffffffffff },
|
|
|
|
|
{ 0x3ff0000000000000, 0x3ff0000000000000, 0x4000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0xbff0000000000000, 0xbff0000000000000, 0xc000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x402123456789abcd, 0x4021000000000000, 0x403111a2b3c4d5e6, 0x3fb1a2b3c4d5e680 },
|
|
|
|
|
{ 0x4061200000000000, 0x406123456789abcd, 0x407121a2b3c4d5e6, 0xbfba2b3c4d5e6800 },
|
|
|
|
|
{ 0x4061230000000000, 0x3fa4560000000000, 0x4061244560000000, 0x406121baa0000000 },
|
|
|
|
|
{ 0xc061230000000000, 0x3fa4560000000000, 0xc06121baa0000000, 0xc061244560000000 },
|
|
|
|
|
{ 0x4061230000000000, 0xbfa4560000000000, 0x406121baa0000000, 0x4061244560000000 },
|
|
|
|
|
{ 0xc061230000000000, 0xbfa4560000000000, 0xc061244560000000, 0xc06121baa0000000 },
|
|
|
|
|
{ 0x3fa1230000000000, 0x4064560000000000, 0x4064571230000000, 0xc06454edd0000000 },
|
|
|
|
|
{ 0xbfa1230000000000, 0x4064560000000000, 0x406454edd0000000, 0xc064571230000000 },
|
|
|
|
|
{ 0x3fa1230000000000, 0xc064560000000000, 0xc06454edd0000000, 0x4064571230000000 },
|
|
|
|
|
{ 0xbfa1230000000000, 0xc064560000000000, 0xc064571230000000, 0x406454edd0000000 },
|
|
|
|
|
{ 0x6780000000000001, 0x6470000000000000, 0x6780000000000009, 0x677ffffffffffff2 },
|
|
|
|
|
{ 0x6780000000000001, 0x6460000000000000, 0x6780000000000005, 0x677ffffffffffffa },
|
|
|
|
|
{ 0x6780000000000001, 0x6450000000000000, 0x6780000000000003, 0x677ffffffffffffe },
|
|
|
|
|
{ 0x6780000000000001, 0x6440000000000000, 0x6780000000000002, 0x6780000000000000 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x7ff9999999999999, 0x7ff8888888888888, 0x7ff8888888888888 },
|
|
|
|
|
{ 0xfff8888888888888, 0x7ff9999999999999, 0xfff8888888888888, 0xfff8888888888888 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x7ff0000000000000, 0x7ff8888888888888, 0x7ff8888888888888 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x0000000000000000, 0x7ff8888888888888, 0x7ff8888888888888 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x0001111111111111, 0x7ff8888888888888, 0x7ff8888888888888 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x3ff0000000000000, 0x7ff8888888888888, 0x7ff8888888888888 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x7ff9999999999999, 0x7ff9999999999999, 0x7ff9999999999999 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x7ff0000000000000, 0x7ff0000000000000, 0x7ff8000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0xfff0000000000000, 0x7ff8000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x0000000000000000, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x8000000000000000, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x8002222222222222, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0xc002222222222222, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x7ff9999999999999, 0x7ff9999999999999, 0x7ff9999999999999 },
|
|
|
|
|
{ 0x0000000000000000, 0x7ff0000000000000, 0x7ff0000000000000, 0xfff0000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x7ff0000000000000, 0x7ff0000000000000, 0xfff0000000000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8002222222222222, 0x0001111111111111, 0x8001111111111111, 0x8003333333333333 },
|
|
|
|
|
{ 0x0000022222222222, 0x0000111111111111, 0x0000133333333333, 0x80000eeeeeeeeeef },
|
|
|
|
|
{ 0x401ffffffbfffefe, 0x406b8265196bd89e, 0x406c8265194bd896, 0xc06a8265198bd8a6 },
|
|
|
|
|
{ 0x4030020000000004, 0xbf110001ffffffff, 0x403001fbbfff8004, 0x4030020440008004 },
|
|
|
|
|
{ 0x3fdfffffffffffff, 0x3fe0000000000000, 0x3ff0000000000000, 0xbc90000000000000 },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int test13(long arg)
|
|
|
|
|
{
|
|
|
|
|
long i;
|
|
|
|
|
unsigned long results[2];
|
|
|
|
|
struct addvals *vp = addvals;
|
|
|
|
|
|
|
|
|
|
set_fpscr(FPS_RN_NEAR);
|
|
|
|
|
for (i = 0; i < sizeof(addvals) / sizeof(addvals[0]); ++i, ++vp) {
|
|
|
|
|
asm("lfd 5,0(%0); lfd 6,8(%0); fadd 7,5,6; fsub 8,5,6; stfd 7,0(%1); stfd 8,8(%1)"
|
|
|
|
|
: : "b" (&vp->val_a), "b" (results) : "memory");
|
|
|
|
|
if (results[0] != vp->sum || results[1] != vp->diff) {
|
|
|
|
|
print_hex(i, 2, " ");
|
|
|
|
|
print_hex(results[0], 16, " ");
|
|
|
|
|
print_hex(results[1], 16, "\r\n");
|
|
|
|
|
return i + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fpu_test_13(void)
|
|
|
|
|
{
|
|
|
|
|
enable_fp();
|
|
|
|
|
return trapit(0, test13);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct addvals sp_addvals[] = {
|
|
|
|
|
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x3fdfffffffffffff, 0x0000000000000000, 0x3fe0000000000000, 0x3fe0000000000000 },
|
|
|
|
|
{ 0x3ff0000000000000, 0x3ff0000000000000, 0x4000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0xbff0000000000000, 0xbff0000000000000, 0xc000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x402123456789abcd, 0x4021000000000000, 0x403111a2c0000000, 0x3fb1a2b000000000 },
|
|
|
|
|
{ 0x4061200000000000, 0x406123456789abcd, 0x407121a2c0000000, 0xbfba2b0000000000 },
|
|
|
|
|
{ 0x4061230000000000, 0x3fa4560000000000, 0x4061244560000000, 0x406121baa0000000 },
|
|
|
|
|
{ 0xc061230000000000, 0x3fa4560000000000, 0xc06121baa0000000, 0xc061244560000000 },
|
|
|
|
|
{ 0x4061230000000000, 0xbfa4560000000000, 0x406121baa0000000, 0x4061244560000000 },
|
|
|
|
|
{ 0xc061230000000000, 0xbfa4560000000000, 0xc061244560000000, 0xc06121baa0000000 },
|
|
|
|
|
{ 0x3fa1230000000000, 0x4064560000000000, 0x4064571240000000, 0xc06454edc0000000 },
|
|
|
|
|
{ 0xbfa1230000000000, 0x4064560000000000, 0x406454edc0000000, 0xc064571240000000 },
|
|
|
|
|
{ 0x3fa1230000000000, 0xc064560000000000, 0xc06454edc0000000, 0x4064571240000000 },
|
|
|
|
|
{ 0xbfa1230000000000, 0xc064560000000000, 0xc064571240000000, 0x406454edc0000000 },
|
|
|
|
|
{ 0x6780000000000001, 0x6470000000000000, 0x7ff0000000000000, 0x7ff8000000000000 },
|
|
|
|
|
{ 0x6780000000000001, 0x6460000000000000, 0x7ff0000000000000, 0x7ff8000000000000 },
|
|
|
|
|
{ 0x6780000000000001, 0x6450000000000000, 0x7ff0000000000000, 0x7ff8000000000000 },
|
|
|
|
|
{ 0x6780000000000001, 0x6440000000000000, 0x7ff0000000000000, 0x7ff8000000000000 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x7ff9999999999999, 0x7ff8888880000000, 0x7ff8888880000000 },
|
|
|
|
|
{ 0xfff8888888888888, 0x7ff9999999999999, 0xfff8888880000000, 0xfff8888880000000 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x7ff0000000000000, 0x7ff8888880000000, 0x7ff8888880000000 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x0000000000000000, 0x7ff8888880000000, 0x7ff8888880000000 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x0001111111111111, 0x7ff8888880000000, 0x7ff8888880000000 },
|
|
|
|
|
{ 0x7ff8888888888888, 0x3ff0000000000000, 0x7ff8888880000000, 0x7ff8888880000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x7ff9999999999999, 0x7ff9999980000000, 0x7ff9999980000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x7ff0000000000000, 0x7ff0000000000000, 0x7ff8000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0xfff0000000000000, 0x7ff8000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x0000000000000000, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x8000000000000000, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0x8002222222222222, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x7ff0000000000000, 0xc002222222222222, 0x7ff0000000000000, 0x7ff0000000000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x7ff9999999999999, 0x7ff9999980000000, 0x7ff9999980000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x7ff0000000000000, 0x7ff0000000000000, 0xfff0000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x7ff0000000000000, 0x7ff0000000000000, 0xfff0000000000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x8002222222222222, 0x0001111111111111, 0x0000000000000000, 0x8000000000000000 },
|
|
|
|
|
{ 0x0000022222222222, 0x0000111111111111, 0x0000000000000000, 0x0000000000000000 },
|
|
|
|
|
{ 0x47dc000020000000, 0x47ec03ffe0000000, 0x7ff0000000000000, 0xc7dc07ffa0000000 },
|
|
|
|
|
{ 0x47dbffffe0000000, 0x47eff7ffe0000000, 0x7ff0000000000000, 0xc7e1f80000000000 },
|
|
|
|
|
{ 0x47efffffc0000000, 0xc7efffffc0000000, 0x0000000000000000, 0x7ff0000000000000 },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int test14(long arg)
|
|
|
|
|
{
|
|
|
|
|
long i;
|
|
|
|
|
unsigned long results[2];
|
|
|
|
|
struct addvals *vp = sp_addvals;
|
|
|
|
|
|
|
|
|
|
set_fpscr(FPS_RN_NEAR);
|
|
|
|
|
for (i = 0; i < sizeof(sp_addvals) / sizeof(sp_addvals[0]); ++i, ++vp) {
|
|
|
|
|
asm("lfd 5,0(%0); frsp 5,5; lfd 6,8(%0); frsp 6,6; "
|
|
|
|
|
"fadds 7,5,6; fsubs 8,5,6; stfd 7,0(%1); stfd 8,8(%1)"
|
|
|
|
|
: : "b" (&vp->val_a), "b" (results) : "memory");
|
|
|
|
|
if (results[0] != vp->sum || results[1] != vp->diff) {
|
|
|
|
|
print_hex(i, 2, " ");
|
|
|
|
|
print_hex(results[0], 16, " ");
|
|
|
|
|
print_hex(results[1], 16, "\r\n");
|
|
|
|
|
return i + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fpu_test_14(void)
|
|
|
|
|
{
|
|
|
|
|
enable_fp();
|
|
|
|
|
return trapit(0, test14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fail = 0;
|
|
|
|
|
|
|
|
|
|
void do_test(int num, int (*test)(void))
|
|
|
|
@ -880,6 +1032,8 @@ int main(void)
|
|
|
|
|
do_test(10, fpu_test_10);
|
|
|
|
|
do_test(11, fpu_test_11);
|
|
|
|
|
do_test(12, fpu_test_12);
|
|
|
|
|
do_test(13, fpu_test_13);
|
|
|
|
|
do_test(14, fpu_test_14);
|
|
|
|
|
|
|
|
|
|
return fail;
|
|
|
|
|
}
|
|
|
|
|