From 2c86fbb0b14a1f674bf56ea5ad6a086cc004a76e Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Thu, 26 Sep 2013 19:22:54 +0000 Subject: 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 --- bench/MathBench.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'bench/MathBench.cpp') 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 +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")) +DEF_BENCH(return new DivModBench("uint16_t")) +DEF_BENCH(return new DivModBench("uint32_t")) +DEF_BENCH(return new DivModBench("uint64_t")) + +DEF_BENCH(return new DivModBench("int8_t")) +DEF_BENCH(return new DivModBench("int16_t")) +DEF_BENCH(return new DivModBench("int32_t")) +DEF_BENCH(return new DivModBench("int64_t")) + +/////////////////////////////////////////////////////////////////////////////// + DEF_BENCH( return new NoOpMathBench(); ) DEF_BENCH( return new SlowISqrtMathBench(); ) DEF_BENCH( return new FastISqrtMathBench(); ) -- cgit v1.2.3