MIPS: Fix mina_maxa for proper NaN handling.

Also clean up variable naming in min_max and other tests. Fix class_fmt in mips64 assembler test for proper NaN checking

Review URL: https://codereview.chromium.org/1276813004

Cr-Commit-Position: refs/heads/master@{#30073}
This commit is contained in:
Djordje.Pesic 2015-08-07 12:05:47 -07:00 committed by Commit bot
parent 62e07112ff
commit 46fafcd706
2 changed files with 320 additions and 330 deletions

View File

@ -1458,18 +1458,18 @@ TEST(min_max) {
} TestFloat;
TestFloat test;
const double dblNaN = std::numeric_limits<double>::quiet_NaN();
const float fltNaN = std::numeric_limits<float>::quiet_NaN();
const int tableLength = 5;
double inputsa[tableLength] = {2.0, 3.0, dblNaN, 3.0, dblNaN};
double inputsb[tableLength] = {3.0, 2.0, 3.0, dblNaN, dblNaN};
double outputsdmin[tableLength] = {2.0, 2.0, 3.0, 3.0, dblNaN};
double outputsdmax[tableLength] = {3.0, 3.0, 3.0, 3.0, dblNaN};
const double double_nan = std::numeric_limits<double>::quiet_NaN();
const float float_nan = std::numeric_limits<float>::quiet_NaN();
const int kTableLength = 5;
double inputsa[kTableLength] = {2.0, 3.0, double_nan, 3.0, double_nan};
double inputsb[kTableLength] = {3.0, 2.0, 3.0, double_nan, double_nan};
double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, double_nan};
double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, double_nan};
float inputse[tableLength] = {2.0, 3.0, fltNaN, 3.0, fltNaN};
float inputsf[tableLength] = {3.0, 2.0, 3.0, fltNaN, fltNaN};
float outputsfmin[tableLength] = {2.0, 2.0, 3.0, 3.0, fltNaN};
float outputsfmax[tableLength] = {3.0, 3.0, 3.0, 3.0, fltNaN};
float inputse[kTableLength] = {2.0, 3.0, float_nan, 3.0, float_nan};
float inputsf[kTableLength] = {3.0, 2.0, 3.0, float_nan, float_nan};
float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, float_nan};
float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, float_nan};
__ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a)));
__ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b)));
@ -1491,7 +1491,7 @@ TEST(min_max) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i];
test.b = inputsb[i];
test.e = inputse[i];
@ -1499,7 +1499,7 @@ TEST(min_max) {
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
if (i < tableLength - 1) {
if (i < kTableLength - 1) {
CHECK_EQ(test.c, outputsdmin[i]);
CHECK_EQ(test.d, outputsdmax[i]);
CHECK_EQ(test.g, outputsfmin[i]);
@ -1517,7 +1517,7 @@ TEST(min_max) {
TEST(rint_d) {
if (IsMipsArchVariant(kMips32r6)) {
const int tableLength = 30;
const int kTableLength = 30;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -1530,7 +1530,7 @@ TEST(rint_d) {
}TestFloat;
TestFloat test;
double inputs[tableLength] = {18446744073709551617.0,
double inputs[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E+308, 6.27463370218383111104242366943E-307,
@ -1542,7 +1542,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RN[tableLength] = {18446744073709551617.0,
double outputs_RN[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 0,
@ -1554,7 +1554,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RZ[tableLength] = {18446744073709551617.0,
double outputs_RZ[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 0,
@ -1566,7 +1566,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RP[tableLength] = {18446744073709551617.0,
double outputs_RP[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 1,
@ -1578,7 +1578,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RM[tableLength] = {18446744073709551617.0,
double outputs_RM[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 0,
@ -1611,7 +1611,7 @@ TEST(rint_d) {
for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j];
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
CHECK_EQ(test.b, outputs[j][i]);
@ -1696,7 +1696,7 @@ TEST(sel) {
TEST(rint_s) {
if (IsMipsArchVariant(kMips32r6)) {
const int tableLength = 30;
const int kTableLength = 30;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -1709,7 +1709,7 @@ TEST(rint_s) {
}TestFloat;
TestFloat test;
float inputs[tableLength] = {18446744073709551617.0,
float inputs[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E+38, 6.27463370218383111104242366943E-37,
@ -1721,7 +1721,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RN[tableLength] = {18446744073709551617.0,
float outputs_RN[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 0,
@ -1733,7 +1733,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RZ[tableLength] = {18446744073709551617.0,
float outputs_RZ[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 0,
@ -1745,7 +1745,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RP[tableLength] = {18446744073709551617.0,
float outputs_RP[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 1,
@ -1757,7 +1757,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RM[tableLength] = {18446744073709551617.0,
float outputs_RM[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 0,
@ -1790,7 +1790,7 @@ TEST(rint_s) {
for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j];
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
CHECK_EQ(test.b, outputs[j][i]);
@ -1802,11 +1802,13 @@ TEST(rint_s) {
TEST(mina_maxa) {
if (IsMipsArchVariant(kMips32r6)) {
const int tableLength = 12;
const int kTableLength = 15;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
MacroAssembler assm(isolate, NULL, 0);
const double double_nan = std::numeric_limits<double>::quiet_NaN();
const float float_nan = std::numeric_limits<float>::quiet_NaN();
typedef struct test_float {
double a;
@ -1820,53 +1822,37 @@ TEST(mina_maxa) {
}TestFloat;
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
double inputsa[kTableLength] = {
5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9,
-9.8, -10.0, -8.9, -9.8, double_nan, 3.0, double_nan
};
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
double inputsb[kTableLength] = {
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, double_nan, double_nan
};
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
double resd[kTableLength] = {
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, double_nan
};
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
double resd1[kTableLength] = {
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, double_nan
};
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
float inputsc[kTableLength] = {
5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9,
-9.8, -10.0, -8.9, -9.8, float_nan, 3.0, float_nan
};
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
float inputsd[kTableLength] = {
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, float_nan, float_nan
};
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
float resf[kTableLength] = {
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, float_nan
};
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
float resf1[kTableLength] = {
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, float_nan
};
__ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
@ -1889,16 +1875,23 @@ TEST(mina_maxa) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i];
test.b = inputsb[i];
test.c = inputsc[i];
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 < kTableLength - 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));
}
}
}
}
@ -1918,22 +1911,22 @@ TEST(trunc_l) {
int64_t c; // a trunc result
int64_t d; // b trunc result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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,
@ -1953,7 +1946,7 @@ TEST(trunc_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -1966,7 +1959,7 @@ TEST(trunc_l) {
TEST(movz_movn) {
if (IsMipsArchVariant(kMips32r2)) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -1987,17 +1980,17 @@ TEST(movz_movn) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
double inputs_S[tableLength] = {
double inputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
@ -2029,7 +2022,7 @@ TEST(movz_movn) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.c = inputs_S[i];
@ -2053,7 +2046,7 @@ TEST(movz_movn) {
TEST(movt_movd) {
if (IsMipsArchVariant(kMips32r2)) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@ -2073,22 +2066,22 @@ TEST(movt_movd) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
5.3, -5.3, 20.8, -2.9
};
double inputs_S[tableLength] = {
double inputs_S[kTableLength] = {
4.88, 4.8, -4.8, -0.29
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
4.88, 4.8, -4.8, -0.29
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
5.3, -5.3, 20.8, -2.9
};
int condition_flags[8] = {0, 1, 2, 3, 4, 5, 6, 7};
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.srcd = inputs_D[i];
test.srcf = inputs_S[i];
@ -2160,8 +2153,8 @@ TEST(cvt_w_d) {
int32_t b;
int32_t fcsr;
}Test;
const int tableLength = 24;
double inputs[tableLength] = {
const int kTableLength = 24;
double inputs[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483637.0, 2147483638.0, 2147483639.0,
@ -2169,28 +2162,28 @@ TEST(cvt_w_d) {
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, 2147483653.0
};
double outputs_RN[tableLength] = {
double outputs_RN[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,
2147483637.0, 2147483638.0, 2147483639.0,
2147483640.0, 2147483641.0, 2147483642.0,
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, kFPUInvalidResult};
double outputs_RZ[tableLength] = {
double outputs_RZ[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,
2147483637.0, 2147483638.0, 2147483639.0,
2147483640.0, 2147483641.0, 2147483642.0,
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, kFPUInvalidResult};
double outputs_RP[tableLength] = {
double outputs_RP[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,
2147483637.0, 2147483638.0, 2147483639.0,
2147483640.0, 2147483641.0, 2147483642.0,
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, kFPUInvalidResult};
double outputs_RM[tableLength] = {
double outputs_RM[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,
2147483637.0, 2147483638.0, 2147483639.0,
@ -2217,7 +2210,7 @@ TEST(cvt_w_d) {
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j];
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
CHECK_EQ(test.b, outputs[j][i]);
@ -2238,22 +2231,22 @@ TEST(trunc_w) {
int32_t c; // a trunc result
int32_t d; // b trunc result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2273,7 +2266,7 @@ TEST(trunc_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2295,22 +2288,22 @@ TEST(round_w) {
int32_t c; // a trunc result
int32_t d; // b trunc result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2330,7 +2323,7 @@ TEST(round_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2353,22 +2346,22 @@ TEST(round_l) {
int64_t c;
int64_t d;
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, dFPU64InvalidResult,
@ -2388,7 +2381,7 @@ TEST(round_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2400,7 +2393,7 @@ TEST(round_l) {
TEST(sub) {
const int tableLength = 12;
const int kTableLength = 12;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2416,27 +2409,27 @@ TEST(sub) {
}TestFloat;
TestFloat test;
double inputfs_D[tableLength] = {
double inputfs_D[kTableLength] = {
5.3, 4.8, 2.9, -5.3, -4.8, -2.9,
5.3, 4.8, 2.9, -5.3, -4.8, -2.9
};
double inputft_D[tableLength] = {
double inputft_D[kTableLength] = {
4.8, 5.3, 2.9, 4.8, 5.3, 2.9,
-4.8, -5.3, -2.9, -4.8, -5.3, -2.9
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
0.5, -0.5, 0.0, -10.1, -10.1, -5.8,
10.1, 10.1, 5.8, -0.5, 0.5, 0.0
};
float inputfs_S[tableLength] = {
float inputfs_S[kTableLength] = {
5.3, 4.8, 2.9, -5.3, -4.8, -2.9,
5.3, 4.8, 2.9, -5.3, -4.8, -2.9
};
float inputft_S[tableLength] = {
float inputft_S[kTableLength] = {
4.8, 5.3, 2.9, 4.8, 5.3, 2.9,
-4.8, -5.3, -2.9, -4.8, -5.3, -2.9
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
0.5, -0.5, 0.0, -10.1, -10.1, -5.8,
10.1, 10.1, 5.8, -0.5, 0.5, 0.0
};
@ -2456,7 +2449,7 @@ TEST(sub) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i];
test.b = inputft_S[i];
test.c = inputfs_D[i];
@ -2469,7 +2462,7 @@ TEST(sub) {
TEST(sqrt_rsqrt_recip) {
const int tableLength = 4;
const int kTableLength = 4;
const double deltaDouble = 2E-15;
const float deltaFloat = 2E-7;
const float sqrt2_s = sqrt(2);
@ -2491,18 +2484,18 @@ TEST(sqrt_rsqrt_recip) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
0.0L, 4.0L, 2.0L, 4e-28L
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
0.0L, 2.0L, sqrt2_d, 2e-14L
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
0.0, 4.0, 2.0, 4e-28
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
0.0, 2.0, sqrt2_s, 2e-14
};
@ -2536,7 +2529,7 @@ TEST(sqrt_rsqrt_recip) {
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
float f1;
double d1;
test.a = inputs_S[i];
@ -2573,7 +2566,7 @@ TEST(sqrt_rsqrt_recip) {
TEST(neg) {
const int tableLength = 3;
const int kTableLength = 3;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2587,18 +2580,18 @@ TEST(neg) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
0.0, 4.0, -2.0
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
0.0, -4.0, 2.0
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
0.0, 4.0, -2.0
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
0.0, -4.0, 2.0
};
__ lwc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
@ -2615,7 +2608,7 @@ TEST(neg) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_S[i];
test.c = inputs_D[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2626,7 +2619,7 @@ TEST(neg) {
TEST(mul) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2642,17 +2635,17 @@ TEST(mul) {
}TestFloat;
TestFloat test;
double inputfs_D[tableLength] = {
double inputfs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
double inputft_D[tableLength] = {
double inputft_D[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
float inputfs_S[tableLength] = {
float inputfs_S[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
float inputft_S[tableLength] = {
float inputft_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
@ -2672,7 +2665,7 @@ TEST(mul) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i];
test.b = inputft_S[i];
test.c = inputfs_D[i];
@ -2685,7 +2678,7 @@ TEST(mul) {
TEST(mov) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2699,17 +2692,17 @@ TEST(mov) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
double inputs_S[tableLength] = {
double inputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
@ -2727,7 +2720,7 @@ TEST(mov) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.c = inputs_S[i];
@ -2750,22 +2743,22 @@ TEST(floor_w) {
int32_t c; // a floor result
int32_t d; // b floor result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2785,7 +2778,7 @@ TEST(floor_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2808,22 +2801,22 @@ TEST(floor_l) {
int64_t c;
int64_t d;
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, dFPU64InvalidResult,
@ -2843,7 +2836,7 @@ TEST(floor_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2866,22 +2859,22 @@ TEST(ceil_w) {
int32_t c; // a floor result
int32_t d; // b floor result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2901,7 +2894,7 @@ TEST(ceil_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2924,22 +2917,22 @@ TEST(ceil_l) {
int64_t c;
int64_t d;
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, dFPU64InvalidResult,
@ -2959,7 +2952,7 @@ TEST(ceil_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));

View File

@ -1440,7 +1440,7 @@ TEST(MIPS16) {
}
// ----------------------mips32r6 specific tests----------------------
// ----------------------mips64r6 specific tests----------------------
TEST(seleqz_selnez) {
if (kArchVariant == kMips64r6) {
CcTest::InitializeVM();
@ -1562,18 +1562,18 @@ TEST(min_max) {
} TestFloat;
TestFloat test;
const double dblNaN = std::numeric_limits<double>::quiet_NaN();
const float fltNaN = std::numeric_limits<float>::quiet_NaN();
const int tableLength = 5;
double inputsa[tableLength] = {2.0, 3.0, dblNaN, 3.0, dblNaN};
double inputsb[tableLength] = {3.0, 2.0, 3.0, dblNaN, dblNaN};
double outputsdmin[tableLength] = {2.0, 2.0, 3.0, 3.0, dblNaN};
double outputsdmax[tableLength] = {3.0, 3.0, 3.0, 3.0, dblNaN};
const double double_nan = std::numeric_limits<double>::quiet_NaN();
const float float_nan = std::numeric_limits<float>::quiet_NaN();
const int kTableLength = 5;
double inputsa[kTableLength] = {2.0, 3.0, double_nan, 3.0, double_nan};
double inputsb[kTableLength] = {3.0, 2.0, 3.0, double_nan, double_nan};
double outputsdmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, double_nan};
double outputsdmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, double_nan};
float inputse[tableLength] = {2.0, 3.0, fltNaN, 3.0, fltNaN};
float inputsf[tableLength] = {3.0, 2.0, 3.0, fltNaN, fltNaN};
float outputsfmin[tableLength] = {2.0, 2.0, 3.0, 3.0, fltNaN};
float outputsfmax[tableLength] = {3.0, 3.0, 3.0, 3.0, fltNaN};
float inputse[kTableLength] = {2.0, 3.0, float_nan, 3.0, float_nan};
float inputsf[kTableLength] = {3.0, 2.0, 3.0, float_nan, float_nan};
float outputsfmin[kTableLength] = {2.0, 2.0, 3.0, 3.0, float_nan};
float outputsfmax[kTableLength] = {3.0, 3.0, 3.0, 3.0, float_nan};
__ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a)));
__ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b)));
@ -1595,7 +1595,7 @@ TEST(min_max) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i];
test.b = inputsb[i];
test.e = inputse[i];
@ -1603,7 +1603,7 @@ TEST(min_max) {
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
if (i < tableLength - 1) {
if (i < kTableLength - 1) {
CHECK_EQ(test.c, outputsdmin[i]);
CHECK_EQ(test.d, outputsdmax[i]);
CHECK_EQ(test.g, outputsfmin[i]);
@ -1621,7 +1621,7 @@ TEST(min_max) {
TEST(rint_d) {
if (kArchVariant == kMips64r6) {
const int tableLength = 30;
const int kTableLength = 30;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -1634,7 +1634,7 @@ TEST(rint_d) {
}TestFloat;
TestFloat test;
double inputs[tableLength] = {18446744073709551617.0,
double inputs[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E+308, 6.27463370218383111104242366943E-307,
@ -1646,7 +1646,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RN[tableLength] = {18446744073709551617.0,
double outputs_RN[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 0,
@ -1658,7 +1658,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RZ[tableLength] = {18446744073709551617.0,
double outputs_RZ[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 0,
@ -1670,7 +1670,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RP[tableLength] = {18446744073709551617.0,
double outputs_RP[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 1,
@ -1682,7 +1682,7 @@ TEST(rint_d) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
double outputs_RM[tableLength] = {18446744073709551617.0,
double outputs_RM[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E147,
1.7976931348623157E308, 0,
@ -1713,7 +1713,7 @@ TEST(rint_d) {
for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j];
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
CHECK_EQ(test.b, outputs[j][i]);
@ -1798,7 +1798,7 @@ TEST(sel) {
TEST(rint_s) {
if (kArchVariant == kMips64r6) {
const int tableLength = 30;
const int kTableLength = 30;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -1811,7 +1811,7 @@ TEST(rint_s) {
}TestFloat;
TestFloat test;
float inputs[tableLength] = {18446744073709551617.0,
float inputs[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E+38, 6.27463370218383111104242366943E-37,
@ -1823,7 +1823,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RN[tableLength] = {18446744073709551617.0,
float outputs_RN[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 0,
@ -1835,7 +1835,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RZ[tableLength] = {18446744073709551617.0,
float outputs_RZ[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 0,
@ -1847,7 +1847,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RP[tableLength] = {18446744073709551617.0,
float outputs_RP[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 1,
@ -1859,7 +1859,7 @@ TEST(rint_s) {
37778931862957161709582.0, 37778931862957161709583.0,
37778931862957161709584.0, 37778931862957161709585.0,
37778931862957161709586.0, 37778931862957161709587.0};
float outputs_RM[tableLength] = {18446744073709551617.0,
float outputs_RM[kTableLength] = {18446744073709551617.0,
4503599627370496.0, -4503599627370496.0,
1.26782468584154733584017312973E30, 1.44860108245951772690707170478E37,
1.7976931348623157E38, 0,
@ -1892,7 +1892,7 @@ TEST(rint_s) {
for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j];
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
CHECK_EQ(test.b, outputs[j][i]);
@ -1904,11 +1904,13 @@ TEST(rint_s) {
TEST(mina_maxa) {
if (kArchVariant == kMips64r6) {
const int tableLength = 12;
const int kTableLength = 15;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
MacroAssembler assm(isolate, NULL, 0);
const double double_nan = std::numeric_limits<double>::quiet_NaN();
const float float_nan = std::numeric_limits<float>::quiet_NaN();
typedef struct test_float {
double a;
@ -1922,53 +1924,37 @@ TEST(mina_maxa) {
}TestFloat;
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
double inputsa[kTableLength] = {
5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9,
-9.8, -10.0, -8.9, -9.8, double_nan, 3.0, double_nan
};
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
double inputsb[kTableLength] = {
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, double_nan, double_nan
};
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
double resd[kTableLength] = {
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, double_nan
};
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
double resd1[kTableLength] = {
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, double_nan
};
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
float inputsc[kTableLength] = {
5.3, 4.8, 6.1, 9.8, 9.8, 9.8, -10.0, -8.9,
-9.8, -10.0, -8.9, -9.8, float_nan, 3.0, float_nan
};
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
float inputsd[kTableLength] = {
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, float_nan, float_nan
};
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
float resf[kTableLength] = {
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, float_nan
};
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
float resf1[kTableLength] = {
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, float_nan
};
__ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
@ -1991,24 +1977,31 @@ TEST(mina_maxa) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i];
test.b = inputsb[i];
test.c = inputsc[i];
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 < kTableLength - 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));
}
}
}
}
// ----------------------mips32r2 specific tests----------------------
// ----------------------mips64r2 specific tests----------------------
TEST(trunc_l) {
if (kArchVariant == kMips64r2) {
CcTest::InitializeVM();
@ -2022,22 +2015,22 @@ TEST(trunc_l) {
int64_t c; // a trunc result
int64_t d; // b trunc result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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,
@ -2057,7 +2050,7 @@ TEST(trunc_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2070,7 +2063,7 @@ TEST(trunc_l) {
TEST(movz_movn) {
if (kArchVariant == kMips64r2) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2091,17 +2084,17 @@ TEST(movz_movn) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
double inputs_S[tableLength] = {
double inputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
@ -2133,7 +2126,7 @@ TEST(movz_movn) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.c = inputs_S[i];
@ -2157,7 +2150,7 @@ TEST(movz_movn) {
TEST(movt_movd) {
if (kArchVariant == kMips64r2) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
typedef struct test_float {
@ -2176,22 +2169,22 @@ TEST(movt_movd) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
5.3, -5.3, 20.8, -2.9
};
double inputs_S[tableLength] = {
double inputs_S[kTableLength] = {
4.88, 4.8, -4.8, -0.29
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
4.88, 4.8, -4.8, -0.29
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
5.3, -5.3, 20.8, -2.9
};
int condition_flags[8] = {0, 1, 2, 3, 4, 5, 6, 7};
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.srcd = inputs_D[i];
test.srcf = inputs_S[i];
@ -2264,8 +2257,8 @@ TEST(cvt_w_d) {
int32_t b;
int fcsr;
}Test;
const int tableLength = 24;
double inputs[tableLength] = {
const int kTableLength = 24;
double inputs[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483637.0, 2147483638.0, 2147483639.0,
@ -2273,28 +2266,28 @@ TEST(cvt_w_d) {
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, 2147483653.0
};
double outputs_RN[tableLength] = {
double outputs_RN[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,
2147483637.0, 2147483638.0, 2147483639.0,
2147483640.0, 2147483641.0, 2147483642.0,
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, kFPUInvalidResult};
double outputs_RZ[tableLength] = {
double outputs_RZ[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,
2147483637.0, 2147483638.0, 2147483639.0,
2147483640.0, 2147483641.0, 2147483642.0,
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, kFPUInvalidResult};
double outputs_RP[tableLength] = {
double outputs_RP[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,
2147483637.0, 2147483638.0, 2147483639.0,
2147483640.0, 2147483641.0, 2147483642.0,
2147483643.0, 2147483644.0, 2147483645.0,
2147483646.0, 2147483647.0, kFPUInvalidResult};
double outputs_RM[tableLength] = {
double outputs_RM[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,
2147483637.0, 2147483638.0, 2147483639.0,
@ -2321,7 +2314,7 @@ TEST(cvt_w_d) {
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j];
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
CHECK_EQ(test.b, outputs[j][i]);
@ -2342,22 +2335,22 @@ TEST(trunc_w) {
int32_t c; // a trunc result
int32_t d; // b trunc result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2377,7 +2370,7 @@ TEST(trunc_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2399,22 +2392,22 @@ TEST(round_w) {
int32_t c; // a trunc result
int32_t d; // b trunc result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2434,7 +2427,7 @@ TEST(round_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2456,22 +2449,22 @@ TEST(round_l) {
int64_t c;
int64_t d;
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, dFPU64InvalidResult,
@ -2491,7 +2484,7 @@ TEST(round_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
std::cout<< i<< "\n";
@ -2503,7 +2496,7 @@ TEST(round_l) {
TEST(sub) {
const int tableLength = 12;
const int kTableLength = 12;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2519,27 +2512,27 @@ TEST(sub) {
}TestFloat;
TestFloat test;
double inputfs_D[tableLength] = {
double inputfs_D[kTableLength] = {
5.3, 4.8, 2.9, -5.3, -4.8, -2.9,
5.3, 4.8, 2.9, -5.3, -4.8, -2.9
};
double inputft_D[tableLength] = {
double inputft_D[kTableLength] = {
4.8, 5.3, 2.9, 4.8, 5.3, 2.9,
-4.8, -5.3, -2.9, -4.8, -5.3, -2.9
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
0.5, -0.5, 0.0, -10.1, -10.1, -5.8,
10.1, 10.1, 5.8, -0.5, 0.5, 0.0
};
float inputfs_S[tableLength] = {
float inputfs_S[kTableLength] = {
5.3, 4.8, 2.9, -5.3, -4.8, -2.9,
5.3, 4.8, 2.9, -5.3, -4.8, -2.9
};
float inputft_S[tableLength] = {
float inputft_S[kTableLength] = {
4.8, 5.3, 2.9, 4.8, 5.3, 2.9,
-4.8, -5.3, -2.9, -4.8, -5.3, -2.9
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
0.5, -0.5, 0.0, -10.1, -10.1, -5.8,
10.1, 10.1, 5.8, -0.5, 0.5, 0.0
};
@ -2559,7 +2552,7 @@ TEST(sub) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i];
test.b = inputft_S[i];
test.c = inputfs_D[i];
@ -2572,7 +2565,7 @@ TEST(sub) {
TEST(sqrt_rsqrt_recip) {
const int tableLength = 4;
const int kTableLength = 4;
const double deltaDouble = 2E-15;
const float deltaFloat = 2E-7;
const float sqrt2_s = sqrt(2);
@ -2594,18 +2587,18 @@ TEST(sqrt_rsqrt_recip) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
0.0L, 4.0L, 2.0L, 4e-28L
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
0.0L, 2.0L, sqrt2_d, 2e-14L
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
0.0, 4.0, 2.0, 4e-28
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
0.0, 2.0, sqrt2_s, 2e-14
};
@ -2633,7 +2626,7 @@ TEST(sqrt_rsqrt_recip) {
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
float f1;
double d1;
test.a = inputs_S[i];
@ -2668,7 +2661,7 @@ TEST(sqrt_rsqrt_recip) {
TEST(neg) {
const int tableLength = 2;
const int kTableLength = 2;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2682,18 +2675,18 @@ TEST(neg) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
4.0, -2.0
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
-4.0, 2.0
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
4.0, -2.0
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
-4.0, 2.0
};
__ lwc1(f2, MemOperand(a0, offsetof(TestFloat, a)) );
@ -2710,7 +2703,7 @@ TEST(neg) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_S[i];
test.c = inputs_D[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2722,7 +2715,7 @@ TEST(neg) {
TEST(mul) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2738,17 +2731,17 @@ TEST(mul) {
}TestFloat;
TestFloat test;
double inputfs_D[tableLength] = {
double inputfs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
double inputft_D[tableLength] = {
double inputft_D[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
float inputfs_S[tableLength] = {
float inputfs_S[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
float inputft_S[tableLength] = {
float inputft_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
@ -2768,7 +2761,7 @@ TEST(mul) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i];
test.b = inputft_S[i];
test.c = inputfs_D[i];
@ -2781,7 +2774,7 @@ TEST(mul) {
TEST(mov) {
const int tableLength = 4;
const int kTableLength = 4;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
@ -2795,17 +2788,17 @@ TEST(mov) {
}TestFloat;
TestFloat test;
double inputs_D[tableLength] = {
double inputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
double inputs_S[tableLength] = {
double inputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
float outputs_S[tableLength] = {
float outputs_S[kTableLength] = {
4.8, 4.8, -4.8, -0.29
};
double outputs_D[tableLength] = {
double outputs_D[kTableLength] = {
5.3, -5.3, 5.3, -2.9
};
@ -2823,7 +2816,7 @@ TEST(mov) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.c = inputs_S[i];
@ -2846,22 +2839,22 @@ TEST(floor_w) {
int32_t c; // a floor result
int32_t d; // b floor result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2881,7 +2874,7 @@ TEST(floor_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2903,22 +2896,22 @@ TEST(floor_l) {
int64_t c;
int64_t d;
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, dFPU64InvalidResult,
@ -2938,7 +2931,7 @@ TEST(floor_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -2960,22 +2953,22 @@ TEST(ceil_w) {
int32_t c; // a floor result
int32_t d; // b floor result
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, kFPUInvalidResult,
@ -2995,7 +2988,7 @@ TEST(ceil_w) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -3017,22 +3010,22 @@ TEST(ceil_l) {
int64_t c;
int64_t d;
}Test;
const int tableLength = 15;
double inputs_D[tableLength] = {
const int kTableLength = 15;
double inputs_D[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::infinity()
};
float inputs_S[tableLength] = {
float inputs_S[kTableLength] = {
2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
-2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
2147483648.0,
std::numeric_limits<float>::quiet_NaN(),
std::numeric_limits<float>::infinity()
};
double outputs[tableLength] = {
double outputs[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, dFPU64InvalidResult,
@ -3052,7 +3045,7 @@ TEST(ceil_l) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < tableLength; i++) {
for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i];
test.b = inputs_S[i];
(CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0));
@ -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);