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

Unified Diff: src/a64/lithium-a64.cc

Issue 152133003: A64: Add support for SMI representation to MulConstI. Also add a test. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Rename LMulConstI to LMulConstIS Created 6 years, 11 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 | « src/a64/lithium-a64.h ('k') | src/a64/lithium-codegen-a64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/lithium-a64.cc
diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
index 28597a14dd33ada2a08c3792ad0dc2c6d28b7ca7..80a37d747a134bb1c6695deb7a98e18afdc1841e 100644
--- a/src/a64/lithium-a64.cc
+++ b/src/a64/lithium-a64.cc
@@ -1848,23 +1848,7 @@ LInstruction* LChunkBuilder::DoMod(HMod* hmod) {
LInstruction* LChunkBuilder::DoMul(HMul* instr) {
- if (instr->representation().IsSmi()) {
- // TODO(jbramley): Implement LMulConstS, then merge this into the Integer32
- // case.
- ASSERT(instr->left()->representation().Equals(instr->representation()));
- ASSERT(instr->right()->representation().Equals(instr->representation()));
-
- bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
- bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
- bool needs_environment = can_overflow || bailout_on_minus_zero;
-
- LOperand* left = UseRegister(instr->BetterLeftOperand());
- LOperand* right = UseRegister(instr->BetterRightOperand());
-
- LMulS* mul = new(zone()) LMulS(left, right);
- if (needs_environment) AssignEnvironment(mul);
- return DefineAsRegister(mul);
- } else if (instr->representation().IsSmiOrInteger32()) {
+ if (instr->representation().IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(instr->representation()));
ASSERT(instr->right()->representation().Equals(instr->representation()));
@@ -1892,18 +1876,25 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) {
IsPowerOf2(constant_abs + 1) ||
IsPowerOf2(constant_abs - 1)))) {
LConstantOperand* right = UseConstant(most_const);
- LMulConstI* mul = new(zone()) LMulConstI(left, right);
+ LMulConstIS* mul = new(zone()) LMulConstIS(left, right);
if (needs_environment) AssignEnvironment(mul);
return DefineAsRegister(mul);
}
}
- // LMulI can handle all cases, but it requires that a register is allocated
- // for the second operand.
- LOperand* right = UseRegisterAtStart(most_const);
- LMulI* mul = new(zone()) LMulI(left, right);
- if (needs_environment) AssignEnvironment(mul);
- return DefineAsRegister(mul);
+ // LMulI/S can handle all cases, but it requires that a register is
+ // allocated for the second operand.
+ LInstruction* result;
+ if (instr->representation().IsSmi()) {
+ // TODO(jbramley/rmcilroy): Fix LMulS so we can UseRegisterAtStart here.
+ LOperand* right = UseRegister(most_const);
+ result = DefineAsRegister(new(zone()) LMulS(left, right));
+ } else {
+ LOperand* right = UseRegisterAtStart(most_const);
+ result = DefineAsRegister(new(zone()) LMulI(left, right));
+ }
+ if (needs_environment) AssignEnvironment(result);
+ return result;
} else if (instr->representation().IsDouble()) {
return DoArithmeticD(Token::MUL, instr);
} else {
« no previous file with comments | « src/a64/lithium-a64.h ('k') | src/a64/lithium-codegen-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698