< prev index next >

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp

Print this page
rev 54190 : [mq]: 8221083_c1_oop_cmp.patch


1438 
1439         case T_OBJECT:
1440           // There are only equal/notequal comparisons on objects.
1441           {
1442             assert(condition == lir_cond_equal || condition == lir_cond_notEqual, "oops");
1443             jobject con = opr2->as_constant_ptr()->as_jobject();
1444             if (con == NULL) {
1445               __ cmpdi(BOOL_RESULT, opr1->as_register(), 0);
1446             } else {
1447               jobject2reg(con, R0);
1448               __ cmpd(BOOL_RESULT, opr1->as_register(), R0);
1449             }
1450           }
1451           break;
1452 
1453         default:
1454           ShouldNotReachHere();
1455           break;
1456       }
1457     } else {
1458       if (opr2->is_address()) {
1459         DEBUG_ONLY( Unimplemented(); ) // Seems to be unused at the moment.
1460         LIR_Address *addr = opr2->as_address_ptr();
1461         BasicType type = addr->type();
1462         if (type == T_OBJECT) { __ ld(R0, index_or_disp(addr), addr->base()->as_register()); }
1463         else                  { __ lwa(R0, index_or_disp(addr), addr->base()->as_register()); }
1464         __ cmpd(BOOL_RESULT, opr1->as_register(), R0);
1465       } else {
1466         if (unsigned_comp) {
1467           __ cmplw(BOOL_RESULT, opr1->as_register(), opr2->as_register());
1468         } else {
1469           __ cmpw(BOOL_RESULT, opr1->as_register(), opr2->as_register());
1470         }
1471       }
1472     }
1473   } else if (opr1->is_double_cpu()) {
1474     if (opr2->is_constant()) {
1475       jlong con = opr2->as_constant_ptr()->as_jlong();
1476       if (unsigned_comp) {
1477         if (Assembler::is_uimm(con, 16)) {
1478           __ cmpldi(BOOL_RESULT, opr1->as_register_lo(), con);
1479         } else {
1480           __ load_const_optimized(R0, con);
1481           __ cmpld(BOOL_RESULT, opr1->as_register_lo(), R0);
1482         }
1483       } else {
1484         if (Assembler::is_simm(con, 16)) {
1485           __ cmpdi(BOOL_RESULT, opr1->as_register_lo(), con);
1486         } else {
1487           __ load_const_optimized(R0, con);
1488           __ cmpd(BOOL_RESULT, opr1->as_register_lo(), R0);
1489         }
1490       }
1491     } else if (opr2->is_register()) {
1492       if (unsigned_comp) {
1493         __ cmpld(BOOL_RESULT, opr1->as_register_lo(), opr2->as_register_lo());
1494       } else {
1495         __ cmpd(BOOL_RESULT, opr1->as_register_lo(), opr2->as_register_lo());
1496       }
1497     } else {
1498       ShouldNotReachHere();
1499     }
1500   } else if (opr1->is_address()) {
1501     DEBUG_ONLY( Unimplemented(); ) // Seems to be unused at the moment.
1502     LIR_Address * addr = opr1->as_address_ptr();
1503     BasicType type = addr->type();
1504     assert (opr2->is_constant(), "Checking");
1505     if (type == T_OBJECT) { __ ld(R0, index_or_disp(addr), addr->base()->as_register()); }
1506     else                  { __ lwa(R0, index_or_disp(addr), addr->base()->as_register()); }
1507     __ cmpdi(BOOL_RESULT, R0, opr2->as_constant_ptr()->as_jint());
1508   } else {
1509     ShouldNotReachHere();
1510   }
1511 }
1512 
1513 
1514 void LIR_Assembler::comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dst, LIR_Op2* op){
1515   const Register Rdst = dst->as_register();
1516   Label done;
1517   if (code == lir_cmp_fd2i || code == lir_ucmp_fd2i) {
1518     bool is_unordered_less = (code == lir_ucmp_fd2i);
1519     if (left->is_single_fpu()) {
1520       __ fcmpu(CCR0, left->as_float_reg(), right->as_float_reg());
1521     } else if (left->is_double_fpu()) {
1522       __ fcmpu(CCR0, left->as_double_reg(), right->as_double_reg());
1523     } else {
1524       ShouldNotReachHere();
1525     }
1526     __ li(Rdst, is_unordered_less ? -1 : 1);
1527     __ bso(CCR0, done);




1438 
1439         case T_OBJECT:
1440           // There are only equal/notequal comparisons on objects.
1441           {
1442             assert(condition == lir_cond_equal || condition == lir_cond_notEqual, "oops");
1443             jobject con = opr2->as_constant_ptr()->as_jobject();
1444             if (con == NULL) {
1445               __ cmpdi(BOOL_RESULT, opr1->as_register(), 0);
1446             } else {
1447               jobject2reg(con, R0);
1448               __ cmpd(BOOL_RESULT, opr1->as_register(), R0);
1449             }
1450           }
1451           break;
1452 
1453         default:
1454           ShouldNotReachHere();
1455           break;
1456       }
1457     } else {
1458       assert(opr1->type() != T_ADDRESS && opr2->type() != T_ADDRESS, "currently unsupported");
1459       if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
1460         // There are only equal/notequal comparisons on objects.
1461         assert(condition == lir_cond_equal || condition == lir_cond_notEqual, "oops");
1462         __ cmpd(BOOL_RESULT, opr1->as_register(), opr2->as_register());


1463       } else {
1464         if (unsigned_comp) {
1465           __ cmplw(BOOL_RESULT, opr1->as_register(), opr2->as_register());
1466         } else {
1467           __ cmpw(BOOL_RESULT, opr1->as_register(), opr2->as_register());
1468         }
1469       }
1470     }
1471   } else if (opr1->is_double_cpu()) {
1472     if (opr2->is_constant()) {
1473       jlong con = opr2->as_constant_ptr()->as_jlong();
1474       if (unsigned_comp) {
1475         if (Assembler::is_uimm(con, 16)) {
1476           __ cmpldi(BOOL_RESULT, opr1->as_register_lo(), con);
1477         } else {
1478           __ load_const_optimized(R0, con);
1479           __ cmpld(BOOL_RESULT, opr1->as_register_lo(), R0);
1480         }
1481       } else {
1482         if (Assembler::is_simm(con, 16)) {
1483           __ cmpdi(BOOL_RESULT, opr1->as_register_lo(), con);
1484         } else {
1485           __ load_const_optimized(R0, con);
1486           __ cmpd(BOOL_RESULT, opr1->as_register_lo(), R0);
1487         }
1488       }
1489     } else if (opr2->is_register()) {
1490       if (unsigned_comp) {
1491         __ cmpld(BOOL_RESULT, opr1->as_register_lo(), opr2->as_register_lo());
1492       } else {
1493         __ cmpd(BOOL_RESULT, opr1->as_register_lo(), opr2->as_register_lo());
1494       }
1495     } else {
1496       ShouldNotReachHere();
1497     }








1498   } else {
1499     ShouldNotReachHere();
1500   }
1501 }
1502 
1503 
1504 void LIR_Assembler::comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dst, LIR_Op2* op){
1505   const Register Rdst = dst->as_register();
1506   Label done;
1507   if (code == lir_cmp_fd2i || code == lir_ucmp_fd2i) {
1508     bool is_unordered_less = (code == lir_ucmp_fd2i);
1509     if (left->is_single_fpu()) {
1510       __ fcmpu(CCR0, left->as_float_reg(), right->as_float_reg());
1511     } else if (left->is_double_fpu()) {
1512       __ fcmpu(CCR0, left->as_double_reg(), right->as_double_reg());
1513     } else {
1514       ShouldNotReachHere();
1515     }
1516     __ li(Rdst, is_unordered_less ? -1 : 1);
1517     __ bso(CCR0, done);


< prev index next >