Index: test/cctest/test-assembler-mips64.cc |
diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc |
index 98e31535072bba56643133be33be5b52d7959997..67143e61d40529135e0fe3007522a94a8c756112 100644 |
--- a/test/cctest/test-assembler-mips64.cc |
+++ b/test/cctest/test-assembler-mips64.cc |
@@ -1234,6 +1234,7 @@ TEST(MIPS14) { |
HandleScope scope(isolate); |
#define ROUND_STRUCT_ELEMENT(x) \ |
+ uint32_t x##_isNaN2008; \ |
int32_t x##_up_out; \ |
int32_t x##_down_out; \ |
int32_t neg_##x##_up_out; \ |
@@ -1271,6 +1272,8 @@ TEST(MIPS14) { |
// Disable FPU exceptions. |
__ ctc1(zero_reg, FCSR); |
#define RUN_ROUND_TEST(x) \ |
+ __ cfc1(t0, FCSR);\ |
+ __ sw(t0, MemOperand(a0, offsetof(T, x##_isNaN2008))); \ |
__ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \ |
__ x##_w_d(f0, f0); \ |
__ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \ |
@@ -1343,12 +1346,17 @@ TEST(MIPS14) { |
USE(dummy); |
#define GET_FPU_ERR(x) (static_cast<int>(x & kFCSRFlagMask)) |
+#define CHECK_NAN2008(x) (x & kFCSRNaN2008FlagMask) |
#define CHECK_ROUND_RESULT(type) \ |
CHECK(GET_FPU_ERR(t.type##_err1_out) & kFCSRInexactFlagMask); \ |
CHECK_EQ(0, GET_FPU_ERR(t.type##_err2_out)); \ |
CHECK(GET_FPU_ERR(t.type##_err3_out) & kFCSRInvalidOpFlagMask); \ |
CHECK(GET_FPU_ERR(t.type##_err4_out) & kFCSRInvalidOpFlagMask); \ |
- CHECK_EQ(static_cast<int32_t>(kFPUInvalidResult), t.type##_invalid_result); |
+ if (CHECK_NAN2008(t.type##_isNaN2008) && kArchVariant == kMips64r6) { \ |
+ CHECK_EQ(static_cast<int32_t>(0), t.type##_invalid_result);\ |
+ } else { \ |
+ CHECK_EQ(static_cast<int32_t>(kFPUInvalidResult), t.type##_invalid_result);\ |
+ } |
CHECK_ROUND_RESULT(round); |
CHECK_ROUND_RESULT(floor); |
@@ -2051,6 +2059,7 @@ TEST(trunc_l) { |
v8::internal::CodeObjectRequired::kYes); |
const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int64_t c; // a trunc result |
@@ -2076,7 +2085,14 @@ TEST(trunc_l) { |
-2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
2147483648.0, dFPU64InvalidResult, |
dFPU64InvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, |
+ -2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
+ 2147483648.0, dFPU64InvalidResult, |
+ dFPU64InvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ trunc_l_d(f8, f4); |
@@ -2095,7 +2111,12 @@ TEST(trunc_l) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && |
+ kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -2372,6 +2393,7 @@ TEST(trunc_w) { |
MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int32_t c; // a trunc result |
@@ -2397,7 +2419,15 @@ TEST(trunc_w) { |
-2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
kFPUInvalidResult, kFPUInvalidResult, |
kFPUInvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, |
+ -2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
+ kFPUInvalidResult, |
+ 0, |
+ kFPUInvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ trunc_w_d(f8, f4); |
@@ -2416,7 +2446,11 @@ TEST(trunc_w) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -2429,6 +2463,7 @@ TEST(round_w) { |
MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int32_t c; // a trunc result |
@@ -2454,7 +2489,14 @@ TEST(round_w) { |
-2.0, -3.0, -2.0, -3.0, -4.0, -4.0, |
kFPUInvalidResult, kFPUInvalidResult, |
kFPUInvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 2.0, 3.0, 2.0, 3.0, 4.0, 4.0, |
+ -2.0, -3.0, -2.0, -3.0, -4.0, -4.0, |
+ kFPUInvalidResult, 0, |
+ kFPUInvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ round_w_d(f8, f4); |
@@ -2473,7 +2515,11 @@ TEST(round_w) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -2487,6 +2533,7 @@ TEST(round_l) { |
v8::internal::CodeObjectRequired::kYes); |
const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int64_t c; |
@@ -2512,7 +2559,15 @@ TEST(round_l) { |
-2.0, -3.0, -2.0, -3.0, -4.0, -4.0, |
2147483648.0, dFPU64InvalidResult, |
dFPU64InvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 2.0, 3.0, 2.0, 3.0, 4.0, 4.0, |
+ -2.0, -3.0, -2.0, -3.0, -4.0, -4.0, |
+ 2147483648.0, |
+ 0, |
+ dFPU64InvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ round_l_d(f8, f4); |
@@ -2530,9 +2585,13 @@ TEST(round_l) { |
for (int i = 0; i < kTableLength; i++) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
- std::cout<< i<< "\n"; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && |
+ kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -2877,6 +2936,7 @@ TEST(floor_w) { |
MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int32_t c; // a floor result |
@@ -2902,7 +2962,15 @@ TEST(floor_w) { |
-3.0, -3.0, -3.0, -4.0, -4.0, -4.0, |
kFPUInvalidResult, kFPUInvalidResult, |
kFPUInvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, |
+ -3.0, -3.0, -3.0, -4.0, -4.0, -4.0, |
+ kFPUInvalidResult, |
+ 0, |
+ kFPUInvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ floor_w_d(f8, f4); |
@@ -2921,7 +2989,11 @@ TEST(floor_w) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -2935,6 +3007,7 @@ TEST(floor_l) { |
v8::internal::CodeObjectRequired::kYes); |
const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int64_t c; |
@@ -2960,7 +3033,15 @@ TEST(floor_l) { |
-3.0, -3.0, -3.0, -4.0, -4.0, -4.0, |
2147483648.0, dFPU64InvalidResult, |
dFPU64InvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, |
+ -3.0, -3.0, -3.0, -4.0, -4.0, -4.0, |
+ 2147483648.0, |
+ 0, |
+ dFPU64InvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ floor_l_d(f8, f4); |
@@ -2979,7 +3060,12 @@ TEST(floor_l) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && |
+ kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -2992,6 +3078,7 @@ TEST(ceil_w) { |
MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int32_t c; // a floor result |
@@ -3017,7 +3104,15 @@ TEST(ceil_w) { |
-2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
kFPUInvalidResult, kFPUInvalidResult, |
kFPUInvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, |
+ -2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
+ kFPUInvalidResult, |
+ 0, |
+ kFPUInvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ ceil_w_d(f8, f4); |
@@ -3036,7 +3131,11 @@ TEST(ceil_w) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |
@@ -3050,6 +3149,7 @@ TEST(ceil_l) { |
v8::internal::CodeObjectRequired::kYes); |
const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
typedef struct test_float { |
+ uint32_t isNaN2008; |
double a; |
float b; |
int64_t c; |
@@ -3075,7 +3175,15 @@ TEST(ceil_l) { |
-2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
2147483648.0, dFPU64InvalidResult, |
dFPU64InvalidResult}; |
+ double outputsNaN2008[kTableLength] = { |
+ 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, |
+ -2.0, -2.0, -2.0, -3.0, -3.0, -3.0, |
+ 2147483648.0, |
+ 0, |
+ dFPU64InvalidResult}; |
+ __ cfc1(t1, FCSR); |
+ __ sw(t1, MemOperand(a0, offsetof(Test, isNaN2008))); |
__ ldc1(f4, MemOperand(a0, offsetof(Test, a)) ); |
__ lwc1(f6, MemOperand(a0, offsetof(Test, b)) ); |
__ ceil_l_d(f8, f4); |
@@ -3094,7 +3202,12 @@ TEST(ceil_l) { |
test.a = inputs_D[i]; |
test.b = inputs_S[i]; |
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
- CHECK_EQ(test.c, outputs[i]); |
+ if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && |
+ kArchVariant == kMips64r6) { |
+ CHECK_EQ(test.c, outputsNaN2008[i]); |
+ } else { |
+ CHECK_EQ(test.c, outputs[i]); |
+ } |
CHECK_EQ(test.d, test.c); |
} |
} |