softfloat: fix some helper definitions
cover softfloat: fix some helper definitions
This series fixes some errors found by
enabling USE_SOFTFLOAT_STRUCT_TYPES.
Most of them are helpers using int types
instead of float types.
This also requires the use of floatXX_val()
and make_floatXX().
Laurent Vivier (4):
arm: fix float64 helper definitions
openrisc: fix float32 and float64 helper definitions
tricore: use make_float32() and float32_val()
softfloat: use floatXX_val() in XX_minmax()
fpu/softfloat.c | 8 +++---- target/arm/helper-a64.h | 6 ++--- target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++---------------------- target/openrisc/helper.h | 20 ++++++++--------- target/tricore/fpu_helper.c | 34 ++++++++++++++--------------- 5 files changed, 60 insertions(+), 60 deletions(-)
Signature · 1 line
2.13.6
PATCH 1/4 arm: fix float64 helper definitions
neon_ceq_f64(), neon_cge_f64() and neon_cgt_f64()
take float64 as parameter, fix the definition inhelper-a64.h
--- target/arm/helper-a64.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/arm/helper-a64.h +3 -3
@@ -26,9 +26,9 @@ DEF_HELPER_3(vfp_cmped_a64, i64, f64, f64, ptr) DEF_HELPER_FLAGS_5(simd_tbl, TCG_CALL_NO_RWG_SE, i64, env, i64, i64, i32, i32) DEF_HELPER_FLAGS_3(vfp_mulxs, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(vfp_mulxd, TCG_CALL_NO_RWG, f64, f64, f64, ptr) -DEF_HELPER_FLAGS_3(neon_ceq_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) -DEF_HELPER_FLAGS_3(neon_cge_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) -DEF_HELPER_FLAGS_3(neon_cgt_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) +DEF_HELPER_FLAGS_3(neon_ceq_f64, TCG_CALL_NO_RWG, i64, f64, f64, ptr) +DEF_HELPER_FLAGS_3(neon_cge_f64, TCG_CALL_NO_RWG, i64, f64, f64, ptr) +DEF_HELPER_FLAGS_3(neon_cgt_f64, TCG_CALL_NO_RWG, i64, f64, f64, ptr) DEF_HELPER_FLAGS_3(recpsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr)DEF_HELPER_FLAGS_3 (rsqrtsf_f32,TCG_CALL_NO_RWG , f32, f32, f32, ptr)
Signature · 1 line
2.13.6
Re: [Qemu-arm] [PATCH 1/4] arm: fix float64 helper definitions
Hi Laurent,
Quoted 16 lines · Laurent Vivier
neon_ceq_f64(),neon_cge_f64()andneon_cgt_f64()
take float64 as parameter, fix the definition inhelper-a64.hSigned-off-by Laurent Vivier <[email protected]>--- target/arm/helper-a64.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)target/arm/helper-a64.h +0
-0@@ -26,9 +26,9 @@ DEF_HELPER_3(vfp_cmped_a64, i64, f64, f64, ptr) DEF_HELPER_FLAGS_5(simd_tbl, TCG_CALL_NO_RWG_SE, i64, env, i64, i64, i32, i32)DEF_HELPER_FLAGS_3 (vfp_mulxs,TCG_CALL_NO_RWG , f32, f32, f32, ptr)
target/arm/helper-a64.h DEF_HELPER_3(vfp_cmped_a64, i64, f64, f64, ptr) · line 34
Quoted 10 lines
target/arm/helper-a64.h +3
-3DEF_HELPER_FLAGS_3(vfp_mulxd, TCG_CALL_NO_RWG, f64, f64, f64, ptr) -DEF_HELPER_FLAGS_3(neon_ceq_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) -DEF_HELPER_FLAGS_3(neon_cge_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) -DEF_HELPER_FLAGS_3(neon_cgt_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) +DEF_HELPER_FLAGS_3(neon_ceq_f64, TCG_CALL_NO_RWG, i64, f64, f64, ptr) +DEF_HELPER_FLAGS_3(neon_cge_f64, TCG_CALL_NO_RWG, i64, f64, f64, ptr) +DEF_HELPER_FLAGS_3(neon_cgt_f64, TCG_CALL_NO_RWG, i64, f64, f64, ptr) DEF_HELPER_FLAGS_3(recpsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr)DEF_HELPER_FLAGS_3 (rsqrtsf_f32,TCG_CALL_NO_RWG , f32, f32, f32, ptr)
As commented replying to your series cover, this patch seems missing:
target/arm/helper-a64.c +0 -0
@@ -159,8 +159,8 @@ uint64_t HELPER(simd_tbl)(CPUARMState *env, uint64_t
result, uint64_t indices,
*/
int elt = (rn * 2 + (index >> 3)) % 64;
int bitidx = (index & 7) * 8;
- uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8);
-
+ uint64_t val = extract64(float64_val(env->vfp.regs[elt]),
+ bitidx, 8);
result = deposit64(result, shift, 8, val);
}
}Regards,
Phil.
PATCH 2/4 openrisc: fix float32 and float64 helper definitions
In reply to Laurent Vivier--- target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++---------------------- target/openrisc/helper.h | 20 ++++++++--------- 2 files changed, 36 insertions(+), 36 deletions(-)
target/openrisc/fpu_helper.c +26 -26
@@ -66,9 +66,9 @@ static inline void update_fpcsr(OpenRISCCPU *cpu) } } -uint64_t HELPER (itofd )(CPUOpenRISCState *env,uint64_t val) +float64 HELPER (itofd )(CPUOpenRISCState *env,uint64_t val) { -uint64_t itofd; +float64 itofd;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);set_float_exception_flags (0 , &cpu->env.fp_status);
@@ -78,9 +78,9 @@ uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val)return itofd; } -uint32_t HELPER (itofs )(CPUOpenRISCState *env,uint32_t val) +float32 HELPER (itofs )(CPUOpenRISCState *env,uint32_t val) { -uint32_t itofs; +float32 itofs;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);set_float_exception_flags (0 , &cpu->env.fp_status);
@@ -90,7 +90,7 @@ uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val)return itofs; } -uint64_t HELPER (ftoid )(CPUOpenRISCState *env,uint64_t val) +uint64_t HELPER (ftoid )(CPUOpenRISCState *env,float32 val) {uint64_t ftoid;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);
@@ -102,7 +102,7 @@ uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val)return ftoid; } -uint32_t HELPER (ftois )(CPUOpenRISCState *env,uint32_t val) +uint32_t HELPER (ftois )(CPUOpenRISCState *env,float32 val) {uint32_t ftois;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);
@@ -117,10 +117,10 @@ uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val)#define FLOAT_OP (name, p) void helper_float_##_##p(void)#define FLOAT_CALC (name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ +float64 helper_float_ ## name ## _d(CPUOpenRISCState *env, \ + float64 fdt0, float64 fdt1) \ { \ - uint64_t result; \ + float64 result; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ set_float_exception_flags(0, &cpu->env.fp_status); \ result = float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); \
@@ -128,10 +128,10 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \return result; \ } \ \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1) \ +float32 helper_float_ ## name ## _s(CPUOpenRISCState *env, \ + float32 fdt0, float32 fdt1) \ { \ - uint32_t result; \ + float32 result; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ set_float_exception_flags(0, &cpu->env.fp_status); \ result = float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); \
@@ -147,11 +147,11 @@ FLOAT_CALC(rem)#undef FLOAT_CALC -uint64_t helper_float_madd_d (CPUOpenRISCState *env,uint64_t a, -uint64_t b,uint64_t c) +float64 helper_float_madd_d (CPUOpenRISCState *env,float64 a, +float64 b,float64 c) {OpenRISCCPU *cpu =openrisc_env_get_cpu (env); -uint64_t result; +float64 result;set_float_exception_flags (0 , &cpu->env.fp_status);/* Note that or1ksim doesn't use merged operation. */ result =float64_mul (b, c, &cpu->env.fp_status);
@@ -160,11 +160,11 @@ uint64_t helper_float_madd_d(CPUOpenRISCState *env, uint64_t a,return result; } -uint32_t helper_float_madd_s (CPUOpenRISCState *env,uint32_t a, -uint32_t b,uint32_t c) +float32 helper_float_madd_s (CPUOpenRISCState *env,float32 a, +float32 b,float32 c) {OpenRISCCPU *cpu =openrisc_env_get_cpu (env); -uint32_t result; +float32 result;set_float_exception_flags (0 , &cpu->env.fp_status);/* Note that or1ksim doesn't use merged operation. */ result =float32_mul (b, c, &cpu->env.fp_status);
@@ -176,7 +176,7 @@ uint32_t helper_float_madd_s(CPUOpenRISCState *env, uint32_t a,#define FLOAT_CMP (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \
@@ -187,7 +187,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1)\ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \
@@ -205,7 +205,7 @@ FLOAT_CMP(lt)#define FLOAT_CMPNE (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \
@@ -216,7 +216,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \
@@ -231,7 +231,7 @@ FLOAT_CMPNE(ne)#define FLOAT_CMPGT (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \
@@ -242,7 +242,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \
@@ -256,7 +256,7 @@ FLOAT_CMPGT(gt)#define FLOAT_CMPGE (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \
@@ -267,7 +267,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \
target/openrisc/helper.h +10 -10
@@ -24,17 +24,17 @@ DEF_HELPER_FLAGS_1(ove_ov, TCG_CALL_NO_WG, void, env)DEF_HELPER_FLAGS_1 (ove_cyov,TCG_CALL_NO_WG , void, env) /* float */ -DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, i32, env, i32) -DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, i32) +DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, f64, env, i64) +DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, f32, env, i32) +DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, f32) +DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, f32) -DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, i32, env, i32, i32, i32) -DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, i64, env, i64, i64, i64) +DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, f32, env, f32, f32, f32) +DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, f64, env, f64, f64, f64)#define FOP_CALC (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, f32, env, f32, f32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, f64, env, f64, f64) FOP_CALC(add) FOP_CALC(sub) FOP_CALC(mul)
@@ -43,8 +43,8 @@ FOP_CALC(rem)#undef FOP_CALC#define FOP_CMP (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, f32, f32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, f64, f64) FOP_CMP(eq) FOP_CMP(lt) FOP_CMP(le)
Signature · 1 line
2.13.6
Re: [Qemu-devel] [PATCH 2/4] openrisc: fix float32 and float64 helper definitions
Hello,
Quoted 1 line · Laurent Vivier
Signed-off-by Laurent Vivier <[email protected]>
There is no commit body here, do we need one? I can see in your cover letter its mentioned this was revealed after enabling "USE_SOFTFLOAT_STRUCT_TYPES".
However, I'm just being curious why is this an issue? In softfloat I assume we pack our own floats so having the type that goes into a uint32 register wouldnt make much difference right?
-Stafford
Quoted 225 lines
--- target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++---------------------- target/openrisc/helper.h | 20 ++++++++--------- 2 files changed, 36 insertions(+), 36 deletions(-)target/openrisc/fpu_helper.c +26
-26@@ -66,9 +66,9 @@ static inline void update_fpcsr(OpenRISCCPU *cpu) } } -uint64_t HELPER (itofd )(CPUOpenRISCState *env,uint64_t val) +float64 HELPER (itofd )(CPUOpenRISCState *env,uint64_t val) { -uint64_t itofd; +float64 itofd;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);set_float_exception_flags (0 , &cpu->env.fp_status);@@ -78,9 +78,9 @@ uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val)return itofd; } -uint32_t HELPER (itofs )(CPUOpenRISCState *env,uint32_t val) +float32 HELPER (itofs )(CPUOpenRISCState *env,uint32_t val) { -uint32_t itofs; +float32 itofs;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);set_float_exception_flags (0 , &cpu->env.fp_status);@@ -90,7 +90,7 @@ uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val)return itofs; } -uint64_t HELPER (ftoid )(CPUOpenRISCState *env,uint64_t val) +uint64_t HELPER (ftoid )(CPUOpenRISCState *env,float32 val) {uint64_t ftoid;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);@@ -102,7 +102,7 @@ uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val)return ftoid; } -uint32_t HELPER (ftois )(CPUOpenRISCState *env,uint32_t val) +uint32_t HELPER (ftois )(CPUOpenRISCState *env,float32 val) {uint32_t ftois;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);@@ -117,10 +117,10 @@ uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val)#define FLOAT_OP (name, p) void helper_float_##_##p(void)#define FLOAT_CALC (name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ +float64 helper_float_ ## name ## _d(CPUOpenRISCState *env, \ + float64 fdt0, float64 fdt1) \ { \ - uint64_t result; \ + float64 result; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ set_float_exception_flags(0, &cpu->env.fp_status); \ result = float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); \@@ -128,10 +128,10 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \return result; \ } \ \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1) \ +float32 helper_float_ ## name ## _s(CPUOpenRISCState *env, \ + float32 fdt0, float32 fdt1) \ { \ - uint32_t result; \ + float32 result; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ set_float_exception_flags(0, &cpu->env.fp_status); \ result = float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); \@@ -147,11 +147,11 @@ FLOAT_CALC(rem)#undef FLOAT_CALC -uint64_t helper_float_madd_d (CPUOpenRISCState *env,uint64_t a, -uint64_t b,uint64_t c) +float64 helper_float_madd_d (CPUOpenRISCState *env,float64 a, +float64 b,float64 c) {OpenRISCCPU *cpu =openrisc_env_get_cpu (env); -uint64_t result; +float64 result;set_float_exception_flags (0 , &cpu->env.fp_status);/* Note that or1ksim doesn't use merged operation. */ result =float64_mul (b, c, &cpu->env.fp_status);@@ -160,11 +160,11 @@ uint64_t helper_float_madd_d(CPUOpenRISCState *env, uint64_t a,return result; } -uint32_t helper_float_madd_s (CPUOpenRISCState *env,uint32_t a, -uint32_t b,uint32_t c) +float32 helper_float_madd_s (CPUOpenRISCState *env,float32 a, +float32 b,float32 c) {OpenRISCCPU *cpu =openrisc_env_get_cpu (env); -uint32_t result; +float32 result;set_float_exception_flags (0 , &cpu->env.fp_status);/* Note that or1ksim doesn't use merged operation. */ result =float32_mul (b, c, &cpu->env.fp_status);@@ -176,7 +176,7 @@ uint32_t helper_float_madd_s(CPUOpenRISCState *env, uint32_t a,#define FLOAT_CMP (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -187,7 +187,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1)\ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \@@ -205,7 +205,7 @@ FLOAT_CMP(lt)#define FLOAT_CMPNE (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -216,7 +216,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \@@ -231,7 +231,7 @@ FLOAT_CMPNE(ne)#define FLOAT_CMPGT (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -242,7 +242,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \@@ -256,7 +256,7 @@ FLOAT_CMPGT(gt)#define FLOAT_CMPGE (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -267,7 +267,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \target/openrisc/helper.h +10
-10@@ -24,17 +24,17 @@ DEF_HELPER_FLAGS_1(ove_ov, TCG_CALL_NO_WG, void, env)DEF_HELPER_FLAGS_1 (ove_cyov,TCG_CALL_NO_WG , void, env) /* float */ -DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, i32, env, i32) -DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, i32) +DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, f64, env, i64) +DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, f32, env, i32) +DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, f32) +DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, f32) -DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, i32, env, i32, i32, i32) -DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, i64, env, i64, i64, i64) +DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, f32, env, f32, f32, f32) +DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, f64, env, f64, f64, f64)#define FOP_CALC (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, f32, env, f32, f32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, f64, env, f64, f64) FOP_CALC(add) FOP_CALC(sub) FOP_CALC(mul)@@ -43,8 +43,8 @@ FOP_CALC(rem)#undef FOP_CALC#define FOP_CMP (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, f32, f32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, f64, f64) FOP_CMP(eq) FOP_CMP(lt) FOP_CMP(le)Signature · 1 line
2.13.6
Re: [Qemu-arm] [PATCH 2/4] openrisc: fix float32 and float64 helper definitions
Le 04/11/2017 à 22:20, Stafford Horne a écrit :
Quoted 11 lines
Hello,
Quoted 1 line · Laurent Vivier
Signed-off-by Laurent Vivier <[email protected]>There is no commit body here, do we need one? I can see in your cover letter its mentioned this was revealed after enabling "
USE_SOFTFLOAT_STRUCT_TYPES".However, I'm just being curious why is this an issue? In softfloat I assume we pack our own floats so having the type that goes into a uint32 register wouldnt make much difference right?
It's not an issue. It's for consistency. We can store a float32 in an uint32_t, but it's better to store float32 in float32 type.
And as said in include/fpu/softfloat.h:
"Use structures for soft-float types. This prevents accidentally mixing
them with native int/float types."
Thanks,
Laurent
Stafford Horne
Acked-byRe: [Qemu-devel] [PATCH 2/4] openrisc: fix float32 and float64 helper definitions
Quoted 9 lines · Laurent Vivier
Le 04/11/2017 à 22:20, Stafford Horne a écrit :
Quoted 8 lines
Hello,
Quoted 1 line · Laurent Vivier
Signed-off-by Laurent Vivier <[email protected]>There is no commit body here, do we need one? I can see in your cover letter its mentioned this was revealed after enabling "
USE_SOFTFLOAT_STRUCT_TYPES".
Quoted 6 lines
Quoted 3 lines
However, I'm just being curious why is this an issue? In softfloat I assume we pack our own floats so having the type that goes into a uint32 register wouldnt make much difference right?
It's not an issue. It's for consistency. We can store a float32 in an
uint32_t, but it's better to store float32 in float32 type.
OK, thank you.
Quoted 4 lines
And as said in
include/fpu/softfloat.h:"Use structures for soft-float types. This prevents accidentally mixing
them with native int/float types."
Thanks, I have not tested this but I trust it should not be an issue.
-Stafford
Re: [Qemu-arm] [PATCH 2/4] openrisc: fix float32 and float64 helper definitions
In reply to Laurent VivierQuoted 1 line · Laurent Vivier
Signed-off-by Laurent Vivier <[email protected]>
Quoted 223 lines
--- target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++---------------------- target/openrisc/helper.h | 20 ++++++++--------- 2 files changed, 36 insertions(+), 36 deletions(-)target/openrisc/fpu_helper.c +26
-26@@ -66,9 +66,9 @@ static inline void update_fpcsr(OpenRISCCPU *cpu) } } -uint64_t HELPER (itofd )(CPUOpenRISCState *env,uint64_t val) +float64 HELPER (itofd )(CPUOpenRISCState *env,uint64_t val) { -uint64_t itofd; +float64 itofd;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);set_float_exception_flags (0 , &cpu->env.fp_status);@@ -78,9 +78,9 @@ uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val)return itofd; } -uint32_t HELPER (itofs )(CPUOpenRISCState *env,uint32_t val) +float32 HELPER (itofs )(CPUOpenRISCState *env,uint32_t val) { -uint32_t itofs; +float32 itofs;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);set_float_exception_flags (0 , &cpu->env.fp_status);@@ -90,7 +90,7 @@ uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val)return itofs; } -uint64_t HELPER (ftoid )(CPUOpenRISCState *env,uint64_t val) +uint64_t HELPER (ftoid )(CPUOpenRISCState *env,float32 val) {uint64_t ftoid;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);@@ -102,7 +102,7 @@ uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val)return ftoid; } -uint32_t HELPER (ftois )(CPUOpenRISCState *env,uint32_t val) +uint32_t HELPER (ftois )(CPUOpenRISCState *env,float32 val) {uint32_t ftois;OpenRISCCPU *cpu =openrisc_env_get_cpu (env);@@ -117,10 +117,10 @@ uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val)#define FLOAT_OP (name, p) void helper_float_##_##p(void)#define FLOAT_CALC (name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ +float64 helper_float_ ## name ## _d(CPUOpenRISCState *env, \ + float64 fdt0, float64 fdt1) \ { \ - uint64_t result; \ + float64 result; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ set_float_exception_flags(0, &cpu->env.fp_status); \ result = float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); \@@ -128,10 +128,10 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \return result; \ } \ \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1) \ +float32 helper_float_ ## name ## _s(CPUOpenRISCState *env, \ + float32 fdt0, float32 fdt1) \ { \ - uint32_t result; \ + float32 result; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ set_float_exception_flags(0, &cpu->env.fp_status); \ result = float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); \@@ -147,11 +147,11 @@ FLOAT_CALC(rem)#undef FLOAT_CALC -uint64_t helper_float_madd_d (CPUOpenRISCState *env,uint64_t a, -uint64_t b,uint64_t c) +float64 helper_float_madd_d (CPUOpenRISCState *env,float64 a, +float64 b,float64 c) {OpenRISCCPU *cpu =openrisc_env_get_cpu (env); -uint64_t result; +float64 result;set_float_exception_flags (0 , &cpu->env.fp_status);/* Note that or1ksim doesn't use merged operation. */ result =float64_mul (b, c, &cpu->env.fp_status);@@ -160,11 +160,11 @@ uint64_t helper_float_madd_d(CPUOpenRISCState *env, uint64_t a,return result; } -uint32_t helper_float_madd_s (CPUOpenRISCState *env,uint32_t a, -uint32_t b,uint32_t c) +float32 helper_float_madd_s (CPUOpenRISCState *env,float32 a, +float32 b,float32 c) {OpenRISCCPU *cpu =openrisc_env_get_cpu (env); -uint32_t result; +float32 result;set_float_exception_flags (0 , &cpu->env.fp_status);/* Note that or1ksim doesn't use merged operation. */ result =float32_mul (b, c, &cpu->env.fp_status);@@ -176,7 +176,7 @@ uint32_t helper_float_madd_s(CPUOpenRISCState *env, uint32_t a,#define FLOAT_CMP (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -187,7 +187,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1)\ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \@@ -205,7 +205,7 @@ FLOAT_CMP(lt)#define FLOAT_CMPNE (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -216,7 +216,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \@@ -231,7 +231,7 @@ FLOAT_CMPNE(ne)#define FLOAT_CMPGT (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -242,7 +242,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \@@ -256,7 +256,7 @@ FLOAT_CMPGT(gt)#define FLOAT_CMPGE (name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ + float64 fdt0, float64 fdt1) \ { \ int res; \ OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \@@ -267,7 +267,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ } \ \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ -uint32_t fdt0,uint32_t fdt1) \ +float32 fdt0,float32 fdt1) \ { \int res; \OpenRISCCPU *cpu =openrisc_env_get_cpu (env); \target/openrisc/helper.h +10
-10@@ -24,17 +24,17 @@ DEF_HELPER_FLAGS_1(ove_ov, TCG_CALL_NO_WG, void, env)DEF_HELPER_FLAGS_1 (ove_cyov,TCG_CALL_NO_WG , void, env) /* float */ -DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, i32, env, i32) -DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, i32) +DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, f64, env, i64) +DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, f32, env, i32) +DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, f32) +DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, f32) -DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, i32, env, i32, i32, i32) -DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, i64, env, i64, i64, i64) +DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, f32, env, f32, f32, f32) +DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, f64, env, f64, f64, f64)#define FOP_CALC (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, f32, env, f32, f32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, f64, env, f64, f64) FOP_CALC(add) FOP_CALC(sub) FOP_CALC(mul)@@ -43,8 +43,8 @@ FOP_CALC(rem)#undef FOP_CALC#define FOP_CMP (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, f32, f32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, f64, f64) FOP_CMP(eq) FOP_CMP(lt) FOP_CMP(le)
PATCH 3/4 tricore: use make_float32() and float32_val()
In reply to Laurent Vivier--- target/tricore/fpu_helper.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
target/tricore/fpu_helper.c +17 -17
@@ -21,10 +21,10 @@#include "cpu.h" #include "exec/helper-proto.h" -#define QUIET_NAN 0x7fc00000 -#define ADD_NAN 0x7fc00001 -#define DIV_NAN 0x7fc00008 -#define MUL_NAN 0x7fc00002 +#define QUIET_NAN make_float32(0x7fc00000) +#define ADD_NAN make_float32(0x7fc00001) +#define DIV_NAN make_float32(0x7fc00008) +#define MUL_NAN make_float32(0x7fc00002)#define FPU_FS PSW_USB_C#define FPU_FI PSW_USB_V#define FPU_FV PSW_USB_SV
@@ -63,13 +63,13 @@ static inline float32 f_maddsub_nan_result(float32 arg1, float32 arg2, }else if (float32_is_zero (arg1) &&float32_is_infinity (arg2)) {return MUL_NAN ; }else { - aSign = arg1 >>31 ; - bSign = arg2 >>31 ; - cSign = arg3 >>31 ; + aSign =float32_val (arg1) >>31 ; + bSign =float32_val (arg2) >>31 ; + cSign =float32_val (arg3) >>31 ; - aExp = (arg1 >>23 ) &0xff ; - bExp = (arg2 >>23 ) &0xff ; - cExp = (arg3 >>23 ) &0xff ; + aExp = (float32_val (arg1) >>23 ) &0xff ; + bExp = (float32_val (arg2) >>23 ) &0xff ; + cExp = (float32_val (arg3) >>23 ) &0xff ;if (muladd_negate_c) { cSign ^=1 ;
@@ -139,7 +139,7 @@ uint32_t helper_f##op(CPUTriCoreState *env, uint32_t r1, uint32_t r2) \ }else { \ env->FPU_FS =0 ; \ } \ -return (uint32_t )f_result; \ +return float32_val (f_result); \ }FADD_SUB (add)FADD_SUB (sub)
@@ -166,7 +166,7 @@ uint32_t helper_fmul(CPUTriCoreState *env, uint32_t r1, uint32_t r2) }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); }
@@ -193,7 +193,7 @@ uint32_t helper_fdiv(CPUTriCoreState *env, uint32_t r1, uint32_t r2) env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); } uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1,
@@ -219,7 +219,7 @@ uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1, }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); } uint32_t helper_fmsub(CPUTriCoreState *env, uint32_t r1,
@@ -247,7 +247,7 @@ uint32_t helper_fmsub(CPUTriCoreState *env, uint32_t r1, }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); }uint32_t helper_fcmp (CPUTriCoreState *env,uint32_t r1,uint32_t r2)
@@ -304,7 +304,7 @@ uint32_t helper_itof(CPUTriCoreState *env, uint32_t arg) }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); }uint32_t helper_ftouz (CPUTriCoreState *env,uint32_t arg)
@@ -321,7 +321,7 @@ uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg)if (float32_is_any_nan (f_arg)) { result =0 ; } - }else if (float32_lt_quiet (f_arg,0 , &env->fp_status)) { + }else if (float32_lt_quiet (f_arg, float32_zero, &env->fp_status)) { flags = float_flag_invalid; result =0 ; }
Signature · 1 line
2.13.6
Re: [Qemu-arm] [PATCH 3/4] tricore: use make_float32() and float32_val()
Quoted 1 line · Laurent Vivier
Signed-off-by Laurent Vivier <[email protected]>
Quoted 107 lines
--- target/tricore/fpu_helper.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)target/tricore/fpu_helper.c +17
-17@@ -21,10 +21,10 @@#include "cpu.h" #include "exec/helper-proto.h" -#define QUIET_NAN 0x7fc00000 -#define ADD_NAN 0x7fc00001 -#define DIV_NAN 0x7fc00008 -#define MUL_NAN 0x7fc00002 +#define QUIET_NAN make_float32(0x7fc00000) +#define ADD_NAN make_float32(0x7fc00001) +#define DIV_NAN make_float32(0x7fc00008) +#define MUL_NAN make_float32(0x7fc00002)#define FPU_FS PSW_USB_C#define FPU_FI PSW_USB_V#define FPU_FV PSW_USB_SV@@ -63,13 +63,13 @@ static inline float32 f_maddsub_nan_result(float32 arg1, float32 arg2, }else if (float32_is_zero (arg1) &&float32_is_infinity (arg2)) {return MUL_NAN ; }else { - aSign = arg1 >>31 ; - bSign = arg2 >>31 ; - cSign = arg3 >>31 ; + aSign =float32_val (arg1) >>31 ; + bSign =float32_val (arg2) >>31 ; + cSign =float32_val (arg3) >>31 ; - aExp = (arg1 >>23 ) &0xff ; - bExp = (arg2 >>23 ) &0xff ; - cExp = (arg3 >>23 ) &0xff ; + aExp = (float32_val (arg1) >>23 ) &0xff ; + bExp = (float32_val (arg2) >>23 ) &0xff ; + cExp = (float32_val (arg3) >>23 ) &0xff ;if (muladd_negate_c) { cSign ^=1 ;@@ -139,7 +139,7 @@ uint32_t helper_f##op(CPUTriCoreState *env, uint32_t r1, uint32_t r2) \ }else { \ env->FPU_FS =0 ; \ } \ -return (uint32_t )f_result; \ +return float32_val (f_result); \ }FADD_SUB (add)FADD_SUB (sub)@@ -166,7 +166,7 @@ uint32_t helper_fmul(CPUTriCoreState *env, uint32_t r1, uint32_t r2) }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); }@@ -193,7 +193,7 @@ uint32_t helper_fdiv(CPUTriCoreState *env, uint32_t r1, uint32_t r2) env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); } uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1,@@ -219,7 +219,7 @@ uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1, }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); } uint32_t helper_fmsub(CPUTriCoreState *env, uint32_t r1,@@ -247,7 +247,7 @@ uint32_t helper_fmsub(CPUTriCoreState *env, uint32_t r1, }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); }uint32_t helper_fcmp (CPUTriCoreState *env,uint32_t r1,uint32_t r2)@@ -304,7 +304,7 @@ uint32_t helper_itof(CPUTriCoreState *env, uint32_t arg) }else { env->FPU_FS =0 ; } -return (uint32_t )f_result; +return float32_val (f_result); }uint32_t helper_ftouz (CPUTriCoreState *env,uint32_t arg)@@ -321,7 +321,7 @@ uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg)if (float32_is_any_nan (f_arg)) { result =0 ; } - }else if (float32_lt_quiet (f_arg,0 , &env->fp_status)) { + }else if (float32_lt_quiet (f_arg, float32_zero, &env->fp_status)) { flags = float_flag_invalid; result =0 ; }
PATCH 4/4 softfloat: use floatXX_val() in XX_minmax()
In reply to Laurent Vivier--- fpu/softfloat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fpu/softfloat.c +4 -4
@@ -7700,11 +7700,9 @@ static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ } \ aSign = extractFloat ## s ## Sign(a); \ bSign = extractFloat ## s ## Sign(b); \ - av = float ## s ## _val(a); \ - bv = float ## s ## _val(b); \ if (ismag) { \ - aav = float ## s ## _abs(av); \ - abv = float ## s ## _abs(bv); \ + aav = float ## s ## _val(float ## s ## _abs(a)); \ + abv = float ## s ## _val(float ## s ## _abs(b)); \ if (aav != abv) { \ if (ismin) { \ return (aav < abv) ? a : b; \
@@ -7713,6 +7711,8 @@ static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ } \ } \ } \ + av = float ## s ## _val(a); \ + bv = float ## s ## _val(b); \ if (aSign != bSign) { \ if (ismin) { \ return aSign ? a : b; \
Signature · 1 line
2.13.6
Hi Laurent,
Quoted 14 lines · Laurent Vivier
This series fixes some errors found by
enablingUSE_SOFTFLOAT_STRUCT_TYPES.Most of them are helpers using int types
instead of float types.
This also requires the use offloatXX_val()
andmake_floatXX().Laurent Vivier (4):
arm: fix float64 helper definitions
openrisc: fix float32 and float64 helper definitions
tricore: usemake_float32()andfloat32_val()
softfloat: usefloatXX_val()inXX_minmax()
Quoted 7 lines
fpu/softfloat.c | 8 +++---- target/arm/helper-a64.h | 6 ++--- target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++---------------------- target/openrisc/helper.h | 20 ++++++++--------- target/tricore/fpu_helper.c | 34 ++++++++++++++--------------- 5 files changed, 60 insertions(+), 60 deletions(-)
I'm getting those errors:
$ make subdir-arm-softmmu -j2
/source/qemu/migration/vmstate-types.c:430:5: error: conversion to non-scalar type requested
qemu_put_be64(f, float64_val(*v));
^~~~~~~~~~~~~make: *** [migration/vmstate-types.o] Error 1
In file included from /source/qemu/fpu/softfloat.c:87:0:
/source/qemu/fpu/softfloat-specialize.h: In function ‘float16_default_nan’:
/source/qemu/include/fpu/softfloat.h:117:26: error: expected expression before ‘{’ token
#define const_float16(x) { x }
^
/source/qemu/fpu/softfloat-specialize.h:95:12: note: in expansion of
macro ‘const_float16’
return const_float16(0x7E00);
^~~~~~~~~~~~~make: *** [fpu/softfloat.o] Error 1
Quoted 3 lines · Laurent Vivier
Quoted 2 lines
This series fixes some errors found by
enablingUSE_SOFTFLOAT_STRUCT_TYPES.
[...]
Quoted 15 lines
I'm getting those errors:
$ make subdir-arm-softmmu -j2/source/qemu/migration/vmstate-types.c:430:5: error: conversion to non-scalar type requested
qemu_put_be64(f, float64_val(*v)); ^~~~~~~~~~~~~make: *** [
migration/vmstate-types.o] Error 1In file included from /source/qemu/fpu/softfloat.c:87:0:
/source/qemu/fpu/softfloat-specialize.h: In function ‘float16_default_nan’:
/source/qemu/include/fpu/softfloat.h:117:26: error: expected expression before ‘{’ token
Quoted 8 lines
#define const_float16(x) { x } ^ /source/qemu/fpu/softfloat-specialize.h:95:12: note: in expansion of macro ‘const_float16’ return const_float16(0x7E00); ^~~~~~~~~~~~~make: *** [
fpu/softfloat.o] Error 1
Also:
$ make subdir-armeb-linux-user -j2
CC linux-user/signal.o
In file included from /source/qemu/linux-user/signal.c:24:0:
/source/qemu/linux-user/signal.c: In function ‘restore_sigframe_v2_vfp’:
/source/qemu/linux-user/qemu.h:472:8: error: lvalue required as left operand of assignment
((x) = (typeof(*hptr))( \
^
/source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro
‘__get_user_e’
# define __get_user(x, hptr) __get_user_e(x, hptr, be)
^~~~~~~~~~~~
/source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro
‘__get_user’
__get_user(float64_val(env->vfp.regs[i]),
&vfpframe->ufp.fpregs[i]);
^~~~~~~~~~
/source/qemu/linux-user/qemu.h:477:13: error: left-hand operand of comma
expression has no effect [-Werror=unused-value]
(hptr)), (void)0)
^
/source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro
‘__get_user_e’
# define __get_user(x, hptr) __get_user_e(x, hptr, be)
^~~~~~~~~~~~
/source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro
‘__get_user’
__get_user(float64_val(env->vfp.regs[i]),
&vfpframe->ufp.fpregs[i]);
^~~~~~~~~~
cc1: all warnings being treated as errors
/source/qemu/rules.mak:66: recipe for target 'linux-user/signal.o' failed CC linux-user/arm/nwfpe/fpa11_cpdt.o
...
/source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion of macro ‘get_user_u32’
get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
^~~~~~~~~~~~
/source/qemu/linux-user/qemu.h:515:13: error: lvalue required as left
operand of assignment
(x) = 0; \
^
/source/qemu/linux-user/qemu.h:536:32: note: in expansion of macro
‘get_user’
#define get_user_u32(x, gaddr) get_user((x), (gaddr), uint32_t)
^~~~~~~~
/source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion
of macro ‘get_user_u32’
get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
^~~~~~~~~~~~Le 03/11/2017 à 22:51, Philippe Mathieu-Daudé a écrit :
Quoted 68 lines
Quoted 3 lines · Laurent Vivier
Quoted 2 lines
This series fixes some errors found by
enablingUSE_SOFTFLOAT_STRUCT_TYPES.[...]
Quoted 15 lines
I'm getting those errors:
$ make subdir-arm-softmmu -j2/source/qemu/migration/vmstate-types.c:430:5: error: conversion to non-scalar type requested
qemu_put_be64(f, float64_val(*v)); ^~~~~~~~~~~~~make: *** [
migration/vmstate-types.o] Error 1In file included from /source/qemu/fpu/softfloat.c:87:0:
/source/qemu/fpu/softfloat-specialize.h: In function ‘float16_default_nan’:
/source/qemu/include/fpu/softfloat.h:117:26: error: expected expression before ‘{’ tokenQuoted 8 lines
#define const_float16(x) { x } ^ /source/qemu/fpu/softfloat-specialize.h:95:12: note: in expansion of macro ‘const_float16’ return const_float16(0x7E00); ^~~~~~~~~~~~~make: *** [
fpu/softfloat.o] Error 1Also:
$ make subdir-armeb-linux-user -j2CC
linux-user/signal.o
In file included from /source/qemu/linux-user/signal.c:24:0:
/source/qemu/linux-user/signal.c: In function ‘restore_sigframe_v2_vfp’:
/source/qemu/linux-user/qemu.h:472:8: error: lvalue required as left operand of assignment((x) = (typeof(*hptr))( \ ^ /source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro ‘__get_user_e’ # define __get_user(x, hptr) __get_user_e(x, hptr, be) ^~~~~~~~~~~~ /source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro ‘__get_user’ __get_user(float64_val(env->vfp.regs[i]), &vfpframe->ufp.fpregs[i]); ^~~~~~~~~~ /source/qemu/linux-user/qemu.h:477:13: error: left-hand operand of comma expression has no effect [-Werror=unused-value] (hptr)), (void)0) ^ /source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro ‘__get_user_e’ # define __get_user(x, hptr) __get_user_e(x, hptr, be) ^~~~~~~~~~~~ /source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro ‘__get_user’ __get_user(float64_val(env->vfp.regs[i]), &vfpframe->ufp.fpregs[i]); ^~~~~~~~~~ cc1: all warnings being treated as errors /source/qemu/rules.mak:66: recipe for target 'linux-user/signal.o' failedCC
linux-user/arm/nwfpe/fpa11_cpdt.o
...
/source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion of macro ‘get_user_u32’
Quoted 15 lines
get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
^~~~~~~~~~~~
/source/qemu/linux-user/qemu.h:515:13: error: lvalue required as left
operand of assignment
(x) = 0; \
^
/source/qemu/linux-user/qemu.h:536:32: note: in expansion of macro
‘get_user’
#define get_user_u32(x, gaddr) get_user((x), (gaddr), uint32_t)
^~~~~~~~
/source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion
of macro ‘get_user_u32’
get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
^~~~~~~~~~~~These series doesn't fix all the problems, only the easiest to fix...
for this one, you need:
migration/vmstate-types.c +0 -0
@@ -425,7 +425,7 @@ static int get_float64(QEMUFile *f, void *pv, size_t
size,
static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField
*field,
QJSON *vmdesc)
{
- uint64_t *v = pv;
+ float64 *v = pv;
qemu_put_be64(f, float64_val(*v));
return 0;Thanks,
Laurent
Quoted 15 lines · Laurent Vivier
Le 03/11/2017 à 22:51, Philippe Mathieu-Daudé a écrit :
Quoted 14 lines
Quoted 3 lines · Laurent Vivier
Quoted 2 lines
This series fixes some errors found by
enablingUSE_SOFTFLOAT_STRUCT_TYPES.[...]
Quoted 10 lines
I'm getting those errors:
$ make subdir-arm-softmmu -j2/source/qemu/migration/vmstate-types.c:430:5: error: conversion to non-scalar type requested
qemu_put_be64(f, float64_val(*v)); ^~~~~~~~~~~~~make: *** [
migration/vmstate-types.o] Error 1
[...]
Quoted 18 lines
These series doesn't fix all the problems, only the easiest to fix...
for this one, you need:
migration/vmstate-types.c +1
-1@@ -425,7 +425,7 @@ static int get_float64(QEMUFile *f, void *pv, size_t size, static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *field,QJSON *vmdesc) { -uint64_t *v = pv; +float64 *v = pv;
Quoted 2 lines
qemu_put_be64(f, float64_val(*v));
return 0;If you respin with this one you can add my Reviewed-by + Tested-by.
Another error:
$ make subdir-aarch64-softmmu
[...]
CC target/arm/helper-a64.o
/source/qemu/target/arm/helper-a64.c: In function ‘helper_simd_tbl’:
/source/qemu/target/arm/helper-a64.c:162:38: error: incompatible type
for argument 1 of ‘extract64’
uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8);
^~~
In file included from /source/qemu/include/qemu/bitmap.h:16:0,
from /source/qemu/include/hw/qdev-core.h:6,
from /source/qemu/include/qom/cpu.h:23,
from /source/qemu/target/arm/cpu-qom.h:23,
from /source/qemu/target/arm/cpu.h:39,
from /source/qemu/target/arm/helper-a64.c:21:
/source/qemu/include/qemu/bitops.h:316:24: note: expected ‘uint64_t {aka
long unsigned int}’ but argument is of type ‘float64 {aka struct
<anonymous>}’
static inline uint64_t extract64(uint64_t value, int start, int length)
^~~~~~~~~
make: *** [target/arm/helper-a64.o] Error 1Quoted 54 lines · Philippe Mathieu-Daudé
Quoted 15 lines · Laurent Vivier
Le 03/11/2017 à 22:51, Philippe Mathieu-Daudé a écrit :
Quoted 14 lines
Quoted 3 lines · Laurent Vivier
Quoted 2 lines
This series fixes some errors found by
enablingUSE_SOFTFLOAT_STRUCT_TYPES.[...]
Quoted 10 lines
I'm getting those errors:
$ make subdir-arm-softmmu -j2/source/qemu/migration/vmstate-types.c:430:5: error: conversion to non-scalar type requested
qemu_put_be64(f, float64_val(*v)); ^~~~~~~~~~~~~make: *** [
migration/vmstate-types.o] Error 1[...]
Quoted 18 lines
These series doesn't fix all the problems, only the easiest to fix...
for this one, you need:
migration/vmstate-types.c +1
-1@@ -425,7 +425,7 @@ static int get_float64(QEMUFile *f, void *pv, size_t size, static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *field,QJSON *vmdesc) { -uint64_t *v = pv; +float64 *v = pv;Quoted 2 lines
qemu_put_be64(f, float64_val(*v)); return 0;If you respin with this one you can add my Reviewed-by + Tested-by.
Another error:
$ make subdir-aarch64-softmmu [...] CC target/arm/helper-a64.o /source/qemu/target/arm/helper-a64.c: In function ‘helper_simd_tbl’: /source/qemu/target/arm/helper-a64.c:162:38: error: incompatible type for argument 1 of ‘extract64’ uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8); ^~~ In file included from /source/qemu/include/qemu/bitmap.h:16:0, from /source/qemu/include/hw/qdev-core.h:6, from /source/qemu/include/qom/cpu.h:23, from /source/qemu/target/arm/cpu-qom.h:23,
Quoted 8 lines
from /source/qemu/target/arm/cpu.h:39,
from /source/qemu/target/arm/helper-a64.c:21:
/source/qemu/include/qemu/bitops.h:316:24: note: expected ‘uint64_t {aka
long unsigned int}’ but argument is of type ‘float64 {aka struct
<anonymous>}’
static inline uint64_t extract64(uint64_t value, int start, int length)
^~~~~~~~~
make: *** [target/arm/helper-a64.o] Error 1OK with:
- uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8);
+ uint64_t val = extract64(float64_val(env->vfp.regs[elt]), bitidx, 8);