1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (C) 2005-2019 Andes Technology Corporation 3 #include <linux/uaccess.h> 4 5 #include <asm/sfp-machine.h> 6 #include <math-emu/soft-fp.h> 7 #include <math-emu/single.h> 8 fs2ui_z(void * ft,void * fa)9void fs2ui_z(void *ft, void *fa) 10 { 11 unsigned int r; 12 13 FP_DECL_S(A); 14 FP_DECL_EX; 15 16 FP_UNPACK_SP(A, fa); 17 18 if (A_c == FP_CLS_INF) { 19 *(unsigned int *)ft = (A_s == 0) ? 0xffffffff : 0x00000000; 20 __FPU_FPCSR |= FP_EX_INVALID; 21 } else if (A_c == FP_CLS_NAN) { 22 *(unsigned int *)ft = 0xffffffff; 23 __FPU_FPCSR |= FP_EX_INVALID; 24 } else { 25 FP_TO_INT_S(r, A, 32, 0); 26 __FPU_FPCSR |= FP_CUR_EXCEPTIONS; 27 *(unsigned int *)ft = r; 28 } 29 30 } 31