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 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5001 | 5001 |
5002 nr_test_cases = sizeof(dahi_tc) / sizeof(TestCaseAui); | 5002 nr_test_cases = sizeof(dahi_tc) / sizeof(TestCaseAui); |
5003 for (size_t i = 0; i < nr_test_cases; ++i) { | 5003 for (size_t i = 0; i < nr_test_cases; ++i) { |
5004 uint64_t res = run_dahi(dahi_tc[i].rs, dahi_tc[i].offset); | 5004 uint64_t res = run_dahi(dahi_tc[i].rs, dahi_tc[i].offset); |
5005 CHECK_EQ(dahi_tc[i].ref_res, res); | 5005 CHECK_EQ(dahi_tc[i].ref_res, res); |
5006 } | 5006 } |
5007 } | 5007 } |
5008 } | 5008 } |
5009 | 5009 |
5010 | 5010 |
5011 uint64_t run_li_macro(uint64_t rs) { | |
5012 Isolate* isolate = CcTest::i_isolate(); | |
5013 HandleScope scope(isolate); | |
5014 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | |
5015 | |
5016 __ li(a0, rs); | |
ivica.bogosavljevic
2015/12/21 16:15:56
There is a third parametar to li macro called LiFl
Alan Li
2016/01/20 14:26:59
Done.
| |
5017 __ mov(v0, a0); | |
5018 __ jr(ra); | |
5019 __ nop(); | |
5020 | |
5021 CodeDesc desc; | |
5022 assm.GetCode(&desc); | |
5023 Handle<Code> code = isolate->factory()->NewCode( | |
5024 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | |
5025 | |
5026 F2 f = FUNCTION_CAST<F2>(code->entry()); | |
5027 | |
5028 uint64_t res = | |
5029 reinterpret_cast<uint64_t> | |
5030 (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | |
5031 | |
5032 return res; | |
5033 } | |
5034 | |
5035 | |
5036 TEST(li_macro) { | |
5037 CcTest::InitializeVM(); | |
5038 | |
5039 uint64_t inputs[] = { | |
5040 0x0000000000000000, | |
ivica.bogosavljevic
2015/12/21 16:15:56
Looks good
Alan Li
2016/01/20 14:26:59
Acknowledged.
| |
5041 0x000000000000ffff, | |
5042 0x00000000ffffffff, | |
5043 0x0000ffffffffffff, | |
5044 0xffffffffffffffff, | |
5045 0xffff000000000000, | |
5046 0xffffffff00000000, | |
5047 0xffffffffffff0000, | |
5048 0xffff0000ffff0000, | |
5049 0x0000ffffffff0000, | |
5050 0x0000ffff0000ffff, | |
5051 }; | |
5052 | |
5053 size_t nr_test_cases = sizeof(inputs) / sizeof(inputs[0]); | |
5054 for (size_t i = 0; i < nr_test_cases; ++i) { | |
5055 uint64_t res = run_li_macro(inputs[i]); | |
5056 CHECK_EQ(inputs[i], res); | |
5057 } | |
5058 } | |
5059 | |
5060 | |
5011 uint64_t run_lwpc(int offset) { | 5061 uint64_t run_lwpc(int offset) { |
5012 Isolate* isolate = CcTest::i_isolate(); | 5062 Isolate* isolate = CcTest::i_isolate(); |
5013 HandleScope scope(isolate); | 5063 HandleScope scope(isolate); |
5014 | 5064 |
5015 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 5065 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
5016 | 5066 |
5017 // 256k instructions; 2^8k | 5067 // 256k instructions; 2^8k |
5018 // addiu t3, a4, 0xffff; (0x250fffff) | 5068 // addiu t3, a4, 0xffff; (0x250fffff) |
5019 // ... | 5069 // ... |
5020 // addiu t0, a4, 0x0000; (0x250c0000) | 5070 // addiu t0, a4, 0x0000; (0x250c0000) |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5825 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5875 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5826 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5876 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5827 | 5877 |
5828 int64_t res = reinterpret_cast<int64_t>( | 5878 int64_t res = reinterpret_cast<int64_t>( |
5829 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5879 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5830 CHECK_EQ(res, 0); | 5880 CHECK_EQ(res, 0); |
5831 } | 5881 } |
5832 | 5882 |
5833 | 5883 |
5834 #undef __ | 5884 #undef __ |
OLD | NEW |