Bugfix for Float64 Divided zero. Remove Float64RightIsZeroCheck.

Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7M88W?from=project-issue

Change-Id: Ia1276d059839a9c5f2559ca42f5b92061030ea1c
Signed-off-by: duanfuchen <slow295185031@163.com>
This commit is contained in:
duanfuchen 2023-07-19 10:34:50 +08:00
parent 99d04f4610
commit 613bf61d37
4 changed files with 61 additions and 1 deletions

View File

@ -326,7 +326,6 @@ void NumberSpeculativeLowering::VisitNumberDiv(GateRef gate)
result = builder_.Int32DivWithCheck(left, right);
acc_.SetMachineType(gate, MachineType::I32);
} else {
builder_.Float64CheckRightIsZero(right);
result = builder_.BinaryArithmetic(circuit_->Fdiv(), MachineType::F64, left, right);
acc_.SetMachineType(gate, MachineType::F64);
}

View File

@ -0,0 +1,18 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("float64divzero") {
deps = []
}

View File

@ -0,0 +1,17 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Infinity
NaN
Infinity
NaN

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//declare function print(str:string):string;
declare function print(str:any):number;
var num0:number = 99
var zero:number = 0.0
var inf1:number = num0 / zero
print(inf1)
var nan1:number = zero / zero
print(nan1)
print(inf1/zero)
print(nan1/zero)