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

Unified Diff: test/cctest/wasm/test-run-wasm.cc

Issue 1519823002: [wasm] Fixed FxxMin and FxxMax for cases where one operand is NaN. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm.cc
diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
index 7db7cb740e6483f4a446fb81c23331df7c24886b..90897fe60e4e90cd9b79a24f9f7f3bf0b0c7d9af 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -3168,7 +3168,18 @@ TEST(Run_Wasm_F32Min) {
FOR_FLOAT32_INPUTS(i) {
FOR_FLOAT32_INPUTS(j) {
- float expected = *i < *j ? *i : *j;
+ float expected;
+ if (*i < *j) {
+ expected = *i;
+ } else if (*j < *i) {
+ expected = *j;
+ } else if (*i != *i) {
+ // If *i or *j is NaN, then the result is NaN.
+ expected = *i;
+ } else {
+ expected = *j;
+ }
+
CheckFloatEq(expected, r.Call(*i, *j));
}
}
@@ -3181,7 +3192,18 @@ TEST(Run_Wasm_F64Min) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- double expected = *i < *j ? *i : *j;
+ double expected;
+ if (*i < *j) {
+ expected = *i;
+ } else if (*j < *i) {
+ expected = *j;
+ } else if (*i != *i) {
+ // If *i or *j is NaN, then the result is NaN.
+ expected = *i;
+ } else {
+ expected = *j;
+ }
+
CheckDoubleEq(expected, r.Call(*i, *j));
}
}
@@ -3194,7 +3216,18 @@ TEST(Run_Wasm_F32Max) {
FOR_FLOAT32_INPUTS(i) {
FOR_FLOAT32_INPUTS(j) {
- float expected = *i > *j ? *i : *j;
+ float expected;
+ if (*i > *j) {
+ expected = *i;
+ } else if (*j > *i) {
+ expected = *j;
+ } else if (*i != *i) {
+ // If *i or *j is NaN, then the result is NaN.
+ expected = *i;
+ } else {
+ expected = *j;
+ }
+
CheckFloatEq(expected, r.Call(*i, *j));
}
}
@@ -3207,7 +3240,18 @@ TEST(Run_Wasm_F64Max) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- double expected = *i > *j ? *i : *j;
+ double expected;
+ if (*i > *j) {
+ expected = *i;
+ } else if (*j > *i) {
+ expected = *j;
+ } else if (*i != *i) {
+ // If *i or *j is NaN, then the result is NaN.
+ expected = *i;
+ } else {
+ expected = *j;
+ }
+
CheckDoubleEq(expected, r.Call(*i, *j));
}
}
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698