18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci// Copyright (C) 2005-2018 Andes Technology Corporation 38c2ecf20Sopenharmony_ci#include <linux/uaccess.h> 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/sfp-machine.h> 68c2ecf20Sopenharmony_ci#include <math-emu/soft-fp.h> 78c2ecf20Sopenharmony_ci#include <math-emu/single.h> 88c2ecf20Sopenharmony_civoid fdivs(void *ft, void *fa, void *fb) 98c2ecf20Sopenharmony_ci{ 108c2ecf20Sopenharmony_ci FP_DECL_S(A); 118c2ecf20Sopenharmony_ci FP_DECL_S(B); 128c2ecf20Sopenharmony_ci FP_DECL_S(R); 138c2ecf20Sopenharmony_ci FP_DECL_EX; 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci FP_UNPACK_SP(A, fa); 168c2ecf20Sopenharmony_ci FP_UNPACK_SP(B, fb); 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) 198c2ecf20Sopenharmony_ci FP_SET_EXCEPTION(FP_EX_DIVZERO); 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci FP_DIV_S(R, A, B); 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci FP_PACK_SP(ft, R); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci __FPU_FPCSR |= FP_CUR_EXCEPTIONS; 268c2ecf20Sopenharmony_ci} 27