tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 1 | #include "Benchmark.h" |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 2 | #include "SkColorPriv.h" |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 3 | #include "SkMatrix.h" |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 4 | #include "SkPaint.h" |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 5 | #include "SkRandom.h" |
| 6 | #include "SkString.h" |
| 7 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 8 | static float sk_fsel(float pred, float result_ge, float result_lt) { |
| 9 | return pred >= 0 ? result_ge : result_lt; |
| 10 | } |
| 11 | |
| 12 | static float fast_floor(float x) { |
reed@google.com | f3a8d8e | 2012-05-30 14:08:57 +0000 | [diff] [blame] | 13 | // float big = sk_fsel(x, 0x1.0p+23, -0x1.0p+23); |
| 14 | float big = sk_fsel(x, (float)(1 << 23), -(float)(1 << 23)); |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 15 | return (x + big) - big; |
| 16 | } |
| 17 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 18 | class MathBench : public Benchmark { |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 19 | enum { |
| 20 | kBuffer = 100, |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 21 | }; |
| 22 | SkString fName; |
| 23 | float fSrc[kBuffer], fDst[kBuffer]; |
| 24 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 25 | MathBench(const char name[]) { |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 26 | fName.printf("math_%s", name); |
| 27 | |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 28 | SkRandom rand; |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 29 | for (int i = 0; i < kBuffer; ++i) { |
| 30 | fSrc[i] = rand.nextSScalar1(); |
| 31 | } |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 32 | } |
tomhudson@google.com | 9dc2713 | 2012-09-13 15:50:24 +0000 | [diff] [blame] | 33 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 34 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 35 | return backend == kNonRendering_Backend; |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 36 | } |
| 37 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 38 | virtual void performTest(float* SK_RESTRICT dst, |
| 39 | const float* SK_RESTRICT src, |
robertphillips@google.com | 6853e80 | 2012-04-16 15:50:18 +0000 | [diff] [blame] | 40 | int count) = 0; |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 41 | |
| 42 | protected: |
| 43 | virtual int mulLoopCount() const { return 1; } |
| 44 | |
| 45 | virtual const char* onGetName() { |
| 46 | return fName.c_str(); |
| 47 | } |
| 48 | |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 49 | virtual void onDraw(const int loops, SkCanvas*) { |
| 50 | int n = loops * this->mulLoopCount(); |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 51 | for (int i = 0; i < n; i++) { |
| 52 | this->performTest(fDst, fSrc, kBuffer); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | private: |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 57 | typedef Benchmark INHERITED; |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 58 | }; |
| 59 | |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 60 | class MathBenchU32 : public MathBench { |
| 61 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 62 | MathBenchU32(const char name[]) : INHERITED(name) {} |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 63 | |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 64 | protected: |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 65 | virtual void performITest(uint32_t* SK_RESTRICT dst, |
| 66 | const uint32_t* SK_RESTRICT src, |
robertphillips@google.com | 6853e80 | 2012-04-16 15:50:18 +0000 | [diff] [blame] | 67 | int count) = 0; |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 68 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 69 | virtual void performTest(float* SK_RESTRICT dst, |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 70 | const float* SK_RESTRICT src, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 71 | int count) override { |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 72 | uint32_t* d = SkTCast<uint32_t*>(dst); |
| 73 | const uint32_t* s = SkTCast<const uint32_t*>(src); |
| 74 | this->performITest(d, s, count); |
| 75 | } |
| 76 | private: |
| 77 | typedef MathBench INHERITED; |
| 78 | }; |
| 79 | |
| 80 | /////////////////////////////////////////////////////////////////////////////// |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 81 | |
| 82 | class NoOpMathBench : public MathBench { |
| 83 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 84 | NoOpMathBench() : INHERITED("noOp") {} |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 85 | protected: |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 86 | virtual void performTest(float* SK_RESTRICT dst, |
| 87 | const float* SK_RESTRICT src, |
robertphillips@google.com | 6853e80 | 2012-04-16 15:50:18 +0000 | [diff] [blame] | 88 | int count) { |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 89 | for (int i = 0; i < count; ++i) { |
| 90 | dst[i] = src[i] + 1; |
| 91 | } |
| 92 | } |
| 93 | private: |
| 94 | typedef MathBench INHERITED; |
| 95 | }; |
| 96 | |
commit-bot@chromium.org | 11e5b97 | 2013-11-08 20:14:16 +0000 | [diff] [blame] | 97 | class SkRSqrtMathBench : public MathBench { |
| 98 | public: |
| 99 | SkRSqrtMathBench() : INHERITED("sk_float_rsqrt") {} |
| 100 | protected: |
| 101 | virtual void performTest(float* SK_RESTRICT dst, |
| 102 | const float* SK_RESTRICT src, |
| 103 | int count) { |
| 104 | for (int i = 0; i < count; ++i) { |
| 105 | dst[i] = sk_float_rsqrt(src[i]); |
| 106 | } |
| 107 | } |
| 108 | private: |
| 109 | typedef MathBench INHERITED; |
| 110 | }; |
| 111 | |
| 112 | |
robertphillips@google.com | 36bb270 | 2013-08-12 12:02:28 +0000 | [diff] [blame] | 113 | class SlowISqrtMathBench : public MathBench { |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 114 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 115 | SlowISqrtMathBench() : INHERITED("slowIsqrt") {} |
commit-bot@chromium.org | b3ecdc4 | 2013-08-12 08:37:51 +0000 | [diff] [blame] | 116 | protected: |
robertphillips@google.com | 36bb270 | 2013-08-12 12:02:28 +0000 | [diff] [blame] | 117 | virtual void performTest(float* SK_RESTRICT dst, |
| 118 | const float* SK_RESTRICT src, |
| 119 | int count) { |
| 120 | for (int i = 0; i < count; ++i) { |
| 121 | dst[i] = 1.0f / sk_float_sqrt(src[i]); |
commit-bot@chromium.org | b3ecdc4 | 2013-08-12 08:37:51 +0000 | [diff] [blame] | 122 | } |
commit-bot@chromium.org | b3ecdc4 | 2013-08-12 08:37:51 +0000 | [diff] [blame] | 123 | } |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 124 | private: |
robertphillips@google.com | 36bb270 | 2013-08-12 12:02:28 +0000 | [diff] [blame] | 125 | typedef MathBench INHERITED; |
| 126 | }; |
| 127 | |
| 128 | static inline float SkFastInvSqrt(float x) { |
| 129 | float xhalf = 0.5f*x; |
| 130 | int i = *SkTCast<int*>(&x); |
| 131 | i = 0x5f3759df - (i>>1); |
| 132 | x = *SkTCast<float*>(&i); |
| 133 | x = x*(1.5f-xhalf*x*x); |
| 134 | // x = x*(1.5f-xhalf*x*x); // this line takes err from 10^-3 to 10^-6 |
| 135 | return x; |
| 136 | } |
| 137 | |
| 138 | class FastISqrtMathBench : public MathBench { |
| 139 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 140 | FastISqrtMathBench() : INHERITED("fastIsqrt") {} |
robertphillips@google.com | 36bb270 | 2013-08-12 12:02:28 +0000 | [diff] [blame] | 141 | protected: |
| 142 | virtual void performTest(float* SK_RESTRICT dst, |
| 143 | const float* SK_RESTRICT src, |
| 144 | int count) { |
| 145 | for (int i = 0; i < count; ++i) { |
| 146 | dst[i] = SkFastInvSqrt(src[i]); |
| 147 | } |
| 148 | } |
| 149 | private: |
| 150 | typedef MathBench INHERITED; |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 151 | }; |
| 152 | |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 153 | static inline uint32_t QMul64(uint32_t value, U8CPU alpha) { |
| 154 | SkASSERT((uint8_t)alpha == alpha); |
| 155 | const uint32_t mask = 0xFF00FF; |
| 156 | |
| 157 | uint64_t tmp = value; |
| 158 | tmp = (tmp & mask) | ((tmp & ~mask) << 24); |
| 159 | tmp *= alpha; |
caryclark@google.com | 19069a2 | 2012-06-06 12:11:45 +0000 | [diff] [blame] | 160 | return (uint32_t) (((tmp >> 8) & mask) | ((tmp >> 32) & ~mask)); |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | class QMul64Bench : public MathBenchU32 { |
| 164 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 165 | QMul64Bench() : INHERITED("qmul64") {} |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 166 | protected: |
| 167 | virtual void performITest(uint32_t* SK_RESTRICT dst, |
| 168 | const uint32_t* SK_RESTRICT src, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 169 | int count) override { |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 170 | for (int i = 0; i < count; ++i) { |
| 171 | dst[i] = QMul64(src[i], (uint8_t)i); |
| 172 | } |
| 173 | } |
| 174 | private: |
| 175 | typedef MathBenchU32 INHERITED; |
| 176 | }; |
| 177 | |
| 178 | class QMul32Bench : public MathBenchU32 { |
| 179 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 180 | QMul32Bench() : INHERITED("qmul32") {} |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 181 | protected: |
| 182 | virtual void performITest(uint32_t* SK_RESTRICT dst, |
| 183 | const uint32_t* SK_RESTRICT src, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 184 | int count) override { |
reed@google.com | e05cc8e | 2011-10-10 14:19:40 +0000 | [diff] [blame] | 185 | for (int i = 0; i < count; ++i) { |
| 186 | dst[i] = SkAlphaMulQ(src[i], (uint8_t)i); |
| 187 | } |
| 188 | } |
| 189 | private: |
| 190 | typedef MathBenchU32 INHERITED; |
| 191 | }; |
| 192 | |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 193 | /////////////////////////////////////////////////////////////////////////////// |
| 194 | |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 195 | static bool isFinite_int(float x) { |
| 196 | uint32_t bits = SkFloat2Bits(x); // need unsigned for our shifts |
| 197 | int exponent = bits << 1 >> 24; |
| 198 | return exponent != 0xFF; |
| 199 | } |
| 200 | |
| 201 | static bool isFinite_float(float x) { |
robertphillips@google.com | 6853e80 | 2012-04-16 15:50:18 +0000 | [diff] [blame] | 202 | return SkToBool(sk_float_isfinite(x)); |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | static bool isFinite_mulzero(float x) { |
| 206 | float y = x * 0; |
| 207 | return y == y; |
| 208 | } |
| 209 | |
| 210 | static bool isfinite_and_int(const float data[4]) { |
| 211 | return isFinite_int(data[0]) && isFinite_int(data[1]) && isFinite_int(data[2]) && isFinite_int(data[3]); |
| 212 | } |
| 213 | |
| 214 | static bool isfinite_and_float(const float data[4]) { |
| 215 | return isFinite_float(data[0]) && isFinite_float(data[1]) && isFinite_float(data[2]) && isFinite_float(data[3]); |
| 216 | } |
| 217 | |
| 218 | static bool isfinite_and_mulzero(const float data[4]) { |
| 219 | return isFinite_mulzero(data[0]) && isFinite_mulzero(data[1]) && isFinite_mulzero(data[2]) && isFinite_mulzero(data[3]); |
| 220 | } |
| 221 | |
| 222 | #define mulzeroadd(data) (data[0]*0 + data[1]*0 + data[2]*0 + data[3]*0) |
| 223 | |
| 224 | static bool isfinite_plus_int(const float data[4]) { |
| 225 | return isFinite_int(mulzeroadd(data)); |
| 226 | } |
| 227 | |
| 228 | static bool isfinite_plus_float(const float data[4]) { |
reed@google.com | 5ae777d | 2011-12-06 20:18:05 +0000 | [diff] [blame] | 229 | return !sk_float_isnan(mulzeroadd(data)); |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | static bool isfinite_plus_mulzero(const float data[4]) { |
| 233 | float x = mulzeroadd(data); |
| 234 | return x == x; |
| 235 | } |
| 236 | |
| 237 | typedef bool (*IsFiniteProc)(const float[]); |
| 238 | |
| 239 | #define MAKEREC(name) { name, #name } |
| 240 | |
| 241 | static const struct { |
| 242 | IsFiniteProc fProc; |
| 243 | const char* fName; |
| 244 | } gRec[] = { |
| 245 | MAKEREC(isfinite_and_int), |
| 246 | MAKEREC(isfinite_and_float), |
| 247 | MAKEREC(isfinite_and_mulzero), |
| 248 | MAKEREC(isfinite_plus_int), |
| 249 | MAKEREC(isfinite_plus_float), |
| 250 | MAKEREC(isfinite_plus_mulzero), |
| 251 | }; |
| 252 | |
| 253 | #undef MAKEREC |
| 254 | |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 255 | static bool isFinite(const SkRect& r) { |
| 256 | // x * 0 will be NaN iff x is infinity or NaN. |
| 257 | // a + b will be NaN iff either a or b is NaN. |
| 258 | float value = r.fLeft * 0 + r.fTop * 0 + r.fRight * 0 + r.fBottom * 0; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 259 | |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 260 | // value is either NaN or it is finite (zero). |
| 261 | // value==value will be true iff value is not NaN |
| 262 | return value == value; |
| 263 | } |
| 264 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 265 | class IsFiniteBench : public Benchmark { |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 266 | enum { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 267 | N = 1000, |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 268 | }; |
| 269 | float fData[N]; |
| 270 | public: |
| 271 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 272 | IsFiniteBench(int index) { |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 273 | SkRandom rand; |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 274 | |
| 275 | for (int i = 0; i < N; ++i) { |
| 276 | fData[i] = rand.nextSScalar1(); |
| 277 | } |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 278 | |
| 279 | if (index < 0) { |
| 280 | fProc = NULL; |
| 281 | fName = "isfinite_rect"; |
| 282 | } else { |
| 283 | fProc = gRec[index].fProc; |
| 284 | fName = gRec[index].fName; |
| 285 | } |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 286 | } |
| 287 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 288 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 289 | return backend == kNonRendering_Backend; |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | protected: |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 293 | virtual void onDraw(const int loops, SkCanvas*) { |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 294 | IsFiniteProc proc = fProc; |
| 295 | const float* data = fData; |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 296 | // do this so the compiler won't throw away the function call |
| 297 | int counter = 0; |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 298 | |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 299 | if (proc) { |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 300 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 301 | for (int i = 0; i < N - 4; ++i) { |
| 302 | counter += proc(&data[i]); |
| 303 | } |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 304 | } |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 305 | } else { |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 306 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 307 | for (int i = 0; i < N - 4; ++i) { |
| 308 | const SkRect* r = reinterpret_cast<const SkRect*>(&data[i]); |
caryclark@google.com | 19069a2 | 2012-06-06 12:11:45 +0000 | [diff] [blame] | 309 | if (false) { // avoid bit rot, suppress warning |
| 310 | isFinite(*r); |
| 311 | } |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 312 | counter += r->isFinite(); |
| 313 | } |
| 314 | } |
| 315 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 316 | |
reed@google.com | 1607863 | 2011-12-06 18:56:37 +0000 | [diff] [blame] | 317 | SkPaint paint; |
| 318 | if (paint.getAlpha() == 0) { |
| 319 | SkDebugf("%d\n", counter); |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 320 | } |
| 321 | } |
| 322 | |
| 323 | virtual const char* onGetName() { |
| 324 | return fName; |
| 325 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 326 | |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 327 | private: |
| 328 | IsFiniteProc fProc; |
| 329 | const char* fName; |
| 330 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 331 | typedef Benchmark INHERITED; |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 332 | }; |
| 333 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 334 | class FloorBench : public Benchmark { |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 335 | enum { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 336 | ARRAY = 1000, |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 337 | }; |
| 338 | float fData[ARRAY]; |
| 339 | bool fFast; |
| 340 | public: |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 341 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 342 | FloorBench(bool fast) : fFast(fast) { |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 343 | SkRandom rand; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 344 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 345 | for (int i = 0; i < ARRAY; ++i) { |
| 346 | fData[i] = rand.nextSScalar1(); |
| 347 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 348 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 349 | if (fast) { |
| 350 | fName = "floor_fast"; |
| 351 | } else { |
| 352 | fName = "floor_std"; |
| 353 | } |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 354 | } |
| 355 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 356 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 357 | return backend == kNonRendering_Backend; |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 358 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 359 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 360 | virtual void process(float) {} |
| 361 | |
| 362 | protected: |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 363 | virtual void onDraw(const int loops, SkCanvas*) { |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 364 | SkRandom rand; |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 365 | float accum = 0; |
| 366 | const float* data = fData; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 367 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 368 | if (fFast) { |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 369 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 370 | for (int i = 0; i < ARRAY; ++i) { |
| 371 | accum += fast_floor(data[i]); |
| 372 | } |
| 373 | this->process(accum); |
| 374 | } |
| 375 | } else { |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 376 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 377 | for (int i = 0; i < ARRAY; ++i) { |
| 378 | accum += sk_float_floor(data[i]); |
| 379 | } |
| 380 | this->process(accum); |
| 381 | } |
| 382 | } |
| 383 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 384 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 385 | virtual const char* onGetName() { |
| 386 | return fName; |
| 387 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 388 | |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 389 | private: |
| 390 | const char* fName; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 391 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 392 | typedef Benchmark INHERITED; |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 393 | }; |
| 394 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 395 | class CLZBench : public Benchmark { |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 396 | enum { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 397 | ARRAY = 1000, |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 398 | }; |
| 399 | uint32_t fData[ARRAY]; |
| 400 | bool fUsePortable; |
| 401 | |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 402 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 403 | CLZBench(bool usePortable) : fUsePortable(usePortable) { |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 404 | |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 405 | SkRandom rand; |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 406 | for (int i = 0; i < ARRAY; ++i) { |
| 407 | fData[i] = rand.nextU(); |
| 408 | } |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 409 | |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 410 | if (fUsePortable) { |
| 411 | fName = "clz_portable"; |
| 412 | } else { |
| 413 | fName = "clz_intrinsic"; |
| 414 | } |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 415 | } |
| 416 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 417 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 418 | return backend == kNonRendering_Backend; |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 419 | } |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 420 | |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 421 | // just so the compiler doesn't remove our loops |
| 422 | virtual void process(int) {} |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 423 | |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 424 | protected: |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 425 | virtual void onDraw(const int loops, SkCanvas*) { |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 426 | int accum = 0; |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 427 | |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 428 | if (fUsePortable) { |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 429 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 430 | for (int i = 0; i < ARRAY; ++i) { |
| 431 | accum += SkCLZ_portable(fData[i]); |
| 432 | } |
| 433 | this->process(accum); |
| 434 | } |
| 435 | } else { |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 436 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 437 | for (int i = 0; i < ARRAY; ++i) { |
| 438 | accum += SkCLZ(fData[i]); |
| 439 | } |
| 440 | this->process(accum); |
| 441 | } |
| 442 | } |
| 443 | } |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 444 | |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 445 | virtual const char* onGetName() { |
| 446 | return fName; |
| 447 | } |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 448 | |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 449 | private: |
| 450 | const char* fName; |
skia.committer@gmail.com | 8152113 | 2013-04-30 07:01:03 +0000 | [diff] [blame] | 451 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 452 | typedef Benchmark INHERITED; |
reed@google.com | 0d7aac9 | 2013-04-29 13:55:11 +0000 | [diff] [blame] | 453 | }; |
| 454 | |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 455 | /////////////////////////////////////////////////////////////////////////////// |
| 456 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 457 | class NormalizeBench : public Benchmark { |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 458 | enum { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 459 | ARRAY =1000, |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 460 | }; |
| 461 | SkVector fVec[ARRAY]; |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 462 | |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 463 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 464 | NormalizeBench() { |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 465 | SkRandom rand; |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 466 | for (int i = 0; i < ARRAY; ++i) { |
| 467 | fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1()); |
| 468 | } |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 469 | |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 470 | fName = "point_normalize"; |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 471 | } |
| 472 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 473 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 474 | return backend == kNonRendering_Backend; |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 475 | } |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 476 | |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 477 | // just so the compiler doesn't remove our loops |
| 478 | virtual void process(int) {} |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 479 | |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 480 | protected: |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 481 | virtual void onDraw(const int loops, SkCanvas*) { |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 482 | int accum = 0; |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 483 | |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 484 | for (int j = 0; j < loops; ++j) { |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 485 | for (int i = 0; i < ARRAY; ++i) { |
| 486 | accum += fVec[i].normalize(); |
| 487 | } |
| 488 | this->process(accum); |
| 489 | } |
| 490 | } |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 491 | |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 492 | virtual const char* onGetName() { |
| 493 | return fName; |
| 494 | } |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 495 | |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 496 | private: |
| 497 | const char* fName; |
skia.committer@gmail.com | ecc9d28 | 2013-05-04 07:01:15 +0000 | [diff] [blame] | 498 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 499 | typedef Benchmark INHERITED; |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 500 | }; |
| 501 | |
| 502 | /////////////////////////////////////////////////////////////////////////////// |
| 503 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 504 | class FixedMathBench : public Benchmark { |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 505 | enum { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 506 | N = 1000, |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 507 | }; |
| 508 | float fData[N]; |
| 509 | SkFixed fResult[N]; |
| 510 | public: |
| 511 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 512 | FixedMathBench() { |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 513 | SkRandom rand; |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 514 | for (int i = 0; i < N; ++i) { |
| 515 | fData[i] = rand.nextSScalar1(); |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 516 | } |
| 517 | |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 518 | } |
| 519 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 520 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 521 | return backend == kNonRendering_Backend; |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | protected: |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 525 | virtual void onDraw(const int loops, SkCanvas*) { |
| 526 | for (int j = 0; j < loops; ++j) { |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 527 | for (int i = 0; i < N - 4; ++i) { |
| 528 | fResult[i] = SkFloatToFixed(fData[i]); |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | SkPaint paint; |
| 533 | if (paint.getAlpha() == 0) { |
| 534 | SkDebugf("%d\n", fResult[0]); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | virtual const char* onGetName() { |
| 539 | return "float_to_fixed"; |
| 540 | } |
| 541 | |
| 542 | private: |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 543 | typedef Benchmark INHERITED; |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 544 | }; |
| 545 | |
| 546 | /////////////////////////////////////////////////////////////////////////////// |
| 547 | |
commit-bot@chromium.org | 2c86fbb | 2013-09-26 19:22:54 +0000 | [diff] [blame] | 548 | template <typename T> |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 549 | class DivModBench : public Benchmark { |
mtklein@google.com | 9cb5177 | 2013-09-27 13:39:14 +0000 | [diff] [blame] | 550 | SkString fName; |
commit-bot@chromium.org | 2c86fbb | 2013-09-26 19:22:54 +0000 | [diff] [blame] | 551 | public: |
mtklein@google.com | 9cb5177 | 2013-09-27 13:39:14 +0000 | [diff] [blame] | 552 | explicit DivModBench(const char* name) { |
| 553 | fName.printf("divmod_%s", name); |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 554 | } |
| 555 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 556 | bool isSuitableFor(Backend backend) override { |
commit-bot@chromium.org | 644629c | 2013-11-21 06:21:58 +0000 | [diff] [blame] | 557 | return backend == kNonRendering_Backend; |
commit-bot@chromium.org | 2c86fbb | 2013-09-26 19:22:54 +0000 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | protected: |
| 561 | virtual const char* onGetName() { |
mtklein@google.com | 9cb5177 | 2013-09-27 13:39:14 +0000 | [diff] [blame] | 562 | return fName.c_str(); |
commit-bot@chromium.org | 2c86fbb | 2013-09-26 19:22:54 +0000 | [diff] [blame] | 563 | } |
| 564 | |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 565 | virtual void onDraw(const int loops, SkCanvas*) { |
commit-bot@chromium.org | 2c86fbb | 2013-09-26 19:22:54 +0000 | [diff] [blame] | 566 | volatile T a = 0, b = 0; |
| 567 | T div = 0, mod = 0; |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 568 | for (int i = 0; i < loops; i++) { |
commit-bot@chromium.org | 2c86fbb | 2013-09-26 19:22:54 +0000 | [diff] [blame] | 569 | if ((T)i == 0) continue; // Small T will wrap around. |
| 570 | SkTDivMod((T)(i+1), (T)i, &div, &mod); |
| 571 | a ^= div; |
| 572 | b ^= mod; |
| 573 | } |
| 574 | } |
| 575 | }; |
| 576 | DEF_BENCH(return new DivModBench<uint8_t>("uint8_t")) |
| 577 | DEF_BENCH(return new DivModBench<uint16_t>("uint16_t")) |
| 578 | DEF_BENCH(return new DivModBench<uint32_t>("uint32_t")) |
| 579 | DEF_BENCH(return new DivModBench<uint64_t>("uint64_t")) |
| 580 | |
| 581 | DEF_BENCH(return new DivModBench<int8_t>("int8_t")) |
| 582 | DEF_BENCH(return new DivModBench<int16_t>("int16_t")) |
| 583 | DEF_BENCH(return new DivModBench<int32_t>("int32_t")) |
| 584 | DEF_BENCH(return new DivModBench<int64_t>("int64_t")) |
| 585 | |
| 586 | /////////////////////////////////////////////////////////////////////////////// |
| 587 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 588 | DEF_BENCH( return new NoOpMathBench(); ) |
commit-bot@chromium.org | 11e5b97 | 2013-11-08 20:14:16 +0000 | [diff] [blame] | 589 | DEF_BENCH( return new SkRSqrtMathBench(); ) |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 590 | DEF_BENCH( return new SlowISqrtMathBench(); ) |
| 591 | DEF_BENCH( return new FastISqrtMathBench(); ) |
| 592 | DEF_BENCH( return new QMul64Bench(); ) |
| 593 | DEF_BENCH( return new QMul32Bench(); ) |
reed@google.com | ddc518b | 2011-08-29 17:49:23 +0000 | [diff] [blame] | 594 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 595 | DEF_BENCH( return new IsFiniteBench(-1); ) |
| 596 | DEF_BENCH( return new IsFiniteBench(0); ) |
| 597 | DEF_BENCH( return new IsFiniteBench(1); ) |
| 598 | DEF_BENCH( return new IsFiniteBench(2); ) |
| 599 | DEF_BENCH( return new IsFiniteBench(3); ) |
| 600 | DEF_BENCH( return new IsFiniteBench(4); ) |
| 601 | DEF_BENCH( return new IsFiniteBench(5); ) |
reed@google.com | 0be5eb7 | 2011-12-05 21:53:22 +0000 | [diff] [blame] | 602 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 603 | DEF_BENCH( return new FloorBench(false); ) |
| 604 | DEF_BENCH( return new FloorBench(true); ) |
reed@google.com | 7f19241 | 2012-05-30 12:26:52 +0000 | [diff] [blame] | 605 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 606 | DEF_BENCH( return new CLZBench(false); ) |
| 607 | DEF_BENCH( return new CLZBench(true); ) |
reed@google.com | 0889f68 | 2013-05-03 12:56:39 +0000 | [diff] [blame] | 608 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 609 | DEF_BENCH( return new NormalizeBench(); ) |
djsollen@google.com | 25a11e4 | 2013-07-18 19:11:30 +0000 | [diff] [blame] | 610 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 611 | DEF_BENCH( return new FixedMathBench(); ) |