Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2341683003: DBC: Double converstion instructions (Closed)
Patch Set: Use uint64_t Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index 3566b6c4aeea2d93e78152b22c0c0335b9af7c4e..aca13bdda4f4d677e5fae7d59cca94a1699c7b3f 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -34,9 +34,6 @@ DECLARE_FLAG(int, optimization_counter_threshold);
M(BinaryInt32Op) \
M(Int32ToDouble) \
M(DoubleToInteger) \
- M(DoubleToDouble) \
- M(DoubleToFloat) \
- M(FloatToDouble) \
M(BoxInt64) \
M(MergedMath) \
M(GuardFieldClass) \
@@ -743,6 +740,20 @@ EMIT_NATIVE_CODE(StoreIndexed, 3, Location::NoLocation(),
}
break;
}
+ case kTypedDataFloat32ArrayCid:
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (index_scale() == 1) {
+ __ StoreIndexedFloat32(array, index, value);
+ } else if (index_scale() == 4) {
+ __ StoreIndexed4Float32(array, index, value);
+ } else {
+ __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
+ __ StoreIndexedFloat32(array, temp, value);
+ }
+ break;
case kTypedDataFloat64ArrayCid:
if (IsExternal()) {
Unsupported(compiler);
@@ -807,10 +818,18 @@ EMIT_NATIVE_CODE(LoadIndexed, 2, Location::RequiresRegister(),
Unsupported(compiler);
UNREACHABLE();
}
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
__ LoadIndexedTwoByteString(result, array, index);
break;
case kTypedDataInt32ArrayCid:
ASSERT(representation() == kUnboxedInt32);
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
if (index_scale() == 1) {
__ LoadIndexedInt32(result, array, index);
} else {
@@ -820,6 +839,10 @@ EMIT_NATIVE_CODE(LoadIndexed, 2, Location::RequiresRegister(),
break;
case kTypedDataUint32ArrayCid:
ASSERT(representation() == kUnboxedUint32);
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
if (index_scale() == 1) {
__ LoadIndexedUint32(result, array, index);
} else {
@@ -827,7 +850,25 @@ EMIT_NATIVE_CODE(LoadIndexed, 2, Location::RequiresRegister(),
__ LoadIndexedUint32(result, array, temp);
}
break;
+ case kTypedDataFloat32ArrayCid:
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (index_scale() == 1) {
+ __ LoadIndexedFloat32(result, array, index);
+ } else if (index_scale() == 4) {
+ __ LoadIndexed4Float32(result, array, index);
+ } else {
+ __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
+ __ LoadIndexedFloat32(result, array, temp);
+ }
+ break;
case kTypedDataFloat64ArrayCid:
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
if (index_scale() == 1) {
__ LoadIndexedFloat64(result, array, index);
} else if (index_scale() == 8) {
@@ -1597,6 +1638,39 @@ EMIT_NATIVE_CODE(MathUnary, 1, Location::RequiresRegister()) {
}
+EMIT_NATIVE_CODE(DoubleToDouble, 1, Location::RequiresRegister()) {
+ const Register in = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ switch (recognized_kind()) {
+ case MethodRecognizer::kDoubleTruncate:
+ __ DTruncate(result, in);
+ break;
+ case MethodRecognizer::kDoubleFloor:
+ __ DFloor(result, in);
+ break;
+ case MethodRecognizer::kDoubleCeil:
+ __ DCeil(result, in);
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+
+EMIT_NATIVE_CODE(DoubleToFloat, 1, Location::RequiresRegister()) {
+ const Register in = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ __ DoubleToFloat(result, in);
+}
+
+
+EMIT_NATIVE_CODE(FloatToDouble, 1, Location::RequiresRegister()) {
+ const Register in = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ __ FloatToDouble(result, in);
+}
+
+
EMIT_NATIVE_CODE(InvokeMathCFunction,
InputCount(), Location::RequiresRegister()) {
const Register left = locs()->in(0).reg();
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698