diff options
| author | 2015-10-16 09:08:46 +0100 | |
|---|---|---|
| committer | 2015-10-16 09:08:46 +0100 | |
| commit | b69fbfb5e43e404270e63b7a35dc5645b29b759c (patch) | |
| tree | b41c69a226238e75bbb497930f86d5463dda31a5 /compiler/optimizing | |
| parent | 28c34f886521f422424768fe245b98b7b83c6bd7 (diff) | |
ARM64: Better recognition of constants encodable as immediates.
When the right-hand side input is a constant, VIXL will automatically
switch between add and sub (or between similar pairs of instructions).
Change-Id: Icf05237b8653c409618f44e45049df87baf0f4c6
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/common_arm64.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/optimizing/common_arm64.h b/compiler/optimizing/common_arm64.h index f54547534f..4abe5e953c 100644 --- a/compiler/optimizing/common_arm64.h +++ b/compiler/optimizing/common_arm64.h @@ -206,7 +206,9 @@ static bool CanEncodeConstantAsImmediate(HConstant* constant, HInstruction* inst if (instr->IsAdd() || instr->IsSub() || instr->IsCondition() || instr->IsCompare() || instr->IsBoundsCheck()) { // Uses aliases of ADD/SUB instructions. - return vixl::Assembler::IsImmAddSub(value); + // If `value` does not fit but `-value` does, VIXL will automatically use + // the 'opposite' instruction. + return vixl::Assembler::IsImmAddSub(value) || vixl::Assembler::IsImmAddSub(-value); } else if (instr->IsAnd() || instr->IsOr() || instr->IsXor()) { // Uses logical operations. return vixl::Assembler::IsImmLogical(value, vixl::kXRegSize); |