OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 5 #ifndef V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
6 #define V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 6 #define V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) | 325 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) |
326 | 326 |
327 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) | 327 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) |
328 | 328 |
329 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock. | 329 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock. |
330 static inline void CheckFloatEq(volatile float x, volatile float y) { | 330 static inline void CheckFloatEq(volatile float x, volatile float y) { |
331 if (std::isnan(x)) { | 331 if (std::isnan(x)) { |
332 CHECK(std::isnan(y)); | 332 CHECK(std::isnan(y)); |
333 } else { | 333 } else { |
334 CHECK_EQ(x, y); | 334 CHECK_EQ(x, y); |
| 335 CHECK_EQ(std::signbit(x), std::signbit(y)); |
335 } | 336 } |
336 } | 337 } |
337 | 338 |
338 #define CHECK_FLOAT_EQ(lhs, rhs) \ | 339 #define CHECK_FLOAT_EQ(lhs, rhs) \ |
339 do { \ | 340 do { \ |
340 volatile float tmp = lhs; \ | 341 volatile float tmp = lhs; \ |
341 CheckFloatEq(tmp, rhs); \ | 342 CheckFloatEq(tmp, rhs); \ |
342 } while (0) | 343 } while (0) |
343 | 344 |
344 static inline void CheckDoubleEq(volatile double x, volatile double y) { | 345 static inline void CheckDoubleEq(volatile double x, volatile double y) { |
345 if (std::isnan(x)) { | 346 if (std::isnan(x)) { |
346 CHECK(std::isnan(y)); | 347 CHECK(std::isnan(y)); |
347 } else { | 348 } else { |
348 CHECK_EQ(x, y); | 349 CHECK_EQ(x, y); |
| 350 CHECK_EQ(std::signbit(x), std::signbit(y)); |
349 } | 351 } |
350 } | 352 } |
351 | 353 |
352 #define CHECK_DOUBLE_EQ(lhs, rhs) \ | 354 #define CHECK_DOUBLE_EQ(lhs, rhs) \ |
353 do { \ | 355 do { \ |
354 volatile double tmp = lhs; \ | 356 volatile double tmp = lhs; \ |
355 CheckDoubleEq(tmp, rhs); \ | 357 CheckDoubleEq(tmp, rhs); \ |
356 } while (0) | 358 } while (0) |
357 | 359 |
358 } // namespace compiler | 360 } // namespace compiler |
359 } // namespace internal | 361 } // namespace internal |
360 } // namespace v8 | 362 } // namespace v8 |
361 | 363 |
362 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 364 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |