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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 23144003: Fold Box(Unbox(v)) and Unbox(Box(v)) for Float32x4 and Uint32x4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index d9bf0cc461e6293d1e2e6e68fa6a8088216734c7..461c1e6491e11d3b5aa4e91d6bff37bbb57da4ef 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1427,6 +1427,52 @@ Definition* UnboxDoubleInstr::Canonicalize(FlowGraph* flow_graph) {
}
+Definition* BoxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) {
+ if (input_use_list() == NULL) {
+ // Environments can accomodate any representation. No need to box.
+ return value()->definition();
+ }
+
+ // Fold away BoxFloat32x4(UnboxFloat32x4(v)).
+ UnboxFloat32x4Instr* defn = value()->definition()->AsUnboxFloat32x4();
+ if ((defn != NULL) && (defn->value()->Type()->ToCid() == kFloat32x4Cid)) {
+ return defn->value()->definition();
+ }
+
+ return this;
+}
+
+
+Definition* UnboxFloat32x4Instr::Canonicalize(FlowGraph* flow_graph) {
+ // Fold away UnboxFloat32x4(BoxFloat32x4(v)).
+ BoxFloat32x4Instr* defn = value()->definition()->AsBoxFloat32x4();
+ return (defn != NULL) ? defn->value()->definition() : this;
+}
+
+
+Definition* BoxUint32x4Instr::Canonicalize(FlowGraph* flow_graph) {
+ if (input_use_list() == NULL) {
+ // Environments can accomodate any representation. No need to box.
+ return value()->definition();
+ }
+
+ // Fold away BoxUint32x4(UnboxUint32x4(v)).
+ UnboxUint32x4Instr* defn = value()->definition()->AsUnboxUint32x4();
+ if ((defn != NULL) && (defn->value()->Type()->ToCid() == kUint32x4Cid)) {
+ return defn->value()->definition();
+ }
+
+ return this;
+}
+
+
+Definition* UnboxUint32x4Instr::Canonicalize(FlowGraph* flow_graph) {
+ // Fold away UnboxUint32x4(BoxUint32x4(v)).
+ BoxUint32x4Instr* defn = value()->definition()->AsBoxUint32x4();
+ return (defn != NULL) ? defn->value()->definition() : this;
+}
+
+
Instruction* BranchInstr::Canonicalize(FlowGraph* flow_graph) {
// Only handle strict-compares.
if (comparison()->IsStrictCompare()) {
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698