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

Unified Diff: runtime/vm/assembler_ia32_test.cc

Issue 21307004: Implement some conditional moves instructions for ia32/x64. Use them in MinMax instruction implemen… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/assembler_x64.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
===================================================================
--- runtime/vm/assembler_ia32_test.cc (revision 25648)
+++ runtime/vm/assembler_ia32_test.cc (working copy)
@@ -2627,6 +2627,28 @@
}
+ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) {
+ __ movl(EDX, Immediate(1)); // Greater equal.
+ __ movl(ECX, Immediate(-1)); // Less
+ __ movl(EAX, Address(ESP, 1 * kWordSize));
+ __ cmpl(EAX, Address(ESP, 2 * kWordSize));
+ __ cmovlessl(EAX, ECX);
+ __ cmovgel(EAX, EDX);
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) {
+ typedef int (*ConditionalMovesCompareCode)(int i, int i);
+ int res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(10, 5);
+ EXPECT_EQ(1, res); // Greater equal.
+ res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5);
+ EXPECT_EQ(1, res); // Greater equal.
+ res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5);
+ EXPECT_EQ(-1, res); // Less.
+}
+
+
ASSEMBLER_TEST_GENERATE(TestLoadDoubleConstant, assembler) {
__ LoadDoubleConstant(XMM3, -12.34);
__ pushl(EAX);
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698