@@ -54,20 +54,6 @@ static void fdouble_ana(FPUTLGState *fpu,
}
}
-static float64 t_to_float64(uint64_t a)
-{
- CPU_DoubleU r;
- r.ll = a;
- return r.d;
-}
-
-static uint64_t float64_to_t(float64 fa)
-{
- CPU_DoubleU r;
- r.d = fa;
- return r.ll;
-}
-
static uint64_t ctx_to_uint64(TileGXFPCtx a)
{
union {
@@ -108,21 +94,21 @@ static uint64_t fdouble_calc(FPUTLGState *fpu,
uint64_t helper_fdouble_add_flags(CPUTLGState *env,
uint64_t rsrc, uint64_t rsrcb)
{
- return fdouble_calc(&env->fpu, t_to_float64(rsrc), t_to_float64(rsrcb),
+ return fdouble_calc(&env->fpu, make_float64(rsrc), make_float64(rsrcb),
float64_add);
}
uint64_t helper_fdouble_sub_flags(CPUTLGState *env,
uint64_t rsrc, uint64_t rsrcb)
{
- return fdouble_calc(&env->fpu, t_to_float64(rsrc), t_to_float64(rsrcb),
+ return fdouble_calc(&env->fpu, make_float64(rsrc), make_float64(rsrcb),
float64_sub);
}
uint64_t helper_fdouble_mul_flags(CPUTLGState *env,
uint64_t rsrc, uint64_t rsrcb)
{
- return fdouble_calc(&env->fpu, t_to_float64(rsrc), t_to_float64(rsrcb),
+ return fdouble_calc(&env->fpu, make_float64(rsrc), make_float64(rsrcb),
float64_mul);
}
@@ -136,17 +122,17 @@ uint64_t helper_fdouble_pack1(CPUTLGState *env,
if (ctx.data>= TILEGX_F_COUNT) {
helper_exception(env, TILEGX_EXCP_OPCODE_INVALID_VALUE);
}
- return float64_to_t(fpu->val64s[ctx.data]);
+ return float64_val(fpu->val64s[ctx.data]);
}
switch (ctx.exp) {
case 0x21b00:
- return float64_to_t(uint32_to_float64(rsrc>> 4, &FP_STATUS));
+ return float64_val(uint32_to_float64(rsrc>> 4, &FP_STATUS));
case 0x121b00:
- return float64_to_t(int32_to_float64((rsrc>> 4) | SIGNBIT32,
- &FP_STATUS));
+ return float64_val(int32_to_float64((rsrc>> 4) | SIGNBIT32,
+ &FP_STATUS));
default:
- fprintf(stderr, "\nUIMP: in helper_fdouble_pack2().\n");
+ qemu_log_mask(LOG_UNIMP, "\nUIMP: in %s.\n", __FUNCTION__);
helper_exception(env, TILEGX_EXCP_OPCODE_UNIMPLEMENTED);
return 0;
}
@@ -199,35 +185,19 @@ static uint64_t fsingle_calc(FPUTLGState *fpu,
uint64_t helper_fsingle_add1(CPUTLGState *env, uint64_t rsrc, uint64_t rsrcb)
{
- FPUTLGState *fpu = &env->fpu;
- return fsingle_calc(fpu, int64_to_float32(rsrc, &FP_STATUS),
- int64_to_float32(rsrcb, &FP_STATUS),
+ return fsingle_calc(&env->fpu, make_float32(rsrc), make_float32(rsrcb),
float32_add);
}
uint64_t helper_fsingle_sub1(CPUTLGState *env, uint64_t rsrc, uint64_t rsrcb)
{
- FPUTLGState *fpu = &env->fpu;
- return fsingle_calc(fpu, int64_to_float32(rsrc, &FP_STATUS),
- int64_to_float32(rsrcb, &FP_STATUS),
+ return fsingle_calc(&env->fpu, make_float32(rsrc), make_float32(rsrcb),
float32_sub);
}
uint64_t helper_fsingle_mul1(CPUTLGState *env, uint64_t rsrc, uint64_t rsrcb)
{
- FPUTLGState *fpu = &env->fpu;
-#if 0
- {
- float32 v;
- fprintf(stderr, "\ncall helper_fsingle_mul1(), %lx, %lx\n", rsrc, rsrcb);
- v = float32_mul(int64_to_float32(rsrc, &FP_STATUS),
- int64_to_float32(rsrcb, &FP_STATUS),
- &FP_STATUS);
- fprintf(stderr, "result: %lx.\n", float32_to_int64(v, &FP_STATUS));
- }
-#endif
- return fsingle_calc(fpu, int64_to_float32(rsrc, &FP_STATUS),
- int64_to_float32(rsrcb, &FP_STATUS),
+ return fsingle_calc(&env->fpu, make_float32(rsrc), make_float32(rsrcb),
float32_mul);
}
@@ -240,19 +210,16 @@ uint64_t helper_fsingle_pack2(CPUTLGState *env, uint64_t rsrc)
if (ctx.data>= TILEGX_F_COUNT) {
helper_exception(env, TILEGX_EXCP_OPCODE_INVALID_VALUE);
}
- return float32_to_int32(fpu->val32s[ctx.data], &FP_STATUS);
+ return float32_val(fpu->val32s[ctx.data]);
}
switch (ctx.exp) {
case 0x9e:
- return float32_to_int64(uint32_to_float32(ctx.data, &FP_STATUS),
- &FP_STATUS);
+ return float32_val(uint32_to_float32(ctx.data, &FP_STATUS));
case 0x49e:
- return float32_to_int64(int32_to_float32(ctx.data | SIGNBIT32,
- &FP_STATUS),
- &FP_STATUS);
+ return float32_val(int32_to_float32(ctx.data | SIGNBIT32, &FP_STATUS));
default:
- fprintf(stderr, "\nUIMP: in helper_fsingle_pack2().\n");
+ qemu_log_mask(LOG_UNIMP, "\nUIMP: in %s.\n", __FUNCTION__);
helper_exception(env, TILEGX_EXCP_OPCODE_UNIMPLEMENTED);
return 0;
}