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

Issue 1436623002: Improve bool folding (Closed)

Created:
5 years, 1 month ago by sehr
Modified:
5 years, 1 month ago
Reviewers:
Jim Stichnoth, John
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

Improve bool folding Fold and/or followed by branch to eliminate cmp. Also, fold fcmp instructions into branches similarly to what was done for icmp instructions. BUG= R=jpp@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=daf096cd1b8b9ec3d29c8d7823c3d60cd51c65c9

Patch Set 1 #

Patch Set 2 : Enabled fcmp folding and test #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+175 lines, -42 lines) Patch
M src/IceTargetLoweringX86Base.h View 1 2 chunks +7 lines, -0 lines 2 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 6 chunks +94 lines, -18 lines 10 comments Download
M tests_lit/llvm2ice_tests/fp.cmp.ll View 1 7 chunks +74 lines, -24 lines 2 comments Download

Messages

Total messages: 7 (2 generated)
sehr
Some small bool folding tweaks.
5 years, 1 month ago (2015-11-11 01:22:37 UTC) #3
John
lgtm https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX86BaseImpl.h File src/IceTargetLoweringX86BaseImpl.h (right): https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX86BaseImpl.h#newcode3026 src/IceTargetLoweringX86BaseImpl.h:3026: _and(T, Src1); would _test be better here? just ...
5 years, 1 month ago (2015-11-11 02:08:10 UTC) #4
Jim Stichnoth
Otherwise LGTM. Strangely, the spec2k geomean was the same with and without this change, with ...
5 years, 1 month ago (2015-11-11 14:05:20 UTC) #5
sehr
Committed patchset #2 (id:20001) manually as daf096cd1b8b9ec3d29c8d7823c3d60cd51c65c9 (presubmit successful).
5 years, 1 month ago (2015-11-11 18:57:03 UTC) #6
sehr
5 years, 1 month ago (2015-11-13 06:00:52 UTC) #7
Message was sent while issue was closed.
For the record.

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
File src/IceTargetLoweringX86Base.h (right):

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
src/IceTargetLoweringX86Base.h:723: /// Emit the code for a combined compare and
branch, or sets the destination
On 2015/11/11 14:05:20, stichnot wrote:
> Nit 1: "set" instead of "sets".
> Nit 2: "if Br == nullptr" (for accuracy, and agreement with setccOrBr).
> Nit 3: Document both methods with the same comment.
> 
> Suggestion:
> 
>   /// Emit the code for a combined icmp/branch or fcmp/branch, or set the
>   /// destination variable of the compare if Br == nullptr.
>   void lowerIcmpAndBr(const InstIcmp *Icmp, const InstBr *Br);
>   void lowerFcmpAndBr(const InstIcmp *Icmp, const InstBr *Br);
> 
> Even better if you know how to make this combined comment doxygen-friendly.

Doxygen is over my head :-).  Done otherwise.

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
File src/IceTargetLoweringX86BaseImpl.h (right):

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
src/IceTargetLoweringX86BaseImpl.h:135: break;
On 2015/11/11 14:05:20, stichnot wrote:
> I think you should just "return PK_None", unless you expect to add the x86-32
> i64 version in the future (in which case leave a TODO).

Done.

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
src/IceTargetLoweringX86BaseImpl.h:2581: Operand *T = Src0;
On 2015/11/11 14:05:20, stichnot wrote:
> std::swap(Src0, Src1);

Done.

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
src/IceTargetLoweringX86BaseImpl.h:2683: } else {
On 2015/11/11 14:05:20, stichnot wrote:
> Can this be "else if"?
> 
>   } else if (IntDefault == 0) {

I used std::swap and removed the duplication, as we discussed.

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
src/IceTargetLoweringX86BaseImpl.h:3026: _and(T, Src1);
On 2015/11/11 02:08:10, John wrote:
> would _test be better here? just curious.

Done.

https://codereview.chromium.org/1436623002/diff/20001/src/IceTargetLoweringX8...
src/IceTargetLoweringX86BaseImpl.h:3026: _and(T, Src1);
On 2015/11/11 14:05:20, stichnot wrote:
> On 2015/11/11 02:08:10, John wrote:
> > would _test be better here? just curious.
> 
> Yes it would be better, since T would be able to share Src0's register.

Done.

https://codereview.chromium.org/1436623002/diff/20001/tests_lit/llvm2ice_test...
File tests_lit/llvm2ice_tests/fp.cmp.ll (right):

https://codereview.chromium.org/1436623002/diff/20001/tests_lit/llvm2ice_test...
tests_lit/llvm2ice_tests/fp.cmp.ll:4: ; there are no special OPTM1 match lines.
On 2015/11/11 14:05:20, stichnot wrote:
> This intro is by now almost entirely untrue. :)
> 
> It never really was a comprehensive test because it only 6 of the 16 fcmp
> conditions - the ones accessible in C.
> 
> And there now are OPTM1 lines (well, CHECK-OM1).

I have removed the comment.

Powered by Google App Engine
This is Rietveld 408576698