summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Evgeny Astigeevich <evgeny.astigeevich@linaro.org> 2018-06-25 17:54:07 +0100
committer Evgeny Astigeevich <evgeny.astigeevich@linaro.org> 2018-07-13 16:30:32 +0100
commitf58dc65c52f5e3f15eaaa1e25d7259e64649ade3 (patch)
tree4485299d9959a658909879b5a234fd807d7627ff /compiler/optimizing
parent0b4a439f808f4602c7b97364e49c5546f5100d51 (diff)
ART: Delete code optimizing a%1 and a%-1 from InstructionCodeGeneratorARM64
In InstructionWithAbsorbingInputSimplifier there is code optimizing a%1 and a%-1. So the code in InstructionCodeGeneratorARM64 optimizing such cases can be deleted. This patch deletes the code from InstructionCodeGeneratorARM64 and adds additional tests. Test: 012-math, 014-math3, 411-optimizing-arith, 411-checker-hdiv-hrem-pow2 Test: 701-easy-div-rem, 442-checker-constant-folding Test: test-art-host, test-art-target Change-Id: Ib80c0aa4c3e28b07fa79bb43783274c9d7fc456a
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/code_generator_arm64.cc18
-rw-r--r--compiler/optimizing/code_generator_arm64.h1
2 files changed, 6 insertions, 13 deletions
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index d1c83ce625..02c995a833 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -5678,14 +5678,6 @@ void InstructionCodeGeneratorARM64::GenerateIntRemForPower2Denom(HRem *instructi
}
}
-void InstructionCodeGeneratorARM64::GenerateIntRemForOneOrMinusOneDenom(HRem *instruction) {
- int64_t imm = Int64FromLocation(instruction->GetLocations()->InAt(1));
- DCHECK(imm == 1 || imm == -1) << imm;
-
- Register out = OutputRegister(instruction);
- __ Mov(out, 0);
-}
-
void InstructionCodeGeneratorARM64::GenerateIntRemForConstDenom(HRem *instruction) {
int64_t imm = Int64FromLocation(instruction->GetLocations()->InAt(1));
@@ -5695,10 +5687,12 @@ void InstructionCodeGeneratorARM64::GenerateIntRemForConstDenom(HRem *instructio
return;
}
- if (imm == 1 || imm == -1) {
- // TODO: These cases need to be optimized in InstructionSimplifier
- GenerateIntRemForOneOrMinusOneDenom(instruction);
- } else if (IsPowerOfTwo(AbsOrMin(imm))) {
+ if (IsPowerOfTwo(AbsOrMin(imm))) {
+ // Cases imm == -1 or imm == 1 are handled in constant folding by
+ // InstructionWithAbsorbingInputSimplifier.
+ // If the cases have survided till code generation they are handled in
+ // GenerateIntRemForPower2Denom becauses -1 and 1 are the power of 2 (2^0).
+ // The correct code is generated for them, just more instructions.
GenerateIntRemForPower2Denom(instruction);
} else {
DCHECK(imm < -2 || imm > 2) << imm;
diff --git a/compiler/optimizing/code_generator_arm64.h b/compiler/optimizing/code_generator_arm64.h
index c44fa48066..93bab3180c 100644
--- a/compiler/optimizing/code_generator_arm64.h
+++ b/compiler/optimizing/code_generator_arm64.h
@@ -327,7 +327,6 @@ class InstructionCodeGeneratorARM64 : public InstructionCodeGenerator {
void GenerateIntDivForPower2Denom(HDiv *instruction);
void GenerateIntRem(HRem* instruction);
void GenerateIntRemForConstDenom(HRem *instruction);
- void GenerateIntRemForOneOrMinusOneDenom(HRem *instruction);
void GenerateIntRemForPower2Denom(HRem *instruction);
void HandleGoto(HInstruction* got, HBasicBlock* successor);