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

Unified Diff: runtime/vm/assembler_ia32_test.cc

Issue 23645003: Esoteric bit operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/assembler_ia32.cc ('k') | runtime/vm/bigint_operations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_ia32_test.cc
diff --git a/runtime/vm/assembler_ia32_test.cc b/runtime/vm/assembler_ia32_test.cc
index 04c2915fbeffe0b9a5a8792e5058d288928a0bed..5628494f6f4460fff652dfe61cab221d664aa926 100644
--- a/runtime/vm/assembler_ia32_test.cc
+++ b/runtime/vm/assembler_ia32_test.cc
@@ -294,6 +294,27 @@ ASSEMBLER_TEST_RUN(Negate, test) {
}
+ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) {
+ __ movl(ECX, Address(ESP, kWordSize));
+ __ movl(EAX, Immediate(666)); // Marker for conditional write.
+ __ bsrl(EAX, ECX);
+ __ 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) {
__ pushl(EBX); // preserve EBX.
__ movl(EDX, Immediate(0x1234ffff));
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/bigint_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698