Exemple #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));
}
Exemple #2
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;
}
Exemple #3
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;
}
Exemple #4
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;
}
Exemple #5
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;
}
Exemple #6
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;
}
Exemple #7
0
int
efdcfs(void *rD, u32 *rB)
{
	FP_DECL_S(B);
	FP_DECL_D(R);
	int ret;
	rB[0]=rB[1];

	__FP_UNPACK_S(B, rB);

#ifdef DEBUG
	printk("B: %ld %lu %ld (%ld)\n", B_s, B_f, B_e, B_c);
#endif

	FP_CONV(D, S, 2, 1, R, B);

#ifdef DEBUG
	printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
#endif
	
	return (ret | __FP_PACK_D(rD, R));
}