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

Unified Diff: runtime/vm/assembler_ia32_test.cc

Issue 385563004: Uses a conditional move for usage counter increment instead of a branch (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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_ia32_test.cc
===================================================================
--- runtime/vm/assembler_ia32_test.cc (revision 38122)
+++ runtime/vm/assembler_ia32_test.cc (working copy)
@@ -3019,6 +3019,27 @@
}
+// Return 1 if overflow, 0 if no overflow.
+ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) {
+ __ movl(EDX, Address(ESP, 1 * kWordSize));
+ __ addl(EDX, Address(ESP, 2 * kWordSize));
+ __ movl(EAX, Immediate(1));
+ __ movl(ECX, Immediate(0));
+ __ cmovno(EAX, ECX);
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(ConditionalMovesNoOverflow, test) {
+ typedef int (*ConditionalMovesNoOverflowCode)(int i, int j);
+ int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(
+ test->entry())(0x7fffffff, 2);
+ EXPECT_EQ(1, res);
+ res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1);
+ EXPECT_EQ(0, res);
+}
+
+
// Return 1 if equal, 0 if not equal.
ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) {
__ xorl(EAX, EAX);

Powered by Google App Engine
This is Rietveld 408576698