Hi, Mark

Thanks very much for your work, will apply your patches.

BTW, is there an easy way to test your patches? do you have such a test program?

Best Regards,
Wu Zhangjin

On Sat, Oct 29, 2011 at 3:19 AM, Mark H Weaver <m...@netris.org> wrote:
> Hello all,
>
> Apologies if this has already been addressed, as I am new to this
> mailing list and have not had time to search the archives carefully.
>
> I have found and fixed the underlying cause of the illegal instruction
> (SIGILL) signals sent to processes that execute some Loongson-specific
> floating-point operations (e.g. an madd/msub/nmadd/nmsub instruction
> with a quiet NaN or denormalized floating-point input value).
>
> MIPS and Loongson processors only implement the common cases of
> floating-point arithmetic operations in hardware.  In unusual cases, the
> FPU signals an "Unimplemented instruction exception" and relies upon the
> OS kernel to emulate the instruction in software.
>
> Linux includes a MIPS floating-point emulator to handle these cases, but
> its emulator does not include support for the Loongson variants of
> madd/msub/nmadd/nmsub.  It also does not include support for the
> Loongson operations on "paired-single" floating-point format (vectors of
> two single-precision values).
>
> The following patches add support for these instructions to
> arch/mips/math-emu.  I fixed some other deficiencies in that code as
> well, and those fixes are included in separate patches before the
> Loongson2f patch.
>
> Note that during testing, I found a mistake in the documentation for the
> Loongson 2F.  Page 95 of Loongson2FUserGuide.pdf claims that the
> paired-single floating-point instructions should use a format (fmt)
> field of 11.  However, the processor itself does not seem to recognize
> instructions with (fmt=11).  It seems to be looking for (fmt=22).
> That's the case for the Loongson2F in my Yeeloong anyway (which
> /proc/cpuinfo identifies as "ICT Loongson-2 V0.3 FPU  V0.1").
>
> I also found that the GNU assembler generates instructions with (fmt=22)
> for most (but not all) of the paired-single floating-point instructions.
> The only exceptions I've found are the Loongson-specific madd.ps,
> msub.ps, nmadd.ps, and nmsub.ps instructions, for which GNU as generates
> (fmt=11), although that does not work on my Loongson2F.  Therefore, I
> have also included a patch to GNU binutils (which will also apply to
> GDB) to use fmt=22 for those instructions on Loongson2F.
>
> I should note that the documentation for Loongson 2E (not 2F) also
> claims that the format field for paired-single instructions should use
> fmt=11.  I don't know whether this is a mistake or not, since I do not
> have access to a Loongson 2E processor with which to test.
>
> Finally, two apologies are in order:
>
> * Ideally I should have added support for the entire set of MIPS 5
>  floating-point operations, but I did not have time to do that job, nor
>  do I have a MIPS 5 processor with which to test.  Therefore, these
>  patches address only the Loongson 2F.
>
> * I must admit that I have not tested these patches against the
>  linux-loongson-community kernel.  However, I have tested them against
>  the linux--2.6.39.1-libre-lemote kernel maintained by Alexandre Oliva,
>  and there is no significant difference in arch/mips/math-emu between
>  those two trees.
>
> Comments and suggestions solicited.
>
>      Mark
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "loongson-dev" group.
> To post to this group, send email to loongson-dev@googlegroups.com.
> To unsubscribe from this group, send email to 
> loongson-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/loongson-dev?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"loongson-dev" group.
To post to this group, send email to loongson-dev@googlegroups.com.
To unsubscribe from this group, send email to 
loongson-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/loongson-dev?hl=en.

Reply via email to