temp-floating-point: Use make_float32/64 and float32/64_val for the input register values
PATCH v2 1/1 temp-floating-point: Use make_float32/64 and float32/64_val for the input register values
Quoted 1 line
From
3655bbab04063bc0878510ab260832c7a6a2a925Mon Sep 17 00:00:00 2001
From: Chen Gang <[email protected]>
Date: Tue, 6 Oct 2015 21:45:11 +0800
Subject: [PATCH v2] temp-floating-point: Use make_float32/64 and float32/64_val for the input register values
Original implementation use int*_to_float32 and float32_to_int*, which will generate incorrect result.
Also remove t_to_float64 and float64_to_t, use make_float64 and float64 instead of.
---
target-tilegx/fpu_helper.c | 63 +++++++++++-----------------------------------
1 file changed, 15 insertions(+), 48 deletions(-)
target-tilegx/fpu_helper.c +0 -0
@@ -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;
}
--
1.9.3
From 3655bbab04063bc0878510ab260832c7a6a2a925 Mon Sep 17 00:00:00 2001
From: Chen Gang <[email protected]>
Date: Tue, 6 Oct 2015 21:45:11 +0800
Subject: [PATCH v2] temp-floating-point: Use make_float32/64 and float32/64_val for the input register values
Original implementation use int*_to_float32 and float32_to_int*, which will generate incorrect result.
Also remove t_to_float64 and float64_to_t, use make_float64 and float64 instead of.
--- target-tilegx/fpu_helper.c | 63 +++++++++++----------------------------------- 1 file changed, 15 insertions(+), 48 deletions(-)
target-tilegx/fpu_helper.c +15 -48
127 lines not on this page · raw message
Signature · 1 line
1.9.3
Quoted 8 lines · Chen Gang
Quoted 1 line
From
3655bbab04063bc0878510ab260832c7a6a2a925Mon Sep 17 00:00:00 2001From: Chen Gang<[email protected]>
Date: Tue, 6 Oct 2015 21:45:11 +0800
Subject: [PATCH v2] temp-floating-point: Use make_float32/64 and float32/64_val for the input register valuesOriginal implementation use int*_to_float32 and float32_to_int*, which will generate incorrect result.
Quoted 7 lines
Also remove
t_to_float64andfloat64_to_t, usemake_float64and float64 instead of.Signed-off-by Chen Gang<[email protected]>--- target-tilegx/fpu_helper.c | 63 +++++++++++----------------------------------- 1 file changed, 15 insertions(+), 48 deletions(-)
This is relative to... what? The v1 patch?
r~
Quoted 12 lines · Richard Henderson
Quoted 11 lines · Chen Gang
Quoted 1 line
From
3655bbab04063bc0878510ab260832c7a6a2a925Mon Sep 17 00:00:00 2001From: Chen Gang<[email protected]>
Date: Tue, 6 Oct 2015 21:45:11 +0800
Subject: [PATCH v2] temp-floating-point: Use make_float32/64 and float32/64_val for the input register valuesOriginal implementation use int*_to_float32 and float32_to_int*, which will generate incorrect result.
Also remove
t_to_float64andfloat64_to_t, usemake_float64and float64 instead of.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Chen Gang<[email protected]>--- target-tilegx/fpu_helper.c | 63 +++++++++++----------------------------------- 1 file changed, 15 insertions(+), 48 deletions(-)This is relative to... what? The v1 patch?
Yes, it is related with v1 patch (has the same name). The v1 patch is based on patch "target-tilegx: Implement floating point temporarily".
Since they are temporary implementations, I guess, we can just left it (do not integrate them into main line).
I sent these temporary implementations, because if someone need test qemu tilegx, they can use these temporary patches (but of cause, I am very glad if they can be integrated into main line, too).
Thanks.
Signature · 3 lines
Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed