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

Issue 1584663007: [turbofan] Implement rounding of floats on x64 and ia32 without sse4.1. (Closed)

Created:
4 years, 11 months ago by ahaas
Modified:
4 years, 10 months ago
Reviewers:
titzer
CC:
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

[turbofan] Implement rounding of floats on x64 and ia32 without sse4.1. The implementation sets the rounding mode flag and then uses the cvtsd2si and cvtsi2sd instructions (convert between float and int) to do the rounding. Input values outside int range either don't have to be rounded anyways, or are rounded by calculating input + 2^52 - 2^52 for positive inputs, or input -2^52 + 2^52 for negative inputs. The original rounding mode is restored afterwards. R=titzer@chromium.org B=575379 Committed: https://crrev.com/fa5d09e547abe79a8c82f780deb980c53ad78beb Cr-Commit-Position: refs/heads/master@{#33367}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Fixed comments #

Patch Set 3 : Properly supports -0.0 now. #

Total comments: 1

Patch Set 4 : reduced generated code. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+708 lines, -97 lines) Patch
M src/assembler.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/assembler.cc View 1 2 3 3 chunks +9 lines, -0 lines 0 comments Download
M src/compiler/ia32/code-generator-ia32.cc View 1 2 2 chunks +15 lines, -3 lines 0 comments Download
M src/compiler/ia32/instruction-selector-ia32.cc View 1 2 4 chunks +85 lines, -21 lines 0 comments Download
M src/compiler/x64/code-generator-x64.cc View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M src/compiler/x64/instruction-selector-x64.cc View 1 3 chunks +33 lines, -19 lines 0 comments Download
M src/ia32/assembler-ia32.h View 1 3 chunks +7 lines, -0 lines 0 comments Download
M src/ia32/assembler-ia32.cc View 1 4 chunks +41 lines, -1 line 0 comments Download
M src/ia32/disasm-ia32.cc View 1 2 chunks +32 lines, -1 line 0 comments Download
M src/ia32/macro-assembler-ia32.h View 1 2 1 chunk +7 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 2 3 1 chunk +140 lines, -0 lines 0 comments Download
M src/snapshot/serialize.cc View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M src/x64/assembler-x64.h View 1 2 6 chunks +27 lines, -0 lines 0 comments Download
M src/x64/assembler-x64.cc View 1 3 chunks +49 lines, -0 lines 0 comments Download
M src/x64/disasm-x64.cc View 1 2 5 chunks +45 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.h View 1 2 3 chunks +11 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 2 3 chunks +148 lines, -0 lines 0 comments Download
M test/cctest/compiler/test-run-machops.cc View 1 2 1 chunk +22 lines, -0 lines 0 comments Download
M test/cctest/compiler/value-helper.h View 1 chunk +30 lines, -43 lines 0 comments Download
M test/cctest/wasm/test-run-wasm.cc View 1 2 2 chunks +0 lines, -5 lines 0 comments Download

Messages

Total messages: 12 (3 generated)
ahaas
4 years, 11 months ago (2016-01-14 14:35:00 UTC) #1
titzer
https://codereview.chromium.org/1584663007/diff/1/src/compiler/ia32/code-generator-ia32.cc File src/compiler/ia32/code-generator-ia32.cc (right): https://codereview.chromium.org/1584663007/diff/1/src/compiler/ia32/code-generator-ia32.cc#newcode663 src/compiler/ia32/code-generator-ia32.cc:663: Register kScratchRegister = i.TempRegister(0); Don't call this kScratchRegister, it's ...
4 years, 11 months ago (2016-01-18 10:44:29 UTC) #3
ahaas
https://codereview.chromium.org/1584663007/diff/1/src/compiler/ia32/code-generator-ia32.cc File src/compiler/ia32/code-generator-ia32.cc (right): https://codereview.chromium.org/1584663007/diff/1/src/compiler/ia32/code-generator-ia32.cc#newcode663 src/compiler/ia32/code-generator-ia32.cc:663: Register kScratchRegister = i.TempRegister(0); On 2016/01/18 at 10:44:28, titzer ...
4 years, 11 months ago (2016-01-18 15:30:30 UTC) #4
titzer
On 2016/01/18 15:30:30, ahaas wrote: > https://codereview.chromium.org/1584663007/diff/1/src/compiler/ia32/code-generator-ia32.cc > File src/compiler/ia32/code-generator-ia32.cc (right): > > https://codereview.chromium.org/1584663007/diff/1/src/compiler/ia32/code-generator-ia32.cc#newcode663 > ...
4 years, 11 months ago (2016-01-18 15:57:41 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1584663007/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1584663007/20001
4 years, 11 months ago (2016-01-18 16:05:51 UTC) #7
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 11 months ago (2016-01-18 16:09:26 UTC) #8
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/fa5d09e547abe79a8c82f780deb980c53ad78beb Cr-Commit-Position: refs/heads/master@{#33367}
4 years, 11 months ago (2016-01-18 16:10:18 UTC) #10
ahaas
A revert of this CL (patchset #2 id:20001) has been created in https://codereview.chromium.org/1593313010/ by ahaas@chromium.org. ...
4 years, 11 months ago (2016-01-18 16:26:31 UTC) #11
ahaas
4 years, 11 months ago (2016-01-19 12:06:00 UTC) #12
PTAL. 

-0.0 is supported properly now. This is achieved by storing the sign of the
input in a temporary register and restoring it after the conversion.

https://codereview.chromium.org/1584663007/diff/40001/src/x64/macro-assembler...
File src/x64/macro-assembler-x64.cc (right):

https://codereview.chromium.org/1584663007/diff/40001/src/x64/macro-assembler...
src/x64/macro-assembler-x64.cc:2888: // Saving the sign bit.
The idea to support -0 is to store the sign of the input in xtmp and then
restore it after the conversion.

Powered by Google App Engine
This is Rietveld 408576698