nds32: support denormalized result through FP emulator
authorVincent Chen <vincentc@andestech.com>
Thu, 22 Nov 2018 03:14:36 +0000 (11:14 +0800)
committerGreentime Hu <greentime@andestech.com>
Thu, 22 Nov 2018 10:13:27 +0000 (18:13 +0800)
commit44e92e0364adfd7b6759084e02a550d06336d896
tree4fb8af79a5ce25f9467bdc22f44e67f6ae42b6d6
parent1ac832509f2ea1b566f0c06f98f308f58b03d098
nds32: support denormalized result through FP emulator

Currently, the nds32 FPU dose not support the arithmetic of denormalized
number. When the nds32 FPU finds the result of the instruction is a
denormlized number, the nds32 FPU considers it to be an underflow condition
and rounds the result to an appropriate number. It may causes some loss
of precision. This commit proposes a solution to re-execute the
instruction by the FPU emulator to enhance the precision. To transfer
calculations from user space to kernel space, this feature will enable
the underflow exception trap by default. Enabling this feature may cause
some side effects:
  1. Performance loss due to extra FPU exception
  2. Need another scheme to control real underflow trap
       A new parameter, UDF_trap, which is belong to FPU context is used
     to control underflow trap.

User can configure this feature via CONFIG_SUPPORT_DENORMAL_ARITHMETIC

Signed-off-by: Vincent Chen <vincentc@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
arch/nds32/Kconfig.cpu
arch/nds32/include/asm/elf.h
arch/nds32/include/asm/fpu.h
arch/nds32/include/asm/syscalls.h
arch/nds32/include/uapi/asm/auxvec.h
arch/nds32/include/uapi/asm/sigcontext.h
arch/nds32/include/uapi/asm/udftrap.h [new file with mode: 0644]
arch/nds32/include/uapi/asm/unistd.h
arch/nds32/kernel/fpu.c
arch/nds32/kernel/sys_nds32.c
arch/nds32/math-emu/fpuemu.c