| Index: test/cctest/test-assembler-mips64.cc
|
| diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc
|
| index 9529dab2422b69f094aa5e7ae2940d9a901ab963..518a9ae36b1fc5ebfc3e777063fdce3139ef54c8 100644
|
| --- a/test/cctest/test-assembler-mips64.cc
|
| +++ b/test/cctest/test-assembler-mips64.cc
|
| @@ -5934,5 +5934,296 @@ TEST(Trampoline) {
|
| CHECK_EQ(res, 0);
|
| }
|
|
|
| +TEST(madd_s_msub_s) {
|
| + if (kArchVariant == kMips64r2) {
|
| + CcTest::InitializeVM();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + HandleScope scope(isolate);
|
| + MacroAssembler assm(isolate, NULL, 0,
|
| + v8::internal::CodeObjectRequired::kYes);
|
| +
|
| + struct TestCase {
|
| + float fr, fs, ft, fd_add, fd_sub;
|
| + };
|
| +
|
| + float x = sqrtf(2.0);
|
| + float y = sqrtf(3.0);
|
| + float z = sqrtf(5.0);
|
| + float x2 = 11.11, y2 = 22.22, z2 = 33.33;
|
| + TestCase test_cases[] = {
|
| + {x, y, z, 0.0, 0.0},
|
| + {x, y, -z, 0.0, 0.0},
|
| + {x, -y, z, 0.0, 0.0},
|
| + {x, -y, -z, 0.0, 0.0},
|
| + {-x, y, z, 0.0, 0.0},
|
| + {-x, y, -z, 0.0, 0.0},
|
| + {-x, -y, z, 0.0, 0.0},
|
| + {-x, -y, -z, 0.0, 0.0},
|
| + {-3.14, 0.2345, -123.000056, 0.0, 0.0},
|
| + {7.3, -23.257, -357.1357, 0.0, 0.0},
|
| + {x2, y2, z2, 0.0, 0.0},
|
| + {x2, y2, -z2, 0.0, 0.0},
|
| + {x2, -y2, z2, 0.0, 0.0},
|
| + {x2, -y2, -z2, 0.0, 0.0},
|
| + {-x2, y2, z2, 0.0, 0.0},
|
| + {-x2, y2, -z2, 0.0, 0.0},
|
| + {-x2, -y2, z2, 0.0, 0.0},
|
| + {-x2, -y2, -z2, 0.0, 0.0},
|
| + };
|
| +
|
| + __ lwc1(f4, MemOperand(a0, offsetof(TestCase, fr)));
|
| + __ lwc1(f6, MemOperand(a0, offsetof(TestCase, fs)));
|
| + __ lwc1(f8, MemOperand(a0, offsetof(TestCase, ft)));
|
| + __ lwc1(f16, MemOperand(a0, offsetof(TestCase, fr)));
|
| +
|
| + __ madd_s(f10, f4, f6, f8);
|
| + __ swc1(f10, MemOperand(a0, offsetof(TestCase, fd_add)));
|
| + __ msub_s(f16, f4, f6, f8);
|
| + __ swc1(f16, MemOperand(a0, offsetof(TestCase, fd_sub)));
|
| +
|
| + __ jr(ra);
|
| + __ nop();
|
| +
|
| + CodeDesc desc;
|
| + assm.GetCode(&desc);
|
| + Handle<Code> code = isolate->factory()->NewCode(
|
| + desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
|
| + F3 f = FUNCTION_CAST<F3>(code->entry());
|
| +
|
| + const size_t kTableLength = sizeof(test_cases) / sizeof(TestCase);
|
| + TestCase tc;
|
| + for (size_t i = 0; i < kTableLength; i++) {
|
| + tc.fr = test_cases[i].fr;
|
| + tc.fs = test_cases[i].fs;
|
| + tc.ft = test_cases[i].ft;
|
| +
|
| + (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0));
|
| +
|
| + float res_add = tc.fr + (tc.fs * tc.ft);
|
| + float res_sub = (tc.fs * tc.ft) - tc.fr;
|
| + CHECK_EQ(tc.fd_add, res_add);
|
| + CHECK_EQ(tc.fd_sub, res_sub);
|
| + }
|
| + }
|
| +}
|
| +
|
| +TEST(maddf_s_msubf_s) {
|
| + if (kArchVariant == kMips64r6) {
|
| + CcTest::InitializeVM();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + HandleScope scope(isolate);
|
| + MacroAssembler assm(isolate, NULL, 0,
|
| + v8::internal::CodeObjectRequired::kYes);
|
| +
|
| + struct TestCase {
|
| + float fr, fs, ft, fd_add, fd_sub;
|
| + };
|
| +
|
| + float x = sqrtf(2.0);
|
| + float y = sqrtf(3.0);
|
| + float z = sqrtf(5.0);
|
| + float x2 = 11.11, y2 = 22.22, z2 = 33.33;
|
| + TestCase test_cases[] = {
|
| + {x, y, z, 0.0, 0.0},
|
| + {x, y, -z, 0.0, 0.0},
|
| + {x, -y, z, 0.0, 0.0},
|
| + {x, -y, -z, 0.0, 0.0},
|
| + {-x, y, z, 0.0, 0.0},
|
| + {-x, y, -z, 0.0, 0.0},
|
| + {-x, -y, z, 0.0, 0.0},
|
| + {-x, -y, -z, 0.0, 0.0},
|
| + {-3.14, 0.2345, -123.000056, 0.0, 0.0},
|
| + {7.3, -23.257, -357.1357, 0.0, 0.0},
|
| + {x2, y2, z2, 0.0, 0.0},
|
| + {x2, y2, -z2, 0.0, 0.0},
|
| + {x2, -y2, z2, 0.0, 0.0},
|
| + {x2, -y2, -z2, 0.0, 0.0},
|
| + {-x2, y2, z2, 0.0, 0.0},
|
| + {-x2, y2, -z2, 0.0, 0.0},
|
| + {-x2, -y2, z2, 0.0, 0.0},
|
| + {-x2, -y2, -z2, 0.0, 0.0},
|
| + };
|
| +
|
| + __ lwc1(f4, MemOperand(a0, offsetof(TestCase, fr)));
|
| + __ lwc1(f6, MemOperand(a0, offsetof(TestCase, fs)));
|
| + __ lwc1(f8, MemOperand(a0, offsetof(TestCase, ft)));
|
| + __ lwc1(f16, MemOperand(a0, offsetof(TestCase, fr)));
|
| +
|
| + __ maddf_s(f4, f6, f8);
|
| + __ swc1(f4, MemOperand(a0, offsetof(TestCase, fd_add)));
|
| + __ msubf_s(f16, f6, f8);
|
| + __ swc1(f16, MemOperand(a0, offsetof(TestCase, fd_sub)));
|
| +
|
| + __ jr(ra);
|
| + __ nop();
|
| +
|
| + CodeDesc desc;
|
| + assm.GetCode(&desc);
|
| + Handle<Code> code = isolate->factory()->NewCode(
|
| + desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
|
| + F3 f = FUNCTION_CAST<F3>(code->entry());
|
| +
|
| + const size_t kTableLength = sizeof(test_cases) / sizeof(TestCase);
|
| + TestCase tc;
|
| + for (size_t i = 0; i < kTableLength; i++) {
|
| + tc.fr = test_cases[i].fr;
|
| + tc.fs = test_cases[i].fs;
|
| + tc.ft = test_cases[i].ft;
|
| +
|
| + (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0));
|
| +
|
| + float res_add = tc.fr + (tc.fs * tc.ft);
|
| + float res_sub = tc.fr - (tc.fs * tc.ft);
|
| + CHECK_EQ(tc.fd_add, res_add);
|
| + CHECK_EQ(tc.fd_sub, res_sub);
|
| + }
|
| + }
|
| +}
|
| +
|
| +TEST(madd_d_msub_d) {
|
| + if (kArchVariant == kMips64r2) {
|
| + CcTest::InitializeVM();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + HandleScope scope(isolate);
|
| + MacroAssembler assm(isolate, NULL, 0,
|
| + v8::internal::CodeObjectRequired::kYes);
|
| +
|
| + struct TestCase {
|
| + double fr, fs, ft, fd_add, fd_sub;
|
| + };
|
| +
|
| + double x = sqrt(2.0);
|
| + double y = sqrt(3.0);
|
| + double z = sqrt(5.0);
|
| + double x2 = 11.11, y2 = 22.22, z2 = 33.33;
|
| + TestCase test_cases[] = {
|
| + {x, y, z, 0.0, 0.0},
|
| + {x, y, -z, 0.0, 0.0},
|
| + {x, -y, z, 0.0, 0.0},
|
| + {x, -y, -z, 0.0, 0.0},
|
| + {-x, y, z, 0.0, 0.0},
|
| + {-x, y, -z, 0.0, 0.0},
|
| + {-x, -y, z, 0.0, 0.0},
|
| + {-x, -y, -z, 0.0, 0.0},
|
| + {-3.14, 0.2345, -123.000056, 0.0, 0.0},
|
| + {7.3, -23.257, -357.1357, 0.0, 0.0},
|
| + {x2, y2, z2, 0.0, 0.0},
|
| + {x2, y2, -z2, 0.0, 0.0},
|
| + {x2, -y2, z2, 0.0, 0.0},
|
| + {x2, -y2, -z2, 0.0, 0.0},
|
| + {-x2, y2, z2, 0.0, 0.0},
|
| + {-x2, y2, -z2, 0.0, 0.0},
|
| + {-x2, -y2, z2, 0.0, 0.0},
|
| + {-x2, -y2, -z2, 0.0, 0.0},
|
| + };
|
| +
|
| + __ ldc1(f4, MemOperand(a0, offsetof(TestCase, fr)));
|
| + __ ldc1(f6, MemOperand(a0, offsetof(TestCase, fs)));
|
| + __ ldc1(f8, MemOperand(a0, offsetof(TestCase, ft)));
|
| + __ ldc1(f16, MemOperand(a0, offsetof(TestCase, fr)));
|
| +
|
| + __ madd_d(f10, f4, f6, f8);
|
| + __ sdc1(f10, MemOperand(a0, offsetof(TestCase, fd_add)));
|
| + __ msub_d(f16, f4, f6, f8);
|
| + __ sdc1(f16, MemOperand(a0, offsetof(TestCase, fd_sub)));
|
| +
|
| + __ jr(ra);
|
| + __ nop();
|
| +
|
| + CodeDesc desc;
|
| + assm.GetCode(&desc);
|
| + Handle<Code> code = isolate->factory()->NewCode(
|
| + desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
|
| + F3 f = FUNCTION_CAST<F3>(code->entry());
|
| +
|
| + const size_t kTableLength = sizeof(test_cases) / sizeof(TestCase);
|
| + TestCase tc;
|
| + for (size_t i = 0; i < kTableLength; i++) {
|
| + tc.fr = test_cases[i].fr;
|
| + tc.fs = test_cases[i].fs;
|
| + tc.ft = test_cases[i].ft;
|
| +
|
| + (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0));
|
| +
|
| + double res_add = tc.fr + (tc.fs * tc.ft);
|
| + double res_sub = (tc.fs * tc.ft) - tc.fr;
|
| + CHECK_EQ(tc.fd_add, res_add);
|
| + CHECK_EQ(tc.fd_sub, res_sub);
|
| + }
|
| + }
|
| +}
|
| +
|
| +TEST(maddf_d_msubf_d) {
|
| + if (kArchVariant == kMips64r6) {
|
| + CcTest::InitializeVM();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + HandleScope scope(isolate);
|
| + MacroAssembler assm(isolate, NULL, 0,
|
| + v8::internal::CodeObjectRequired::kYes);
|
| +
|
| + struct TestCase {
|
| + double fr, fs, ft, fd_add, fd_sub;
|
| + };
|
| +
|
| + double x = sqrt(2.0);
|
| + double y = sqrt(3.0);
|
| + double z = sqrt(5.0);
|
| + double x2 = 11.11, y2 = 22.22, z2 = 33.33;
|
| + TestCase test_cases[] = {
|
| + {x, y, z, 0.0, 0.0},
|
| + {x, y, -z, 0.0, 0.0},
|
| + {x, -y, z, 0.0, 0.0},
|
| + {x, -y, -z, 0.0, 0.0},
|
| + {-x, y, z, 0.0, 0.0},
|
| + {-x, y, -z, 0.0, 0.0},
|
| + {-x, -y, z, 0.0, 0.0},
|
| + {-x, -y, -z, 0.0, 0.0},
|
| + {-3.14, 0.2345, -123.000056, 0.0, 0.0},
|
| + {7.3, -23.257, -357.1357, 0.0, 0.0},
|
| + {x2, y2, z2, 0.0, 0.0},
|
| + {x2, y2, -z2, 0.0, 0.0},
|
| + {x2, -y2, z2, 0.0, 0.0},
|
| + {x2, -y2, -z2, 0.0, 0.0},
|
| + {-x2, y2, z2, 0.0, 0.0},
|
| + {-x2, y2, -z2, 0.0, 0.0},
|
| + {-x2, -y2, z2, 0.0, 0.0},
|
| + {-x2, -y2, -z2, 0.0, 0.0},
|
| + };
|
| +
|
| + __ ldc1(f4, MemOperand(a0, offsetof(TestCase, fr)));
|
| + __ ldc1(f6, MemOperand(a0, offsetof(TestCase, fs)));
|
| + __ ldc1(f8, MemOperand(a0, offsetof(TestCase, ft)));
|
| + __ ldc1(f16, MemOperand(a0, offsetof(TestCase, fr)));
|
| +
|
| + __ maddf_d(f4, f6, f8);
|
| + __ sdc1(f4, MemOperand(a0, offsetof(TestCase, fd_add)));
|
| + __ msubf_d(f16, f6, f8);
|
| + __ sdc1(f16, MemOperand(a0, offsetof(TestCase, fd_sub)));
|
| +
|
| + __ jr(ra);
|
| + __ nop();
|
| +
|
| + CodeDesc desc;
|
| + assm.GetCode(&desc);
|
| + Handle<Code> code = isolate->factory()->NewCode(
|
| + desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
|
| + F3 f = FUNCTION_CAST<F3>(code->entry());
|
| +
|
| + const size_t kTableLength = sizeof(test_cases) / sizeof(TestCase);
|
| + TestCase tc;
|
| + for (size_t i = 0; i < kTableLength; i++) {
|
| + tc.fr = test_cases[i].fr;
|
| + tc.fs = test_cases[i].fs;
|
| + tc.ft = test_cases[i].ft;
|
| +
|
| + (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0));
|
| +
|
| + double res_add = tc.fr + (tc.fs * tc.ft);
|
| + double res_sub = tc.fr - (tc.fs * tc.ft);
|
| + CHECK_EQ(tc.fd_add, res_add);
|
| + CHECK_EQ(tc.fd_sub, res_sub);
|
| + }
|
| + }
|
| +}
|
|
|
| #undef __
|
|
|