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

Unified Diff: src/compiler/representation-change.h

Issue 596703004: [turbofan] Add backend support for float32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 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 | « src/compiler/register-allocator.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.h
diff --git a/src/compiler/representation-change.h b/src/compiler/representation-change.h
index aaa248eab86f65e29e8284ab091500d4f29abbc7..e9486f332a3f77aa09cc449419a23bfaa665a1f8 100644
--- a/src/compiler/representation-change.h
+++ b/src/compiler/representation-change.h
@@ -51,10 +51,10 @@ class RepresentationChanger {
}
if (use_type & kRepTagged) {
return GetTaggedRepresentationFor(node, output_type);
+ } else if (use_type & kRepFloat32) {
+ return GetFloat32RepresentationFor(node, output_type);
} else if (use_type & kRepFloat64) {
return GetFloat64RepresentationFor(node, output_type);
- } else if (use_type & kRepFloat32) {
- return TypeError(node, output_type, use_type); // TODO(titzer): handle
} else if (use_type & kRepBit) {
return GetBitRepresentationFor(node, output_type);
} else if (use_type & rWord) {
@@ -103,6 +103,10 @@ class RepresentationChanger {
} else {
return TypeError(node, output_type, kRepTagged);
}
+ } else if (output_type & kRepFloat32) {
+ node = jsgraph()->graph()->NewNode(machine()->ChangeFloat32ToFloat64(),
+ node);
+ op = simplified()->ChangeFloat64ToTagged();
} else if (output_type & kRepFloat64) {
op = simplified()->ChangeFloat64ToTagged();
} else {
@@ -111,6 +115,19 @@ class RepresentationChanger {
return jsgraph()->graph()->NewNode(op, node);
}
+ Node* GetFloat32RepresentationFor(Node* node, MachineTypeUnion output_type) {
+ // Eagerly fold representation changes for constants.
+ switch (node->opcode()) {
+ // TODO(turbofan): NumberConstant, Int32Constant, and Float64Constant?
+ case IrOpcode::kFloat32Constant:
+ return node; // No change necessary.
+ default:
+ break;
+ }
+ // TODO(turbofan): Select the correct X -> Float32 operator.
+ return TypeError(node, output_type, kRepFloat32);
+ }
+
Node* GetFloat64RepresentationFor(Node* node, MachineTypeUnion output_type) {
// Eagerly fold representation changes for constants.
switch (node->opcode()) {
@@ -141,6 +158,8 @@ class RepresentationChanger {
}
} else if (output_type & kRepTagged) {
op = simplified()->ChangeTaggedToFloat64();
+ } else if (output_type & kRepFloat32) {
+ op = machine()->ChangeFloat32ToFloat64();
} else {
return TypeError(node, output_type, kRepFloat64);
}
@@ -353,8 +372,9 @@ class RepresentationChanger {
SimplifiedOperatorBuilder* simplified() { return simplified_; }
MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
};
-}
-}
-} // namespace v8::internal::compiler
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
#endif // V8_COMPILER_REPRESENTATION_CHANGE_H_
« no previous file with comments | « src/compiler/register-allocator.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698