WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 150919
[JSC] Add B3-to-Air lowering for the shift opcodes
https://bugs.webkit.org/show_bug.cgi?id=150919
Summary
[JSC] Add B3-to-Air lowering for the shift opcodes
Benjamin Poulain
Reported
2015-11-04 19:10:54 PST
[JSC] Add B3-to-Air lowering for the shift opcodes
Attachments
Patch
(30.53 KB, patch)
2015-11-04 19:11 PST
,
Benjamin Poulain
fpizlo
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Benjamin Poulain
Comment 1
2015-11-04 19:11:16 PST
Created
attachment 264835
[details]
Patch
Filip Pizlo
Comment 2
2015-11-04 20:33:41 PST
Comment on
attachment 264835
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=264835&action=review
> Source/JavaScriptCore/b3/B3Const32Value.cpp:105 > +Value* Const32Value::shlConstant(Procedure& proc, Value* other) const > +{ > + if (!other->hasInt32()) > + return nullptr; > + return proc.add<Const32Value>(origin(), m_value << other->asInt32()); > +} > + > +Value* Const32Value::sShrConstant(Procedure& proc, Value* other) const > +{ > + if (!other->hasInt32()) > + return nullptr; > + return proc.add<Const32Value>(origin(), m_value >> other->asInt32()); > +} > + > +Value* Const32Value::zShrConstant(Procedure& proc, Value* other) const > +{ > + if (!other->hasInt32()) > + return nullptr; > + return proc.add<Const32Value>(origin(), static_cast<int32_t>(static_cast<uint32_t>(m_value) >> other->asInt32())); > +} > +
You should explicitly mask the shift amount. I propose that we define shifts in B3 to be defined so that: Shl(a, b) where a is In32 is: a << (b & 31) and where a is Int64 it's: a << (b & 63) The reason why this is important is that this matches exactly what X86_64 and ARM do, and it's what FTL lowering will expect. But in C, the upper bits of the shit amount have an undefined effect on the outcome of the shift. Therefore, when using C code to fold shifts, we need to mask. And of course I had to file:
https://bugs.webkit.org/show_bug.cgi?id=150924
Benjamin Poulain
Comment 3
2015-11-04 21:50:53 PST
Committed
r192051
: <
http://trac.webkit.org/changeset/192051
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug