hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp
changeset 46315 a796c32af782
parent 42897 57e7b1c75d17
child 46386 742f8b16d00c
equal deleted inserted replaced
46314:f39171272d2b 46315:a796c32af782
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * Copyright (c) 2016 SAP SE. 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.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5  *
     5  *
     6  * This code is free software; you can redistribute it and/or modify it
     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
     7  * under the terms of the GNU General Public License version 2 only, as
     8  * published by the Free Software Foundation.
     8  * published by the Free Software Foundation.
    56       r = LIR_OprFact::value_type(value()->type());
    56       r = LIR_OprFact::value_type(value()->type());
    57     }
    57     }
    58     _result = r;
    58     _result = r;
    59   } else {
    59   } else {
    60     load_item();
    60     load_item();
    61   }
       
    62 }
       
    63 
       
    64 inline void load_int_as_long(LIR_List *ll, LIRItem &li, LIR_Opr dst) {
       
    65   LIR_Opr r = li.value()->operand();
       
    66   if (r->is_constant()) {
       
    67     // Constants get loaded with sign extend on this platform.
       
    68     ll->move(li.result(), dst);
       
    69   } else {
       
    70     if (!r->is_register()) {
       
    71       li.load_item_force(dst);
       
    72     }
       
    73     LIR_Opr dst_l = FrameMap::as_long_opr(dst->as_register());
       
    74     ll->convert(Bytecodes::_i2l, li.result(), dst_l); // Convert.
       
    75   }
    61   }
    76 }
    62 }
    77 
    63 
    78 //--------------------------------------------------------------
    64 //--------------------------------------------------------------
    79 //               LIRGenerator
    65 //               LIRGenerator
  1215 
  1201 
  1216       LIR_Opr arg1 = cc->at(0);
  1202       LIR_Opr arg1 = cc->at(0);
  1217       LIR_Opr arg2 = cc->at(1);
  1203       LIR_Opr arg2 = cc->at(1);
  1218       LIR_Opr arg3 = cc->at(2);
  1204       LIR_Opr arg3 = cc->at(2);
  1219 
  1205 
  1220       // CCallingConventionRequiresIntsAsLongs
       
  1221       crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32 stub doesn't care about high bits.
  1206       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);
  1207       __ leal(LIR_OprFact::address(a), arg2);
  1223       load_int_as_long(gen()->lir(), len, arg3);
  1208       len.load_item_force(arg3); // We skip int->long conversion here, because CRC32 stub expects int.
  1224 
  1209 
  1225       __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), LIR_OprFact::illegalOpr, result_reg, cc->args());
  1210       __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), LIR_OprFact::illegalOpr, result_reg, cc->args());
  1226       __ move(result_reg, result);
  1211       __ move(result_reg, result);
  1227       break;
  1212       break;
  1228     }
  1213     }
  1231     }
  1216     }
  1232   }
  1217   }
  1233 }
  1218 }
  1234 
  1219 
  1235 void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
  1220 void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
  1236   Unimplemented();
  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   }
  1237 }
  1275 }
  1238 
  1276 
  1239 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
  1277 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
  1240   assert(x->number_of_arguments() == 3, "wrong type");
  1278   assert(x->number_of_arguments() == 3, "wrong type");
  1241   assert(UseFMA, "Needs FMA instructions support.");
  1279   assert(UseFMA, "Needs FMA instructions support.");
  1262 }
  1300 }
  1263 
  1301 
  1264 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
  1302 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
  1265   fatal("vectorizedMismatch intrinsic is not implemented on this platform");
  1303   fatal("vectorizedMismatch intrinsic is not implemented on this platform");
  1266 }
  1304 }
  1267