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

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

Issue 1481493002: (mips) adding simulator support for AUI/DAUI/DAHI/DATI instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix mips64 compilation error. Created 5 years, 1 month 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/mips64/simulator-mips64.cc ('k') | test/cctest/test-assembler-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/mips64/simulator-mips64.cc ('k') | test/cctest/test-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698