From fde36818c60f5b7b1c80acbad4a99ade5556e3f5 Mon Sep 17 00:00:00 2001 From: karl Date: Tue, 6 Oct 2015 07:50:29 -0700 Subject: [PATCH] Fix unwanted float-to-double-promotions Unwanted promotions resulted into check_eq errors from this CR: https://codereview.chromium.org/1384873002/ http://build.chromium.org/p/client.v8/builders/V8%20Arm/builds/3141/steps/Check/logs/4 Found via -Wdouble-promotion. Review URL: https://codereview.chromium.org/1372133006 Cr-Commit-Position: refs/heads/master@{#31125} --- test/cctest/compiler/test-run-machops.cc | 2 +- test/cctest/test-assembler-arm.cc | 52 ++++++++++++------------ test/cctest/test-heap.cc | 2 +- test/cctest/test-serialize.cc | 6 +-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc index 38b044b727..335d20caa0 100644 --- a/test/cctest/compiler/test-run-machops.cc +++ b/test/cctest/compiler/test-run-machops.cc @@ -4866,7 +4866,7 @@ TEST(RunChangeFloat32ToFloat64) { FOR_FLOAT32_INPUTS(i) { expected = *i; CHECK_EQ(0, m.Call()); - CHECK_EQ(expected, actual); + CHECK_EQ(static_cast(expected), actual); } } diff --git a/test/cctest/test-assembler-arm.cc b/test/cctest/test-assembler-arm.cc index 8f93150fad..4ab118380f 100644 --- a/test/cctest/test-assembler-arm.cc +++ b/test/cctest/test-assembler-arm.cc @@ -337,8 +337,8 @@ TEST(4) { t.y = 9.0; Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); USE(dummy); - CHECK_EQ(4.5, t.y); - CHECK_EQ(9.0, t.x); + CHECK_EQ(4.5f, t.y); + CHECK_EQ(9.0f, t.x); CHECK_EQ(-123.456, t.n); CHECK_EQ(2718.2818, t.m); CHECK_EQ(2, t.i); @@ -704,14 +704,14 @@ TEST(8) { CHECK_EQ(5.5, d.g); CHECK_EQ(6.6, d.h); - CHECK_EQ(7.0, f.a); - CHECK_EQ(8.0, f.b); - CHECK_EQ(1.0, f.c); - CHECK_EQ(2.0, f.d); - CHECK_EQ(3.0, f.e); - CHECK_EQ(4.0, f.f); - CHECK_EQ(5.0, f.g); - CHECK_EQ(6.0, f.h); + CHECK_EQ(7.0f, f.a); + CHECK_EQ(8.0f, f.b); + CHECK_EQ(1.0f, f.c); + CHECK_EQ(2.0f, f.d); + CHECK_EQ(3.0f, f.e); + CHECK_EQ(4.0f, f.f); + CHECK_EQ(5.0f, f.g); + CHECK_EQ(6.0f, f.h); } @@ -814,14 +814,14 @@ TEST(9) { CHECK_EQ(5.5, d.g); CHECK_EQ(6.6, d.h); - CHECK_EQ(7.0, f.a); - CHECK_EQ(8.0, f.b); - CHECK_EQ(1.0, f.c); - CHECK_EQ(2.0, f.d); - CHECK_EQ(3.0, f.e); - CHECK_EQ(4.0, f.f); - CHECK_EQ(5.0, f.g); - CHECK_EQ(6.0, f.h); + CHECK_EQ(7.0f, f.a); + CHECK_EQ(8.0f, f.b); + CHECK_EQ(1.0f, f.c); + CHECK_EQ(2.0f, f.d); + CHECK_EQ(3.0f, f.e); + CHECK_EQ(4.0f, f.f); + CHECK_EQ(5.0f, f.g); + CHECK_EQ(6.0f, f.h); } @@ -920,14 +920,14 @@ TEST(10) { CHECK_EQ(5.5, d.g); CHECK_EQ(6.6, d.h); - CHECK_EQ(7.0, f.a); - CHECK_EQ(8.0, f.b); - CHECK_EQ(1.0, f.c); - CHECK_EQ(2.0, f.d); - CHECK_EQ(3.0, f.e); - CHECK_EQ(4.0, f.f); - CHECK_EQ(5.0, f.g); - CHECK_EQ(6.0, f.h); + CHECK_EQ(7.0f, f.a); + CHECK_EQ(8.0f, f.b); + CHECK_EQ(1.0f, f.c); + CHECK_EQ(2.0f, f.d); + CHECK_EQ(3.0f, f.e); + CHECK_EQ(4.0f, f.f); + CHECK_EQ(5.0f, f.g); + CHECK_EQ(6.0f, f.h); } diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc index e2a32e3021..2cc7add49e 100644 --- a/test/cctest/test-heap.cc +++ b/test/cctest/test-heap.cc @@ -260,7 +260,7 @@ TEST(SimdObjects) { // Check special lane values. value->set_lane(1, -0.0); - CHECK_EQ(-0.0, value->get_lane(1)); + CHECK_EQ(-0.0f, value->get_lane(1)); CHECK(std::signbit(value->get_lane(1))); // Sign bit should be preserved. value->set_lane(2, quiet_NaN); CHECK(std::isnan(value->get_lane(2))); diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index a37d6a0f19..1cca27b1ac 100644 --- a/test/cctest/test-serialize.cc +++ b/test/cctest/test-serialize.cc @@ -1276,7 +1276,7 @@ TEST(SerializeToplevelExternalString) { Handle copy_result = Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); - CHECK_EQ(15.0f, copy_result->Number()); + CHECK_EQ(15.0, copy_result->Number()); delete cache; } @@ -1334,7 +1334,7 @@ TEST(SerializeToplevelLargeExternalString) { Handle copy_result = Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); - CHECK_EQ(42.0f, copy_result->Number()); + CHECK_EQ(42.0, copy_result->Number()); delete cache; string.Dispose(); @@ -1385,7 +1385,7 @@ TEST(SerializeToplevelExternalScriptName) { Handle copy_result = Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); - CHECK_EQ(10.0f, copy_result->Number()); + CHECK_EQ(10.0, copy_result->Number()); delete cache; }