src/cpu/x86/vm/c1_LIRGenerator_x86.cpp

changeset 9843
a6f289d66efe
parent 9614
bb44c0e88235
child 9852
70aa912cebe5
equal deleted inserted replaced
9842:4df47a343601 9843:a6f289d66efe
231 void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info) { 231 void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info) {
232 __ cmp_reg_mem(condition, reg, new LIR_Address(base, disp, type), info); 232 __ cmp_reg_mem(condition, reg, new LIR_Address(base, disp, type), info);
233 } 233 }
234 234
235 235
236 bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { 236 bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
237 if (tmp->is_valid()) { 237 if (tmp->is_valid() && c > 0 && c < max_jint) {
238 if (is_power_of_2(c + 1)) { 238 if (is_power_of_2(c + 1)) {
239 __ move(left, tmp); 239 __ move(left, tmp);
240 __ shift_left(left, log2_jint(c + 1), left); 240 __ shift_left(left, log2_jint(c + 1), left);
241 __ sub(left, tmp, result); 241 __ sub(left, tmp, result);
242 return true; 242 return true;
600 if (x->op() == Bytecodes::_imul ) { 600 if (x->op() == Bytecodes::_imul ) {
601 // check if we can use shift instead 601 // check if we can use shift instead
602 bool use_constant = false; 602 bool use_constant = false;
603 bool use_tmp = false; 603 bool use_tmp = false;
604 if (right_arg->is_constant()) { 604 if (right_arg->is_constant()) {
605 int iconst = right_arg->get_jint_constant(); 605 jint iconst = right_arg->get_jint_constant();
606 if (iconst > 0) { 606 if (iconst > 0 && iconst < max_jint) {
607 if (is_power_of_2(iconst)) { 607 if (is_power_of_2(iconst)) {
608 use_constant = true; 608 use_constant = true;
609 } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) { 609 } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
610 use_constant = true; 610 use_constant = true;
611 use_tmp = true; 611 use_tmp = true;

mercurial