diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-26 19:22:54 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-26 19:22:54 +0000 |
commit | 2c86fbb0b14a1f674bf56ea5ad6a086cc004a76e (patch) | |
tree | 39c7755bf8736c85ae8c3d35d8e4c273140932b1 /bench/MathBench.cpp | |
parent | 52753b93518d2ad3322c2807799eacb869e9f9d9 (diff) |
Add SkDivMod with a special case for ARM.
BUG=skia:1663
R=djsollen@google.com, tomhudson@google.com, reed@google.com
Author: mtklein@google.com
Review URL: https://chromiumcodereview.appspot.com/24159009
git-svn-id: http://skia.googlecode.com/svn/trunk@11482 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/MathBench.cpp')
-rw-r--r-- | bench/MathBench.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp index c34be44303..260159f3f0 100644 --- a/bench/MathBench.cpp +++ b/bench/MathBench.cpp @@ -512,6 +512,42 @@ private: /////////////////////////////////////////////////////////////////////////////// +template <typename T> +class DivModBench : public SkBenchmark { + const char* fName; +public: + explicit DivModBench(const char* name) : fName(name) { + fIsRendering = false; + } + +protected: + virtual const char* onGetName() { + return SkStringPrintf("divmod_%s", fName).c_str(); + } + + virtual void onDraw(SkCanvas*) { + volatile T a = 0, b = 0; + T div = 0, mod = 0; + for (int i = 0; i < this->getLoops(); i++) { + if ((T)i == 0) continue; // Small T will wrap around. + SkTDivMod((T)(i+1), (T)i, &div, &mod); + a ^= div; + b ^= mod; + } + } +}; +DEF_BENCH(return new DivModBench<uint8_t>("uint8_t")) +DEF_BENCH(return new DivModBench<uint16_t>("uint16_t")) +DEF_BENCH(return new DivModBench<uint32_t>("uint32_t")) +DEF_BENCH(return new DivModBench<uint64_t>("uint64_t")) + +DEF_BENCH(return new DivModBench<int8_t>("int8_t")) +DEF_BENCH(return new DivModBench<int16_t>("int16_t")) +DEF_BENCH(return new DivModBench<int32_t>("int32_t")) +DEF_BENCH(return new DivModBench<int64_t>("int64_t")) + +/////////////////////////////////////////////////////////////////////////////// + DEF_BENCH( return new NoOpMathBench(); ) DEF_BENCH( return new SlowISqrtMathBench(); ) DEF_BENCH( return new FastISqrtMathBench(); ) |