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

Unified Diff: runtime/vm/assembler_x64_test.cc

Issue 867383002: Implement bitLength intrinsic on x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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
Index: runtime/vm/assembler_x64_test.cc
===================================================================
--- runtime/vm/assembler_x64_test.cc (revision 43118)
+++ runtime/vm/assembler_x64_test.cc (working copy)
@@ -620,9 +620,9 @@
ASSEMBLER_TEST_GENERATE(Negate, assembler) {
- __ movl(RCX, Immediate(42));
- __ negl(RCX);
- __ movl(RAX, RCX);
+ __ movq(RCX, Immediate(42));
Cutch 2015/01/23 22:10:00 Good catch.
+ __ negq(RCX);
+ __ movq(RAX, RCX);
__ ret();
}
@@ -633,6 +633,29 @@
}
+ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) {
+ __ pushq(CallingConventions::kArg1Reg);
+ __ movq(RCX, Address(RSP, 0));
+ __ movq(RAX, Immediate(666)); // Marker for conditional write.
+ __ bsrq(RAX, RCX);
+ __ popq(RCX);
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(BitScanReverse, test) {
+ typedef int (*Bsr)(int input);
+ Bsr call = reinterpret_cast<Bsr>(test->entry());
+ EXPECT_EQ(666, call(0));
+ EXPECT_EQ(0, call(1));
+ EXPECT_EQ(1, call(2));
+ EXPECT_EQ(1, call(3));
+ EXPECT_EQ(2, call(4));
+ EXPECT_EQ(5, call(42));
+ EXPECT_EQ(31, call(-1));
+}
+
+
ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) {
__ movq(RDX, Immediate(0xffff));
__ movzxb(RAX, RDX); // RAX = 0xff

Powered by Google App Engine
This is Rietveld 408576698