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

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: Created 4 years, 11 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
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 5007 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
5028 uint64_t run_addiupc(int32_t imm19) { 5028 uint32_t run_addiupc(int32_t imm19) {
5029 Isolate* isolate = CcTest::i_isolate(); 5029 Isolate* isolate = CcTest::i_isolate();
5030 HandleScope scope(isolate); 5030 HandleScope scope(isolate);
5031 5031
5032 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); 5032 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5033 5033
5034 __ addiupc(v0, imm19); 5034 __ addiupc(v0, imm19);
5035 __ jr(ra); 5035 __ jr(ra);
5036 __ nop(); 5036 __ nop();
5037 5037
5038 CodeDesc desc; 5038 CodeDesc desc;
(...skipping 12 matching lines...) Expand all
5051 5051
5052 5052
5053 TEST(r6_addiupc) { 5053 TEST(r6_addiupc) {
5054 if (IsMipsArchVariant(kMips32r6)) { 5054 if (IsMipsArchVariant(kMips32r6)) {
5055 CcTest::InitializeVM(); 5055 CcTest::InitializeVM();
5056 5056
5057 struct TestCaseAddiupc { 5057 struct TestCaseAddiupc {
5058 int32_t imm19; 5058 int32_t imm19;
5059 }; 5059 };
5060 5060
5061 struct TestCaseAddiupc tc[] = { 5061 TestCaseAddiupc tc[] = {
5062 // imm19 5062 // imm19
5063 { -262144 }, // 0x40000 5063 {-262144}, // 0x40000
5064 { -1 }, // 0x7FFFF 5064 {-1}, // 0x7FFFF
5065 { 0 }, 5065 {0},
5066 { 1 }, // 0x00001 5066 {1}, // 0x00001
5067 { 262143 } // 0x3FFFF 5067 {262143} // 0x3FFFF
5068 }; 5068 };
5069 5069
5070 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAddiupc); 5070 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAddiupc);
5071 for (size_t i = 0; i < nr_test_cases; ++i) { 5071 for (size_t i = 0; i < nr_test_cases; ++i) {
5072 PC = 0; 5072 PC = 0;
5073 uint32_t res = run_addiupc(tc[i].imm19); 5073 uint32_t res = run_addiupc(tc[i].imm19);
5074 // Now, the program_counter (PC) is set. 5074 // Now, the program_counter (PC) is set.
5075 uint32_t expected_res = PC + (tc[i].imm19 << 2); 5075 uint32_t expected_res = PC + (tc[i].imm19 << 2);
5076 CHECK_EQ(expected_res, res); 5076 CHECK_EQ(expected_res, res);
5077 } 5077 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 Handle<Code> code = isolate->factory()->NewCode( 5447 Handle<Code> code = isolate->factory()->NewCode(
5448 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5448 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5449 F2 f = FUNCTION_CAST<F2>(code->entry()); 5449 F2 f = FUNCTION_CAST<F2>(code->entry());
5450 5450
5451 int32_t res = reinterpret_cast<int32_t>( 5451 int32_t res = reinterpret_cast<int32_t>(
5452 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5452 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5453 CHECK_EQ(res, 0); 5453 CHECK_EQ(res, 0);
5454 } 5454 }
5455 5455
5456 #undef __ 5456 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698