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

Unified Diff: runtime/vm/assembler_x64_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_x64_test.cc
===================================================================
--- runtime/vm/assembler_x64_test.cc (revision 38122)
+++ runtime/vm/assembler_x64_test.cc (working copy)
@@ -2969,6 +2969,27 @@
EXPECT_EQ(0, res);
}
+
+// Return 1 if overflow, 0 if no overflow.
+ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) {
+ __ movq(RDX, CallingConventions::kArg1Reg);
+ __ addq(RDX, CallingConventions::kArg2Reg);
+ __ movq(RAX, Immediate(1));
+ __ movq(RCX, Immediate(0));
+ __ cmovnoq(RAX, RCX);
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(ConditionalMovesNoOverflow, test) {
+ typedef int (*ConditionalMovesNoOverflowCode)(int64_t i, int64_t j);
+ int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(
+ test->entry())(0x7fffffffffffffff, 2);
+ EXPECT_EQ(1, res);
+ res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1);
+ EXPECT_EQ(0, res);
+}
+
} // namespace dart
#endif // defined TARGET_ARCH_X64

Powered by Google App Engine
This is Rietveld 408576698