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

Side by Side Diff: test/cctest/test-assembler-mips64.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 | « test/cctest/test-assembler-mips.cc ('k') | no next file » | 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 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 } 1579 }
1580 } 1580 }
1581 1581
1582 1582
1583 1583
1584 TEST(min_max) { 1584 TEST(min_max) {
1585 if (kArchVariant == kMips64r6) { 1585 if (kArchVariant == kMips64r6) {
1586 CcTest::InitializeVM(); 1586 CcTest::InitializeVM();
1587 Isolate* isolate = CcTest::i_isolate(); 1587 Isolate* isolate = CcTest::i_isolate();
1588 HandleScope scope(isolate); 1588 HandleScope scope(isolate);
1589 MacroAssembler assm(isolate, NULL, 0, 1589 MacroAssembler assm(isolate, nullptr, 0,
1590 v8::internal::CodeObjectRequired::kYes); 1590 v8::internal::CodeObjectRequired::kYes);
1591 1591
1592 typedef struct test_float { 1592 struct TestFloat {
1593 double a; 1593 double a;
1594 double b; 1594 double b;
1595 double c; 1595 double c;
1596 double d; 1596 double d;
1597 float e; 1597 float e;
1598 float f; 1598 float f;
1599 float g; 1599 float g;
1600 float h; 1600 float h;
1601 } TestFloat; 1601 };
1602 1602
1603 TestFloat test; 1603 TestFloat test;
1604 const double double_nan = std::numeric_limits<double>::quiet_NaN(); 1604 const double dnan = std::numeric_limits<double>::quiet_NaN();
1605 const float float_nan = std::numeric_limits<float>::quiet_NaN(); 1605 const double dinf = std::numeric_limits<double>::infinity();
1606 const int kTableLength = 5; 1606 const double dminf = -std::numeric_limits<double>::infinity();
1607 double inputsa[kTableLength] = {2.0, 3.0, double_nan, 3.0, double_nan}; 1607 const float fnan = std::numeric_limits<float>::quiet_NaN();
1608 double inputsb[kTableLength] = {3.0, 2.0, 3.0, double_nan, double_nan}; 1608 const float finf = std::numeric_limits<float>::infinity();
1609 double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, double_nan}; 1609 const float fminf = std::numeric_limits<float>::infinity();
1610 double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, double_nan}; 1610 const int kTableLength = 13;
1611 double inputsa[kTableLength] = {2.0, 3.0, dnan, 3.0, -0.0, 0.0, dinf,
1612 dnan, 42.0, dinf, dminf, dinf, dnan};
1613 double inputsb[kTableLength] = {3.0, 2.0, 3.0, dnan, 0.0, -0.0, dnan,
1614 dinf, dinf, 42.0, dinf, dminf, dnan};
1615 double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0,
1616 -0.0, dinf, dinf, 42.0, 42.0,
1617 dminf, dminf, dnan};
1618 double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, dinf,
1619 dinf, dinf, dinf, dinf, dinf, dnan};
1611 1620
1612 float inputse[kTableLength] = {2.0, 3.0, float_nan, 3.0, float_nan}; 1621 float inputse[kTableLength] = {2.0, 3.0, fnan, 3.0, -0.0, 0.0, finf,
1613 float inputsf[kTableLength] = {3.0, 2.0, 3.0, float_nan, float_nan}; 1622 fnan, 42.0, finf, fminf, finf, fnan};
1614 float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, float_nan}; 1623 float inputsf[kTableLength] = {3.0, 2.0, 3.0, fnan, -0.0, 0.0, fnan,
1615 float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, float_nan}; 1624 finf, finf, 42.0, finf, fminf, fnan};
1625 float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, -0.0,
1626 -0.0, finf, finf, 42.0, 42.0,
1627 fminf, fminf, fnan};
1628 float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, 0.0, 0.0, finf,
1629 finf, finf, finf, finf, finf, fnan};
1616 1630
1617 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); 1631 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a)));
1618 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); 1632 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b)));
1619 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); 1633 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e)));
1620 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f))); 1634 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f)));
1621 __ min_d(f10, f4, f8); 1635 __ min_d(f10, f4, f8);
1622 __ max_d(f12, f4, f8); 1636 __ max_d(f12, f4, f8);
1623 __ min_s(f14, f2, f6); 1637 __ min_s(f14, f2, f6);
1624 __ max_s(f16, f2, f6); 1638 __ max_s(f16, f2, f6);
1625 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, c))); 1639 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, c)));
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); 1953 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
1940 CHECK_EQ(test.b, outputs[j][i]); 1954 CHECK_EQ(test.b, outputs[j][i]);
1941 } 1955 }
1942 } 1956 }
1943 } 1957 }
1944 } 1958 }
1945 1959
1946 1960
1947 TEST(mina_maxa) { 1961 TEST(mina_maxa) {
1948 if (kArchVariant == kMips64r6) { 1962 if (kArchVariant == kMips64r6) {
1949 const int kTableLength = 15; 1963 const int kTableLength = 23;
1950 CcTest::InitializeVM(); 1964 CcTest::InitializeVM();
1951 Isolate* isolate = CcTest::i_isolate(); 1965 Isolate* isolate = CcTest::i_isolate();
1952 HandleScope scope(isolate); 1966 HandleScope scope(isolate);
1953 MacroAssembler assm(isolate, NULL, 0, 1967 MacroAssembler assm(isolate, nullptr, 0,
1954 v8::internal::CodeObjectRequired::kYes); 1968 v8::internal::CodeObjectRequired::kYes);
1955 const double double_nan = std::numeric_limits<double>::quiet_NaN(); 1969 const double dnan = std::numeric_limits<double>::quiet_NaN();
1956 const float float_nan = std::numeric_limits<float>::quiet_NaN(); 1970 const double dinf = std::numeric_limits<double>::infinity();
1971 const double dminf = -std::numeric_limits<double>::infinity();
1972 const float fnan = std::numeric_limits<float>::quiet_NaN();
1973 const float finf = std::numeric_limits<float>::infinity();
1974 const float fminf = std::numeric_limits<float>::infinity();
1957 1975
1958 typedef struct test_float { 1976 struct TestFloat {
1959 double a; 1977 double a;
1960 double b; 1978 double b;
1961 double resd; 1979 double resd;
1962 double resd1; 1980 double resd1;
1963 float c; 1981 float c;
1964 float d; 1982 float d;
1965 float resf; 1983 float resf;
1966 float resf1; 1984 float resf1;
1967 }TestFloat; 1985 };
1968 1986
1969 TestFloat test; 1987 TestFloat test;
1970 double inputsa[kTableLength] = { 1988 double inputsa[kTableLength] = {
1971 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, 1989 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, -9.8, -10.0, -8.9, -9.8,
1972 -9.8, -10.0, -8.9, -9.8, double_nan, 3.0, double_nan 1990 dnan, 3.0, -0.0, 0.0, dinf, dnan, 42.0, dinf, dminf, dinf, dnan};
1973 };
1974 double inputsb[kTableLength] = { 1991 double inputsb[kTableLength] = {
1975 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, 1992 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, 9.8, -9.8, -11.2, -9.8,
1976 9.8, -9.8, -11.2, -9.8, 3.0, double_nan, double_nan 1993 3.0, dnan, 0.0, -0.0, dnan, dinf, dinf, 42.0, dinf, dminf, dnan};
1977 };
1978 double resd[kTableLength] = { 1994 double resd[kTableLength] = {
1979 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, 1995 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, -9.8, -9.8, -8.9, -9.8,
1980 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, double_nan 1996 3.0, 3.0, -0.0, -0.0, dinf, dinf, 42.0, 42.0, dminf, dminf, dnan};
1981 };
1982 double resd1[kTableLength] = { 1997 double resd1[kTableLength] = {
1983 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 1998 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 9.8, -10.0, -11.2, -9.8,
1984 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, double_nan 1999 3.0, 3.0, 0.0, 0.0, dinf, dinf, dinf, dinf, dinf, dinf, dnan};
1985 };
1986 float inputsc[kTableLength] = { 2000 float inputsc[kTableLength] = {
1987 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, 2001 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9, -9.8, -10.0, -8.9, -9.8,
1988 -9.8, -10.0, -8.9, -9.8, float_nan, 3.0, float_nan 2002 fnan, 3.0, -0.0, 0.0, finf, fnan, 42.0, finf, fminf, finf, fnan};
1989 }; 2003 float inputsd[kTableLength] = {4.8, 5.3, 6.1, -10.0, -8.9, -9.8,
1990 float inputsd[kTableLength] = { 2004 9.8, 9.8, 9.8, -9.8, -11.2, -9.8,
1991 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8, 2005 3.0, fnan, -0.0, 0.0, fnan, finf,
1992 9.8, -9.8, -11.2, -9.8, 3.0, float_nan, float_nan 2006 finf, 42.0, finf, fminf, fnan};
1993 };
1994 float resf[kTableLength] = { 2007 float resf[kTableLength] = {
1995 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, 2008 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9, -9.8, -9.8, -8.9, -9.8,
1996 -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, float_nan 2009 3.0, 3.0, -0.0, -0.0, finf, finf, 42.0, 42.0, fminf, fminf, fnan};
1997 };
1998 float resf1[kTableLength] = { 2010 float resf1[kTableLength] = {
1999 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 2011 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8, 9.8, -10.0, -11.2, -9.8,
2000 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, float_nan 2012 3.0, 3.0, 0.0, 0.0, finf, finf, finf, finf, finf, finf, fnan};
2001 };
2002 2013
2003 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); 2014 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
2004 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) ); 2015 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, b)) );
2005 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) ); 2016 __ lwc1(f8, MemOperand(a0, offsetof(TestFloat, c)) );
2006 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) ); 2017 __ lwc1(f10, MemOperand(a0, offsetof(TestFloat, d)) );
2007 __ mina_d(f6, f2, f4); 2018 __ mina_d(f6, f2, f4);
2008 __ mina_s(f12, f8, f10); 2019 __ mina_s(f12, f8, f10);
2009 __ maxa_d(f14, f2, f4); 2020 __ maxa_d(f14, f2, f4);
2010 __ maxa_s(f16, f8, f10); 2021 __ maxa_s(f16, f8, f10);
2011 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) ); 2022 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, resf)) );
(...skipping 3801 matching lines...) Expand 10 before | Expand all | Expand 10 after
5813 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5824 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5814 F2 f = FUNCTION_CAST<F2>(code->entry()); 5825 F2 f = FUNCTION_CAST<F2>(code->entry());
5815 5826
5816 int64_t res = reinterpret_cast<int64_t>( 5827 int64_t res = reinterpret_cast<int64_t>(
5817 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5828 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5818 CHECK_EQ(res, 0); 5829 CHECK_EQ(res, 0);
5819 } 5830 }
5820 5831
5821 5832
5822 #undef __ 5833 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698