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

Issue 15769010: Improve code for integral modulus calculation. (Closed)

Created:
7 years, 6 months ago by Sven Panne
Modified:
7 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Improve code for integral modulus calculation. Depending on what we know about the right operand, we basically do 3 different things (and the code is actually structured this way): * If we statically know that the right operand is a power of 2, we do some bit fiddling instead of doing a "real" modulus calculation. This should actually be done on the Hydrogen level, not on the Lithium level, but this will be a separate CL. * If type feedback tells us that the right operand is a power of 2, we do the same as above, but guarded by conditional deoptimization to make sure that the assumption is still valid. In the long run, we should make this guard visible on the Hydrogen level to make it visible for GVN and other optimizations. * In the general case we only do the minimum steps necessary and don't try to be too clever, because cleverness actually slows us down on real-world code. If we look at the code gerators for LModI, we actually see that we basically have 3 (4 on ARM) fundamentally different translations. I don't really like lumping them together, they should probably be different Lithium instructions. For the time being, I restructured the generators to make this crystal-clear, at the cost of some duplication regarding the power-of-2 cases. This will go away when we do the strength reduction on the Hydrogen level, so I'd like to keep it as it is for now. Note that the MIPS part was only slightly restructured, there is still some work to do there. R=jkummerow@chromium.org Committed: http://code.google.com/p/v8/source/detail?r=15034

Patch Set 1 #

Total comments: 4

Patch Set 2 : Rebased. Addressed feedback. Tiny simplifications. #

Patch Set 3 : Rebased. x64. Partial stuff on ARM/MIPS. #

Patch Set 4 : Rebased. ia32/x64/ARM done, MIPS restructured. #

Total comments: 17

Patch Set 5 : Rebased. Addressed feedback. #

Patch Set 6 : Rebased. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+509 lines, -419 lines) Patch
M src/arm/lithium-arm.h View 1 2 3 4 1 chunk +3 lines, -17 lines 0 comments Download
M src/arm/lithium-arm.cc View 1 2 3 4 1 chunk +45 lines, -27 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 5 2 chunks +127 lines, -103 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 5 1 chunk +80 lines, -75 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 2 3 1 chunk +39 lines, -28 lines 0 comments Download
M src/mips/lithium-codegen-mips.cc View 1 2 3 4 5 1 chunk +54 lines, -39 lines 0 comments Download
M src/mips/lithium-mips.cc View 1 2 3 1 chunk +30 lines, -28 lines 0 comments Download
M src/utils.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 5 1 chunk +81 lines, -76 lines 0 comments Download
M src/x64/lithium-x64.cc View 1 2 3 1 chunk +37 lines, -26 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Sven Panne
ia32 version only, just to get early feedback.
7 years, 6 months ago (2013-06-05 12:37:19 UTC) #1
Jakob Kummerow
Looks good. Needing that mammoth condition in the lithium translator is unfortunate, but in the ...
7 years, 6 months ago (2013-06-05 17:08:41 UTC) #2
Sven Panne
https://codereview.chromium.org/15769010/diff/1/src/ia32/lithium-codegen-ia32.cc File src/ia32/lithium-codegen-ia32.cc (right): https://codereview.chromium.org/15769010/diff/1/src/ia32/lithium-codegen-ia32.cc#newcode1246 src/ia32/lithium-codegen-ia32.cc:1246: int32_t divisor = HConstant::cast(right)->Integer32Value(); On 2013/06/05 17:08:41, Jakob wrote: ...
7 years, 6 months ago (2013-06-06 06:50:23 UTC) #3
Sven Panne
ia32/x64/ARM complete, PTAL again. Note that the TODOs should probably be done by platform experts. ...
7 years, 6 months ago (2013-06-07 11:59:50 UTC) #4
Jakob Kummerow
Haven't looked at MIPS. https://codereview.chromium.org/15769010/diff/11001/src/arm/lithium-codegen-arm.cc File src/arm/lithium-codegen-arm.cc (right): https://codereview.chromium.org/15769010/diff/11001/src/arm/lithium-codegen-arm.cc#newcode1303 src/arm/lithium-codegen-arm.cc:1303: // TODO(svenpanne) The last comments ...
7 years, 6 months ago (2013-06-07 16:50:07 UTC) #5
Rodolph Perfetta
https://codereview.chromium.org/15769010/diff/11001/src/arm/lithium-arm.cc File src/arm/lithium-arm.cc (right): https://codereview.chromium.org/15769010/diff/11001/src/arm/lithium-arm.cc#newcode1502 src/arm/lithium-arm.cc:1502: UseFixedDouble(left, d1), Technically not part of your patch but ...
7 years, 6 months ago (2013-06-07 19:55:03 UTC) #6
Sven Panne
Addressed feedback, PTAL again... https://codereview.chromium.org/15769010/diff/11001/src/arm/lithium-arm.cc File src/arm/lithium-arm.cc (right): https://codereview.chromium.org/15769010/diff/11001/src/arm/lithium-arm.cc#newcode1502 src/arm/lithium-arm.cc:1502: UseFixedDouble(left, d1), On 2013/06/07 19:55:03, ...
7 years, 6 months ago (2013-06-10 11:05:39 UTC) #7
Jakob Kummerow
lgtm
7 years, 6 months ago (2013-06-10 11:50:01 UTC) #8
Sven Panne
Committed patchset #6 manually as r15034 (presubmit successful).
7 years, 6 months ago (2013-06-10 12:06:05 UTC) #9
Sven Panne
Just a small note regarding the MIPS part: It works as it is, but not ...
7 years, 6 months ago (2013-06-11 06:49:52 UTC) #10
kisg
7 years, 6 months ago (2013-06-11 07:47:29 UTC) #11
Message was sent while issue was closed.
On 2013/06/11 06:49:52, Sven Panne wrote:
> Just a small note regarding the MIPS part: It works as it is, but not in an
> optimal way: LChunkBuilder::DoMod seems to allocate temp registers for LModI
for
> no good reason, and LCodeGen::DoModI doesn't handle the has_fixed_right_arg()
> case specially. Fixing both issues should yield a very visible performance
> improvement in e.g. Kraken and other benchmarks.

Hi Sven,

Thanks for the note, we are looking into it.

Best Regards,
Gergely

Powered by Google App Engine
This is Rietveld 408576698