summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2015-03-12 17:00:14 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-12 17:00:15 +0000
commit97d30aca68af2aa4f114a01d7a7d73e4bf009fe0 (patch)
treee441187dfab14ffab41aff6576df6aaa14ce8b1c /runtime
parent3848c4fbc189287bca1298d45d07e21ec90c7c82 (diff)
parentb2fd7bca70b580921eebf7c45769c39d2dfd8a5a (diff)
downloadandroid_art-97d30aca68af2aa4f114a01d7a7d73e4bf009fe0.tar.gz
android_art-97d30aca68af2aa4f114a01d7a7d73e4bf009fe0.tar.bz2
android_art-97d30aca68af2aa4f114a01d7a7d73e4bf009fe0.zip
Merge "Opt compiler: Basic simplification for arithmetic operations."
Diffstat (limited to 'runtime')
-rw-r--r--runtime/primitive.h4
-rw-r--r--runtime/utils.h6
2 files changed, 10 insertions, 0 deletions
diff --git a/runtime/primitive.h b/runtime/primitive.h
index 9dda144755..2d6b6b30c7 100644
--- a/runtime/primitive.h
+++ b/runtime/primitive.h
@@ -165,6 +165,10 @@ class Primitive {
}
}
+ static bool IsIntOrLongType(Type type) {
+ return type == kPrimInt || type == kPrimLong;
+ }
+
static bool Is64BitType(Type type) {
return type == kPrimLong || type == kPrimDouble;
}
diff --git a/runtime/utils.h b/runtime/utils.h
index 0c11610932..cd04c3ff2c 100644
--- a/runtime/utils.h
+++ b/runtime/utils.h
@@ -289,6 +289,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)