This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
The mips simulator uses sim_fpu_inv() as a reciprocal function
but all it really does is negate the exponent. So we end up
calculating 1 / (x*2^y) as x*2^-y.
Test case:
#include <stdio.h>
int
main ()
{
double d;
float f;
asm ("recip.s %0,%1" : "=f" (f) : "f" (20.0f));
printf ("%g\n", f);
asm ("recip.d %0,%1" : "=f" (d) : "f" (10.0));
printf ("%g\n", d);
asm ("rsqrt.s %0,%1" : "=f" (f) : "f" (0.01f));
printf ("%g\n", f);
asm ("rsqrt.d %0,%1" : "=f" (d) : "f" (25.0));
printf ("%g\n", d);
return 0;
}
Can this test case be written in strict assembler so that it can be
added to the simulator testsuite?The simulator says:
0.078125
0.15625
25.6
0.3125
while a vr5500 says:
0.05
0.1
10
0.2
Unfortunately, sim_fpu_inv isn't commented and cp1.c seems to be
its only active user. Which should change?
FWIW, the patch below fixes the test case. Please install if OK.
Hmm, I guess:| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |