< prev index next >

src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp

Print this page

1423       Register minus_one = Z_R1_scratch;
1424       __ z_cgr(left->as_register_lo(), right->as_register_lo());
1425       __ z_lghi(minus_one, -1);
1426       __ z_lghi(one,  1);
1427       __ z_lghi(dreg, 0);
1428       __ z_locgr(dreg, one, Assembler::bcondHigh);
1429       __ z_locgr(dreg, minus_one, Assembler::bcondLow);
1430     } else {
1431       __ z_cgr(left->as_register_lo(), right->as_register_lo());
1432       __ z_lghi(dreg,  0);     // eq value
1433       __ z_bre(done);
1434       __ z_lghi(dreg,  1);     // gt value
1435       __ z_brh(done);
1436       __ z_lghi(dreg, -1);     // lt value
1437     }
1438   }
1439   __ bind(done);
1440 }
1441 
1442 // result = condition ? opr1 : opr2
1443 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {



1444   Assembler::branch_condition acond = Assembler::bcondEqual, ncond = Assembler::bcondNotEqual;
1445   switch (condition) {
1446     case lir_cond_equal:        acond = Assembler::bcondEqual;    ncond = Assembler::bcondNotEqual; break;
1447     case lir_cond_notEqual:     acond = Assembler::bcondNotEqual; ncond = Assembler::bcondEqual;    break;
1448     case lir_cond_less:         acond = Assembler::bcondLow;      ncond = Assembler::bcondNotLow;   break;
1449     case lir_cond_lessEqual:    acond = Assembler::bcondNotHigh;  ncond = Assembler::bcondHigh;     break;
1450     case lir_cond_greaterEqual: acond = Assembler::bcondNotLow;   ncond = Assembler::bcondLow;      break;
1451     case lir_cond_greater:      acond = Assembler::bcondHigh;     ncond = Assembler::bcondNotHigh;  break;
1452     case lir_cond_belowEqual:   acond = Assembler::bcondNotHigh;  ncond = Assembler::bcondHigh;     break;
1453     case lir_cond_aboveEqual:   acond = Assembler::bcondNotLow;   ncond = Assembler::bcondLow;      break;
1454     default:                    ShouldNotReachHere();
1455   }
1456 
1457   if (opr1->is_cpu_register()) {
1458     reg2reg(opr1, result);
1459   } else if (opr1->is_stack()) {
1460     stack2reg(opr1, result, result->type());
1461   } else if (opr1->is_constant()) {
1462     const2reg(opr1, result, lir_patch_none, NULL);
1463   } else {

1423       Register minus_one = Z_R1_scratch;
1424       __ z_cgr(left->as_register_lo(), right->as_register_lo());
1425       __ z_lghi(minus_one, -1);
1426       __ z_lghi(one,  1);
1427       __ z_lghi(dreg, 0);
1428       __ z_locgr(dreg, one, Assembler::bcondHigh);
1429       __ z_locgr(dreg, minus_one, Assembler::bcondLow);
1430     } else {
1431       __ z_cgr(left->as_register_lo(), right->as_register_lo());
1432       __ z_lghi(dreg,  0);     // eq value
1433       __ z_bre(done);
1434       __ z_lghi(dreg,  1);     // gt value
1435       __ z_brh(done);
1436       __ z_lghi(dreg, -1);     // lt value
1437     }
1438   }
1439   __ bind(done);
1440 }
1441 
1442 // result = condition ? opr1 : opr2
1443 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type,
1444                           LIR_Opr cmp_opr1, LIR_Opr cmp_opr2) {
1445   assert(cmp_opr1 == LIR_OprFact::illegalOpr && cmp_opr2 == LIR_OprFact::illegalOpr, "unnecessary cmp oprs on s390");
1446 
1447   Assembler::branch_condition acond = Assembler::bcondEqual, ncond = Assembler::bcondNotEqual;
1448   switch (condition) {
1449     case lir_cond_equal:        acond = Assembler::bcondEqual;    ncond = Assembler::bcondNotEqual; break;
1450     case lir_cond_notEqual:     acond = Assembler::bcondNotEqual; ncond = Assembler::bcondEqual;    break;
1451     case lir_cond_less:         acond = Assembler::bcondLow;      ncond = Assembler::bcondNotLow;   break;
1452     case lir_cond_lessEqual:    acond = Assembler::bcondNotHigh;  ncond = Assembler::bcondHigh;     break;
1453     case lir_cond_greaterEqual: acond = Assembler::bcondNotLow;   ncond = Assembler::bcondLow;      break;
1454     case lir_cond_greater:      acond = Assembler::bcondHigh;     ncond = Assembler::bcondNotHigh;  break;
1455     case lir_cond_belowEqual:   acond = Assembler::bcondNotHigh;  ncond = Assembler::bcondHigh;     break;
1456     case lir_cond_aboveEqual:   acond = Assembler::bcondNotLow;   ncond = Assembler::bcondLow;      break;
1457     default:                    ShouldNotReachHere();
1458   }
1459 
1460   if (opr1->is_cpu_register()) {
1461     reg2reg(opr1, result);
1462   } else if (opr1->is_stack()) {
1463     stack2reg(opr1, result, result->type());
1464   } else if (opr1->is_constant()) {
1465     const2reg(opr1, result, lir_patch_none, NULL);
1466   } else {
< prev index next >