Index: test/cctest/test-assembler-mips64.cc |
diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc |
index 988083cadc0247c799d19cfc67ed70d357f27eb4..255f205e5be4be4662ea280a88d763c354e3af59 100644 |
--- a/test/cctest/test-assembler-mips64.cc |
+++ b/test/cctest/test-assembler-mips64.cc |
@@ -4997,6 +4997,54 @@ TEST(r6_aui_family) { |
} |
+uint64_t run_li_macro(uint64_t rs, LiFlags mode) { |
+ Isolate* isolate = CcTest::i_isolate(); |
+ HandleScope scope(isolate); |
+ MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
+ |
+ __ li(a0, rs, mode); |
+ __ mov(v0, a0); |
+ __ jr(ra); |
+ __ nop(); |
+ |
+ CodeDesc desc; |
+ assm.GetCode(&desc); |
+ Handle<Code> code = isolate->factory()->NewCode( |
+ desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
+ |
+ F2 f = FUNCTION_CAST<F2>(code->entry()); |
+ |
+ uint64_t res = reinterpret_cast<uint64_t>( |
+ CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
+ |
+ return res; |
+} |
+ |
+ |
+TEST(li_macro) { |
+ CcTest::InitializeVM(); |
+ |
+ uint64_t inputs[] = { |
+ 0x0000000000000000, 0x000000000000ffff, 0x00000000ffffffff, |
+ 0x0000ffffffffffff, 0xffffffffffffffff, 0xffff000000000000, |
+ 0xffffffff00000000, 0xffffffffffff0000, 0xffff0000ffff0000, |
+ 0x0000ffffffff0000, 0x0000ffff0000ffff, |
+ }; |
+ |
+ size_t nr_test_cases = sizeof(inputs) / sizeof(inputs[0]); |
+ for (size_t i = 0; i < nr_test_cases; ++i) { |
+ uint64_t res = run_li_macro(inputs[i], OPTIMIZE_SIZE); |
+ CHECK_EQ(inputs[i], res); |
+ res = run_li_macro(inputs[i], CONSTANT_SIZE); |
+ CHECK_EQ(inputs[i], res); |
+ if (is_int48(inputs[i])) { |
+ res = run_li_macro(inputs[i], ADDRESS_LOAD); |
+ CHECK_EQ(inputs[i], res); |
+ } |
+ } |
+} |
+ |
+ |
uint64_t run_lwpc(int offset) { |
Isolate* isolate = CcTest::i_isolate(); |
HandleScope scope(isolate); |