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

Side by Side Diff: src/arm/lithium-arm.cc

Issue 11308040: ARM: Emit RSB (reverse-subtract) for subtraction with constant lhs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase, address comments 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
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 } else { 1321 } else {
1322 return DoArithmeticT(Token::MUL, instr); 1322 return DoArithmeticT(Token::MUL, instr);
1323 } 1323 }
1324 } 1324 }
1325 1325
1326 1326
1327 LInstruction* LChunkBuilder::DoSub(HSub* instr) { 1327 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1328 if (instr->representation().IsInteger32()) { 1328 if (instr->representation().IsInteger32()) {
1329 ASSERT(instr->left()->representation().IsInteger32()); 1329 ASSERT(instr->left()->representation().IsInteger32());
1330 ASSERT(instr->right()->representation().IsInteger32()); 1330 ASSERT(instr->right()->representation().IsInteger32());
1331
1332 if (instr->left()->IsConstant()) {
1333 // If lhs is constant, do reverse subtraction instead.
1334 return DoRSub(instr);
1335 }
1336
1331 LOperand* left = UseRegisterAtStart(instr->left()); 1337 LOperand* left = UseRegisterAtStart(instr->left());
1332 LOperand* right = UseOrConstantAtStart(instr->right()); 1338 LOperand* right = UseOrConstantAtStart(instr->right());
1333 LSubI* sub = new(zone()) LSubI(left, right); 1339 LSubI* sub = new(zone()) LSubI(left, right);
1334 LInstruction* result = DefineAsRegister(sub); 1340 LInstruction* result = DefineAsRegister(sub);
1335 if (instr->CheckFlag(HValue::kCanOverflow)) { 1341 if (instr->CheckFlag(HValue::kCanOverflow)) {
1336 result = AssignEnvironment(result); 1342 result = AssignEnvironment(result);
1337 } 1343 }
1338 return result; 1344 return result;
1339 } else if (instr->representation().IsDouble()) { 1345 } else if (instr->representation().IsDouble()) {
1340 return DoArithmeticD(Token::SUB, instr); 1346 return DoArithmeticD(Token::SUB, instr);
1341 } else { 1347 } else {
1342 return DoArithmeticT(Token::SUB, instr); 1348 return DoArithmeticT(Token::SUB, instr);
1343 } 1349 }
1344 } 1350 }
1345 1351
1352
1353 LInstruction* LChunkBuilder::DoRSub(HSub* instr) {
1354 ASSERT(instr->representation().IsInteger32());
1355 ASSERT(instr->left()->representation().IsInteger32());
1356 ASSERT(instr->right()->representation().IsInteger32());
1357
1358 // Note: The lhs of the subtraction becomes the rhs of the
1359 // reverse-subtraction.
1360 LOperand* left = UseRegisterAtStart(instr->right());
1361 LOperand* right = UseOrConstantAtStart(instr->left());
1362 LRSubI* rsb = new(zone()) LRSubI(left, right);
1363 LInstruction* result = DefineAsRegister(rsb);
1364 if (instr->CheckFlag(HValue::kCanOverflow)) {
1365 result = AssignEnvironment(result);
1366 }
1367 return result;
1368 }
1369
1370
1346 LInstruction* LChunkBuilder::DoMultiplyAdd(HMul* mul, HValue* addend) { 1371 LInstruction* LChunkBuilder::DoMultiplyAdd(HMul* mul, HValue* addend) {
1347 LOperand* multiplier_op = UseRegisterAtStart(mul->left()); 1372 LOperand* multiplier_op = UseRegisterAtStart(mul->left());
1348 LOperand* multiplicand_op = UseRegisterAtStart(mul->right()); 1373 LOperand* multiplicand_op = UseRegisterAtStart(mul->right());
1349 LOperand* addend_op = UseRegisterAtStart(addend); 1374 LOperand* addend_op = UseRegisterAtStart(addend);
1350 return DefineSameAsFirst(new(zone()) LMultiplyAddD(addend_op, multiplier_op, 1375 return DefineSameAsFirst(new(zone()) LMultiplyAddD(addend_op, multiplier_op,
1351 multiplicand_op)); 1376 multiplicand_op));
1352 } 1377 }
1353 1378
1354 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { 1379 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1355 if (instr->representation().IsInteger32()) { 1380 if (instr->representation().IsInteger32()) {
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 2325
2301 2326
2302 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2327 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2303 LOperand* object = UseRegister(instr->object()); 2328 LOperand* object = UseRegister(instr->object());
2304 LOperand* index = UseRegister(instr->index()); 2329 LOperand* index = UseRegister(instr->index());
2305 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2330 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2306 } 2331 }
2307 2332
2308 2333
2309 } } // namespace v8::internal 2334 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698