mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
!4159 Fix Multiplication -0 Bug
Merge pull request !4159 from 李晨帅/master
This commit is contained in:
commit
fe69c3eee3
@ -4314,9 +4314,28 @@ GateRef StubBuilder::FastAddSubAndMul(GateRef left, GateRef right, ProfileOperat
|
||||
}
|
||||
Bind(¬Overflow);
|
||||
{
|
||||
result = IntToTaggedPtr(TruncInt64ToInt32(res));
|
||||
TYPE_CALL_BACK(PGOSampleType::Type::INT)
|
||||
Jump(&exit);
|
||||
if (Op == OpCode::MUL) {
|
||||
Label resultIsZero(env);
|
||||
Label returnNegativeZero(env);
|
||||
Label returnResult(env);
|
||||
Branch(Int64Equal(res, Int64(0)), &resultIsZero, &returnResult);
|
||||
Bind(&resultIsZero);
|
||||
GateRef leftNegative = Int32LessThan(GetInt32OfTInt(left), Int32(0));
|
||||
GateRef rightNegative = Int32LessThan(GetInt32OfTInt(right), Int32(0));
|
||||
Branch(BoolOr(leftNegative, rightNegative), &returnNegativeZero, &returnResult);
|
||||
Bind(&returnNegativeZero);
|
||||
result = DoubleToTaggedDoublePtr(Double(-0.0));
|
||||
TYPE_CALL_BACK(PGOSampleType::Type::DOUBLE)
|
||||
Jump(&exit);
|
||||
Bind(&returnResult);
|
||||
result = IntToTaggedPtr(TruncInt64ToInt32(res));
|
||||
TYPE_CALL_BACK(PGOSampleType::Type::INT)
|
||||
Jump(&exit);
|
||||
} else {
|
||||
result = IntToTaggedPtr(TruncInt64ToInt32(res));
|
||||
TYPE_CALL_BACK(PGOSampleType::Type::INT)
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
Bind(&exit);
|
||||
auto ret = *result;
|
||||
|
@ -112,6 +112,9 @@ public:
|
||||
if (res > INT32_MAX || res < INT32_MIN) {
|
||||
return JSTaggedNumber(static_cast<double>(res));
|
||||
}
|
||||
if (res == 0 && (intA < 0 || intB < 0)) {
|
||||
return JSTaggedNumber(-0.0);
|
||||
}
|
||||
return JSTaggedNumber(static_cast<int>(res));
|
||||
}
|
||||
return JSTaggedNumber(GetNumber() * number.GetNumber());
|
||||
|
@ -23,4 +23,5 @@ let result = Number.parseInt("16947500000");
|
||||
print("builtins number start");
|
||||
print("parseInt result = " + result);
|
||||
print(1 / 0.75 * 0.6);
|
||||
print(1 / (-1 * 0));
|
||||
print("builtins number end");
|
||||
|
@ -36,6 +36,7 @@ builtins ir end
|
||||
builtins number start
|
||||
parseInt result = 16947500000
|
||||
0.7999999999999999
|
||||
-Infinity
|
||||
builtins number end
|
||||
builtins regexp start
|
||||
20210608_5V0J5lVh4xVNYx0AUE.jpg,.jpg
|
||||
|
Loading…
Reference in New Issue
Block a user