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

Side by Side Diff: test/cctest/test-assembler-mips.cc

Issue 1628453002: MIPS: Use PC realitive instructions on r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5006 matching lines...) Expand 10 before | Expand all | Expand 10 after
5017 }; 5017 };
5018 5018
5019 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseJialc); 5019 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseJialc);
5020 for (size_t i = 0; i < nr_test_cases; ++i) { 5020 for (size_t i = 0; i < nr_test_cases; ++i) {
5021 uint32_t res = run_jialc(tc[i].offset); 5021 uint32_t res = run_jialc(tc[i].offset);
5022 CHECK_EQ(tc[i].expected_res, res); 5022 CHECK_EQ(tc[i].expected_res, res);
5023 } 5023 }
5024 } 5024 }
5025 } 5025 }
5026 5026
5027 5027 static uint32_t run_addiupc(int32_t imm19) {
5028 uint64_t run_addiupc(int32_t imm19) {
5029 Isolate* isolate = CcTest::i_isolate(); 5028 Isolate* isolate = CcTest::i_isolate();
5030 HandleScope scope(isolate); 5029 HandleScope scope(isolate);
5031 5030
5032 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); 5031 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5033 5032
5034 __ addiupc(v0, imm19); 5033 __ addiupc(v0, imm19);
5035 __ jr(ra); 5034 __ jr(ra);
5036 __ nop(); 5035 __ nop();
5037 5036
5038 CodeDesc desc; 5037 CodeDesc desc;
(...skipping 12 matching lines...) Expand all
5051 5050
5052 5051
5053 TEST(r6_addiupc) { 5052 TEST(r6_addiupc) {
5054 if (IsMipsArchVariant(kMips32r6)) { 5053 if (IsMipsArchVariant(kMips32r6)) {
5055 CcTest::InitializeVM(); 5054 CcTest::InitializeVM();
5056 5055
5057 struct TestCaseAddiupc { 5056 struct TestCaseAddiupc {
5058 int32_t imm19; 5057 int32_t imm19;
5059 }; 5058 };
5060 5059
5061 struct TestCaseAddiupc tc[] = { 5060 TestCaseAddiupc tc[] = {
5062 // imm19 5061 // imm19
5063 { -262144 }, // 0x40000 5062 {-262144}, // 0x40000
5064 { -1 }, // 0x7FFFF 5063 {-1}, // 0x7FFFF
5065 { 0 }, 5064 {0},
5066 { 1 }, // 0x00001 5065 {1}, // 0x00001
5067 { 262143 } // 0x3FFFF 5066 {262143} // 0x3FFFF
5068 }; 5067 };
5069 5068
5070 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAddiupc); 5069 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAddiupc);
5071 for (size_t i = 0; i < nr_test_cases; ++i) { 5070 for (size_t i = 0; i < nr_test_cases; ++i) {
5072 PC = 0; 5071 PC = 0;
5073 uint32_t res = run_addiupc(tc[i].imm19); 5072 uint32_t res = run_addiupc(tc[i].imm19);
5074 // Now, the program_counter (PC) is set. 5073 // Now, the program_counter (PC) is set.
5075 uint32_t expected_res = PC + (tc[i].imm19 << 2); 5074 uint32_t expected_res = PC + (tc[i].imm19 << 2);
5076 CHECK_EQ(expected_res, res); 5075 CHECK_EQ(expected_res, res);
5077 } 5076 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 Handle<Code> code = isolate->factory()->NewCode( 5446 Handle<Code> code = isolate->factory()->NewCode(
5448 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5447 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5449 F2 f = FUNCTION_CAST<F2>(code->entry()); 5448 F2 f = FUNCTION_CAST<F2>(code->entry());
5450 5449
5451 int32_t res = reinterpret_cast<int32_t>( 5450 int32_t res = reinterpret_cast<int32_t>(
5452 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5451 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5453 CHECK_EQ(res, 0); 5452 CHECK_EQ(res, 0);
5454 } 5453 }
5455 5454
5456 #undef __ 5455 #undef __
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698