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

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

Issue 1668143002: MIPS: Fix FPU min, max, mina, maxa in simulator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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-assembler-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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 } 1449 }
1450 } 1450 }
1451 } 1451 }
1452 1452
1453 1453
1454 TEST(min_max) { 1454 TEST(min_max) {
1455 if (IsMipsArchVariant(kMips32r6)) { 1455 if (IsMipsArchVariant(kMips32r6)) {
1456 CcTest::InitializeVM(); 1456 CcTest::InitializeVM();
1457 Isolate* isolate = CcTest::i_isolate(); 1457 Isolate* isolate = CcTest::i_isolate();
1458 HandleScope scope(isolate); 1458 HandleScope scope(isolate);
1459 MacroAssembler assm(isolate, NULL, 0, 1459 MacroAssembler assm(isolate, nullptr, 0,
1460 v8::internal::CodeObjectRequired::kYes); 1460 v8::internal::CodeObjectRequired::kYes);
1461 1461
1462 typedef struct test_float { 1462 struct TestFloat {
1463 double a; 1463 double a;
1464 double b; 1464 double b;
1465 double c; 1465 double c;
1466 double d; 1466 double d;
1467 float e; 1467 float e;
1468 float f; 1468 float f;
1469 float g; 1469 float g;
1470 float h; 1470 float h;
1471 } TestFloat; 1471 };
1472 1472
1473 TestFloat test; 1473 TestFloat test;
1474 const double double_nan = std::numeric_limits<double>::quiet_NaN(); 1474 const double dnan = std::numeric_limits<double>::quiet_NaN();
1475 const float float_nan = std::numeric_limits<float>::quiet_NaN(); 1475 const double dinf = std::numeric_limits<double>::infinity();
1476 const int kTableLength = 5; 1476 const double dminf = -std::numeric_limits<double>::infinity();
1477 double inputsa[kTableLength] = {2.0, 3.0, double_nan, 3.0, double_nan}; 1477 const float fnan = std::numeric_limits<float>::quiet_NaN();
1478 double inputsb[kTableLength] = {3.0, 2.0, 3.0, double_nan, double_nan}; 1478 const float finf = std::numeric_limits<float>::infinity();
1479 double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, double_nan}; 1479 const float fminf = std::numeric_limits<float>::infinity();
1480 double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, double_nan}; 1480 const int kTableLength = 13;
1481 double inputsa[kTableLength] = {2.0, 3.0, dnan, 3.0, -0.0, 0.0, dinf,
1482 dnan, 42.0, dinf, dminf, dinf, dnan};
1483 double inputsb[kTableLength] = {3.0, 2.0, 3.0, dnan, 0.0, -0.0, dnan,
1484 dinf, dinf, 42.0, dinf, dminf, dnan};
1485 double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0,
1486 -0.0, dinf, dinf, 42.0, 42.0,
1487 dminf, dminf, dnan};
1488 double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, dinf,
1489 dinf, dinf, dinf, dinf, dinf, dnan};
1481 1490
1482 float inputse[kTableLength] = {2.0, 3.0, float_nan, 3.0, float_nan}; 1491 float inputse[kTableLength] = {2.0, 3.0, fnan, 3.0, -0.0, 0.0, finf,
1483 float inputsf[kTableLength] = {3.0, 2.0, 3.0, float_nan, float_nan}; 1492 fnan, 42.0, finf, fminf, finf, fnan};
1484 float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, float_nan}; 1493 float inputsf[kTableLength] = {3.0, 2.0, 3.0, fnan, -0.0, 0.0, fnan,
1485 float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, float_nan}; 1494 finf, finf, 42.0, finf, fminf, fnan};
1495 float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0,
1496 -0.0, finf, finf, 42.0, 42.0,
1497 fminf, fminf, fnan};
1498 float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, finf,
1499 finf, finf, finf, finf, finf, fnan};
1486 1500
1487 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); 1501 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a)));
1488 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); 1502 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b)));
1489 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); 1503 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e)));
1490 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f))); 1504 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f)));
1491 __ min_d(f10, f4, f8); 1505 __ min_d(f10, f4, f8);
1492 __ max_d(f12, f4, f8); 1506 __ max_d(f12, f4, f8);
1493 __ min_s(f14, f2, f6); 1507 __ min_s(f14, f2, f6);
1494 __ max_s(f16, f2, f6); 1508 __ max_s(f16, f2, f6);
1495 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, c))); 1509 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, c)));
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 test.input = inputs[i]; 1870 test.input = inputs[i];
1857 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); 1871 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
1858 // Check outputs 1872 // Check outputs
1859 CHECK_EQ(test.output, outputs[i]); 1873 CHECK_EQ(test.output, outputs[i]);
1860 } 1874 }
1861 } 1875 }
1862 1876
1863 1877
1864 TEST(mina_maxa) { 1878 TEST(mina_maxa) {
1865 if (IsMipsArchVariant(kMips32r6)) { 1879 if (IsMipsArchVariant(kMips32r6)) {
1866 const int kTableLength = 15; 1880 const int kTableLength = 23;
1867 CcTest::InitializeVM(); 1881 CcTest::InitializeVM();
1868 Isolate* isolate = CcTest::i_isolate(); 1882 Isolate* isolate = CcTest::i_isolate();
1869 HandleScope scope(isolate); 1883 HandleScope scope(isolate);
1870 MacroAssembler assm(isolate, NULL, 0, 1884 MacroAssembler assm(isolate, nullptr, 0,
1871 v8::internal::CodeObjectRequired::kYes); 1885 v8::internal::CodeObjectRequired::kYes);
1872 const double double_nan = std::numeric_limits<double>::quiet_NaN(); 1886 const double dnan = std::numeric_limits<double>::quiet_NaN();
1873 const float float_nan = std::numeric_limits<float>::quiet_NaN(); 1887 const double dinf = std::numeric_limits<double>::infinity();
1888 const double dminf = -std::numeric_limits<double>::infinity();
1889 const float fnan = std::numeric_limits<float>::quiet_NaN();
1890 const float finf = std::numeric_limits<float>::infinity();
1891 const float fminf = std::numeric_limits<float>::infinity();
1874 1892
1875 typedef struct test_float { 1893 struct TestFloat {
1876 double a; 1894 double a;
1877 double b; 1895 double b;
1878 double resd; 1896 double resd;
1879 double resd1; 1897 double resd1;
1880 float c; 1898 float c;
1881 float d; 1899 float d;
1882 float resf; 1900 float resf;
1883 float resf1; 1901 float resf1;
1884 }TestFloat; 1902 };
1885 1903
1886 TestFloat test; 1904 TestFloat test;
1887 double inputsa[kTableLength] = { 1905 double inputsa[kTableLength] = {
1888 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, 1906 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, -9.8, -10.0, -8.9, -9.8,
1889 -9.8, -10.0, -8.9, -9.8, double_nan, 3.0, double_nan 1907 dnan, 3.0, -0.0, 0.0, dinf, dnan, 42.0, dinf, dminf, dinf, dnan};
1890 };
1891 double inputsb[kTableLength] = { 1908 double inputsb[kTableLength] = {
1892 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, 1909 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, 9.8, -9.8, -11.2, -9.8,
1893 9.8, -9.8, -11.2, -9.8, 3.0, double_nan, double_nan 1910 3.0, dnan, 0.0, -0.0, dnan, dinf, dinf, 42.0, dinf, dminf, dnan};
1894 };
1895 double resd[kTableLength] = { 1911 double resd[kTableLength] = {
1896 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, 1912 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, -9.8, -9.8, -8.9, -9.8,
1897 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, double_nan 1913 3.0, 3.0, -0.0, -0.0, dinf, dinf, 42.0, 42.0, dminf, dminf, dnan};
1898 };
1899 double resd1[kTableLength] = { 1914 double resd1[kTableLength] = {
1900 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 1915 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 9.8, -10.0, -11.2, -9.8,
1901 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, double_nan 1916 3.0, 3.0, 0.0, 0.0, dinf, dinf, dinf, dinf, dinf, dinf, dnan};
1902 };
1903 float inputsc[kTableLength] = { 1917 float inputsc[kTableLength] = {
1904 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, 1918 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, -9.8, -10.0, -8.9, -9.8,
1905 -9.8, -10.0, -8.9, -9.8, float_nan, 3.0, float_nan 1919 fnan, 3.0, -0.0, 0.0, finf, fnan, 42.0, finf, fminf, finf, fnan};
1906 }; 1920 float inputsd[kTableLength] = {4.8, 5.3, 6.1, -10.0, -8.9, -9.8,
1907 float inputsd[kTableLength] = { 1921 9.8, 9.8, 9.8, -9.8, -11.2, -9.8,
1908 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, 1922 3.0, fnan, -0.0, 0.0, fnan, finf,
1909 9.8, -9.8, -11.2, -9.8, 3.0, float_nan, float_nan 1923 finf, 42.0, finf, fminf, fnan};
1910 };
1911 float resf[kTableLength] = { 1924 float resf[kTableLength] = {
1912 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, 1925 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, -9.8, -9.8, -8.9, -9.8,
1913 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, float_nan 1926 3.0, 3.0, -0.0, -0.0, finf, finf, 42.0, 42.0, fminf, fminf, fnan};
1914 };
1915 float resf1[kTableLength] = { 1927 float resf1[kTableLength] = {
1916 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 1928 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 9.8, -10.0, -11.2, -9.8,
1917 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, float_nan 1929 3.0, 3.0, 0.0, 0.0, finf, finf, finf, finf, finf, finf, fnan};
1918 };
1919 1930
1920 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); 1931 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
1921 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) ); 1932 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) );
1922 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); 1933 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) );
1923 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) ); 1934 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) );
1924 __ mina_d(f6, f2, f4); 1935 __ mina_d(f6, f2, f4);
1925 __ mina_s(f12, f8, f10); 1936 __ mina_s(f12, f8, f10);
1926 __ maxa_d(f14, f2, f4); 1937 __ maxa_d(f14, f2, f4);
1927 __ maxa_s(f16, f8, f10); 1938 __ maxa_s(f16, f8, f10);
1928 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) ); 1939 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) );
(...skipping 3517 matching lines...) Expand 10 before | Expand all | Expand 10 after
5446 Handle<Code> code = isolate->factory()->NewCode( 5457 Handle<Code> code = isolate->factory()->NewCode(
5447 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5458 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5448 F2 f = FUNCTION_CAST<F2>(code->entry()); 5459 F2 f = FUNCTION_CAST<F2>(code->entry());
5449 5460
5450 int32_t res = reinterpret_cast<int32_t>( 5461 int32_t res = reinterpret_cast<int32_t>(
5451 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5462 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5452 CHECK_EQ(res, 0); 5463 CHECK_EQ(res, 0);
5453 } 5464 }
5454 5465
5455 #undef __ 5466 #undef __
OLDNEW
« no previous file with comments | « src/mips64/simulator-mips64.cc ('k') | test/cctest/test-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698