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

Unified Diff: crosstest/test_arith_main.cpp

Issue 384443003: Add scalar lowering for sqrt intrinsic. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: whitespace Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crosstest/test_arith.h ('k') | crosstest/test_arith_sqrt.ll » ('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 745da61671ec4f7c3b006ba73c752d78a1036fe0..8c53ad5289023537261f77156019cffc51022f73 100644
--- a/crosstest/test_arith_main.cpp
+++ b/crosstest/test_arith_main.cpp
@@ -1,5 +1,6 @@
/* crosstest.py --test=test_arith.cpp --test=test_arith_frem.ll \
- --driver=test_arith_main.cpp --prefix=Subzero_ --output=test_arith */
+ --test=test_arith_sqrt.ll --driver=test_arith_main.cpp \
+ --prefix=Subzero_ --output=test_arith */
#include <stdint.h>
@@ -123,6 +124,7 @@ void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
static const Type NegInf = -1.0 / 0.0;
static const Type PosInf = 1.0 / 0.0;
static const Type Nan = 0.0 / 0.0;
+ static const Type NegNan = -0.0 / 0.0;
volatile Type Values[] = {
0, 1, 0x7e,
0x7f, 0x80, 0x81,
@@ -134,7 +136,8 @@ void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
0x100000001ll, 0x7ffffffffffffffell, 0x7fffffffffffffffll,
0x8000000000000000ll, 0x8000000000000001ll, 0xfffffffffffffffell,
0xffffffffffffffffll, NegInf, PosInf,
- Nan, FLT_MIN, FLT_MAX,
+ Nan, NegNan, -0.0,
+ FLT_MIN, FLT_MAX,
DBL_MIN, DBL_MAX
};
const static size_t NumValues = sizeof(Values) / sizeof(*Values);
@@ -173,6 +176,22 @@ void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
}
}
}
+ for (size_t i = 0; i < NumValues; ++i) {
+ Type Value = Values[i];
+ ++TotalTests;
+ Type ResultSz = Subzero_::mySqrt(Value);
+ Type ResultLlc = mySqrt(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_sqrt"
+ << (8 * sizeof(Type)) << "(" << Value
+ << "): sz=" << ResultSz << " llc=" << ResultLlc
+ << std::endl;
+ }
+ }
}
int main(int argc, char **argv) {
« no previous file with comments | « crosstest/test_arith.h ('k') | crosstest/test_arith_sqrt.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698