提交 714547bb 编写于 作者: B blueswir1

Convert basic float32 ops to TCG

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5189 c046a42c-6fe2-441c-8c8c-71466251a162
上级 bcdf9b4d
......@@ -58,12 +58,12 @@ DEF_HELPER(void, helper_st_asi, (target_ulong addr, uint64_t val, int asi, \
DEF_HELPER(void, helper_ldfsr, (uint32_t new_fsr))
DEF_HELPER(void, helper_check_ieee_exceptions, (void))
DEF_HELPER(void, helper_clear_float_exceptions, (void))
DEF_HELPER(void, helper_fabss, (void))
DEF_HELPER(void, helper_fsqrts, (void))
DEF_HELPER(float32, helper_fabss, (float32 src))
DEF_HELPER(float32, helper_fsqrts, (float32 src))
DEF_HELPER(void, helper_fsqrtd, (void))
DEF_HELPER(void, helper_fcmps, (void))
DEF_HELPER(void, helper_fcmps, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmpd, (void))
DEF_HELPER(void, helper_fcmpes, (void))
DEF_HELPER(void, helper_fcmpes, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmped, (void))
DEF_HELPER(void, helper_fsqrtq, (void))
DEF_HELPER(void, helper_fcmpq, (void))
......@@ -71,17 +71,17 @@ DEF_HELPER(void, helper_fcmpeq, (void))
#ifdef TARGET_SPARC64
DEF_HELPER(void, helper_ldxfsr, (uint64_t new_fsr))
DEF_HELPER(void, helper_fabsd, (void))
DEF_HELPER(void, helper_fcmps_fcc1, (void))
DEF_HELPER(void, helper_fcmps_fcc1, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmps_fcc2, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmps_fcc3, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmpd_fcc1, (void))
DEF_HELPER(void, helper_fcmps_fcc2, (void))
DEF_HELPER(void, helper_fcmpd_fcc2, (void))
DEF_HELPER(void, helper_fcmps_fcc3, (void))
DEF_HELPER(void, helper_fcmpd_fcc3, (void))
DEF_HELPER(void, helper_fcmpes_fcc1, (void))
DEF_HELPER(void, helper_fcmpes_fcc1, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmpes_fcc2, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmpes_fcc3, (float32 src1, float32 src2))
DEF_HELPER(void, helper_fcmped_fcc1, (void))
DEF_HELPER(void, helper_fcmpes_fcc2, (void))
DEF_HELPER(void, helper_fcmped_fcc2, (void))
DEF_HELPER(void, helper_fcmpes_fcc3, (void))
DEF_HELPER(void, helper_fcmped_fcc3, (void))
DEF_HELPER(void, helper_fabsq, (void))
DEF_HELPER(void, helper_fcmpq_fcc1, (void))
......@@ -97,17 +97,28 @@ DEF_HELPER(void, raise_exception, (int tt))
F_HELPER_0_0(name ## s); \
F_HELPER_0_0(name ## d); \
F_HELPER_0_0(name ## q)
#define F_HELPER_DQ_0_0(name) \
F_HELPER_0_0(name ## d); \
F_HELPER_0_0(name ## q)
F_HELPER_DQ_0_0(add);
F_HELPER_DQ_0_0(sub);
F_HELPER_DQ_0_0(mul);
F_HELPER_DQ_0_0(div);
F_HELPER_SDQ_0_0(add);
F_HELPER_SDQ_0_0(sub);
F_HELPER_SDQ_0_0(mul);
F_HELPER_SDQ_0_0(div);
DEF_HELPER(float32, helper_fadds, (float32 src1, float32 src2))
DEF_HELPER(float32, helper_fsubs, (float32 src1, float32 src2))
DEF_HELPER(float32, helper_fmuls, (float32 src1, float32 src2))
DEF_HELPER(float32, helper_fdivs, (float32 src1, float32 src2))
F_HELPER_0_0(smuld);
F_HELPER_0_0(dmulq);
DEF_HELPER(void, helper_fnegs, (void))
F_HELPER_SDQ_0_0(ito);
DEF_HELPER(float32, helper_fnegs, (float32 src))
F_HELPER_DQ_0_0(ito);
DEF_HELPER(float32, helper_fitos, (int32_t src))
#ifdef TARGET_SPARC64
DEF_HELPER(void, helper_fnegd, (void))
DEF_HELPER(void, helper_fnegq, (void))
......@@ -119,7 +130,7 @@ F_HELPER_0_0(qtos);
F_HELPER_0_0(stoq);
F_HELPER_0_0(qtod);
F_HELPER_0_0(dtoq);
F_HELPER_0_0(stoi);
DEF_HELPER(int32_t, helper_fstoi, (float32 src))
F_HELPER_0_0(dtoi);
F_HELPER_0_0(qtoi);
#ifdef TARGET_SPARC64
......@@ -176,6 +187,6 @@ VIS_CMPHELPER(cmple);
VIS_CMPHELPER(cmpne);
#endif
#undef F_HELPER_0_0
#undef F_HELPER_SDQ_0_0
#undef F_HELPER_DQ_0_0
#undef VIS_HELPER
#undef VIS_CMPHELPER
......@@ -87,9 +87,9 @@ void helper_check_align(target_ulong addr, uint32_t align)
#define F_HELPER(name, p) void helper_f##name##p(void)
#define F_BINOP(name) \
F_HELPER(name, s) \
float32 helper_f ## name ## s (float32 src1, float32 src2) \
{ \
FT0 = float32_ ## name (FT0, FT1, &env->fp_status); \
return float32_ ## name (src1, src2, &env->fp_status); \
} \
F_HELPER(name, d) \
{ \
......@@ -120,9 +120,9 @@ void helper_fdmulq(void)
&env->fp_status);
}
F_HELPER(neg, s)
float32 helper_fnegs(float32 src)
{
FT0 = float32_chs(FT1);
return float32_chs(src);
}
#ifdef TARGET_SPARC64
......@@ -138,9 +138,9 @@ F_HELPER(neg, q)
#endif
/* Integer to float conversion. */
F_HELPER(ito, s)
float32 helper_fitos(int32_t src)
{
FT0 = int32_to_float32(*((int32_t *)&FT1), &env->fp_status);
return int32_to_float32(src, &env->fp_status);
}
F_HELPER(ito, d)
......@@ -203,9 +203,9 @@ void helper_fdtoq(void)
}
/* Float to integer conversion. */
void helper_fstoi(void)
int32_t helper_fstoi(float32 src)
{
*((int32_t *)&FT0) = float32_to_int32_round_to_zero(FT1, &env->fp_status);
return float32_to_int32_round_to_zero(src, &env->fp_status);
}
void helper_fdtoi(void)
......@@ -714,9 +714,9 @@ void helper_clear_float_exceptions(void)
set_float_exception_flags(0, &env->fp_status);
}
void helper_fabss(void)
float32 helper_fabss(float32 src)
{
FT0 = float32_abs(FT1);
return float32_abs(src);
}
#ifdef TARGET_SPARC64
......@@ -731,9 +731,9 @@ void helper_fabsq(void)
}
#endif
void helper_fsqrts(void)
float32 helper_fsqrts(float32 src)
{
FT0 = float32_sqrt(FT1, &env->fp_status);
return float32_sqrt(src, &env->fp_status);
}
void helper_fsqrtd(void)
......@@ -776,41 +776,72 @@ void helper_fsqrtq(void)
} \
env->fsr |= new_fsr; \
}
#define GEN_FCMPS(name, size, FS, TRAP) \
void glue(helper_, name)(float32 src1, float32 src2) \
{ \
target_ulong new_fsr; \
\
env->fsr &= ~((FSR_FCC1 | FSR_FCC0) << FS); \
switch (glue(size, _compare) (src1, src2, &env->fp_status)) { \
case float_relation_unordered: \
new_fsr = (FSR_FCC1 | FSR_FCC0) << FS; \
if ((env->fsr & FSR_NVM) || TRAP) { \
env->fsr |= new_fsr; \
env->fsr |= FSR_NVC; \
env->fsr |= FSR_FTT_IEEE_EXCP; \
raise_exception(TT_FP_EXCP); \
} else { \
env->fsr |= FSR_NVA; \
} \
break; \
case float_relation_less: \
new_fsr = FSR_FCC0 << FS; \
break; \
case float_relation_greater: \
new_fsr = FSR_FCC1 << FS; \
break; \
default: \
new_fsr = 0; \
break; \
} \
env->fsr |= new_fsr; \
}
GEN_FCMP(fcmps, float32, FT0, FT1, 0, 0);
GEN_FCMPS(fcmps, float32, 0, 0);
GEN_FCMP(fcmpd, float64, DT0, DT1, 0, 0);
GEN_FCMP(fcmpes, float32, FT0, FT1, 0, 1);
GEN_FCMPS(fcmpes, float32, 0, 1);
GEN_FCMP(fcmped, float64, DT0, DT1, 0, 1);
GEN_FCMP(fcmpq, float128, QT0, QT1, 0, 0);
GEN_FCMP(fcmpeq, float128, QT0, QT1, 0, 1);
#ifdef TARGET_SPARC64
GEN_FCMP(fcmps_fcc1, float32, FT0, FT1, 22, 0);
GEN_FCMPS(fcmps_fcc1, float32, 22, 0);
GEN_FCMP(fcmpd_fcc1, float64, DT0, DT1, 22, 0);
GEN_FCMP(fcmpq_fcc1, float128, QT0, QT1, 22, 0);
GEN_FCMP(fcmps_fcc2, float32, FT0, FT1, 24, 0);
GEN_FCMPS(fcmps_fcc2, float32, 24, 0);
GEN_FCMP(fcmpd_fcc2, float64, DT0, DT1, 24, 0);
GEN_FCMP(fcmpq_fcc2, float128, QT0, QT1, 24, 0);
GEN_FCMP(fcmps_fcc3, float32, FT0, FT1, 26, 0);
GEN_FCMPS(fcmps_fcc3, float32, 26, 0);
GEN_FCMP(fcmpd_fcc3, float64, DT0, DT1, 26, 0);
GEN_FCMP(fcmpq_fcc3, float128, QT0, QT1, 26, 0);
GEN_FCMP(fcmpes_fcc1, float32, FT0, FT1, 22, 1);
GEN_FCMPS(fcmpes_fcc1, float32, 22, 1);
GEN_FCMP(fcmped_fcc1, float64, DT0, DT1, 22, 1);
GEN_FCMP(fcmpeq_fcc1, float128, QT0, QT1, 22, 1);
GEN_FCMP(fcmpes_fcc2, float32, FT0, FT1, 24, 1);
GEN_FCMPS(fcmpes_fcc2, float32, 24, 1);
GEN_FCMP(fcmped_fcc2, float64, DT0, DT1, 24, 1);
GEN_FCMP(fcmpeq_fcc2, float128, QT0, QT1, 24, 1);
GEN_FCMP(fcmpes_fcc3, float32, FT0, FT1, 26, 1);
GEN_FCMPS(fcmpes_fcc3, float32, 26, 1);
GEN_FCMP(fcmped_fcc3, float64, DT0, DT1, 26, 1);
GEN_FCMP(fcmpeq_fcc3, float128, QT0, QT1, 26, 1);
#endif
#undef GEN_FCMPS
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) && \
defined(DEBUG_MXCC)
......@@ -2220,7 +2251,7 @@ void helper_ldf_asi(target_ulong addr, int asi, int size, int rd)
switch(size) {
default:
case 4:
*((uint32_t *)&FT0) = val;
*((uint32_t *)&env->fpr[rd]) = val;
break;
case 8:
*((int64_t *)&DT0) = val;
......@@ -2261,7 +2292,7 @@ void helper_stf_asi(target_ulong addr, int asi, int size, int rd)
switch(size) {
default:
case 4:
val = *((uint32_t *)&FT0);
val = *((uint32_t *)&env->fpr[rd]);
break;
case 8:
val = *((int64_t *)&DT0);
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册