diff options
author | Alexandre Rames <alexandre.rames@arm.com> | 2015-03-11 16:48:16 +0000 |
---|---|---|
committer | Alexandre Rames <alexandre.rames@arm.com> | 2015-03-11 16:48:16 +0000 |
commit | b2fd7bca70b580921eebf7c45769c39d2dfd8a5a (patch) | |
tree | c5dae29519df73f889ba14495eb79d545cd7d6e5 /runtime/utils.h | |
parent | 356286f989941ac495417195e4129aaceaf36a83 (diff) | |
download | art-b2fd7bca70b580921eebf7c45769c39d2dfd8a5a.zip art-b2fd7bca70b580921eebf7c45769c39d2dfd8a5a.tar.gz art-b2fd7bca70b580921eebf7c45769c39d2dfd8a5a.tar.bz2 |
Opt compiler: Basic simplification for arithmetic operations.
The optimisations in this patch do not look further than the
inputs of each operation.
Change-Id: Iddd0ab6b360b9e7bb042db22086d51a31be85530
Diffstat (limited to 'runtime/utils.h')
-rw-r--r-- | runtime/utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/utils.h b/runtime/utils.h index d294f4b..7a96672 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -271,6 +271,12 @@ static constexpr int CTZ(T x) { } template<typename T> +static inline int WhichPowerOf2(T x) { + DCHECK((x != 0) && IsPowerOfTwo(x)); + return CTZ(x); +} + +template<typename T> static constexpr int POPCOUNT(T x) { return (sizeof(T) == sizeof(uint32_t)) ? __builtin_popcount(x) |