[Bug]: 汇编解释器中进行乘法运算时返回的结果导致后续除法无法区分±Infinity

修复了浮点数0取相反数的结果仍然为0的问题。

Issue: #I7M4ZW

Signed-off-by: lichenshuai <lichenshuai@huawei.com>
Change-Id: If698fc0162bca664a3187c42910f823e36f203f3
This commit is contained in:
lichenshuai 2023-07-18 20:38:52 +08:00
parent b70208ed53
commit 8c5ac2e445
4 changed files with 9 additions and 3 deletions

View File

@ -779,7 +779,7 @@ GateRef NumberSpeculativeLowering::MonocularDouble(GateRef value)
res = builder_.DoubleSub(value, builder_.Double(1));
break;
case TypedUnOp::TYPED_NEG:
res = builder_.DoubleSub(builder_.Double(0), value);
res = builder_.DoubleMul(builder_.Double(-1), value);
break;
default:
break;

View File

@ -1345,7 +1345,7 @@ GateRef OperationsStubBuilder::Neg(GateRef glue, GateRef value, ProfileOperation
{
callback.ProfileOpType(Int32(PGOSampleType::DoubleType()));
GateRef valueDouble = GetDoubleOfTDouble(value);
result = DoubleToTaggedDoublePtr(DoubleSub(Double(0), valueDouble));
result = DoubleToTaggedDoublePtr(DoubleMul(Double(-1), valueDouble));
Jump(&exit);
}
Bind(&valueNotDouble);

View File

@ -13,3 +13,5 @@
-2147483648
2147483648
Infinity
-Infinity

View File

@ -18,4 +18,8 @@ let negone = -1;
let intmin = negone - intmax;
let negintmin = -intmin;
print(intmin);
print(negintmin);
print(negintmin);
let doublezero = 0 * 0.1;
print(1 / doublezero);
print(1 / -doublezero);