Fix interp/fast-jit float min/max issues (#1733)
This commit is contained in:
@ -1527,47 +1527,47 @@ jit_compile_op_f64_math(JitCompContext *cc, FloatMath math_op)
|
||||
}
|
||||
|
||||
static float32
|
||||
local_minf(float32 f1, float32 f2)
|
||||
f32_min(float32 a, float32 b)
|
||||
{
|
||||
if (isnan(f1))
|
||||
return f1;
|
||||
if (isnan(f2))
|
||||
return f2;
|
||||
|
||||
return fminf(f1, f2);
|
||||
}
|
||||
|
||||
static float64
|
||||
local_min(float64 f1, float64 f2)
|
||||
{
|
||||
if (isnan(f1))
|
||||
return f1;
|
||||
if (isnan(f2))
|
||||
return f2;
|
||||
|
||||
return fmin(f1, f2);
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? a : b;
|
||||
else
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
static float32
|
||||
local_maxf(float32 f1, float32 f2)
|
||||
f32_max(float32 a, float32 b)
|
||||
{
|
||||
if (isnan(f1))
|
||||
return f1;
|
||||
if (isnan(f2))
|
||||
return f2;
|
||||
|
||||
return fmaxf(f1, f2);
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? b : a;
|
||||
else
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
static float64
|
||||
local_max(float64 f1, float64 f2)
|
||||
f64_min(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(f1))
|
||||
return f1;
|
||||
if (isnan(f2))
|
||||
return f2;
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? a : b;
|
||||
else
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
return fmax(f1, f2);
|
||||
static float64
|
||||
f64_max(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? b : a;
|
||||
else
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1579,9 +1579,9 @@ compile_op_float_min_max(JitCompContext *cc, FloatArithmetic arith_op,
|
||||
|
||||
res = is_f32 ? jit_cc_new_reg_F32(cc) : jit_cc_new_reg_F64(cc);
|
||||
if (arith_op == FLOAT_MIN)
|
||||
func = is_f32 ? (void *)local_minf : (void *)local_min;
|
||||
func = is_f32 ? (void *)f32_min : (void *)f64_min;
|
||||
else
|
||||
func = is_f32 ? (void *)local_maxf : (void *)local_max;
|
||||
func = is_f32 ? (void *)f32_max : (void *)f64_max;
|
||||
|
||||
args[0] = lhs;
|
||||
args[1] = rhs;
|
||||
|
||||
Reference in New Issue
Block a user