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

Side by Side Diff: crosstest/test_fcmp_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 unified diff | Download patch
« no previous file with comments | « crosstest/test_arith_sqrt.ll ('k') | src/IceInstX8632.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crosstest.py --test=test_fcmp.pnacl.ll --driver=test_fcmp_main.cpp \ 1 /* crosstest.py --test=test_fcmp.pnacl.ll --driver=test_fcmp_main.cpp \
2 --prefix=Subzero_ --output=test_fcmp */ 2 --prefix=Subzero_ --output=test_fcmp */
3 3
4 #include <cassert> 4 #include <cassert>
5 #include <cfloat> 5 #include <cfloat>
6 #include <cmath> 6 #include <cmath>
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "test_fcmp.def" 9 #include "test_fcmp.def"
10 10
11 #define X(cmp) \ 11 #define X(cmp) \
12 extern "C" bool fcmp##cmp##Float(float a, float b); \ 12 extern "C" bool fcmp##cmp##Float(float a, float b); \
13 extern "C" bool fcmp##cmp##Double(double a, double b); \ 13 extern "C" bool fcmp##cmp##Double(double a, double b); \
14 extern "C" bool Subzero_fcmp##cmp##Float(float a, float b); \ 14 extern "C" bool Subzero_fcmp##cmp##Float(float a, float b); \
15 extern "C" bool Subzero_fcmp##cmp##Double(double a, double b); 15 extern "C" bool Subzero_fcmp##cmp##Double(double a, double b);
16 FCMP_TABLE; 16 FCMP_TABLE;
17 #undef X 17 #undef X
18 18
19 int main(int argc, char **argv) { 19 int main(int argc, char **argv) {
20 static const double NegInf = -1.0 / 0.0; 20 static const double NegInf = -1.0 / 0.0;
21 static const double Zero = 0.0; 21 static const double Zero = 0.0;
22 static const double Ten = 10.0; 22 static const double Ten = 10.0;
23 static const double PosInf = 1.0 / 0.0; 23 static const double PosInf = 1.0 / 0.0;
24 static const double Nan = 0.0 / 0.0; 24 static const double Nan = 0.0 / 0.0;
25 static const double NegNan = -0.0 / 0.0;
25 assert(std::fpclassify(NegInf) == FP_INFINITE); 26 assert(std::fpclassify(NegInf) == FP_INFINITE);
26 assert(std::fpclassify(PosInf) == FP_INFINITE); 27 assert(std::fpclassify(PosInf) == FP_INFINITE);
27 assert(std::fpclassify(Nan) == FP_NAN); 28 assert(std::fpclassify(Nan) == FP_NAN);
29 assert(std::fpclassify(NegNan) == FP_NAN);
28 assert(NegInf < Zero); 30 assert(NegInf < Zero);
29 assert(NegInf < PosInf); 31 assert(NegInf < PosInf);
30 assert(Zero < PosInf); 32 assert(Zero < PosInf);
31 33
32 volatile double Values[] = { NegInf, Zero, DBL_MIN, FLT_MIN, Ten, 34 volatile double Values[] = { NegInf, -Zero, Zero, DBL_MIN, FLT_MIN,
33 FLT_MAX, DBL_MAX, PosInf, Nan, }; 35 Ten, FLT_MAX, DBL_MAX, PosInf, Nan,
36 NegNan };
34 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 37 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
35 38
36 typedef bool (*FuncTypeFloat)(float, float); 39 typedef bool (*FuncTypeFloat)(float, float);
37 typedef bool (*FuncTypeDouble)(double, double); 40 typedef bool (*FuncTypeDouble)(double, double);
38 static struct { 41 static struct {
39 const char *Name; 42 const char *Name;
40 FuncTypeFloat FuncFloatSz; 43 FuncTypeFloat FuncFloatSz;
41 FuncTypeFloat FuncFloatLlc; 44 FuncTypeFloat FuncFloatLlc;
42 FuncTypeDouble FuncDoubleSz; 45 FuncTypeDouble FuncDoubleSz;
43 FuncTypeDouble FuncDoubleLlc; 46 FuncTypeDouble FuncDoubleLlc;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 << " llc=" << ResultLlc << std::endl; 92 << " llc=" << ResultLlc << std::endl;
90 } 93 }
91 } 94 }
92 } 95 }
93 } 96 }
94 97
95 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 98 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
96 << " Failures=" << Failures << "\n"; 99 << " Failures=" << Failures << "\n";
97 return Failures; 100 return Failures;
98 } 101 }
OLDNEW
« no previous file with comments | « crosstest/test_arith_sqrt.ll ('k') | src/IceInstX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698