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
diff --git a/runtime/primitive.h b/runtime/primitive.h
index 9dda144..2d6b6b3 100644
--- a/runtime/primitive.h
+++ b/runtime/primitive.h
@@ -165,6 +165,10 @@
     }
   }
 
+  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 d294f4b..7a96672 100644
--- a/runtime/utils.h
+++ b/runtime/utils.h
@@ -271,6 +271,12 @@
 }
 
 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)