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

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

Issue 145273014: A64: Implement LModI for ARM A64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: 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 11cf0d138b1f4127cde22a41eb3bd941ef508347..414dab31dc749f1b5e0041525ee341bfc52d8722 100644
--- a/src/a64/lithium-a64.cc
+++ b/src/a64/lithium-a64.cc
@@ -1761,16 +1761,37 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
}
-LInstruction* LChunkBuilder::DoMod(HMod* instr) {
- if (instr->representation().IsInteger32()) {
- ASSERT(instr->left()->representation().IsInteger32());
- ASSERT(instr->right()->representation().IsInteger32());
+LInstruction* LChunkBuilder::DoMod(HMod* hmod) {
+ HValue* hleft = hmod->left();
+ HValue* hright = hmod->right();
+
+ if (hmod->representation().IsInteger32()) {
+ ASSERT(hleft->representation().IsInteger32());
+ ASSERT(hleft->representation().IsInteger32());
+ LOperand* left_op;
+ LOperand* right_op;
+
+ if (hmod->HasPowerOf2Divisor()) {
+ left_op = UseRegisterAtStart(hleft);
+ right_op = UseConstant(hright);
+ } else {
+ right_op = UseRegister(hright);
+ left_op = UseRegister(hleft);
+ }
+
+ LModI* lmod = new(zone()) LModI(left_op, right_op);
+
+ if (hmod->right()->CanBeZero() ||
+ (hmod->CheckFlag(HValue::kBailoutOnMinusZero) &&
+ hmod->left()->CanBeNegative() && hmod->CanBeZero())) {
+ AssignEnvironment(lmod);
+ }
+ return DefineAsRegister(lmod);
- UNIMPLEMENTED_INSTRUCTION();
- } else if (instr->representation().IsSmiOrTagged()) {
- UNIMPLEMENTED_INSTRUCTION();
+ } else if (hmod->representation().IsSmiOrTagged()) {
+ return DoArithmeticT(Token::MOD, hmod);
} else {
- return DoArithmeticD(Token::MOD, instr);
+ return DoArithmeticD(Token::MOD, hmod);
}
}
« 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