#define FLOAT_ONE64 (0x3ffULL << 52)
#define FLOAT_TWO32 (1 << 30)
#define FLOAT_TWO64 (1ULL << 62)
+#define FLOAT_QNAN32 0x7fbfffff
+#define FLOAT_QNAN64 0x7ff7ffffffffffffULL
+#define FLOAT_SNAN32 0x7fffffff
+#define FLOAT_SNAN64 0x7fffffffffffffffULL
/* convert MIPS rounding mode in FCR31 to IEEE library */
unsigned int ieee_rm[] = {
DT2 = float64_to_int64(FDT0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(cvtl, s)
{
DT2 = float32_to_int64(FST0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(cvtps, pw)
WTH2 = float32_to_int32(FSTH0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(cvts, d)
{
WT2 = float32_to_int32(FST0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(cvtw, d)
{
WT2 = float64_to_int32(FDT0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(roundl, d)
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(roundl, s)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(roundw, d)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(roundw, s)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(truncl, d)
DT2 = float64_to_int64_round_to_zero(FDT0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(truncl, s)
{
DT2 = float32_to_int64_round_to_zero(FST0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(truncw, d)
{
WT2 = float64_to_int32_round_to_zero(FDT0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(truncw, s)
{
WT2 = float32_to_int32_round_to_zero(FST0, &env->fpu->fp_status);
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(ceill, d)
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(ceill, s)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(ceilw, d)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(ceilw, s)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(floorl, d)
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(floorl, s)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- DT2 = 0x7fffffffffffffffULL;
+ DT2 = FLOAT_SNAN64;
}
FLOAT_OP(floorw, d)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
FLOAT_OP(floorw, s)
{
RESTORE_ROUNDING_MODE;
update_fcr31();
if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
- WT2 = 0x7fffffff;
+ WT2 = FLOAT_SNAN32;
}
/* MIPS specific unary operations */
FDT2 = float64_ ## name (FDT0, FDT1, &env->fpu->fp_status); \
update_fcr31(); \
if (GET_FP_CAUSE(env->fpu->fcr31) & FP_INVALID) \
- FDT2 = 0x7ff7ffffffffffffULL; \
+ FDT2 = FLOAT_QNAN64; \
} \
FLOAT_OP(name, s) \
{ \
FST2 = float32_ ## name (FST0, FST1, &env->fpu->fp_status); \
update_fcr31(); \
if (GET_FP_CAUSE(env->fpu->fcr31) & FP_INVALID) \
- FST2 = 0x7fbfffff; \
+ FST2 = FLOAT_QNAN32; \
} \
FLOAT_OP(name, ps) \
{ \
FSTH2 = float32_ ## name (FSTH0, FSTH1, &env->fpu->fp_status); \
update_fcr31(); \
if (GET_FP_CAUSE(env->fpu->fcr31) & FP_INVALID) { \
- FST2 = 0x7fbfffff; \
- FSTH2 = 0x7fbfffff; \
+ FST2 = FLOAT_QNAN32; \
+ FSTH2 = FLOAT_QNAN32; \
} \
}
FLOAT_BINOP(add)