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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 8264 matching lines...) Expand 10 before | Expand all | Expand 10 after
8275 HConstant* right_const = HConstant::cast(right); 8275 HConstant* right_const = HConstant::cast(right);
8276 if (right_const->HasInteger32Value() && 8276 if (right_const->HasInteger32Value() &&
8277 (right_const->Integer32Value() & 0x1f) != 0) { 8277 (right_const->Integer32Value() & 0x1f) != 0) {
8278 return false; 8278 return false;
8279 } 8279 }
8280 } 8280 }
8281 return true; 8281 return true;
8282 } 8282 }
8283 8283
8284 8284
8285 bool HGraphBuilder::MatchMultiplyAdd(HValue* left, HValue* right, HValue** a, HV alue** b, HValue** c) {
8286 if (right->IsMul()) {
8287 HValue *tmp = left;
8288 left = right;
8289 right = tmp;
8290 }
8291 if (!left->IsMul())
8292 return false;
8293
8294 HMul* mul = HMul::cast(left);
8295 *a = mul->left();
8296 *b = mul->right();
8297 *c = right;
8298 //printf("matched multiply-add\n");
8299 return true;
8300 }
8301
8302
8285 HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, 8303 HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
8286 HValue* left, 8304 HValue* left,
8287 HValue* right) { 8305 HValue* right) {
8288 HValue* context = environment()->LookupContext(); 8306 HValue* context = environment()->LookupContext();
8289 TypeInfo info = oracle()->BinaryType(expr); 8307 TypeInfo info = oracle()->BinaryType(expr);
8290 if (info.IsUninitialized()) { 8308 if (info.IsUninitialized()) {
8291 AddInstruction(new(zone()) HSoftDeoptimize); 8309 AddInstruction(new(zone()) HSoftDeoptimize);
8292 current_block()->MarkAsDeoptimizing(); 8310 current_block()->MarkAsDeoptimizing();
8293 info = TypeInfo::Unknown(); 8311 info = TypeInfo::Unknown();
8294 } 8312 }
8295 HInstruction* instr = NULL; 8313 HInstruction* instr = NULL;
8296 switch (expr->op()) { 8314 switch (expr->op()) {
8297 case Token::ADD: 8315 case Token::ADD: {
8316 #ifdef V8_TARGET_ARCH_ARM
8317 HValue* a, *b, *c;
8318 #endif
8298 if (info.IsString()) { 8319 if (info.IsString()) {
8299 AddInstruction(new(zone()) HCheckNonSmi(left)); 8320 AddInstruction(new(zone()) HCheckNonSmi(left));
8300 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); 8321 AddInstruction(HCheckInstanceType::NewIsString(left, zone()));
8301 AddInstruction(new(zone()) HCheckNonSmi(right)); 8322 AddInstruction(new(zone()) HCheckNonSmi(right));
8302 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); 8323 AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
8303 instr = new(zone()) HStringAdd(context, left, right); 8324 instr = new(zone()) HStringAdd(context, left, right);
8325 #ifdef V8_TARGET_ARCH_ARM
8326 } else if (info.IsDouble() && MatchMultiplyAdd(left, right, &a, &b, &c)) {
8327 // FIXME: Probably need to check types here?
ulan_google 2012/11/07 09:54:03 Setting input representation should be sufficient.
8328 // FIXME: I'm not sure I'm hooking this up correctly :/
8329 instr = new(zone()) HMultiplyAdd(context, a, b, c);
8330 #endif
8304 } else { 8331 } else {
8305 instr = HAdd::NewHAdd(zone(), context, left, right); 8332 instr = HAdd::NewHAdd(zone(), context, left, right);
8306 } 8333 }
8307 break; 8334 break;
8335 }
8308 case Token::SUB: 8336 case Token::SUB:
8309 instr = HSub::NewHSub(zone(), context, left, right); 8337 instr = HSub::NewHSub(zone(), context, left, right);
8310 break; 8338 break;
8311 case Token::MUL: 8339 case Token::MUL:
8312 instr = HMul::NewHMul(zone(), context, left, right); 8340 instr = HMul::NewHMul(zone(), context, left, right);
8313 break; 8341 break;
8314 case Token::MOD: 8342 case Token::MOD:
8315 instr = HMod::NewHMod(zone(), context, left, right); 8343 instr = HMod::NewHMod(zone(), context, left, right);
8316 break; 8344 break;
8317 case Token::DIV: 8345 case Token::DIV:
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
10011 } 10039 }
10012 } 10040 }
10013 10041
10014 #ifdef DEBUG 10042 #ifdef DEBUG
10015 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10043 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10016 if (allocator_ != NULL) allocator_->Verify(); 10044 if (allocator_ != NULL) allocator_->Verify();
10017 #endif 10045 #endif
10018 } 10046 }
10019 10047
10020 } } // namespace v8::internal 10048 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698