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

Unified Diff: src/hydrogen.cc

Issue 11293061: Emit VMLA for multiply-add on ARM (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use VMLA instead, pass all tests(*) Created 8 years, 1 month 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 51ae7f5a44c29fc4b69f66651b95fcfef7a6f2fa..658e265b9fbb0749a4c5c1dd3c531cb633fc6fc8 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8282,6 +8282,24 @@ bool CanBeZero(HValue *right) {
}
+bool HGraphBuilder::MatchMultiplyAdd(HValue* left, HValue* right, HValue** a, HValue** b, HValue** c) {
+ if (right->IsMul()) {
+ HValue *tmp = left;
+ left = right;
+ right = tmp;
+ }
+ if (!left->IsMul())
+ return false;
+
+ HMul* mul = HMul::cast(left);
+ *a = mul->left();
+ *b = mul->right();
+ *c = right;
+ //printf("matched multiply-add\n");
+ return true;
+}
+
+
HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
HValue* left,
HValue* right) {
@@ -8294,17 +8312,27 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
}
HInstruction* instr = NULL;
switch (expr->op()) {
- case Token::ADD:
+ case Token::ADD: {
+#ifdef V8_TARGET_ARCH_ARM
+ HValue* a, *b, *c;
+#endif
if (info.IsString()) {
AddInstruction(new(zone()) HCheckNonSmi(left));
AddInstruction(HCheckInstanceType::NewIsString(left, zone()));
AddInstruction(new(zone()) HCheckNonSmi(right));
AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
instr = new(zone()) HStringAdd(context, left, right);
+#ifdef V8_TARGET_ARCH_ARM
+ } else if (info.IsDouble() && MatchMultiplyAdd(left, right, &a, &b, &c)) {
+ // FIXME: Probably need to check types here?
ulan_google 2012/11/07 09:54:03 Setting input representation should be sufficient.
+ // FIXME: I'm not sure I'm hooking this up correctly :/
+ instr = new(zone()) HMultiplyAdd(context, a, b, c);
+#endif
} else {
instr = HAdd::NewHAdd(zone(), context, left, right);
}
break;
+ }
case Token::SUB:
instr = HSub::NewHSub(zone(), context, left, right);
break;

Powered by Google App Engine
This is Rietveld 408576698