Index: test/cctest/compiler/test-run-machops.cc |
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc |
index 52672c8a89204cdf1fcc7d275311813bbeaf9a46..19f677b157dbf191b4026b90715e49f614233c06 100644 |
--- a/test/cctest/compiler/test-run-machops.cc |
+++ b/test/cctest/compiler/test-run-machops.cc |
@@ -4136,6 +4136,30 @@ TEST(RunTruncateFloat32ToInt32) { |
} |
+TEST(RunTruncateFloat32ToUint32) { |
+ BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float32()); |
+ m.Return(m.TruncateFloat32ToUint32(m.Parameter(0))); |
+ { |
+ FOR_UINT32_INPUTS(i) { |
+ float input = static_cast<float>(*i); |
+ // This condition on 'input' is required because |
+ // static_cast<float>(UINT32_MAX) results in a value outside uint32 range. |
+ if (input < static_cast<float>(UINT32_MAX)) { |
+ CHECK_EQ(static_cast<uint32_t>(input), m.Call(input)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_FLOAT32_INPUTS(i) { |
+ if (*i <= static_cast<float>(std::numeric_limits<uint32_t>::max()) && |
ahaas
2016/02/03 13:47:02
Nit: I think you should use either UINT32_MAX or s
|
+ *i >= static_cast<float>(std::numeric_limits<uint32_t>::min())) { |
+ CheckFloatEq(static_cast<uint32_t>(*i), m.Call(*i)); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
TEST(RunChangeFloat64ToInt32_A) { |
BufferedRawMachineAssemblerTester<int32_t> m; |
double magic = 11.1; |