Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: test/cctest/compiler/value-helper.h

Issue 1773513002: x87: fix the use of CheckFloatEq and CheckDoubleEq in test. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use a do { .. } while(false) to be a good macro citizen. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock. 315 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock.
316 static inline void CheckFloatEq(volatile float x, volatile float y) { 316 static inline void CheckFloatEq(volatile float x, volatile float y) {
317 if (std::isnan(x)) { 317 if (std::isnan(x)) {
318 CHECK(std::isnan(y)); 318 CHECK(std::isnan(y));
319 } else { 319 } else {
320 CHECK_EQ(x, y); 320 CHECK_EQ(x, y);
321 } 321 }
322 } 322 }
323 323
324 #define CHECK_FLOAT_EQ(lhs, rhs) \
325 do { \
326 volatile float tmp = lhs; \
327 CheckFloatEq(tmp, rhs); \
328 } while (0)
329
324 static inline void CheckDoubleEq(volatile double x, volatile double y) { 330 static inline void CheckDoubleEq(volatile double x, volatile double y) {
325 if (std::isnan(x)) { 331 if (std::isnan(x)) {
326 CHECK(std::isnan(y)); 332 CHECK(std::isnan(y));
327 } else { 333 } else {
328 CHECK_EQ(x, y); 334 CHECK_EQ(x, y);
329 } 335 }
330 } 336 }
331 337
338 #define CHECK_DOUBLE_EQ(lhs, rhs) \
339 do { \
340 volatile double tmp = lhs; \
341 CheckDoubleEq(tmp, rhs); \
342 } while (0)
343
332 } // namespace compiler 344 } // namespace compiler
333 } // namespace internal 345 } // namespace internal
334 } // namespace v8 346 } // namespace v8
335 347
336 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ 348 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698