From 4708dcd68eebf1173aef1097dad8ab13466059aa Mon Sep 17 00:00:00 2001 From: Mark Mendell Date: Wed, 22 Jan 2014 09:05:18 -0800 Subject: Improve x86 long multiply and shifts Generate inline code for long shifts by constants and do long multiplication inline. Convert multiplication by a constant to a shift when we can. Fix some x86 assembler problems and add the new instructions that were needed (64 bit shifts). Change-Id: I6237a31c36159096e399d40d01eb6bfa22ac2772 Signed-off-by: Mark Mendell --- compiler/dex/quick/codegen_util.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'compiler/dex/quick/codegen_util.cc') diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index 12ecfff935..1eb79c98ac 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -1137,4 +1137,28 @@ void Mir2Lir::InsertLIRAfter(LIR* current_lir, LIR* new_lir) { new_lir->next->prev = new_lir; } +bool Mir2Lir::IsPowerOfTwo(uint64_t x) { + return (x & (x - 1)) == 0; +} + +// Returns the index of the lowest set bit in 'x'. +int32_t Mir2Lir::LowestSetBit(uint64_t x) { + int bit_posn = 0; + while ((x & 0xf) == 0) { + bit_posn += 4; + x >>= 4; + } + while ((x & 1) == 0) { + bit_posn++; + x >>= 1; + } + return bit_posn; +} + +bool Mir2Lir::BadOverlap(RegLocation rl_src, RegLocation rl_dest) { + DCHECK(rl_src.wide); + DCHECK(rl_dest.wide); + return (abs(mir_graph_->SRegToVReg(rl_src.s_reg_low) - mir_graph_->SRegToVReg(rl_dest.s_reg_low)) == 1); +} + } // namespace art -- cgit v1.2.3-59-g8ed1b