1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016 SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 1216 LIR_Opr arg1 = cc->at(0); 1217 LIR_Opr arg2 = cc->at(1); 1218 LIR_Opr arg3 = cc->at(2); 1219 1220 // CCallingConventionRequiresIntsAsLongs 1221 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32 stub doesn't care about high bits. 1222 __ leal(LIR_OprFact::address(a), arg2); 1223 load_int_as_long(gen()->lir(), len, arg3); 1224 1225 __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), LIR_OprFact::illegalOpr, result_reg, cc->args()); 1226 __ move(result_reg, result); 1227 break; 1228 } 1229 default: { 1230 ShouldNotReachHere(); 1231 } 1232 } 1233 } 1234 1235 void LIRGenerator::do_update_CRC32C(Intrinsic* x) { 1236 Unimplemented(); 1237 } 1238 1239 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) { 1240 assert(x->number_of_arguments() == 3, "wrong type"); 1241 assert(UseFMA, "Needs FMA instructions support."); 1242 LIRItem value(x->argument_at(0), this); 1243 LIRItem value1(x->argument_at(1), this); 1244 LIRItem value2(x->argument_at(2), this); 1245 1246 value2.set_destroys_register(); 1247 1248 value.load_item(); 1249 value1.load_item(); 1250 value2.load_item(); 1251 1252 LIR_Opr calc_input = value.result(); 1253 LIR_Opr calc_input1 = value1.result(); 1254 LIR_Opr calc_input2 = value2.result(); 1255 LIR_Opr calc_result = rlock_result(x); 1256 1257 switch (x->id()) { 1258 case vmIntrinsics::_fmaD: __ fmad(calc_input, calc_input1, calc_input2, calc_result); break; 1259 case vmIntrinsics::_fmaF: __ fmaf(calc_input, calc_input1, calc_input2, calc_result); break; 1260 default: ShouldNotReachHere(); 1261 } 1262 } 1263 1264 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { 1265 fatal("vectorizedMismatch intrinsic is not implemented on this platform"); 1266 } 1267 | 1 /* 2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016, 2017, SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 1216 LIR_Opr arg1 = cc->at(0); 1217 LIR_Opr arg2 = cc->at(1); 1218 LIR_Opr arg3 = cc->at(2); 1219 1220 // CCallingConventionRequiresIntsAsLongs 1221 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32 stub doesn't care about high bits. 1222 __ leal(LIR_OprFact::address(a), arg2); 1223 load_int_as_long(gen()->lir(), len, arg3); 1224 1225 __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), LIR_OprFact::illegalOpr, result_reg, cc->args()); 1226 __ move(result_reg, result); 1227 break; 1228 } 1229 default: { 1230 ShouldNotReachHere(); 1231 } 1232 } 1233 } 1234 1235 void LIRGenerator::do_update_CRC32C(Intrinsic* x) { 1236 assert(UseCRC32CIntrinsics, "or should not be here"); 1237 LIR_Opr result = rlock_result(x); 1238 1239 switch (x->id()) { 1240 case vmIntrinsics::_updateBytesCRC32C: 1241 case vmIntrinsics::_updateDirectByteBufferCRC32C: { 1242 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C); 1243 1244 LIRItem crc(x->argument_at(0), this); 1245 LIRItem buf(x->argument_at(1), this); 1246 LIRItem off(x->argument_at(2), this); 1247 LIRItem len(x->argument_at(3), this); 1248 buf.load_item(); 1249 off.load_nonconstant(); 1250 1251 LIR_Opr index = off.result(); 1252 int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0; 1253 if (off.result()->is_constant()) { 1254 index = LIR_OprFact::illegalOpr; 1255 offset += off.result()->as_jint(); 1256 } 1257 LIR_Opr base_op = buf.result(); 1258 1259 if (index->is_valid()) { 1260 LIR_Opr tmp = new_register(T_LONG); 1261 __ convert(Bytecodes::_i2l, index, tmp); 1262 index = tmp; 1263 } 1264 1265 LIR_Address* a = new LIR_Address(base_op, index, offset, T_BYTE); 1266 1267 BasicTypeList signature(3); 1268 signature.append(T_INT); 1269 signature.append(T_ADDRESS); 1270 signature.append(T_INT); 1271 CallingConvention* cc = frame_map()->c_calling_convention(&signature); 1272 const LIR_Opr result_reg = result_register_for (x->type()); 1273 1274 LIR_Opr arg1 = cc->at(0); 1275 LIR_Opr arg2 = cc->at(1); 1276 LIR_Opr arg3 = cc->at(2); 1277 1278 // CCallingConventionRequiresIntsAsLongs 1279 crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32 stub doesn't care about high bits. 1280 __ leal(LIR_OprFact::address(a), arg2); 1281 load_int_as_long(gen()->lir(), len, arg3); 1282 1283 __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args()); 1284 __ move(result_reg, result); 1285 break; 1286 } 1287 default: { 1288 ShouldNotReachHere(); 1289 } 1290 } 1291 } 1292 1293 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) { 1294 assert(x->number_of_arguments() == 3, "wrong type"); 1295 assert(UseFMA, "Needs FMA instructions support."); 1296 LIRItem value(x->argument_at(0), this); 1297 LIRItem value1(x->argument_at(1), this); 1298 LIRItem value2(x->argument_at(2), this); 1299 1300 value2.set_destroys_register(); 1301 1302 value.load_item(); 1303 value1.load_item(); 1304 value2.load_item(); 1305 1306 LIR_Opr calc_input = value.result(); 1307 LIR_Opr calc_input1 = value1.result(); 1308 LIR_Opr calc_input2 = value2.result(); 1309 LIR_Opr calc_result = rlock_result(x); 1310 1311 switch (x->id()) { 1312 case vmIntrinsics::_fmaD: __ fmad(calc_input, calc_input1, calc_input2, calc_result); break; 1313 case vmIntrinsics::_fmaF: __ fmaf(calc_input, calc_input1, calc_input2, calc_result); break; 1314 default: ShouldNotReachHere(); 1315 } 1316 } 1317 1318 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { 1319 fatal("vectorizedMismatch intrinsic is not implemented on this platform"); 1320 } |