Chromium Code Reviews

Unified Diff: crosstest/test_arith_main.cpp

Issue 1022573004: Subzero: Add fabs intrinsic support. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « crosstest/test_arith_fabs.ll ('k') | src/IceInstX8632.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crosstest/test_arith_main.cpp
diff --git a/crosstest/test_arith_main.cpp b/crosstest/test_arith_main.cpp
index e95db4430ebd9172001227dc136c426de78c7e1c..b4c70ee61f0100a3d4f4d82c07f11c56ebafcb73 100644
--- a/crosstest/test_arith_main.cpp
+++ b/crosstest/test_arith_main.cpp
@@ -287,6 +287,18 @@ void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
<< Value << "): sz=" << ResultSz << " llc=" << ResultLlc
<< "\n";
}
+ ++TotalTests;
+ ResultSz = Subzero_::myFabs(Value);
+ ResultLlc = myFabs(Value);
+ // Compare results using memcmp() in case they are both NaN.
+ if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) {
+ ++Passes;
+ } else {
+ ++Failures;
+ std::cout << std::fixed << "test_fabs" << (CHAR_BIT * sizeof(Type)) << "("
+ << Value << "): sz=" << ResultSz << " llc=" << ResultLlc
+ << "\n";
+ }
}
}
@@ -334,6 +346,19 @@ void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
<< "): sz=" << vectAsString<v4f32>(ResultSz) << " llc"
<< vectAsString<v4f32>(ResultLlc) << "\n";
}
+ // Special case for unary fabs operation. Use Value1, ignore Value2.
+ ResultSz = Subzero_::myFabs(Value1);
+ ResultLlc = myFabs(Value1);
+ ++TotalTests;
+ if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) {
+ ++Passes;
+ } else {
+ ++Failures;
+ std::cout << "test_fabs_v4f32"
+ << "(" << vectAsString<v4f32>(Value1)
+ << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc"
+ << vectAsString<v4f32>(ResultLlc) << "\n";
+ }
}
}
}
« no previous file with comments | « crosstest/test_arith_fabs.ll ('k') | src/IceInstX8632.h » ('j') | no next file with comments »

Powered by Google App Engine