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

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

Issue 1962563003: [x64] Fix testw with immediates. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 66199fb54053c2672af5854e8a2093cfa5a1cd86..e18ae7109d35e6578173f58dbaba3e102ebe6ca7 100644
--- a/test/cctest/test-assembler-x64.cc
+++ b/test/cctest/test-assembler-x64.cc
@@ -328,6 +328,32 @@ TEST(AssemblerX64TestlOperations) {
CHECK_EQ(1u, result);
}
+TEST(AssemblerX64TestwOperations) {
+ typedef uint16_t (*F)(uint16_t * x);
+ CcTest::InitializeVM();
+ // Allocate an executable page of memory.
+ size_t actual_size;
+ byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
+ Assembler::kMinimalBufferSize, &actual_size, true));
+ CHECK(buffer);
+ Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
+
+ // Set rax with the ZF flag of the testl instruction.
+ Label done;
+ __ movq(rax, Immediate(1));
+ __ testw(Operand(arg1, 0), Immediate(0xf0f0));
+ __ j(not_zero, &done, Label::kNear);
+ __ movq(rax, Immediate(0));
+ __ bind(&done);
+ __ ret(0);
+
+ CodeDesc desc;
+ assm.GetCode(&desc);
+ // Call the function from C++.
+ uint16_t operand = 0x8000;
+ uint16_t result = FUNCTION_CAST<F>(buffer)(&operand);
+ CHECK_EQ(1u, result);
+}
TEST(AssemblerX64XorlOperations) {
CcTest::InitializeVM();
« 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