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

Unified Diff: runtime/vm/intrinsifier_arm.cc

Issue 1124173002: Implement Smi_bitLength intrinsic on mips, arm, and arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_arm.cc
===================================================================
--- runtime/vm/intrinsifier_arm.cc (revision 45551)
+++ runtime/vm/intrinsifier_arm.cc (working copy)
@@ -793,7 +793,14 @@
void Intrinsifier::Smi_bitLength(Assembler* assembler) {
- // TODO(sra): Implement as word-length - CLZ.
+ __ ldr(R0, Address(SP, 0 * kWordSize));
+ __ SmiUntag(R0);
+ // XOR with sign bit to complement bits if value is negative.
+ __ eor(R0, R0, Operand(R0, ASR, 31));
+ __ clz(R0, R0);
+ __ rsb(R0, R0, Operand(32));
+ __ SmiTag(R0);
+ __ Ret();
}
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698