int efsadd(void *rD, void *rA, void *rB) { FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R); int ret = 0; #ifdef DEBUG printk("%s: %p %p %p\n", __FUNCTION__, rD, rA, rB); #endif __FP_UNPACK_S(A, rA); __FP_UNPACK_S(B, rB); #ifdef DEBUG printk("A: %ld %lu %ld (%ld)\n", A_s, A_f, A_e, A_c); printk("B: %ld %lu %ld (%ld)\n", B_s, B_f, B_e, B_c); #endif FP_ADD_S(R, A, B); #ifdef DEBUG printk("D: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c); #endif return (ret | __FP_PACK_S(rD, R)); }
int FSQRTS(void *rd, void *rs2) { FP_DECL_S(A); FP_DECL_S(R); __FP_UNPACK_S(A, rs2); FP_SQRT_S(R, A); __FP_PACK_S(rd, R); return 1; }
int FDIVS(void *rd, void *rs2, void *rs1) { FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R); __FP_UNPACK_S(A, rs1); __FP_UNPACK_S(B, rs2); FP_DIV_S(R, A, B); __FP_PACK_S(rd, R); return 1; }
CMPtype __unordsf2(SFtype a, SFtype b) { FP_DECL_S(A); FP_DECL_S(B); CMPtype r; FP_UNPACK_RAW_S(A, a); FP_UNPACK_RAW_S(B, b); FP_CMP_UNORD_S(r, A, B); return r; }
CMPtype __c6xabi_gtf(SFtype a, SFtype b) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(B); CMPtype r; FP_UNPACK_RAW_S(A, a); FP_UNPACK_RAW_S(B, b); FP_CMP_S(r, A, B, -2, 2); FP_HANDLE_EXCEPTIONS; return r > 0; }
CMPtype __c6xabi_eqf(SFtype a, SFtype b) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(B); CMPtype r; FP_UNPACK_RAW_S(A, a); FP_UNPACK_RAW_S(B, b); FP_CMP_EQ_S(r, A, B, 1); FP_HANDLE_EXCEPTIONS; return !r; }
SFtype __negsf2(SFtype a) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(R); SFtype r; FP_UNPACK_S(A, a); FP_NEG_S(R, A); FP_PACK_S(r, R); FP_CLEAR_EXCEPTIONS; FP_HANDLE_EXCEPTIONS; return r; }
float __negsf2(float a) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(R); float r; FP_UNPACK_S(A, a); FP_NEG_S(R, A); FP_PACK_S(r, R); FP_CLEAR_EXCEPTIONS; FP_HANDLE_EXCEPTIONS; return r; }
SFtype __addsf3(SFtype a, SFtype b) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R); SFtype r; FP_INIT_ROUNDMODE; FP_UNPACK_SEMIRAW_S(A, a); FP_UNPACK_SEMIRAW_S(B, b); FP_ADD_S(R, A, B); FP_PACK_SEMIRAW_S(r, R); FP_HANDLE_EXCEPTIONS; return r; }
int __eqsf2(SFtype a, SFtype b) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(B); int r; FP_UNPACK_RAW_S(A, a); FP_UNPACK_RAW_S(B, b); FP_CMP_EQ_S(r, A, B); if (r && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B))) FP_SET_EXCEPTION(FP_EX_INVALID); FP_HANDLE_EXCEPTIONS; return r; }
CMPtype __c6xabi_ltf(SFtype a, SFtype b) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_S(B); CMPtype r; FP_UNPACK_RAW_S(A, a); FP_UNPACK_RAW_S(B, b); FP_CMP_S(r, A, B, 2); if (r == 2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B))) FP_SET_EXCEPTION(FP_EX_INVALID); FP_HANDLE_EXCEPTIONS; return r < 0; }
int FCMPS(void *rd, void *rs2, void *rs1) { FP_DECL_S(A); FP_DECL_S(B); long ret; unsigned long *fsr = rd; __FP_UNPACK_S(A, rs1); __FP_UNPACK_S(B, rs2); FP_CMP_S(ret, B, A, 1); if (ret == -1) ret = 2; *fsr = (*fsr & ~0xc00) | (ret << 10); return 1; }
CMPtype __eqsf2 (SFtype a, SFtype b) { FP_DECL_EX; FP_DECL_S (A); FP_DECL_S (B); CMPtype r; FP_INIT_EXCEPTIONS; FP_UNPACK_RAW_S (A, a); FP_UNPACK_RAW_S (B, b); FP_CMP_EQ_S (r, A, B, 1); FP_HANDLE_EXCEPTIONS; return r; }
int stfs(void *frS, void *ea) { FP_DECL_D(A); FP_DECL_S(R); FP_DECL_EX; float f; #ifdef DEBUG printk("%s: S %p, ea %p\n", __func__, frS, ea); #endif FP_UNPACK_DP(A, frS); #ifdef DEBUG printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); #endif FP_CONV(S, D, 1, 2, R, A); #ifdef DEBUG printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c); #endif _FP_PACK_CANONICAL(S, 1, R); if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) { _FP_PACK_RAW_1_P(S, &f, R); if (copy_to_user(ea, &f, sizeof(float))) return -EFAULT; } return FP_CUR_EXCEPTIONS; }
int stfs(void *frS, void *ea) { FP_DECL_D(A); FP_DECL_S(R); float f; int err; #ifdef DEBUG printk("%s: S %p, ea %p\n", __FUNCTION__, frS, ea); #endif __FP_UNPACK_D(A, frS); #ifdef DEBUG printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); #endif FP_CONV(S, D, 1, 2, R, A); #ifdef DEBUG printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c); #endif err = _FP_PACK_CANONICAL(S, 1, R); if (!err || !__FPU_TRAP_P(err)) { __FP_PACK_RAW_1(S, &f, R); if (copy_to_user(ea, &f, sizeof(float))) return -EFAULT; } return err; }
SFtype __sqrtsf2 (SFtype a) { FP_DECL_EX; FP_DECL_S (A); FP_DECL_S (R); SFtype r; FP_INIT_ROUNDMODE; FP_UNPACK_S (A, a); FP_SQRT_S (R, A); FP_PACK_S (r, R); FP_HANDLE_EXCEPTIONS; return r; }
static int fmac(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n) { FP_DECL_EX; FP_DECL_S(Fr); FP_DECL_S(Ft); FP_DECL_S(F0); FP_DECL_S(Fm); FP_DECL_S(Fn); UNPACK_S(F0, FR0); UNPACK_S(Fm, FRm); UNPACK_S(Fn, FRn); FP_MUL_S(Ft, Fm, F0); FP_ADD_S(Fr, Fn, Ft); PACK_S(FRn, Fr); return 0; }
void fdivs(void *ft, void *fa, void *fb) { FP_DECL_S(A); FP_DECL_S(B); FP_DECL_S(R); FP_DECL_EX; FP_UNPACK_SP(A, fa); FP_UNPACK_SP(B, fb); if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO) FP_SET_EXCEPTION(FP_EX_DIVZERO); FP_DIV_S(R, A, B); FP_PACK_SP(ft, R); __FPU_FPCSR |= FP_CUR_EXCEPTIONS; }
static int fcnvsd(struct sh_fpu_soft_struct *fregs, int n) { FP_DECL_EX; FP_DECL_S(Fn); FP_DECL_D(Fr); UNPACK_S(Fn, FPUL); FP_CONV(D, S, 2, 1, Fr, Fn); PACK_D(DRn, Fr); return 0; }
static int fcnvds(struct sh_fpu_soft_struct *fregs, int n) { FP_DECL_EX; FP_DECL_D(Fn); FP_DECL_S(Fr); UNPACK_D(Fn, DRn); FP_CONV(S, D, 1, 2, Fr, Fn); PACK_S(FPUL, Fr); return 0; }
float __fmaf (float a, float b, float c) { FP_DECL_EX; FP_DECL_S (A); FP_DECL_S (B); FP_DECL_S (C); FP_DECL_S (R); float r; FP_INIT_ROUNDMODE; FP_UNPACK_S (A, a); FP_UNPACK_S (B, b); FP_UNPACK_S (C, c); FP_FMA_S (R, A, B, C); FP_PACK_S (r, R); FP_HANDLE_EXCEPTIONS; return r; }
SItype __fixsfsi(SFtype a) { FP_DECL_EX; FP_DECL_S(A); USItype r; FP_UNPACK_RAW_S(A, a); FP_TO_INT_S(r, A, SI_BITS, 1); FP_HANDLE_EXCEPTIONS; return r; }
UDItype __fixunssfdi(SFtype a) { FP_DECL_EX; FP_DECL_S(A); UDItype r; FP_UNPACK_RAW_S(A, a); FP_TO_INT_S(r, A, DI_BITS, 0); FP_HANDLE_EXCEPTIONS; return r; }
UDItype __fixunssfdi(float a) { FP_DECL_EX; FP_DECL_S(A); UDItype r; FP_UNPACK_S(A, a); FP_TO_INT_S(r, A, 64, 0); FP_HANDLE_EXCEPTIONS; return r; }
SFtype __floatunsisf(USItype i) { FP_DECL_EX; FP_DECL_S(A); SFtype a; FP_FROM_INT_S(A, i, SI_BITS, USItype); FP_PACK_RAW_S(a, A); FP_HANDLE_EXCEPTIONS; return a; }
float __floatsisf(SItype i) { FP_DECL_EX; FP_DECL_S(A); float a; FP_FROM_INT_S(A, i, 32, int); FP_PACK_S(a, A); FP_HANDLE_EXCEPTIONS; return a; }
int evfsctui(u32 *rD, u32 *rB) { FP_DECL_S(B0); FP_DECL_S(B1); unsigned int r0, r1; __FP_UNPACK_S(B0, rB); __FP_UNPACK_S(B1, rB+1); _FP_ROUND(1, B0); _FP_ROUND(1, B1); FP_TO_INT_S(r0, B0, 32, 0); rD[0] = r0; FP_TO_INT_S(r1, B1, 32, 0); rD[1] = r1; #ifdef DEBUG printk("%s: D %p, B %p: ", __FUNCTION__, rD, rB); printk("\n"); #endif return 0; }
SFtype __floatuntisf (UTItype i) { FP_DECL_EX; FP_DECL_S (A); SFtype a; FP_INIT_ROUNDMODE; FP_FROM_INT_S (A, i, TI_BITS, UTItype); FP_PACK_RAW_S (a, A); FP_HANDLE_EXCEPTIONS; return a; }
int efscmpgt(u32 *ccr, int crD, void *rA, void *rB) { FP_DECL_S(A); FP_DECL_S(B); long cmp; int ret = 0; #ifdef DEBUG printk("%s: %p (%08x) %d %p %p\n", __FUNCTION__, ccr, *ccr, crD, rA, rB); #endif __FP_UNPACK_S(A, rA); __FP_UNPACK_S(B, rB); #ifdef DEBUG printk("A: %ld %lu %ld (%ld)\n", A_s, A_f, A_e, A_c); printk("B: %ld %lu %ld (%ld)\n", B_s, B_f, B_e, B_c); #endif FP_CMP_S(cmp, A, B, 2); if (cmp == 1) { cmp = 0x4; } else { cmp = 0; } *ccr &= ~(15 << ((7 - crD) << 2)); *ccr |= (cmp << ((7 - crD) << 2)); #ifdef DEBUG printk("CR: %08x\n", *ccr); #endif return ret; }
long double _Q_stoq(const float a) { FP_DECL_EX; FP_DECL_S(A); FP_DECL_Q(C); long double c; FP_UNPACK_RAW_S(A, a); #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q FP_EXTEND(Q,S,4,1,C,A); #else FP_EXTEND(Q,S,2,1,C,A); #endif FP_PACK_RAW_Q(c, C); FP_HANDLE_EXCEPTIONS; return c; }