OLD | NEW |
1 //===- subzero/crosstest/test_fcmp_main.cpp - Driver for tests ------------===// | 1 //===- subzero/crosstest/test_fcmp_main.cpp - Driver for tests ------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // Driver for cross testing the fcmp bitcode instruction | 10 // Driver for cross testing the fcmp bitcode instruction |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 static const double Nan = 0.0 / 0.0; | 44 static const double Nan = 0.0 / 0.0; |
45 static const double NegNan = -0.0 / 0.0; | 45 static const double NegNan = -0.0 / 0.0; |
46 assert(std::fpclassify(NegInf) == FP_INFINITE); | 46 assert(std::fpclassify(NegInf) == FP_INFINITE); |
47 assert(std::fpclassify(PosInf) == FP_INFINITE); | 47 assert(std::fpclassify(PosInf) == FP_INFINITE); |
48 assert(std::fpclassify(Nan) == FP_NAN); | 48 assert(std::fpclassify(Nan) == FP_NAN); |
49 assert(std::fpclassify(NegNan) == FP_NAN); | 49 assert(std::fpclassify(NegNan) == FP_NAN); |
50 assert(NegInf < Zero); | 50 assert(NegInf < Zero); |
51 assert(NegInf < PosInf); | 51 assert(NegInf < PosInf); |
52 assert(Zero < PosInf); | 52 assert(Zero < PosInf); |
53 static volatile double InitValues[] = | 53 static volatile double InitValues[] = |
54 FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); | 54 FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); |
55 NumValues = sizeof(InitValues) / sizeof(*InitValues); | 55 NumValues = sizeof(InitValues) / sizeof(*InitValues); |
56 Values = InitValues; | 56 Values = InitValues; |
57 } | 57 } |
58 | 58 |
59 void testsScalar(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 59 void testsScalar(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
60 typedef bool (*FuncTypeFloat)(float, float); | 60 typedef bool (*FuncTypeFloat)(float, float); |
61 typedef bool (*FuncTypeDouble)(double, double); | 61 typedef bool (*FuncTypeDouble)(double, double); |
62 static struct { | 62 static struct { |
63 const char *Name; | 63 const char *Name; |
64 FuncTypeFloat FuncFloatSz; | 64 FuncTypeFloat FuncFloatSz; |
65 FuncTypeFloat FuncFloatLlc; | 65 FuncTypeFloat FuncFloatLlc; |
66 FuncTypeDouble FuncDoubleSz; | 66 FuncTypeDouble FuncDoubleSz; |
67 FuncTypeDouble FuncDoubleLlc; | 67 FuncTypeDouble FuncDoubleLlc; |
68 } Funcs[] = { | 68 } Funcs[] = { |
69 #define X(cmp) \ | 69 #define X(cmp) \ |
70 { \ | 70 { \ |
71 "fcmp" STR(cmp), Subzero_fcmp##cmp##Float, fcmp##cmp##Float, \ | 71 "fcmp" STR(cmp), Subzero_fcmp##cmp##Float, fcmp##cmp##Float, \ |
72 Subzero_fcmp##cmp##Double, fcmp##cmp##Double \ | 72 Subzero_fcmp##cmp##Double, fcmp##cmp##Double \ |
73 } \ | 73 } \ |
74 , | 74 , |
75 FCMP_TABLE | 75 FCMP_TABLE |
76 #undef X | 76 #undef X |
77 }; | 77 }; |
78 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); | 78 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); |
79 | 79 |
80 bool ResultSz, ResultLlc; | 80 bool ResultSz, ResultLlc; |
81 | 81 |
82 assert(Values && NumValues); | 82 assert(Values && NumValues); |
83 | 83 |
84 for (size_t f = 0; f < NumFuncs; ++f) { | 84 for (size_t f = 0; f < NumFuncs; ++f) { |
85 for (size_t i = 0; i < NumValues; ++i) { | 85 for (size_t i = 0; i < NumValues; ++i) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 initializeValues(); | 167 initializeValues(); |
168 | 168 |
169 testsScalar(TotalTests, Passes, Failures); | 169 testsScalar(TotalTests, Passes, Failures); |
170 testsVector(TotalTests, Passes, Failures); | 170 testsVector(TotalTests, Passes, Failures); |
171 | 171 |
172 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 172 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
173 << " Failures=" << Failures << "\n"; | 173 << " Failures=" << Failures << "\n"; |
174 return Failures; | 174 return Failures; |
175 } | 175 } |
OLD | NEW |