Chromium Code Reviews

Issue 1993773004: [Subzero][MIPS32] Addition of bool folding machinery and implementation of conditional branches (Closed)

Created:
4 years, 7 months ago by sagar.thakur
Modified:
4 years, 7 months ago
Reviewers:
Eric Holk, Karl, Jim Stichnoth, John
CC:
native-client-reviews_googlegroups.com, srdjan.obucina_imgtec.com, rich.fuhler_imgtec.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Added bool folding machinery for MIPS32. Added implementation for conditional branch instructions. R=jpp@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=5cce76190a9bd6a6a524b2afee917f6bec922d8d

Patch Set 1 #

Patch Set 2 : Added tests for eq and ne branches and corrected branch target label emission #

Total comments: 31

Patch Set 3 : Addressed review comments #

Total comments: 10

Patch Set 4 : Addressed review comments #

Total comments: 2
Unified diffs Side-by-side diffs Stats (+525 lines, -26 lines)
A + src/IceConditionCodesMIPS32.h View 3 chunks +12 lines, -12 lines 0 comments
M src/IceInstMIPS32.h View 3 chunks +34 lines, -4 lines 2 comments
M src/IceInstMIPS32.cpp View 3 chunks +75 lines, -5 lines 0 comments
M src/IceInstMIPS32.def View 2 chunks +14 lines, -3 lines 0 comments
M src/IceTargetLoweringMIPS32.h View 3 chunks +77 lines, -0 lines 0 comments
M src/IceTargetLoweringMIPS32.cpp View 4 chunks +146 lines, -2 lines 0 comments
A tests_lit/llvm2ice_tests/cond-branch.ll View 1 chunk +167 lines, -0 lines 0 comments

Messages

Total messages: 14 (3 generated)
sagar.thakur
4 years, 7 months ago (2016-05-19 05:17:33 UTC) #3
John
lgtm https://codereview.chromium.org/1993773004/diff/20001/src/IceTargetLoweringMIPS32.cpp File src/IceTargetLoweringMIPS32.cpp (right): https://codereview.chromium.org/1993773004/diff/20001/src/IceTargetLoweringMIPS32.cpp#newcode888 src/IceTargetLoweringMIPS32.cpp:888: return; no need to "return" here. https://codereview.chromium.org/1993773004/diff/20001/tests_lit/llvm2ice_tests/cond-branch.ll File ...
4 years, 7 months ago (2016-05-19 15:00:00 UTC) #4
Jim Stichnoth
https://codereview.chromium.org/1993773004/diff/20001/src/IceConditionCodesMIPS32.h File src/IceConditionCodesMIPS32.h (right): https://codereview.chromium.org/1993773004/diff/20001/src/IceConditionCodesMIPS32.h#newcode1 src/IceConditionCodesMIPS32.h:1: //===- subzero/src/IceConditionCodesMIPS32.h - Condition Codes ---*- C++ Fix clang-format's ...
4 years, 7 months ago (2016-05-19 15:03:41 UTC) #5
sagar.thakur
https://codereview.chromium.org/1993773004/diff/20001/src/IceConditionCodesMIPS32.h File src/IceConditionCodesMIPS32.h (right): https://codereview.chromium.org/1993773004/diff/20001/src/IceConditionCodesMIPS32.h#newcode1 src/IceConditionCodesMIPS32.h:1: //===- subzero/src/IceConditionCodesMIPS32.h - Condition Codes ---*- C++ On 2016/05/19 ...
4 years, 7 months ago (2016-05-23 18:30:26 UTC) #6
Jim Stichnoth
https://codereview.chromium.org/1993773004/diff/40001/src/IceInstMIPS32.cpp File src/IceInstMIPS32.cpp (right): https://codereview.chromium.org/1993773004/diff/40001/src/IceInstMIPS32.cpp#newcode127 src/IceInstMIPS32.cpp:127: : InstMIPS32(Func, InstMIPS32::Br, 2, nullptr), TargetTrue(TargetTrue), s/2/1/ https://codereview.chromium.org/1993773004/diff/40001/src/IceTargetLoweringMIPS32.cpp File ...
4 years, 7 months ago (2016-05-23 19:53:06 UTC) #7
sagar.thakur
https://codereview.chromium.org/1993773004/diff/40001/src/IceInstMIPS32.cpp File src/IceInstMIPS32.cpp (right): https://codereview.chromium.org/1993773004/diff/40001/src/IceInstMIPS32.cpp#newcode127 src/IceInstMIPS32.cpp:127: : InstMIPS32(Func, InstMIPS32::Br, 2, nullptr), TargetTrue(TargetTrue), On 2016/05/23 19:53:05, ...
4 years, 7 months ago (2016-05-24 05:44:36 UTC) #8
sagar.thakur
On 2016/05/24 05:44:36, sagar.thakur wrote: > https://codereview.chromium.org/1993773004/diff/40001/src/IceInstMIPS32.cpp > File src/IceInstMIPS32.cpp (right): > > https://codereview.chromium.org/1993773004/diff/40001/src/IceInstMIPS32.cpp#newcode127 > ...
4 years, 7 months ago (2016-05-24 06:59:02 UTC) #9
Jim Stichnoth
lgtm https://codereview.chromium.org/1993773004/diff/60001/src/IceInstMIPS32.h File src/IceInstMIPS32.h (right): https://codereview.chromium.org/1993773004/diff/60001/src/IceInstMIPS32.h#newcode347 src/IceInstMIPS32.h:347: /// Create a conditional branch to the false ...
4 years, 7 months ago (2016-05-24 13:12:56 UTC) #10
Jim Stichnoth
Committed patchset #4 (id:60001) manually as 5cce76190a9bd6a6a524b2afee917f6bec922d8d (presubmit successful).
4 years, 7 months ago (2016-05-24 13:25:56 UTC) #12
Jim Stichnoth
On 2016/05/24 06:59:02, sagar.thakur wrote: > Considering these two tests : > > 1. define ...
4 years, 7 months ago (2016-05-24 13:33:02 UTC) #13
sagar.thakur
4 years, 7 months ago (2016-05-25 08:39:06 UTC) #14
Message was sent while issue was closed.
https://codereview.chromium.org/1993773004/diff/60001/src/IceInstMIPS32.h
File src/IceInstMIPS32.h (right):

https://codereview.chromium.org/1993773004/diff/60001/src/IceInstMIPS32.h#new...
src/IceInstMIPS32.h:347: /// Create a conditional branch to the false node.
On 2016/05/24 13:12:56, stichnot wrote:
> Sorry, I forgot to comment on this last time.
> 
> Usually the conditional branch is to the *true* node, with fallthrough to the
> *false* node.  Are these forms of the branch instruction really meant to
> conditional-branch to the *false* node?
> 
> (If this comment is actually wrong, it can be fixed as part of a future CL.)

These branch instructions can be targeted to either the *true* node or the
*false* node.
I examined mips assembly output of llc and gcc.
For code like this :

if (foo == bar)
  a = foo;
else
  a = bar;
return a;

The generated conditional branch is:

bne foo, bar, %if.else

And for code like this:

if (foo != bar)
  a = foo;
else
  a = bar;
return a;

The generated conditional branch is:

beq foo, bar, %if.else

From this I observed that both llc and gcc always emit conditional branches
targeted to the else part (*false* node). And following the same approach as llc
we are emitting conditional branches always targeted to the *false* node.
Nevertheless we can also have the mips lowering to emit conditional branches to
the *true* node, with fall through to the *false* node if it is more beneficial
than emitting conditional branch to *false* node.

Powered by Google App Engine