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

Unified Diff: test/cctest/test-assembler-mips64.cc

Issue 1276813004: MIPS: Fix mina_maxa for proper NaN handling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« test/cctest/test-assembler-mips.cc ('K') | « test/cctest/test-assembler-mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-assembler-mips64.cc
diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc
index 1fe7cfeb39e6f7b2ee2996923ac9cf172fb8381f..21458849b25810be3d3326b46bc8737517df46e5 100644
--- a/test/cctest/test-assembler-mips64.cc
+++ b/test/cctest/test-assembler-mips64.cc
@@ -1904,11 +1904,13 @@ TEST(rint_s) {
TEST(mina_maxa) {
if (kArchVariant == kMips64r6) {
- const int tableLength = 12;
+ 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
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
MacroAssembler assm(isolate, NULL, 0);
+ const double dblNaN = std::numeric_limits<double>::quiet_NaN();
+ const float fltNaN = std::numeric_limits<float>::quiet_NaN();
typedef struct test_float {
double a;
@@ -1923,52 +1925,36 @@ TEST(mina_maxa) {
TestFloat test;
double inputsa[tableLength] = {
- 5.3, 4.8, 6.1,
- 9.8, 9.8, 9.8,
- -10.0, -8.9, -9.8,
- -10.0, -8.9, -9.8
+ 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9,
+ -9.8, -10.0, -8.9, -9.8, dblNaN, 3.0, dblNaN
};
double inputsb[tableLength] = {
- 4.8, 5.3, 6.1,
- -10.0, -8.9, -9.8,
- 9.8, 9.8, 9.8,
- -9.8, -11.2, -9.8
+ 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8,
+ 9.8, -9.8, -11.2, -9.8, 3.0, dblNaN, dblNaN
};
double resd[tableLength] = {
- 4.8, 4.8, 6.1,
- 9.8, -8.9, 9.8,
- 9.8, -8.9, 9.8,
- -9.8, -8.9, -9.8
+ 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9,
+ -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, dblNaN
};
double resd1[tableLength] = {
- 5.3, 5.3, 6.1,
- -10.0, 9.8, 9.8,
- -10.0, 9.8, 9.8,
- -10.0, -11.2, -9.8
+ 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8,
+ 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, dblNaN
};
float inputsc[tableLength] = {
- 5.3, 4.8, 6.1,
- 9.8, 9.8, 9.8,
- -10.0, -8.9, -9.8,
- -10.0, -8.9, -9.8
+ 5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9,
+ -9.8, -10.0, -8.9, -9.8, fltNaN, 3.0, fltNaN
};
float inputsd[tableLength] = {
- 4.8, 5.3, 6.1,
- -10.0, -8.9, -9.8,
- 9.8, 9.8, 9.8,
- -9.8, -11.2, -9.8
+ 4.8, 5.3, 6.1, -10.0, -8.9, -9.8, 9.8, 9.8,
+ 9.8, -9.8, -11.2, -9.8, 3.0, fltNaN, fltNaN
};
float resf[tableLength] = {
- 4.8, 4.8, 6.1,
- 9.8, -8.9, 9.8,
- 9.8, -8.9, 9.8,
- -9.8, -8.9, -9.8
+ 4.8, 4.8, 6.1, 9.8, -8.9, -9.8, 9.8, -8.9,
+ -9.8, -9.8, -8.9, -9.8, 3.0, 3.0, fltNaN
};
float resf1[tableLength] = {
- 5.3, 5.3, 6.1,
- -10.0, 9.8, 9.8,
- -10.0, 9.8, 9.8,
- -10.0, -11.2, -9.8
+ 5.3, 5.3, 6.1, -10.0, 9.8, 9.8, -10.0, 9.8,
+ 9.8, -10.0, -11.2, -9.8, 3.0, 3.0, fltNaN
};
__ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
@@ -1998,10 +1984,17 @@ TEST(mina_maxa) {
test.d = inputsd[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
- CHECK_EQ(test.resd, resd[i]);
- CHECK_EQ(test.resf, resf[i]);
- CHECK_EQ(test.resd1, resd1[i]);
- CHECK_EQ(test.resf1, resf1[i]);
+ if (i < tableLength - 1) {
+ CHECK_EQ(test.resd, resd[i]);
+ CHECK_EQ(test.resf, resf[i]);
+ CHECK_EQ(test.resd1, resd1[i]);
+ CHECK_EQ(test.resf1, resf1[i]);
+ } else {
+ DCHECK(std::isnan(test.resd));
+ DCHECK(std::isnan(test.resf));
+ DCHECK(std::isnan(test.resd1));
+ DCHECK(std::isnan(test.resf1));
+ }
}
}
}
@@ -3517,6 +3510,8 @@ TEST(class_fmt) {
Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
USE(dummy);
// Expected double results.
+ CHECK_EQ(bit_cast<int64_t>(t.dSignalingNan), 0x001);
+ CHECK_EQ(bit_cast<int64_t>(t.dQuietNan), 0x002);
CHECK_EQ(bit_cast<int64_t>(t.dNegInf), 0x004);
CHECK_EQ(bit_cast<int64_t>(t.dNegNorm), 0x008);
CHECK_EQ(bit_cast<int64_t>(t.dNegSubnorm), 0x010);
@@ -3527,6 +3522,8 @@ TEST(class_fmt) {
CHECK_EQ(bit_cast<int64_t>(t.dPosZero), 0x200);
// Expected float results.
+ CHECK_EQ(bit_cast<int32_t>(t.fSignalingNan), 0x001);
+ CHECK_EQ(bit_cast<int32_t>(t.fQuietNan), 0x002);
CHECK_EQ(bit_cast<int32_t>(t.fNegInf), 0x004);
CHECK_EQ(bit_cast<int32_t>(t.fNegNorm), 0x008);
CHECK_EQ(bit_cast<int32_t>(t.fNegSubnorm), 0x010);
« test/cctest/test-assembler-mips.cc ('K') | « test/cctest/test-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698