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

Unified Diff: test/cctest/test-assembler-x64.cc

Issue 214753002: Refactor the arithmetic instructions for x64 port (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correct arithmetic_op_8 implementation and add a test case Created 6 years, 9 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 | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-assembler-x64.cc
diff --git a/test/cctest/test-assembler-x64.cc b/test/cctest/test-assembler-x64.cc
index 446cec6adf3f8057967a9db3a669c4009ce64aa9..ddc681c0e24a176bbf339ec84f1920fd6d47d02e 100644
--- a/test/cctest/test-assembler-x64.cc
+++ b/test/cctest/test-assembler-x64.cc
@@ -141,6 +141,37 @@ TEST(AssemblerX64ArithmeticOperations) {
}
+TEST(AssemblerX64CmpbOperation) {
+ // Allocate an executable page of memory.
+ size_t actual_size;
+ byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
+ &actual_size,
+ true));
+ CHECK(buffer);
+ Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
+
+ // Assemble a function that compare argument byte returing 1 if equal else 0.
+ // On Windows, it compares rcx with rdx which does not require REX prefix;
+ // on Linux, it compares rdi with rsi which requires REX prefix.
+
+ Label done;
+ __ movq(rax, Immediate(1));
+ __ cmpb(arg1, arg2);
+ __ j(equal, &done);
+ __ movq(rax, Immediate(0));
+ __ bind(&done);
+ __ ret(0);
+
+ CodeDesc desc;
+ assm.GetCode(&desc);
+ // Call the function from C++.
+ int result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2002);
+ CHECK_EQ(1, result);
+ result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2003);
+ CHECK_EQ(0, result);
+}
+
+
TEST(AssemblerX64ImulOperation) {
// Allocate an executable page of memory.
size_t actual_size;
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698