Fix vminfp & vmaxfp emulation (VEX's jm-ppc-test -a, triggered nan bugs)

This commit is contained in:
gbeauche
2006-07-04 04:47:04 +00:00
parent 39ee6ba1aa
commit de5389bc0e
2 changed files with 24 additions and 2 deletions

View File

@@ -222,6 +222,18 @@ struct op_max {
}
};
template<>
struct op_max<float> {
static inline float apply(float a, float b) {
// XXX The maximum of any value and a NaN is a QNaN
if (mathlib_isnan(a))
return a;
if (mathlib_isnan(b))
return b;
return a > b ? a : b;
}
};
template< class TYPE >
struct op_min {
static inline TYPE apply(TYPE a, TYPE b) {
@@ -229,6 +241,18 @@ struct op_min {
}
};
template<>
struct op_min<float> {
static inline float apply(float a, float b) {
// XXX The minimum of any value and a NaN is a QNaN
if (mathlib_isnan(a))
return a;
if (mathlib_isnan(b))
return b;
return a < b ? a : b;
}
};
template< int nbytes >
struct op_all_ones {
static const uint32 value = (1U << (8 * nbytes)) - 1;

View File

@@ -1427,10 +1427,8 @@ powerpc_cpu::compile_block(uint32 entry_point)
case PPC_I(VCMPGTSH):
case PPC_I(VCMPGTSW):
case PPC_I(VMADDFP):
case PPC_I(VMAXFP):
case PPC_I(VMAXSH):
case PPC_I(VMAXUB):
case PPC_I(VMINFP):
case PPC_I(VMINSH):
case PPC_I(VMINUB):
case PPC_I(VNMSUBFP):