Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/types.h>
0003 #include <linux/errno.h>
0004 #include <linux/uaccess.h>
0005 
0006 #include <asm/sfp-machine.h>
0007 #include <math-emu/soft-fp.h>
0008 #include <math-emu/double.h>
0009 #include <math-emu/single.h>
0010 
0011 int
0012 fsqrts(void *frD, void *frB)
0013 {
0014     FP_DECL_D(B);
0015     FP_DECL_D(R);
0016     FP_DECL_EX;
0017 
0018 #ifdef DEBUG
0019     printk("%s: %p %p %p %p\n", __func__, frD, frB);
0020 #endif
0021 
0022     FP_UNPACK_DP(B, frB);
0023 
0024 #ifdef DEBUG
0025     printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
0026 #endif
0027 
0028     if (B_s && B_c != FP_CLS_ZERO)
0029         FP_SET_EXCEPTION(EFLAG_VXSQRT);
0030     if (B_c == FP_CLS_NAN)
0031         FP_SET_EXCEPTION(EFLAG_VXSNAN);
0032 
0033     FP_SQRT_D(R, B);
0034 
0035 #ifdef DEBUG
0036     printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
0037 #endif
0038 
0039     __FP_PACK_DS(frD, R);
0040 
0041     return FP_CUR_EXCEPTIONS;
0042 }