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 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1897 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 1897 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
1898 CHECK_EQ(test.b, outputs[j][i]); | 1898 CHECK_EQ(test.b, outputs[j][i]); |
1899 } | 1899 } |
1900 } | 1900 } |
1901 } | 1901 } |
1902 } | 1902 } |
1903 | 1903 |
1904 | 1904 |
1905 TEST(mina_maxa) { | 1905 TEST(mina_maxa) { |
1906 if (kArchVariant == kMips64r6) { | 1906 if (kArchVariant == kMips64r6) { |
1907 const int tableLength = 12; | 1907 const int tableLength = 15; |
paul.l...
2015/08/07 04:48:14
Same comment as in 32-bit versionL kTableLength, d
Djordje.Pesic
2015/08/07 06:31:42
Done. Also changed tableLength to kTableLength in
| |
1908 CcTest::InitializeVM(); | 1908 CcTest::InitializeVM(); |
1909 Isolate* isolate = CcTest::i_isolate(); | 1909 Isolate* isolate = CcTest::i_isolate(); |
1910 HandleScope scope(isolate); | 1910 HandleScope scope(isolate); |
1911 MacroAssembler assm(isolate, NULL, 0); | 1911 MacroAssembler assm(isolate, NULL, 0); |
1912 const double dblNaN = std::numeric_limits<double>::quiet_NaN(); | |
1913 const float fltNaN = std::numeric_limits<float>::quiet_NaN(); | |
1912 | 1914 |
1913 typedef struct test_float { | 1915 typedef struct test_float { |
1914 double a; | 1916 double a; |
1915 double b; | 1917 double b; |
1916 double resd; | 1918 double resd; |
1917 double resd1; | 1919 double resd1; |
1918 float c; | 1920 float c; |
1919 float d; | 1921 float d; |
1920 float resf; | 1922 float resf; |
1921 float resf1; | 1923 float resf1; |
1922 }TestFloat; | 1924 }TestFloat; |
1923 | 1925 |
1924 TestFloat test; | 1926 TestFloat test; |
1925 double inputsa[tableLength] = { | 1927 double inputsa[tableLength] = { |
1926 5.3, 4.8, 6.1, | 1928 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, |
1927 9.8, 9.8, 9.8, | 1929 -9.8, -10.0, -8.9, -9.8, dblNaN, 3.0, dblNaN |
1928 -10.0, -8.9, -9.8, | |
1929 -10.0, -8.9, -9.8 | |
1930 }; | 1930 }; |
1931 double inputsb[tableLength] = { | 1931 double inputsb[tableLength] = { |
1932 4.8, 5.3, 6.1, | 1932 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, |
1933 -10.0, -8.9, -9.8, | 1933 9.8, -9.8, -11.2, -9.8, 3.0, dblNaN, dblNaN |
1934 9.8, 9.8, 9.8, | |
1935 -9.8, -11.2, -9.8 | |
1936 }; | 1934 }; |
1937 double resd[tableLength] = { | 1935 double resd[tableLength] = { |
1938 4.8, 4.8, 6.1, | 1936 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, |
1939 9.8, -8.9, 9.8, | 1937 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, dblNaN |
1940 9.8, -8.9, 9.8, | |
1941 -9.8, -8.9, -9.8 | |
1942 }; | 1938 }; |
1943 double resd1[tableLength] = { | 1939 double resd1[tableLength] = { |
1944 5.3, 5.3, 6.1, | 1940 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, |
1945 -10.0, 9.8, 9.8, | 1941 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, dblNaN |
1946 -10.0, 9.8, 9.8, | |
1947 -10.0, -11.2, -9.8 | |
1948 }; | 1942 }; |
1949 float inputsc[tableLength] = { | 1943 float inputsc[tableLength] = { |
1950 5.3, 4.8, 6.1, | 1944 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, |
1951 9.8, 9.8, 9.8, | 1945 -9.8, -10.0, -8.9, -9.8, fltNaN, 3.0, fltNaN |
1952 -10.0, -8.9, -9.8, | |
1953 -10.0, -8.9, -9.8 | |
1954 }; | 1946 }; |
1955 float inputsd[tableLength] = { | 1947 float inputsd[tableLength] = { |
1956 4.8, 5.3, 6.1, | 1948 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, |
1957 -10.0, -8.9, -9.8, | 1949 9.8, -9.8, -11.2, -9.8, 3.0, fltNaN, fltNaN |
1958 9.8, 9.8, 9.8, | |
1959 -9.8, -11.2, -9.8 | |
1960 }; | 1950 }; |
1961 float resf[tableLength] = { | 1951 float resf[tableLength] = { |
1962 4.8, 4.8, 6.1, | 1952 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, |
1963 9.8, -8.9, 9.8, | 1953 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, fltNaN |
1964 9.8, -8.9, 9.8, | |
1965 -9.8, -8.9, -9.8 | |
1966 }; | 1954 }; |
1967 float resf1[tableLength] = { | 1955 float resf1[tableLength] = { |
1968 5.3, 5.3, 6.1, | 1956 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, |
1969 -10.0, 9.8, 9.8, | 1957 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, fltNaN |
1970 -10.0, 9.8, 9.8, | |
1971 -10.0, -11.2, -9.8 | |
1972 }; | 1958 }; |
1973 | 1959 |
1974 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); | 1960 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); |
1975 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) ); | 1961 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) ); |
1976 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); | 1962 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); |
1977 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) ); | 1963 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) ); |
1978 __ mina_d(f6, f2, f4); | 1964 __ mina_d(f6, f2, f4); |
1979 __ mina_s(f12, f8, f10); | 1965 __ mina_s(f12, f8, f10); |
1980 __ maxa_d(f14, f2, f4); | 1966 __ maxa_d(f14, f2, f4); |
1981 __ maxa_s(f16, f8, f10); | 1967 __ maxa_s(f16, f8, f10); |
1982 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) ); | 1968 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) ); |
1983 __ sdc1(f6, MemOperand(a0, offsetof(TestFloat, resd)) ); | 1969 __ sdc1(f6, MemOperand(a0, offsetof(TestFloat, resd)) ); |
1984 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, resf1)) ); | 1970 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, resf1)) ); |
1985 __ sdc1(f14, MemOperand(a0, offsetof(TestFloat, resd1)) ); | 1971 __ sdc1(f14, MemOperand(a0, offsetof(TestFloat, resd1)) ); |
1986 __ jr(ra); | 1972 __ jr(ra); |
1987 __ nop(); | 1973 __ nop(); |
1988 | 1974 |
1989 CodeDesc desc; | 1975 CodeDesc desc; |
1990 assm.GetCode(&desc); | 1976 assm.GetCode(&desc); |
1991 Handle<Code> code = isolate->factory()->NewCode( | 1977 Handle<Code> code = isolate->factory()->NewCode( |
1992 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1978 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1993 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1979 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1994 for (int i = 0; i < tableLength; i++) { | 1980 for (int i = 0; i < tableLength; i++) { |
1995 test.a = inputsa[i]; | 1981 test.a = inputsa[i]; |
1996 test.b = inputsb[i]; | 1982 test.b = inputsb[i]; |
1997 test.c = inputsc[i]; | 1983 test.c = inputsc[i]; |
1998 test.d = inputsd[i]; | 1984 test.d = inputsd[i]; |
1999 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 1985 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
2000 | 1986 |
2001 CHECK_EQ(test.resd, resd[i]); | 1987 if (i < tableLength - 1) { |
2002 CHECK_EQ(test.resf, resf[i]); | 1988 CHECK_EQ(test.resd, resd[i]); |
2003 CHECK_EQ(test.resd1, resd1[i]); | 1989 CHECK_EQ(test.resf, resf[i]); |
2004 CHECK_EQ(test.resf1, resf1[i]); | 1990 CHECK_EQ(test.resd1, resd1[i]); |
1991 CHECK_EQ(test.resf1, resf1[i]); | |
1992 } else { | |
1993 DCHECK(std::isnan(test.resd)); | |
1994 DCHECK(std::isnan(test.resf)); | |
1995 DCHECK(std::isnan(test.resd1)); | |
1996 DCHECK(std::isnan(test.resf1)); | |
1997 } | |
2005 } | 1998 } |
2006 } | 1999 } |
2007 } | 2000 } |
2008 | 2001 |
2009 | 2002 |
2010 | 2003 |
2011 // ----------------------mips32r2 specific tests---------------------- | 2004 // ----------------------mips32r2 specific tests---------------------- |
2012 TEST(trunc_l) { | 2005 TEST(trunc_l) { |
2013 if (kArchVariant == kMips64r2) { | 2006 if (kArchVariant == kMips64r2) { |
2014 CcTest::InitializeVM(); | 2007 CcTest::InitializeVM(); |
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3510 t.fNegSubnorm = -FLT_MIN / 1.5; | 3503 t.fNegSubnorm = -FLT_MIN / 1.5; |
3511 t.fNegZero = -0.0; | 3504 t.fNegZero = -0.0; |
3512 t.fPosInf = 100000.0 / 0.0; | 3505 t.fPosInf = 100000.0 / 0.0; |
3513 t.fPosNorm = FLT_MAX; | 3506 t.fPosNorm = FLT_MAX; |
3514 t.fPosSubnorm = FLT_MIN / 20.0; | 3507 t.fPosSubnorm = FLT_MIN / 20.0; |
3515 t.fPosZero = +0.0; | 3508 t.fPosZero = +0.0; |
3516 | 3509 |
3517 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 3510 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
3518 USE(dummy); | 3511 USE(dummy); |
3519 // Expected double results. | 3512 // Expected double results. |
3513 CHECK_EQ(bit_cast<int64_t>(t.dSignalingNan), 0x001); | |
3514 CHECK_EQ(bit_cast<int64_t>(t.dQuietNan), 0x002); | |
3520 CHECK_EQ(bit_cast<int64_t>(t.dNegInf), 0x004); | 3515 CHECK_EQ(bit_cast<int64_t>(t.dNegInf), 0x004); |
3521 CHECK_EQ(bit_cast<int64_t>(t.dNegNorm), 0x008); | 3516 CHECK_EQ(bit_cast<int64_t>(t.dNegNorm), 0x008); |
3522 CHECK_EQ(bit_cast<int64_t>(t.dNegSubnorm), 0x010); | 3517 CHECK_EQ(bit_cast<int64_t>(t.dNegSubnorm), 0x010); |
3523 CHECK_EQ(bit_cast<int64_t>(t.dNegZero), 0x020); | 3518 CHECK_EQ(bit_cast<int64_t>(t.dNegZero), 0x020); |
3524 CHECK_EQ(bit_cast<int64_t>(t.dPosInf), 0x040); | 3519 CHECK_EQ(bit_cast<int64_t>(t.dPosInf), 0x040); |
3525 CHECK_EQ(bit_cast<int64_t>(t.dPosNorm), 0x080); | 3520 CHECK_EQ(bit_cast<int64_t>(t.dPosNorm), 0x080); |
3526 CHECK_EQ(bit_cast<int64_t>(t.dPosSubnorm), 0x100); | 3521 CHECK_EQ(bit_cast<int64_t>(t.dPosSubnorm), 0x100); |
3527 CHECK_EQ(bit_cast<int64_t>(t.dPosZero), 0x200); | 3522 CHECK_EQ(bit_cast<int64_t>(t.dPosZero), 0x200); |
3528 | 3523 |
3529 // Expected float results. | 3524 // Expected float results. |
3525 CHECK_EQ(bit_cast<int32_t>(t.fSignalingNan), 0x001); | |
3526 CHECK_EQ(bit_cast<int32_t>(t.fQuietNan), 0x002); | |
3530 CHECK_EQ(bit_cast<int32_t>(t.fNegInf), 0x004); | 3527 CHECK_EQ(bit_cast<int32_t>(t.fNegInf), 0x004); |
3531 CHECK_EQ(bit_cast<int32_t>(t.fNegNorm), 0x008); | 3528 CHECK_EQ(bit_cast<int32_t>(t.fNegNorm), 0x008); |
3532 CHECK_EQ(bit_cast<int32_t>(t.fNegSubnorm), 0x010); | 3529 CHECK_EQ(bit_cast<int32_t>(t.fNegSubnorm), 0x010); |
3533 CHECK_EQ(bit_cast<int32_t>(t.fNegZero), 0x020); | 3530 CHECK_EQ(bit_cast<int32_t>(t.fNegZero), 0x020); |
3534 CHECK_EQ(bit_cast<int32_t>(t.fPosInf), 0x040); | 3531 CHECK_EQ(bit_cast<int32_t>(t.fPosInf), 0x040); |
3535 CHECK_EQ(bit_cast<int32_t>(t.fPosNorm), 0x080); | 3532 CHECK_EQ(bit_cast<int32_t>(t.fPosNorm), 0x080); |
3536 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); | 3533 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); |
3537 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); | 3534 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); |
3538 } | 3535 } |
3539 } | 3536 } |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5460 }; | 5457 }; |
5461 | 5458 |
5462 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); | 5459 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); |
5463 for (size_t i = 0; i < nr_test_cases; ++i) { | 5460 for (size_t i = 0; i < nr_test_cases; ++i) { |
5464 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); | 5461 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); |
5465 } | 5462 } |
5466 } | 5463 } |
5467 | 5464 |
5468 | 5465 |
5469 #undef __ | 5466 #undef __ |
OLD | NEW |