diff options
Diffstat (limited to 'src/compiler/codegen/x86')
| -rw-r--r-- | src/compiler/codegen/x86/codegen_x86.h | 14 | ||||
| -rw-r--r-- | src/compiler/codegen/x86/int_x86.cc | 21 | ||||
| -rw-r--r-- | src/compiler/codegen/x86/utility_x86.cc | 24 |
3 files changed, 52 insertions, 7 deletions
diff --git a/src/compiler/codegen/x86/codegen_x86.h b/src/compiler/codegen/x86/codegen_x86.h index 141638cf1a..9cc17f130e 100644 --- a/src/compiler/codegen/x86/codegen_x86.h +++ b/src/compiler/codegen/x86/codegen_x86.h @@ -38,8 +38,7 @@ class X86Codegen : public Codegen { int displacement, int r_dest, int r_dest_hi, OpSize size, int s_reg); virtual LIR* LoadConstantNoClobber(CompilationUnit* cu, int r_dest, int value); - virtual LIR* LoadConstantValueWide(CompilationUnit* cu, int r_dest_lo, int r_dest_hi, - int val_lo, int val_hi); + virtual LIR* LoadConstantWide(CompilationUnit* cu, int r_dest_lo, int r_dest_hi, int64_t value); virtual LIR* StoreBaseDisp(CompilationUnit* cu, int rBase, int displacement, int r_src, OpSize size); virtual LIR* StoreBaseDispWide(CompilationUnit* cu, int rBase, int displacement, int r_src_lo, @@ -90,12 +89,18 @@ class X86Codegen : public Codegen { virtual bool IsUnconditionalBranch(LIR* lir); // Required for target - Dalvik-level generators. + virtual bool GenArithImmOpLong(CompilationUnit* cu, Instruction::Code opcode, RegLocation rl_dest, + RegLocation rl_src1, RegLocation rl_src2); virtual void GenArrayObjPut(CompilationUnit* cu, int opt_flags, RegLocation rl_array, RegLocation rl_index, RegLocation rl_src, int scale); virtual void GenArrayGet(CompilationUnit* cu, int opt_flags, OpSize size, RegLocation rl_array, RegLocation rl_index, RegLocation rl_dest, int scale); virtual void GenArrayPut(CompilationUnit* cu, int opt_flags, OpSize size, RegLocation rl_array, RegLocation rl_index, RegLocation rl_src, int scale); + virtual bool GenShiftImmOpLong(CompilationUnit* cu, Instruction::Code opcode, + RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_shift); + virtual void GenMulLong(CompilationUnit* cu, RegLocation rl_dest, RegLocation rl_src1, + RegLocation rl_src2); virtual bool GenAddLong(CompilationUnit* cu, RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2); virtual bool GenAndLong(CompilationUnit* cu, RegLocation rl_dest, RegLocation rl_src1, @@ -188,7 +193,10 @@ class X86Codegen : public Codegen { void SpillCoreRegs(CompilationUnit* cu); void UnSpillCoreRegs(CompilationUnit* cu); static const X86EncodingMap EncodingMap[kX86Last]; - bool InexpensiveConstant(int reg, int value); + bool InexpensiveConstantInt(int32_t value); + bool InexpensiveConstantFloat(int32_t value); + bool InexpensiveConstantLong(int64_t value); + bool InexpensiveConstantDouble(int64_t value); }; } // namespace art diff --git a/src/compiler/codegen/x86/int_x86.cc b/src/compiler/codegen/x86/int_x86.cc index 0ae51e0e23..d4a34f7d37 100644 --- a/src/compiler/codegen/x86/int_x86.cc +++ b/src/compiler/codegen/x86/int_x86.cc @@ -322,6 +322,13 @@ LIR* X86Codegen::OpIT(CompilationUnit* cu, ConditionCode cond, const char* guide LOG(FATAL) << "Unexpected use of OpIT in x86"; return NULL; } + +void X86Codegen::GenMulLong(CompilationUnit* cu, RegLocation rl_dest, RegLocation rl_src1, + RegLocation rl_src2) +{ + LOG(FATAL) << "Unexpected use of GenX86Long for x86"; + return; +} bool X86Codegen::GenAddLong(CompilationUnit* cu, RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2) { @@ -583,4 +590,18 @@ void X86Codegen::GenArrayObjPut(CompilationUnit* cu, int opt_flags, RegLocation MarkGCCard(cu, r_value, r_array); } +bool X86Codegen::GenShiftImmOpLong(CompilationUnit* cu, Instruction::Code opcode, RegLocation rl_dest, + RegLocation rl_src1, RegLocation rl_shift) +{ + // Default implementation is just to ignore the constant case. + return GenShiftOpLong(cu, opcode, rl_dest, rl_src1, rl_shift); +} + +bool X86Codegen::GenArithImmOpLong(CompilationUnit* cu, Instruction::Code opcode, + RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2) +{ + // Default - bail to non-const handler. + return GenArithOpLong(cu, opcode, rl_dest, rl_src1, rl_src2); +} + } // namespace art diff --git a/src/compiler/codegen/x86/utility_x86.cc b/src/compiler/codegen/x86/utility_x86.cc index 4f9e28b444..4cc2c182cb 100644 --- a/src/compiler/codegen/x86/utility_x86.cc +++ b/src/compiler/codegen/x86/utility_x86.cc @@ -50,11 +50,26 @@ LIR* X86Codegen::OpFpRegCopy(CompilationUnit *cu, int r_dest, int r_src) return res; } -bool X86Codegen::InexpensiveConstant(int reg, int value) +bool X86Codegen::InexpensiveConstantInt(int32_t value) { return true; } +bool X86Codegen::InexpensiveConstantFloat(int32_t value) +{ + return false; +} + +bool X86Codegen::InexpensiveConstantLong(int64_t value) +{ + return true; +} + +bool X86Codegen::InexpensiveConstantDouble(int64_t value) +{ + return false; // TUNING +} + /* * Load a immediate using a shortcut if possible; otherwise * grab from the per-translation literal pool. If target is @@ -316,13 +331,14 @@ LIR* X86Codegen::OpMem(CompilationUnit* cu, OpKind op, int rBase, int disp) return NewLIR2(cu, opcode, rBase, disp); } -LIR* X86Codegen::LoadConstantValueWide(CompilationUnit *cu, int r_dest_lo, - int r_dest_hi, int val_lo, int val_hi) +LIR* X86Codegen::LoadConstantWide(CompilationUnit *cu, int r_dest_lo, int r_dest_hi, int64_t value) { + int32_t val_lo = Low32Bits(value); + int32_t val_hi = High32Bits(value); LIR *res; if (X86_FPREG(r_dest_lo)) { DCHECK(X86_FPREG(r_dest_hi)); // ignore r_dest_hi - if (val_lo == 0 && val_hi == 0) { + if (value == 0) { return NewLIR2(cu, kX86XorpsRR, r_dest_lo, r_dest_lo); } else { if (val_lo == 0) { |