1416 break;
1417 }
1418 default: {
1419 ShouldNotReachHere();
1420 }
1421 }
1422 }
1423
1424 void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
1425 assert(UseCRC32CIntrinsics, "or should not be here");
1426 LIR_Opr result = rlock_result(x);
1427
1428 switch (x->id()) {
1429 case vmIntrinsics::_updateBytesCRC32C:
1430 case vmIntrinsics::_updateDirectByteBufferCRC32C: {
1431 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C);
1432
1433 LIRItem crc(x->argument_at(0), this);
1434 LIRItem buf(x->argument_at(1), this);
1435 LIRItem off(x->argument_at(2), this);
1436 LIRItem len(x->argument_at(3), this);
1437 buf.load_item();
1438 off.load_nonconstant();
1439
1440 LIR_Opr index = off.result();
1441 int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
1442 if (off.result()->is_constant()) {
1443 index = LIR_OprFact::illegalOpr;
1444 offset += off.result()->as_jint();
1445 }
1446 LIR_Opr base_op = buf.result();
1447 LIR_Address* a = NULL;
1448
1449 if (index->is_valid()) {
1450 LIR_Opr tmp = new_register(T_LONG);
1451 __ convert(Bytecodes::_i2l, index, tmp);
1452 index = tmp;
1453 __ add(index, LIR_OprFact::intptrConst(offset), index);
1454 a = new LIR_Address(base_op, index, T_BYTE);
1455 } else {
1456 a = new LIR_Address(base_op, offset, T_BYTE);
1457 }
1458
1459 BasicTypeList signature(3);
1460 signature.append(T_INT);
1461 signature.append(T_ADDRESS);
1462 signature.append(T_INT);
1463 CallingConvention* cc = frame_map()->c_calling_convention(&signature);
1464 const LIR_Opr result_reg = result_register_for(x->type());
1465
1466 LIR_Opr arg1 = cc->at(0),
1467 arg2 = cc->at(1),
1468 arg3 = cc->at(2);
1469
1470 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32 stub doesn't care about high bits.
1471 __ leal(LIR_OprFact::address(a), arg2);
1472 len.load_item_force(arg3); // We skip int->long conversion here, , because CRC32 stub expects int.
1473
1474 __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args());
1475 __ move(result_reg, result);
1476 break;
1477 }
1478 default: {
1479 ShouldNotReachHere();
1480 }
1481 }
1482 }
1483
1484 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
1485 assert(x->number_of_arguments() == 3, "wrong type");
1486 assert(UseFMA, "Needs FMA instructions support.");
1487 LIRItem value(x->argument_at(0), this);
1488 LIRItem value1(x->argument_at(1), this);
1489 LIRItem value2(x->argument_at(2), this);
1490
1491 value.load_item();
1492 value1.load_item();
|
1416 break;
1417 }
1418 default: {
1419 ShouldNotReachHere();
1420 }
1421 }
1422 }
1423
1424 void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
1425 assert(UseCRC32CIntrinsics, "or should not be here");
1426 LIR_Opr result = rlock_result(x);
1427
1428 switch (x->id()) {
1429 case vmIntrinsics::_updateBytesCRC32C:
1430 case vmIntrinsics::_updateDirectByteBufferCRC32C: {
1431 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C);
1432
1433 LIRItem crc(x->argument_at(0), this);
1434 LIRItem buf(x->argument_at(1), this);
1435 LIRItem off(x->argument_at(2), this);
1436 LIRItem end(x->argument_at(3), this);
1437 buf.load_item();
1438 off.load_nonconstant();
1439 end.load_nonconstant();
1440
1441 // len = end - off
1442 LIR_Opr len = end.result();
1443 LIR_Opr tmpA = new_register(T_INT);
1444 LIR_Opr tmpB = new_register(T_INT);
1445 __ move(end.result(), tmpA);
1446 __ move(off.result(), tmpB);
1447 __ sub(tmpA, tmpB, tmpA);
1448 len = tmpA;
1449
1450 LIR_Opr index = off.result();
1451 int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
1452 if (off.result()->is_constant()) {
1453 index = LIR_OprFact::illegalOpr;
1454 offset += off.result()->as_jint();
1455 }
1456 LIR_Opr base_op = buf.result();
1457 LIR_Address* a = NULL;
1458
1459 if (index->is_valid()) {
1460 LIR_Opr tmp = new_register(T_LONG);
1461 __ convert(Bytecodes::_i2l, index, tmp);
1462 index = tmp;
1463 __ add(index, LIR_OprFact::intptrConst(offset), index);
1464 a = new LIR_Address(base_op, index, T_BYTE);
1465 } else {
1466 a = new LIR_Address(base_op, offset, T_BYTE);
1467 }
1468
1469 BasicTypeList signature(3);
1470 signature.append(T_INT);
1471 signature.append(T_ADDRESS);
1472 signature.append(T_INT);
1473 CallingConvention* cc = frame_map()->c_calling_convention(&signature);
1474 const LIR_Opr result_reg = result_register_for(x->type());
1475
1476 LIR_Opr arg1 = cc->at(0),
1477 arg2 = cc->at(1),
1478 arg3 = cc->at(2);
1479
1480 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32C stub doesn't care about high bits.
1481 __ leal(LIR_OprFact::address(a), arg2);
1482 __ move(len, cc->at(2)); // We skip int->long conversion here, because CRC32C stub expects int.
1483
1484 __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args());
1485 __ move(result_reg, result);
1486 break;
1487 }
1488 default: {
1489 ShouldNotReachHere();
1490 }
1491 }
1492 }
1493
1494 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
1495 assert(x->number_of_arguments() == 3, "wrong type");
1496 assert(UseFMA, "Needs FMA instructions support.");
1497 LIRItem value(x->argument_at(0), this);
1498 LIRItem value1(x->argument_at(1), this);
1499 LIRItem value2(x->argument_at(2), this);
1500
1501 value.load_item();
1502 value1.load_item();
|