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 5025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5036 | 5036 |
5037 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5037 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5038 | 5038 |
5039 int32_t res = reinterpret_cast<int32_t>( | 5039 int32_t res = reinterpret_cast<int32_t>( |
5040 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 5040 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
5041 | 5041 |
5042 return res; | 5042 return res; |
5043 } | 5043 } |
5044 | 5044 |
5045 | 5045 |
| 5046 uint32_t run_aui(uint32_t rs, uint16_t offset) { |
| 5047 Isolate* isolate = CcTest::i_isolate(); |
| 5048 HandleScope scope(isolate); |
| 5049 |
| 5050 MacroAssembler assm(isolate, NULL, 0); |
| 5051 |
| 5052 __ li(t0, rs); |
| 5053 __ aui(v0, t0, offset); |
| 5054 __ jr(ra); |
| 5055 __ nop(); |
| 5056 |
| 5057 CodeDesc desc; |
| 5058 assm.GetCode(&desc); |
| 5059 Handle<Code> code = isolate->factory()->NewCode( |
| 5060 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 5061 |
| 5062 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 5063 |
| 5064 uint32_t res = |
| 5065 reinterpret_cast<uint32_t> |
| 5066 (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
| 5067 |
| 5068 return res; |
| 5069 } |
| 5070 |
| 5071 |
| 5072 TEST(r6_aui) { |
| 5073 if (IsMipsArchVariant(kMips32r6)) { |
| 5074 CcTest::InitializeVM(); |
| 5075 |
| 5076 struct TestCaseAui { |
| 5077 uint32_t rs; |
| 5078 uint16_t offset; |
| 5079 uint32_t ref_res; |
| 5080 }; |
| 5081 |
| 5082 struct TestCaseAui tc[] = { |
| 5083 // input, offset, result |
| 5084 {0xfffeffff, 1, 0xffffffff}, |
| 5085 {0xffffffff, 0, 0xffffffff}, |
| 5086 {0, 0xffff, 0xffff0000}, |
| 5087 {0x0008ffff, 0xfff7, 0xffffffff}, |
| 5088 {32767, 32767, 0x7fff7fff}, |
| 5089 // overflow cases |
| 5090 {0xffffffff, 0x1, 0x0000ffff}, |
| 5091 {0xffffffff, 0xffff, 0xfffeffff}, |
| 5092 }; |
| 5093 |
| 5094 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAui); |
| 5095 for (size_t i = 0; i < nr_test_cases; ++i) { |
| 5096 PC = 0; |
| 5097 uint32_t res = run_aui(tc[i].rs, tc[i].offset); |
| 5098 CHECK_EQ(tc[i].ref_res, res); |
| 5099 } |
| 5100 } |
| 5101 } |
| 5102 |
| 5103 |
5046 TEST(r6_balc) { | 5104 TEST(r6_balc) { |
5047 if (IsMipsArchVariant(kMips32r6)) { | 5105 if (IsMipsArchVariant(kMips32r6)) { |
5048 CcTest::InitializeVM(); | 5106 CcTest::InitializeVM(); |
5049 | 5107 |
5050 struct TestCaseBalc { | 5108 struct TestCaseBalc { |
5051 int32_t offset; | 5109 int32_t offset; |
5052 int32_t expected_res; | 5110 int32_t expected_res; |
5053 }; | 5111 }; |
5054 | 5112 |
5055 struct TestCaseBalc tc[] = { | 5113 struct TestCaseBalc tc[] = { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5146 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5204 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5147 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5205 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5148 | 5206 |
5149 int32_t res = reinterpret_cast<int32_t>( | 5207 int32_t res = reinterpret_cast<int32_t>( |
5150 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5208 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5151 CHECK_EQ(res, 0); | 5209 CHECK_EQ(res, 0); |
5152 } | 5210 } |
5153 | 5211 |
5154 | 5212 |
5155 #undef __ | 5213 #undef __ |
OLD | NEW |