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

Issue 24095002: ShiftAmountsAllowReplaceByRotate Extension (Closed)

Created:
7 years, 3 months ago by Bangfu
Modified:
7 years, 3 months ago
CC:
v8-dev
Visibility:
Public.

Description

In the case of shift amounts with two constants and if their sum is equal 32, then shift can also be replaced with bit rotate. R=svenpanne@chromium.org Committed: http://code.google.com/p/v8/source/detail?r=16735

Patch Set 1 #

Patch Set 2 : add test case #

Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -1 line) Patch
M src/hydrogen.cc View 1 chunk +8 lines, -1 line 0 comments Download
M test/mjsunit/compiler/rotate.js View 1 1 chunk +86 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Sven Panne
Can we have an explicit test case for this?
7 years, 3 months ago (2013-09-13 12:54:49 UTC) #1
Bangfu
On 2013/09/13 12:54:49, Sven Panne wrote: > Can we have an explicit test case for ...
7 years, 3 months ago (2013-09-16 13:32:06 UTC) #2
Sven Panne
LGTM, although it would be nice to know if there is some real-world example which ...
7 years, 3 months ago (2013-09-16 13:39:54 UTC) #3
Sven Panne
Committed patchset #2 manually as r16735.
7 years, 3 months ago (2013-09-16 13:51:48 UTC) #4
Bangfu
On 2013/09/16 13:51:48, Sven Panne wrote: > Committed patchset #2 manually as r16735. for example: ...
7 years, 3 months ago (2013-09-16 14:54:24 UTC) #5
Sven Panne
On 2013/09/16 14:54:24, Bangfu wrote: > On 2013/09/16 13:51:48, Sven Panne wrote: > > Committed ...
7 years, 3 months ago (2013-09-17 05:58:31 UTC) #6
Bangfu
7 years, 3 months ago (2013-09-17 07:27:32 UTC) #7
Message was sent while issue was closed.
On 2013/09/17 05:58:31, Sven Panne wrote:
> On 2013/09/16 14:54:24, Bangfu wrote:
> > On 2013/09/16 13:51:48, Sven Panne wrote:
> > > Committed patchset #2 manually as r16735.
> > 
> > for example:
> > 
> > var b = 0x1234;
> > function rol(num, cnt)
> > {
> >   return (num << cnt) | (num >>> (32 - cnt));
> > }
> > var c;
> > for(var i = 0; i < 1000; i++)
> > {
> >   c = rol(b, 30);
> > }
> > 
> > In the above example, V8 compiler would replace cnt and (32-cnt) with two
> > constants operands if function rol() is inlined during optimization.
> Therefore,
> > the old logic failed to detect it's a rotation.
> 
> Well, that's a nano-benchmark again, we would be interested in something
> non-synthetic: Is there a real-world application or some other motivation for
> this patch?

The motivations are:
1. To improve current function working properly without adding extra complexity.
2. Rotation is often used in encryption application such as, secure hash
algorithm. Rotation is much faster than "two shifts OR".   
Thanks.

Powered by Google App Engine
This is Rietveld 408576698