1212 break; 1213 } 1214 default: { 1215 ShouldNotReachHere(); 1216 } 1217 } 1218 } 1219 1220 void LIRGenerator::do_update_CRC32C(Intrinsic* x) { 1221 assert(UseCRC32CIntrinsics, "or should not be here"); 1222 LIR_Opr result = rlock_result(x); 1223 1224 switch (x->id()) { 1225 case vmIntrinsics::_updateBytesCRC32C: 1226 case vmIntrinsics::_updateDirectByteBufferCRC32C: { 1227 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C); 1228 1229 LIRItem crc(x->argument_at(0), this); 1230 LIRItem buf(x->argument_at(1), this); 1231 LIRItem off(x->argument_at(2), this); 1232 LIRItem len(x->argument_at(3), this); 1233 buf.load_item(); 1234 off.load_nonconstant(); 1235 1236 LIR_Opr index = off.result(); 1237 int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0; 1238 if (off.result()->is_constant()) { 1239 index = LIR_OprFact::illegalOpr; 1240 offset += off.result()->as_jint(); 1241 } 1242 LIR_Opr base_op = buf.result(); 1243 1244 if (index->is_valid()) { 1245 LIR_Opr tmp = new_register(T_LONG); 1246 __ convert(Bytecodes::_i2l, index, tmp); 1247 index = tmp; 1248 } 1249 1250 LIR_Address* a = new LIR_Address(base_op, index, offset, T_BYTE); 1251 1252 BasicTypeList signature(3); 1253 signature.append(T_INT); 1254 signature.append(T_ADDRESS); 1255 signature.append(T_INT); 1256 CallingConvention* cc = frame_map()->c_calling_convention(&signature); 1257 const LIR_Opr result_reg = result_register_for (x->type()); 1258 1259 LIR_Opr arg1 = cc->at(0); 1260 LIR_Opr arg2 = cc->at(1); 1261 LIR_Opr arg3 = cc->at(2); 1262 1263 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32C stub doesn't care about high bits. 1264 __ leal(LIR_OprFact::address(a), arg2); 1265 len.load_item_force(arg3); // We skip int->long conversion here, because CRC32C stub expects int. 1266 1267 __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args()); 1268 __ move(result_reg, result); 1269 break; 1270 } 1271 default: { 1272 ShouldNotReachHere(); 1273 } 1274 } 1275 } 1276 1277 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) { 1278 assert(x->number_of_arguments() == 3, "wrong type"); 1279 assert(UseFMA, "Needs FMA instructions support."); 1280 LIRItem value(x->argument_at(0), this); 1281 LIRItem value1(x->argument_at(1), this); 1282 LIRItem value2(x->argument_at(2), this); 1283 1284 value2.set_destroys_register(); 1285 | 1212 break; 1213 } 1214 default: { 1215 ShouldNotReachHere(); 1216 } 1217 } 1218 } 1219 1220 void LIRGenerator::do_update_CRC32C(Intrinsic* x) { 1221 assert(UseCRC32CIntrinsics, "or should not be here"); 1222 LIR_Opr result = rlock_result(x); 1223 1224 switch (x->id()) { 1225 case vmIntrinsics::_updateBytesCRC32C: 1226 case vmIntrinsics::_updateDirectByteBufferCRC32C: { 1227 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C); 1228 1229 LIRItem crc(x->argument_at(0), this); 1230 LIRItem buf(x->argument_at(1), this); 1231 LIRItem off(x->argument_at(2), this); 1232 LIRItem end(x->argument_at(3), this); 1233 buf.load_item(); 1234 off.load_nonconstant(); 1235 end.load_nonconstant(); 1236 1237 // len = end - off 1238 LIR_Opr len = end.result(); 1239 LIR_Opr tmpA = new_register(T_INT); 1240 LIR_Opr tmpB = new_register(T_INT); 1241 __ move(end.result(), tmpA); 1242 __ move(off.result(), tmpB); 1243 __ sub(tmpA, tmpB, tmpA); 1244 len = tmpA; 1245 1246 LIR_Opr index = off.result(); 1247 int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0; 1248 if (off.result()->is_constant()) { 1249 index = LIR_OprFact::illegalOpr; 1250 offset += off.result()->as_jint(); 1251 } 1252 LIR_Opr base_op = buf.result(); 1253 1254 if (index->is_valid()) { 1255 LIR_Opr tmp = new_register(T_LONG); 1256 __ convert(Bytecodes::_i2l, index, tmp); 1257 index = tmp; 1258 } 1259 1260 LIR_Address* a = new LIR_Address(base_op, index, offset, T_BYTE); 1261 1262 BasicTypeList signature(3); 1263 signature.append(T_INT); 1264 signature.append(T_ADDRESS); 1265 signature.append(T_INT); 1266 CallingConvention* cc = frame_map()->c_calling_convention(&signature); 1267 const LIR_Opr result_reg = result_register_for (x->type()); 1268 1269 LIR_Opr arg1 = cc->at(0); 1270 LIR_Opr arg2 = cc->at(1); 1271 LIR_Opr arg3 = cc->at(2); 1272 1273 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32C stub doesn't care about high bits. 1274 __ leal(LIR_OprFact::address(a), arg2); 1275 __ move(len, cc->at(2)); // We skip int->long conversion here, because CRC32C stub expects int. 1276 1277 __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args()); 1278 __ move(result_reg, result); 1279 break; 1280 } 1281 default: { 1282 ShouldNotReachHere(); 1283 } 1284 } 1285 } 1286 1287 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) { 1288 assert(x->number_of_arguments() == 3, "wrong type"); 1289 assert(UseFMA, "Needs FMA instructions support."); 1290 LIRItem value(x->argument_at(0), this); 1291 LIRItem value1(x->argument_at(1), this); 1292 LIRItem value2(x->argument_at(2), this); 1293 1294 value2.set_destroys_register(); 1295 |