예제 #1
0
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));
}
예제 #2
0
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;
}
예제 #3
0
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;
}
예제 #5
0
파일: gtf.c 프로젝트: gmarkall/gcc
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;
}
예제 #6
0
파일: eqf.c 프로젝트: AlexMioMio/gcc
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;
}
예제 #7
0
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;
}
예제 #8
0
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;
}
예제 #9
0
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;
}
예제 #10
0
파일: eqsf2.c 프로젝트: Abioy/gccxml
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;
}
예제 #11
0
파일: ltf.c 프로젝트: ChaosJohn/gcc
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;
}
예제 #12
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;
}
예제 #13
0
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;
}
예제 #14
0
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;
}
예제 #15
0
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;
}
예제 #16
0
파일: sqrtsf2.c 프로젝트: AubrCool/glibc
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;
}
예제 #17
0
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;
}
예제 #18
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;
}
예제 #19
0
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;
}
예제 #20
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;
}
예제 #21
0
파일: fmasf4.c 프로젝트: AubrCool/glibc
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;
}
예제 #22
0
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;
}
예제 #23
0
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;
}
예제 #24
0
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;
}
예제 #25
0
파일: floatunsisf.c 프로젝트: ChaosJohn/gcc
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;
}
예제 #26
0
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;
}
예제 #27
0
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;
}
예제 #28
0
파일: floatuntisf.c 프로젝트: 0day-ci/gcc
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;
}
예제 #29
0
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;
}
예제 #30
0
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;
}