Index: test/cctest/test-assembler-mips.cc |
diff --git a/test/cctest/test-assembler-mips.cc b/test/cctest/test-assembler-mips.cc |
index 16c9970eef1c72902d80c8a82f5d285e053adbad..9390159da8ada9490a1394a36e2cde904f73eb1c 100644 |
--- a/test/cctest/test-assembler-mips.cc |
+++ b/test/cctest/test-assembler-mips.cc |
@@ -5059,6 +5059,64 @@ int32_t run_balc(int32_t offset) { |
} |
+uint32_t run_aui(uint32_t rs, uint16_t offset) { |
+ Isolate* isolate = CcTest::i_isolate(); |
+ HandleScope scope(isolate); |
+ |
+ MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
+ |
+ __ li(t0, rs); |
+ __ aui(v0, t0, offset); |
+ __ 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()); |
+ |
+ uint32_t res = |
+ reinterpret_cast<uint32_t> |
+ (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
+ |
+ return res; |
+} |
+ |
+ |
+TEST(r6_aui) { |
+ if (IsMipsArchVariant(kMips32r6)) { |
+ CcTest::InitializeVM(); |
+ |
+ struct TestCaseAui { |
+ uint32_t rs; |
+ uint16_t offset; |
+ uint32_t ref_res; |
+ }; |
+ |
+ struct TestCaseAui tc[] = { |
+ // input, offset, result |
+ {0xfffeffff, 1, 0xffffffff}, |
+ {0xffffffff, 0, 0xffffffff}, |
+ {0, 0xffff, 0xffff0000}, |
+ {0x0008ffff, 0xfff7, 0xffffffff}, |
+ {32767, 32767, 0x7fff7fff}, |
+ // overflow cases |
+ {0xffffffff, 0x1, 0x0000ffff}, |
+ {0xffffffff, 0xffff, 0xfffeffff}, |
+ }; |
+ |
+ size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAui); |
+ for (size_t i = 0; i < nr_test_cases; ++i) { |
+ PC = 0; |
+ uint32_t res = run_aui(tc[i].rs, tc[i].offset); |
+ CHECK_EQ(tc[i].ref_res, res); |
+ } |
+ } |
+} |
+ |
+ |
TEST(r6_balc) { |
if (IsMipsArchVariant(kMips32r6)) { |
CcTest::InitializeVM(); |