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

Issue 1371703003: Generate better two address code by using commutativity (Closed)

Created:
5 years, 2 months ago by sehr
Modified:
5 years, 2 months ago
Reviewers:
Jim Stichnoth, JF
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Generate better two address code by using commutativity For operations such as t0 = t1 + t2 Subzero's pattern for arithmetic operations generates two address code that looks like movl ...t1..., %ecx addl ...t2..., %ecx // t0 is in %ecx When register pressure is high this sometimes becomes: movl ...t2..., SPILL movl ...t1..., %ecx addl SPILL, %ecx // t0 is in %ecx This CL takes advantage of cases where the use of t2 is the last one, so the register that held t2 before the operation can be reused. The optimization simply swaps the (commutative) operation to t0 = t2 + t1 which then generates code as movl ...t2..., %ecx addl ...t1..., %ecx // t0 is in %ecx This optimization is used for any commutative operation, which now includes Fadd and Fmul, which were erroneously marked as non-commutative. See the rationale in IceInst.def for the IEEE wordings. BUG= R=jfb@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=487bad0253e0d70d0cb191e8e5c71d01bf0044ee

Patch Set 1 #

Total comments: 2

Patch Set 2 : Make lit test non-commutative to remove spurious fails #

Patch Set 3 : Add test for commutativity. #

Total comments: 2

Patch Set 4 : Address code review comments in test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+169 lines, -36 lines) Patch
M src/IceInst.def View 1 chunk +19 lines, -2 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 2 1 chunk +15 lines, -2 lines 0 comments Download
M tests_lit/assembler/x86/opcode_register_encodings.ll View 1 4 chunks +32 lines, -32 lines 0 comments Download
A tests_lit/llvm2ice_tests/commutativity.ll View 1 2 3 1 chunk +103 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (1 generated)
sehr
PTAL.
5 years, 2 months ago (2015-09-25 20:40:27 UTC) #2
JF
lgtm
5 years, 2 months ago (2015-09-25 21:02:50 UTC) #3
Jim Stichnoth
Also can you add a test? https://codereview.chromium.org/1371703003/diff/1/src/IceTargetLoweringX86BaseImpl.h File src/IceTargetLoweringX86BaseImpl.h (right): https://codereview.chromium.org/1371703003/diff/1/src/IceTargetLoweringX86BaseImpl.h#newcode1289 src/IceTargetLoweringX86BaseImpl.h:1289: std::swap(Src0, Src1); I'm ...
5 years, 2 months ago (2015-09-25 21:12:09 UTC) #4
sehr
Changed and added a test. PTAL. https://codereview.chromium.org/1371703003/diff/1/src/IceTargetLoweringX86BaseImpl.h File src/IceTargetLoweringX86BaseImpl.h (right): https://codereview.chromium.org/1371703003/diff/1/src/IceTargetLoweringX86BaseImpl.h#newcode1289 src/IceTargetLoweringX86BaseImpl.h:1289: std::swap(Src0, Src1); On ...
5 years, 2 months ago (2015-10-06 18:42:00 UTC) #5
Jim Stichnoth
https://chromiumcodereview.appspot.com/1371703003/diff/40001/tests_lit/llvm2ice_tests/commutativity.ll File tests_lit/llvm2ice_tests/commutativity.ll (right): https://chromiumcodereview.appspot.com/1371703003/diff/40001/tests_lit/llvm2ice_tests/commutativity.ll#newcode20 tests_lit/llvm2ice_tests/commutativity.ll:20: ; CHECK-NOT: mov [[REG1:e.x]],[[REG2:e.x]] A few problems here. 1. ...
5 years, 2 months ago (2015-10-06 19:35:49 UTC) #6
sehr
PTAL. https://chromiumcodereview.appspot.com/1371703003/diff/40001/tests_lit/llvm2ice_tests/commutativity.ll File tests_lit/llvm2ice_tests/commutativity.ll (right): https://chromiumcodereview.appspot.com/1371703003/diff/40001/tests_lit/llvm2ice_tests/commutativity.ll#newcode20 tests_lit/llvm2ice_tests/commutativity.ll:20: ; CHECK-NOT: mov [[REG1:e.x]],[[REG2:e.x]] On 2015/10/06 19:35:49, stichnot ...
5 years, 2 months ago (2015-10-07 00:18:30 UTC) #7
Jim Stichnoth
lgtm
5 years, 2 months ago (2015-10-07 00:29:24 UTC) #8
sehr
5 years, 2 months ago (2015-10-07 00:41:30 UTC) #9
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
487bad0253e0d70d0cb191e8e5c71d01bf0044ee (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698