0001
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
0010 int
0011 fsub(void *frD, void *frA, void *frB)
0012 {
0013 FP_DECL_D(A);
0014 FP_DECL_D(B);
0015 FP_DECL_D(R);
0016 FP_DECL_EX;
0017
0018 #ifdef DEBUG
0019 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
0020 #endif
0021
0022 FP_UNPACK_DP(A, frA);
0023 FP_UNPACK_DP(B, frB);
0024
0025 #ifdef DEBUG
0026 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
0027 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
0028 #endif
0029
0030 if (B_c != FP_CLS_NAN)
0031 B_s ^= 1;
0032
0033 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
0034 FP_SET_EXCEPTION(EFLAG_VXISI);
0035
0036 FP_ADD_D(R, A, B);
0037
0038 #ifdef DEBUG
0039 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
0040 #endif
0041
0042 __FP_PACK_D(frD, R);
0043
0044 return FP_CUR_EXCEPTIONS;
0045 }