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

Unified Diff: runtime/vm/intrinsifier_arm64.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/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_arm64.cc
===================================================================
--- runtime/vm/intrinsifier_arm64.cc (revision 45551)
+++ runtime/vm/intrinsifier_arm64.cc (working copy)
@@ -692,7 +692,15 @@
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, 63));
+ __ clz(R0, R0);
+ __ LoadImmediate(R1, 64, kNoPP);
+ __ sub(R0, R1, Operand(R0));
+ __ SmiTag(R0);
+ __ ret();
}
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698