diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-03 10:23:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-03 10:23:41 -0700 |
commit | 30d1d92a888d03681b927c76a35181b4eed7071f (patch) | |
tree | 8a1d452bd9c13d9edaa8f86ff9355f663ea9ec55 /arch/nds32/math-emu/fd2uiz.c | |
parent | 01e7a841b4346836f19b40677e1fef4657cc0d0d (diff) | |
parent | 932296120543149e3397af252e7daee7af37eb05 (diff) |
Merge tag 'nds32-for-linux-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux
Pull nds32 fixes from Greentime Hu:
- fix warning for math-emu
- fix nds32 fpu exception handling
- fix nds32 fpu emulation implementation
* tag 'nds32-for-linux-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux:
nds32: add new emulations for floating point instruction
nds32: Avoid IEX status being incorrectly modified
math-emu: Use statement expressions to fix Wshift-count-overflow warning
Diffstat (limited to 'arch/nds32/math-emu/fd2uiz.c')
-rw-r--r-- | arch/nds32/math-emu/fd2uiz.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/nds32/math-emu/fd2uiz.c b/arch/nds32/math-emu/fd2uiz.c new file mode 100644 index 000000000000..8ae17cfce90d --- /dev/null +++ b/arch/nds32/math-emu/fd2uiz.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2019 Andes Technology Corporation +#include <linux/uaccess.h> + +#include <asm/sfp-machine.h> +#include <math-emu/soft-fp.h> +#include <math-emu/double.h> + +void fd2ui_z(void *ft, void *fa) +{ + unsigned int r; + + FP_DECL_D(A); + FP_DECL_EX; + + FP_UNPACK_DP(A, fa); + + if (A_c == FP_CLS_INF) { + *(unsigned int *)ft = (A_s == 0) ? 0xffffffff : 0x00000000; + __FPU_FPCSR |= FP_EX_INVALID; + } else if (A_c == FP_CLS_NAN) { + *(unsigned int *)ft = 0xffffffff; + __FPU_FPCSR |= FP_EX_INVALID; + } else { + FP_TO_INT_D(r, A, 32, 0); + __FPU_FPCSR |= FP_CUR_EXCEPTIONS; + *(unsigned int *)ft = r; + } + +} |