OLD | NEW |
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 5041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5052 | 5052 |
5053 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5053 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5054 | 5054 |
5055 int32_t res = reinterpret_cast<int32_t>( | 5055 int32_t res = reinterpret_cast<int32_t>( |
5056 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 5056 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
5057 | 5057 |
5058 return res; | 5058 return res; |
5059 } | 5059 } |
5060 | 5060 |
5061 | 5061 |
| 5062 uint32_t run_aui(uint32_t rs, uint16_t offset) { |
| 5063 Isolate* isolate = CcTest::i_isolate(); |
| 5064 HandleScope scope(isolate); |
| 5065 |
| 5066 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
| 5067 |
| 5068 __ li(t0, rs); |
| 5069 __ aui(v0, t0, offset); |
| 5070 __ jr(ra); |
| 5071 __ nop(); |
| 5072 |
| 5073 CodeDesc desc; |
| 5074 assm.GetCode(&desc); |
| 5075 Handle<Code> code = isolate->factory()->NewCode( |
| 5076 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 5077 |
| 5078 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 5079 |
| 5080 uint32_t res = |
| 5081 reinterpret_cast<uint32_t> |
| 5082 (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
| 5083 |
| 5084 return res; |
| 5085 } |
| 5086 |
| 5087 |
| 5088 TEST(r6_aui) { |
| 5089 if (IsMipsArchVariant(kMips32r6)) { |
| 5090 CcTest::InitializeVM(); |
| 5091 |
| 5092 struct TestCaseAui { |
| 5093 uint32_t rs; |
| 5094 uint16_t offset; |
| 5095 uint32_t ref_res; |
| 5096 }; |
| 5097 |
| 5098 struct TestCaseAui tc[] = { |
| 5099 // input, offset, result |
| 5100 {0xfffeffff, 1, 0xffffffff}, |
| 5101 {0xffffffff, 0, 0xffffffff}, |
| 5102 {0, 0xffff, 0xffff0000}, |
| 5103 {0x0008ffff, 0xfff7, 0xffffffff}, |
| 5104 {32767, 32767, 0x7fff7fff}, |
| 5105 // overflow cases |
| 5106 {0xffffffff, 0x1, 0x0000ffff}, |
| 5107 {0xffffffff, 0xffff, 0xfffeffff}, |
| 5108 }; |
| 5109 |
| 5110 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAui); |
| 5111 for (size_t i = 0; i < nr_test_cases; ++i) { |
| 5112 PC = 0; |
| 5113 uint32_t res = run_aui(tc[i].rs, tc[i].offset); |
| 5114 CHECK_EQ(tc[i].ref_res, res); |
| 5115 } |
| 5116 } |
| 5117 } |
| 5118 |
| 5119 |
5062 TEST(r6_balc) { | 5120 TEST(r6_balc) { |
5063 if (IsMipsArchVariant(kMips32r6)) { | 5121 if (IsMipsArchVariant(kMips32r6)) { |
5064 CcTest::InitializeVM(); | 5122 CcTest::InitializeVM(); |
5065 | 5123 |
5066 struct TestCaseBalc { | 5124 struct TestCaseBalc { |
5067 int32_t offset; | 5125 int32_t offset; |
5068 int32_t expected_res; | 5126 int32_t expected_res; |
5069 }; | 5127 }; |
5070 | 5128 |
5071 struct TestCaseBalc tc[] = { | 5129 struct TestCaseBalc tc[] = { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5163 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5221 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5164 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5222 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5165 | 5223 |
5166 int32_t res = reinterpret_cast<int32_t>( | 5224 int32_t res = reinterpret_cast<int32_t>( |
5167 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5225 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5168 CHECK_EQ(res, 0); | 5226 CHECK_EQ(res, 0); |
5169 } | 5227 } |
5170 | 5228 |
5171 | 5229 |
5172 #undef __ | 5230 #undef __ |
OLD | NEW |