< prev index next >

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Print this page

1993       __ cmpxchgl(newval, Address(addr, 0));
1994     }
1995 #ifdef _LP64
1996   } else if (op->code() == lir_cas_long) {
1997     Register addr = (op->addr()->is_single_cpu() ? op->addr()->as_register() : op->addr()->as_register_lo());
1998     Register newval = op->new_value()->as_register_lo();
1999     Register cmpval = op->cmp_value()->as_register_lo();
2000     assert(cmpval == rax, "wrong register");
2001     assert(newval != NULL, "new val must be register");
2002     assert(cmpval != newval, "cmp and new values must be in different registers");
2003     assert(cmpval != addr, "cmp and addr must be in different registers");
2004     assert(newval != addr, "new value and addr must be in different registers");
2005     __ lock();
2006     __ cmpxchgq(newval, Address(addr, 0));
2007 #endif // _LP64
2008   } else {
2009     Unimplemented();
2010   }
2011 }
2012 
2013 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {



2014   Assembler::Condition acond, ncond;
2015   switch (condition) {
2016     case lir_cond_equal:        acond = Assembler::equal;        ncond = Assembler::notEqual;     break;
2017     case lir_cond_notEqual:     acond = Assembler::notEqual;     ncond = Assembler::equal;        break;
2018     case lir_cond_less:         acond = Assembler::less;         ncond = Assembler::greaterEqual; break;
2019     case lir_cond_lessEqual:    acond = Assembler::lessEqual;    ncond = Assembler::greater;      break;
2020     case lir_cond_greaterEqual: acond = Assembler::greaterEqual; ncond = Assembler::less;         break;
2021     case lir_cond_greater:      acond = Assembler::greater;      ncond = Assembler::lessEqual;    break;
2022     case lir_cond_belowEqual:   acond = Assembler::belowEqual;   ncond = Assembler::above;        break;
2023     case lir_cond_aboveEqual:   acond = Assembler::aboveEqual;   ncond = Assembler::below;        break;
2024     default:                    acond = Assembler::equal;        ncond = Assembler::notEqual;
2025                                 ShouldNotReachHere();
2026   }
2027 
2028   if (opr1->is_cpu_register()) {
2029     reg2reg(opr1, result);
2030   } else if (opr1->is_stack()) {
2031     stack2reg(opr1, result, result->type());
2032   } else if (opr1->is_constant()) {
2033     const2reg(opr1, result, lir_patch_none, NULL);

1993       __ cmpxchgl(newval, Address(addr, 0));
1994     }
1995 #ifdef _LP64
1996   } else if (op->code() == lir_cas_long) {
1997     Register addr = (op->addr()->is_single_cpu() ? op->addr()->as_register() : op->addr()->as_register_lo());
1998     Register newval = op->new_value()->as_register_lo();
1999     Register cmpval = op->cmp_value()->as_register_lo();
2000     assert(cmpval == rax, "wrong register");
2001     assert(newval != NULL, "new val must be register");
2002     assert(cmpval != newval, "cmp and new values must be in different registers");
2003     assert(cmpval != addr, "cmp and addr must be in different registers");
2004     assert(newval != addr, "new value and addr must be in different registers");
2005     __ lock();
2006     __ cmpxchgq(newval, Address(addr, 0));
2007 #endif // _LP64
2008   } else {
2009     Unimplemented();
2010   }
2011 }
2012 
2013 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type,
2014                           LIR_Opr cmp_opr1, LIR_Opr cmp_opr2) {
2015   assert(cmp_opr1 == LIR_OprFact::illegalOpr && cmp_opr2 == LIR_OprFact::illegalOpr, "unnecessary cmp oprs on x86");
2016 
2017   Assembler::Condition acond, ncond;
2018   switch (condition) {
2019     case lir_cond_equal:        acond = Assembler::equal;        ncond = Assembler::notEqual;     break;
2020     case lir_cond_notEqual:     acond = Assembler::notEqual;     ncond = Assembler::equal;        break;
2021     case lir_cond_less:         acond = Assembler::less;         ncond = Assembler::greaterEqual; break;
2022     case lir_cond_lessEqual:    acond = Assembler::lessEqual;    ncond = Assembler::greater;      break;
2023     case lir_cond_greaterEqual: acond = Assembler::greaterEqual; ncond = Assembler::less;         break;
2024     case lir_cond_greater:      acond = Assembler::greater;      ncond = Assembler::lessEqual;    break;
2025     case lir_cond_belowEqual:   acond = Assembler::belowEqual;   ncond = Assembler::above;        break;
2026     case lir_cond_aboveEqual:   acond = Assembler::aboveEqual;   ncond = Assembler::below;        break;
2027     default:                    acond = Assembler::equal;        ncond = Assembler::notEqual;
2028                                 ShouldNotReachHere();
2029   }
2030 
2031   if (opr1->is_cpu_register()) {
2032     reg2reg(opr1, result);
2033   } else if (opr1->is_stack()) {
2034     stack2reg(opr1, result, result->type());
2035   } else if (opr1->is_constant()) {
2036     const2reg(opr1, result, lir_patch_none, NULL);
< prev index next >