< prev index next >

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Print this page

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



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

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