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

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: Clean up and support other targets 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..b74a5984beacf2964dd0d5ef31f330b773089aec 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;
+ return true;
+}
+
+
HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
HValue* left,
HValue* right) {
@@ -8294,17 +8312,21 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
}
HInstruction* instr = NULL;
switch (expr->op()) {
- case Token::ADD:
+ case Token::ADD: {
+ HValue* a, *b, *c;
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);
+ } else if (info.IsDouble() && MatchMultiplyAdd(left, right, &a, &b, &c)) {
+ instr = new(zone()) HMultiplyAddD(context, a, b, c);
} else {
instr = HAdd::NewHAdd(zone(), context, left, right);
}
break;
+ }
case Token::SUB:
instr = HSub::NewHSub(zone(), context, left, right);
break;
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/ia32/lithium-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698