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

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

Issue 1245173002: MIPS: Fix simulator data trace for DSLL and BAL/BGEZAL. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/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 13abbbb4470828d0444feb00b54dde71876060e0..514173e8209b5c0eb676822b3a1dbbb8febe74fe 100644
--- a/test/cctest/test-assembler-mips.cc
+++ b/test/cctest/test-assembler-mips.cc
@@ -5059,4 +5059,56 @@ TEST(r6_balc) {
}
+uint32_t run_bal(int16_t offset) {
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+
+ MacroAssembler assm(isolate, NULL, 0);
+
+ __ mov(t0, ra);
+ __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset".
+ __ nop();
+
+ __ mov(ra, t0);
+ __ jr(ra);
+ __ nop();
+
+ __ li(v0, 1);
+ __ 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(f, 0, 0, 0, 0, 0));
+
+ return res;
+}
+
+
+TEST(bal) {
+ CcTest::InitializeVM();
+
+ struct TestCaseBal {
+ int16_t offset;
+ uint32_t expected_res;
+ };
+
+ struct TestCaseBal tc[] = {
+ // offset, expected_res
+ { 4, 1 },
+ };
+
+ size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal);
+ for (size_t i = 0; i < nr_test_cases; ++i) {
+ CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset));
+ }
+}
+
+
#undef __
« 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