Re: (Hardware?) problem with denormal values on mipsel
James Cowgill <[email protected]>
| Newsgroups | gmane.linux.debian.ports.mips |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2015-05-27 at 20:46 +0200, Ole Streicher wrote:
> Hi all,
>
> Am 27.05.2015 um 15:45 schrieb James Cowgill:
> > There's probably still a hardware bug in here somewhere, but before 3.16
> > the kernel was fixing it with the math emulator.
>
> Without understanding the discussion in detail, I'd like to bring a few
> points here back: the issue is not about SIGILL on *any* call of sqrt; it is
> just when it is called with a denormal number. Using f.e. 1.134e-32 f.e.
> worked for me.
Yes the Loongson machines do not implement the sqrt.s instruction for
denormals, but it works for normalized numbers.
> Also, the minimal "C" analogon
>
> #include <math.h>
> int main(void) {
> float r = 1.1342362e-39;
> r = sqrt(r);
> exit(0);
> }
Your test case is wrong. If compiled without optimization, GCC call
'sqrt' from glibc instead of using the sqrt.s MIPS instruction. With
optimization GCC will remove the call altogether. This is different to
fortran because in fortran SQRT is a builtin intrinsic.
Try this instead (compile with -O2 -lm):
#include <math.h>
float x = 1.1342362e-39;
int main(void) {
x = sqrt(x);
return 0;
}
Thanks,
James
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCgAGBQJVZtxgAAoJENp9Vyz7AWUHuvwP/iprcF91v5/9Gxo6MQJPW41S DtU9eY5uUwML0Ljo9bPrRUXHhflBzqdUFDwRy+lFbM1OMwhTMsfRY8XYpVp9eK0V jUMadhzY1bn7P1MXDG/whrafz0vZI4UFnioLI9CuWn1malbLNxsjqlCcA5fxUkQ7 yRxxhwEvT5Jm4ikL2HV033Np4PI+jEOoUFjOJDz0NzqZtohTLvqPSBkYH+0h9px/ 8f5xeyeE4SkLnIrgz/cL7RZDug2SN/sum28VHqMearHXwfxPHY+86A/66+972TSG 6HeUPsqWUymg8PcmImjtjq7KlGZMPcyjs0hquqHOFFIoNJdMTSQT3GcFlYqhoZeJ OU/oynzWg3N3ktxa4hsyM+295wXWFxRdxLMQ4tPl1WtxeguVGaa4HeWHY23d4oLo eU8N0DouLf7Q177qqJAeZgKrIZqreUireAOZOW8kXnWg1dYPoY5EgTHGOO08//2C l+IWL0VwxVWUvAv/5zpCczEjqZI3mcDJs7D5F79X/MP7G6vAw20SA7x8+y3e9ypB XW3DlqF49C8Y0R/lp72yDmvoUvJReCsXXZ3UmY3gwSgx2LLBztZEMdUza1ZPjf8m lfTkdXp3MKoOp24vef8Q7BiC6WP0uVn8ZZJbhLpknPpD/5DDthMrvK3sqxyxWNFM MnzNevBJ6EYXRVNaH3or =fphL -----END PGP SIGNATURE-----