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

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

Issue 2871663002: MIPS64: Add/fix bit insertion/extraction instrs. (Closed)
Patch Set: Remove pps variable use Created 3 years, 7 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/simulator-mips64.cc ('k') | test/cctest/test-disasm-mips64.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 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after
6050 TEST(maddf_msubf_d) { 6050 TEST(maddf_msubf_d) {
6051 if (kArchVariant != kMips64r6) return; 6051 if (kArchVariant != kMips64r6) return;
6052 helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { 6052 helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) {
6053 __ maddf_d(f4, f6, f8); 6053 __ maddf_d(f4, f6, f8);
6054 __ Sdc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); 6054 __ Sdc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add)));
6055 __ msubf_d(f16, f6, f8); 6055 __ msubf_d(f16, f6, f8);
6056 __ Sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); 6056 __ Sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub)));
6057 }); 6057 });
6058 } 6058 }
6059 6059
6060 uint64_t run_Dins(uint64_t imm, uint64_t source, uint16_t pos, uint16_t size) {
6061 Isolate* isolate = CcTest::i_isolate();
6062 HandleScope scope(isolate);
6063
6064 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
6065
6066 __ li(v0, imm);
6067 __ li(t0, source);
6068 __ Dins(v0, t0, pos, size);
6069 __ jr(ra);
6070 __ nop();
6071
6072 CodeDesc desc;
6073 assm.GetCode(&desc);
6074 Handle<Code> code = isolate->factory()->NewCode(
6075 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
6076 F2 f = FUNCTION_CAST<F2>(code->entry());
6077
6078 uint64_t res = reinterpret_cast<uint64_t>(
6079 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0));
6080
6081 return res;
6082 }
6083
6084 TEST(Dins) {
6085 CcTest::InitializeVM();
6086
6087 // Test Dins macro-instruction.
6088
6089 struct TestCaseDins {
6090 uint64_t imm;
6091 uint64_t source;
6092 uint16_t pos;
6093 uint16_t size;
6094 uint64_t expected_res;
6095 };
6096
6097 // We load imm to v0 and source to t0 and then call
6098 // Dins(v0, t0, pos, size) to test cases listed below.
6099 struct TestCaseDins tc[] = {
6100 // imm, source, pos, size, expected_res
6101 {0x5555555555555555, 0x1ABCDEF01, 31, 1, 0x55555555D5555555},
6102 {0x5555555555555555, 0x1ABCDEF02, 30, 2, 0x5555555595555555},
6103 {0x201234567, 0x1FABCDEFF, 0, 32, 0x2FABCDEFF},
6104 {0x201234567, 0x7FABCDEFF, 31, 2, 0x381234567},
6105 {0x800000000, 0x7FABCDEFF, 0, 33, 0x9FABCDEFF},
6106 {0x1234, 0xABCDABCDABCDABCD, 0, 64, 0xABCDABCDABCDABCD},
6107 {0xABCD, 0xABCEABCF, 32, 1, 0x10000ABCD},
6108 {0xABCD, 0xABCEABCF, 63, 1, 0x800000000000ABCD},
6109 {0xABCD, 0xABC1ABC2ABC3ABC4, 32, 32, 0xABC3ABC40000ABCD},
6110 };
6111
6112 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseDins);
6113 for (size_t i = 0; i < nr_test_cases; ++i) {
6114 CHECK_EQ(tc[i].expected_res,
6115 run_Dins(tc[i].imm, tc[i].source, tc[i].pos, tc[i].size));
6116 }
6117 }
6118
6060 #undef __ 6119 #undef __
OLDNEW
« no previous file with comments | « src/mips64/simulator-mips64.cc ('k') | test/cctest/test-disasm-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698