Chromium Code Reviews| 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 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1795 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 1795 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
| 1796 CHECK_EQ(test.b, outputs[j][i]); | 1796 CHECK_EQ(test.b, outputs[j][i]); |
| 1797 } | 1797 } |
| 1798 } | 1798 } |
| 1799 } | 1799 } |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 | 1802 |
| 1803 TEST(mina_maxa) { | 1803 TEST(mina_maxa) { |
| 1804 if (IsMipsArchVariant(kMips32r6)) { | 1804 if (IsMipsArchVariant(kMips32r6)) { |
| 1805 const int tableLength = 12; | 1805 const int tableLength = 15; |
|
paul.l...
2015/08/07 04:48:14
nit: name capitalization does not conform to style
Djordje.Pesic
2015/08/07 06:31:42
Done. Also changed tableLength to kTableLength in
| |
| 1806 CcTest::InitializeVM(); | 1806 CcTest::InitializeVM(); |
| 1807 Isolate* isolate = CcTest::i_isolate(); | 1807 Isolate* isolate = CcTest::i_isolate(); |
| 1808 HandleScope scope(isolate); | 1808 HandleScope scope(isolate); |
| 1809 MacroAssembler assm(isolate, NULL, 0); | 1809 MacroAssembler assm(isolate, NULL, 0); |
| 1810 const double dblNaN = std::numeric_limits<double>::quiet_NaN(); | |
| 1811 const float fltNaN = std::numeric_limits<float>::quiet_NaN(); | |
|
paul.l...
2015/08/07 04:48:14
nit: these two names also don't conform. Suggest d
Djordje.Pesic
2015/08/07 06:31:42
Done.
| |
| 1810 | 1812 |
| 1811 typedef struct test_float { | 1813 typedef struct test_float { |
| 1812 double a; | 1814 double a; |
| 1813 double b; | 1815 double b; |
| 1814 double resd; | 1816 double resd; |
| 1815 double resd1; | 1817 double resd1; |
| 1816 float c; | 1818 float c; |
| 1817 float d; | 1819 float d; |
| 1818 float resf; | 1820 float resf; |
| 1819 float resf1; | 1821 float resf1; |
| 1820 }TestFloat; | 1822 }TestFloat; |
| 1821 | 1823 |
| 1822 TestFloat test; | 1824 TestFloat test; |
| 1823 double inputsa[tableLength] = { | 1825 double inputsa[tableLength] = { |
| 1824 5.3, 4.8, 6.1, | 1826 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, |
| 1825 9.8, 9.8, 9.8, | 1827 -9.8, -10.0, -8.9, -9.8, dblNaN, 3.0, dblNaN |
| 1826 -10.0, -8.9, -9.8, | |
| 1827 -10.0, -8.9, -9.8 | |
| 1828 }; | 1828 }; |
| 1829 double inputsb[tableLength] = { | 1829 double inputsb[tableLength] = { |
| 1830 4.8, 5.3, 6.1, | 1830 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, |
| 1831 -10.0, -8.9, -9.8, | 1831 9.8, -9.8, -11.2, -9.8, 3.0, dblNaN, dblNaN |
| 1832 9.8, 9.8, 9.8, | |
| 1833 -9.8, -11.2, -9.8 | |
| 1834 }; | 1832 }; |
| 1835 double resd[tableLength] = { | 1833 double resd[tableLength] = { |
| 1836 4.8, 4.8, 6.1, | 1834 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, |
| 1837 9.8, -8.9, 9.8, | 1835 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, dblNaN |
| 1838 9.8, -8.9, 9.8, | |
| 1839 -9.8, -8.9, -9.8 | |
| 1840 }; | 1836 }; |
| 1841 double resd1[tableLength] = { | 1837 double resd1[tableLength] = { |
| 1842 5.3, 5.3, 6.1, | 1838 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, |
| 1843 -10.0, 9.8, 9.8, | 1839 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, dblNaN |
| 1844 -10.0, 9.8, 9.8, | |
| 1845 -10.0, -11.2, -9.8 | |
| 1846 }; | 1840 }; |
| 1847 float inputsc[tableLength] = { | 1841 float inputsc[tableLength] = { |
| 1848 5.3, 4.8, 6.1, | 1842 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, |
| 1849 9.8, 9.8, 9.8, | 1843 -9.8, -10.0, -8.9, -9.8, fltNaN, 3.0, fltNaN |
| 1850 -10.0, -8.9, -9.8, | |
| 1851 -10.0, -8.9, -9.8 | |
| 1852 }; | 1844 }; |
| 1853 float inputsd[tableLength] = { | 1845 float inputsd[tableLength] = { |
| 1854 4.8, 5.3, 6.1, | 1846 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, |
| 1855 -10.0, -8.9, -9.8, | 1847 9.8, -9.8, -11.2, -9.8, 3.0, fltNaN, fltNaN |
| 1856 9.8, 9.8, 9.8, | |
| 1857 -9.8, -11.2, -9.8 | |
| 1858 }; | 1848 }; |
| 1859 float resf[tableLength] = { | 1849 float resf[tableLength] = { |
| 1860 4.8, 4.8, 6.1, | 1850 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, |
| 1861 9.8, -8.9, 9.8, | 1851 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, fltNaN |
| 1862 9.8, -8.9, 9.8, | |
| 1863 -9.8, -8.9, -9.8 | |
| 1864 }; | 1852 }; |
| 1865 float resf1[tableLength] = { | 1853 float resf1[tableLength] = { |
| 1866 5.3, 5.3, 6.1, | 1854 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, |
| 1867 -10.0, 9.8, 9.8, | 1855 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, fltNaN |
| 1868 -10.0, 9.8, 9.8, | |
| 1869 -10.0, -11.2, -9.8 | |
| 1870 }; | 1856 }; |
| 1871 | 1857 |
| 1872 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); | 1858 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); |
| 1873 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) ); | 1859 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) ); |
| 1874 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); | 1860 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); |
| 1875 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) ); | 1861 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) ); |
| 1876 __ mina_d(f6, f2, f4); | 1862 __ mina_d(f6, f2, f4); |
| 1877 __ mina_s(f12, f8, f10); | 1863 __ mina_s(f12, f8, f10); |
| 1878 __ maxa_d(f14, f2, f4); | 1864 __ maxa_d(f14, f2, f4); |
| 1879 __ maxa_s(f16, f8, f10); | 1865 __ maxa_s(f16, f8, f10); |
| 1880 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) ); | 1866 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) ); |
| 1881 __ sdc1(f6, MemOperand(a0, offsetof(TestFloat, resd)) ); | 1867 __ sdc1(f6, MemOperand(a0, offsetof(TestFloat, resd)) ); |
| 1882 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, resf1)) ); | 1868 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, resf1)) ); |
| 1883 __ sdc1(f14, MemOperand(a0, offsetof(TestFloat, resd1)) ); | 1869 __ sdc1(f14, MemOperand(a0, offsetof(TestFloat, resd1)) ); |
| 1884 __ jr(ra); | 1870 __ jr(ra); |
| 1885 __ nop(); | 1871 __ nop(); |
| 1886 | 1872 |
| 1887 CodeDesc desc; | 1873 CodeDesc desc; |
| 1888 assm.GetCode(&desc); | 1874 assm.GetCode(&desc); |
| 1889 Handle<Code> code = isolate->factory()->NewCode( | 1875 Handle<Code> code = isolate->factory()->NewCode( |
| 1890 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1876 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1891 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1877 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1892 for (int i = 0; i < tableLength; i++) { | 1878 for (int i = 0; i < tableLength; i++) { |
| 1893 test.a = inputsa[i]; | 1879 test.a = inputsa[i]; |
| 1894 test.b = inputsb[i]; | 1880 test.b = inputsb[i]; |
| 1895 test.c = inputsc[i]; | 1881 test.c = inputsc[i]; |
| 1896 test.d = inputsd[i]; | 1882 test.d = inputsd[i]; |
| 1897 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 1883 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
| 1898 CHECK_EQ(test.resd, resd[i]); | 1884 if (i < tableLength - 1) { |
| 1899 CHECK_EQ(test.resf, resf[i]); | 1885 CHECK_EQ(test.resd, resd[i]); |
| 1900 CHECK_EQ(test.resd1, resd1[i]); | 1886 CHECK_EQ(test.resf, resf[i]); |
| 1901 CHECK_EQ(test.resf1, resf1[i]); | 1887 CHECK_EQ(test.resd1, resd1[i]); |
| 1888 CHECK_EQ(test.resf1, resf1[i]); | |
| 1889 } else { | |
| 1890 DCHECK(std::isnan(test.resd)); | |
| 1891 DCHECK(std::isnan(test.resf)); | |
| 1892 DCHECK(std::isnan(test.resd1)); | |
| 1893 DCHECK(std::isnan(test.resf1)); | |
| 1894 } | |
| 1902 } | 1895 } |
| 1903 } | 1896 } |
| 1904 } | 1897 } |
| 1905 | 1898 |
| 1906 | 1899 |
| 1907 // ----------------------mips32r2 specific tests---------------------- | 1900 // ----------------------mips32r2 specific tests---------------------- |
| 1908 TEST(trunc_l) { | 1901 TEST(trunc_l) { |
| 1909 if (IsMipsArchVariant(kMips32r2) && IsFp64Mode()) { | 1902 if (IsMipsArchVariant(kMips32r2) && IsFp64Mode()) { |
| 1910 CcTest::InitializeVM(); | 1903 CcTest::InitializeVM(); |
| 1911 Isolate* isolate = CcTest::i_isolate(); | 1904 Isolate* isolate = CcTest::i_isolate(); |
| (...skipping 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5105 }; | 5098 }; |
| 5106 | 5099 |
| 5107 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); | 5100 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); |
| 5108 for (size_t i = 0; i < nr_test_cases; ++i) { | 5101 for (size_t i = 0; i < nr_test_cases; ++i) { |
| 5109 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); | 5102 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); |
| 5110 } | 5103 } |
| 5111 } | 5104 } |
| 5112 | 5105 |
| 5113 | 5106 |
| 5114 #undef __ | 5107 #undef __ |
| OLD | NEW |