Commit f3ae77ff authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Do not fold f32-to-f64 and f64-to-f32 conversions.

R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2669753002
Cr-Commit-Position: refs/heads/master@{#42920}
parent 082bf306
...@@ -606,7 +606,13 @@ Reduction MachineOperatorReducer::Reduce(Node* node) { ...@@ -606,7 +606,13 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
} }
case IrOpcode::kChangeFloat32ToFloat64: { case IrOpcode::kChangeFloat32ToFloat64: {
Float32Matcher m(node->InputAt(0)); Float32Matcher m(node->InputAt(0));
if (m.HasValue()) return ReplaceFloat64(m.Value()); if (m.HasValue()) {
if (!allow_signalling_nan_ && std::isnan(m.Value())) {
// Do some calculation to make guarantee the value is a quiet NaN.
return ReplaceFloat64(m.Value() + m.Value());
}
return ReplaceFloat64(m.Value());
}
break; break;
} }
case IrOpcode::kChangeFloat64ToInt32: { case IrOpcode::kChangeFloat64ToInt32: {
...@@ -655,8 +661,15 @@ Reduction MachineOperatorReducer::Reduce(Node* node) { ...@@ -655,8 +661,15 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
} }
case IrOpcode::kTruncateFloat64ToFloat32: { case IrOpcode::kTruncateFloat64ToFloat32: {
Float64Matcher m(node->InputAt(0)); Float64Matcher m(node->InputAt(0));
if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); if (m.HasValue()) {
if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); if (!allow_signalling_nan_ && std::isnan(m.Value())) {
// Do some calculation to make guarantee the value is a quiet NaN.
return ReplaceFloat32(DoubleToFloat32(m.Value() + m.Value()));
}
return ReplaceFloat32(DoubleToFloat32(m.Value()));
}
if (allow_signalling_nan_ && m.IsChangeFloat32ToFloat64())
return Replace(m.node()->InputAt(0));
break; break;
} }
case IrOpcode::kRoundFloat64ToInt32: { case IrOpcode::kRoundFloat64ToInt32: {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment