Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Issue 2105313002: [wasm] Detect unrepresentability in the float32-to-int32 conversion correctly on arm. (Closed)

Created:
4 years, 5 months ago by ahaas
Modified:
4 years, 5 months ago
CC:
v8-mips-ports_googlegroups.com, v8-ppc-ports_googlegroups.com, v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[wasm] Detect unrepresentability in the float32-to-int32 conversion correctly on arm. In the current implementation of wasm an unrepresentable input of the float32-to-int32 conversion is detected by first truncating the input, then converting the truncated input to int32 and back to float32, and then checking whether the result is the same as the truncated input. This input check does not work on arm and arm64 for an input of (INT32_MAX + 1) because on these platforms the float32-to-int32 conversion results in INT32_MAX if the input is greater than INT32_MAX. When INT32_MAX is converted back to float32, then the result is (INT32_MAX + 1) again because INT32_MAX cannot be represented precisely as float32, and rounding-to-nearest results in (INT32_MAX + 1). Since (INT32_MAX + 1) equals the truncated input value, the input appears to be representable. With the changes in this CL, the result of the float32-to-int32 conversion is incremented by 1 if the original result was INT32_MAX. Thereby the detection of unrepresenable inputs in wasm works. Note that since INT32_MAX cannot be represented precisely in float32, it can also never be a valid result of the float32-to-int32 conversion. @v8-mips-ports, can you do a similar implementation for mips? R=titzer@chromium.org, Rodolph.Perfetta@arm.com Committed: https://crrev.com/de369129d272c9cbd2a6282f4097a5d0ce264e85 Cr-Commit-Position: refs/heads/master@{#37448}

Patch Set 1 #

Total comments: 5

Patch Set 2 : Update bounds in test-run-machops #

Total comments: 2

Patch Set 3 : address comments #

Total comments: 2

Patch Set 4 : use i.OutputRegister32() instead of i.OutputRegister() #

Total comments: 2

Patch Set 5 : Define the bounds properly in variables. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -31 lines) Patch
M src/compiler/arm/code-generator-arm.cc View 1 2 3 4 2 chunks +8 lines, -0 lines 0 comments Download
M src/compiler/arm64/code-generator-arm64.cc View 1 2 3 4 1 chunk +9 lines, -0 lines 0 comments Download
M src/wasm/wasm-interpreter.cc View 1 2 3 4 4 chunks +27 lines, -5 lines 0 comments Download
M test/cctest/compiler/test-run-machops.cc View 1 2 3 4 2 chunks +20 lines, -17 lines 0 comments Download
M test/cctest/compiler/value-helper.h View 2 chunks +4 lines, -0 lines 0 comments Download
M test/cctest/wasm/test-run-wasm.cc View 1 2 3 4 4 chunks +28 lines, -9 lines 0 comments Download

Messages

Total messages: 20 (3 generated)
ahaas
4 years, 5 months ago (2016-06-29 12:23:41 UTC) #1
Rodolph Perfetta (ARM)
https://codereview.chromium.org/2105313002/diff/1/src/compiler/arm/code-generator-arm.cc File src/compiler/arm/code-generator-arm.cc (right): https://codereview.chromium.org/2105313002/diff/1/src/compiler/arm/code-generator-arm.cc#newcode1127 src/compiler/arm/code-generator-arm.cc:1127: __ add(i.OutputRegister(), i.OutputRegister(), Operand(1), SBit::LeaveCC, on arm32 INT32_MIN is ...
4 years, 5 months ago (2016-06-29 14:45:09 UTC) #2
ahaas
https://codereview.chromium.org/2105313002/diff/1/src/compiler/arm/code-generator-arm.cc File src/compiler/arm/code-generator-arm.cc (right): https://codereview.chromium.org/2105313002/diff/1/src/compiler/arm/code-generator-arm.cc#newcode1139 src/compiler/arm/code-generator-arm.cc:1139: __ add(i.OutputRegister(), i.OutputRegister(), Operand(1), SBit::LeaveCC, On 2016/06/29 at 14:45:08, ...
4 years, 5 months ago (2016-06-29 14:49:42 UTC) #3
Rodolph Perfetta (ARM)
> Is adc better than the mov instruction we use for the signed implementation, > ...
4 years, 5 months ago (2016-06-29 14:56:23 UTC) #4
ahaas
https://codereview.chromium.org/2105313002/diff/1/src/compiler/arm/code-generator-arm.cc File src/compiler/arm/code-generator-arm.cc (right): https://codereview.chromium.org/2105313002/diff/1/src/compiler/arm/code-generator-arm.cc#newcode1127 src/compiler/arm/code-generator-arm.cc:1127: __ add(i.OutputRegister(), i.OutputRegister(), Operand(1), SBit::LeaveCC, On 2016/06/29 at 14:45:08, ...
4 years, 5 months ago (2016-06-29 15:07:33 UTC) #5
Rodolph Perfetta (ARM)
LGTM with the comment addressed https://codereview.chromium.org/2105313002/diff/40001/src/compiler/arm64/code-generator-arm64.cc File src/compiler/arm64/code-generator-arm64.cc (right): https://codereview.chromium.org/2105313002/diff/40001/src/compiler/arm64/code-generator-arm64.cc#newcode1340 src/compiler/arm64/code-generator-arm64.cc:1340: __ Adc(i.OutputRegister(), i.OutputRegister(), Operand(0)); ...
4 years, 5 months ago (2016-06-29 15:42:18 UTC) #6
ahaas
https://codereview.chromium.org/2105313002/diff/40001/src/compiler/arm64/code-generator-arm64.cc File src/compiler/arm64/code-generator-arm64.cc (right): https://codereview.chromium.org/2105313002/diff/40001/src/compiler/arm64/code-generator-arm64.cc#newcode1340 src/compiler/arm64/code-generator-arm64.cc:1340: __ Adc(i.OutputRegister(), i.OutputRegister(), Operand(0)); On 2016/06/29 at 15:42:18, Rodolph ...
4 years, 5 months ago (2016-06-29 15:49:53 UTC) #7
titzer
https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc File test/cctest/compiler/test-run-machops.cc (right): https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc#newcode4037 test/cctest/compiler/test-run-machops.cc:4037: if (input < (static_cast<float>(static_cast<uint64_t>(UINT32_MAX) + 1))) { Why don't ...
4 years, 5 months ago (2016-06-30 10:55:26 UTC) #8
ahaas
https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc File test/cctest/compiler/test-run-machops.cc (right): https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc#newcode4037 test/cctest/compiler/test-run-machops.cc:4037: if (input < (static_cast<float>(static_cast<uint64_t>(UINT32_MAX) + 1))) { On 2016/06/30 ...
4 years, 5 months ago (2016-06-30 12:02:27 UTC) #9
titzer
On 2016/06/30 12:02:27, ahaas wrote: > https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc > File test/cctest/compiler/test-run-machops.cc (right): > > https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc#newcode4037 > ...
4 years, 5 months ago (2016-06-30 12:03:58 UTC) #10
ahaas
On 2016/06/30 at 12:03:58, titzer wrote: > On 2016/06/30 12:02:27, ahaas wrote: > > https://codereview.chromium.org/2105313002/diff/60001/test/cctest/compiler/test-run-machops.cc ...
4 years, 5 months ago (2016-06-30 12:13:00 UTC) #11
titzer
On 2016/06/30 12:13:00, ahaas wrote: > On 2016/06/30 at 12:03:58, titzer wrote: > > On ...
4 years, 5 months ago (2016-06-30 12:20:05 UTC) #12
ahaas
On 2016/06/30 at 12:20:05, titzer wrote: > On 2016/06/30 12:13:00, ahaas wrote: > > On ...
4 years, 5 months ago (2016-06-30 13:56:12 UTC) #13
titzer
lgtm
4 years, 5 months ago (2016-06-30 13:57:13 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2105313002/80001
4 years, 5 months ago (2016-06-30 13:57:59 UTC) #17
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 5 months ago (2016-06-30 14:29:44 UTC) #18
commit-bot: I haz the power
4 years, 5 months ago (2016-06-30 14:30:53 UTC) #20
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/de369129d272c9cbd2a6282f4097a5d0ce264e85
Cr-Commit-Position: refs/heads/master@{#37448}

Powered by Google App Engine
This is Rietveld 408576698