< prev index next >

src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp

Print this page




 657   }
 658   left.load_item();
 659   right.load_item();
 660   LIR_Opr reg = rlock_result(x);
 661 
 662   if (x->x()->type()->is_float_kind()) {
 663     Bytecodes::Code code = x->op();
 664     __ fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl));
 665   } else if (x->x()->type()->tag() == longTag) {
 666     __ lcmp2int(left.result(), right.result(), reg);
 667   } else {
 668     Unimplemented();
 669   }
 670 }
 671 
 672 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {
 673   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
 674   if (type == T_OBJECT || type == T_ARRAY) {
 675     cmp_value.load_item_force(FrameMap::rax_oop_opr);
 676     new_value.load_item();
 677     __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 678   } else if (type == T_INT) {
 679     cmp_value.load_item_force(FrameMap::rax_opr);
 680     new_value.load_item();
 681     __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 682   } else if (type == T_LONG) {
 683     cmp_value.load_item_force(FrameMap::long0_opr);
 684     new_value.load_item_force(FrameMap::long1_opr);
 685     __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 686   } else {
 687     Unimplemented();
 688   }
 689   LIR_Opr result = new_register(T_INT);
 690   __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
 691            result, type);
 692   return result;
 693 }
 694 
 695 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
 696   bool is_oop = type == T_OBJECT || type == T_ARRAY;
 697   LIR_Opr result = new_register(type);
 698   value.load_item();
 699   // Because we want a 2-arg form of xchg and xadd
 700   __ move(value.result(), result);
 701   assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type");
 702   __ xchg(addr, result, result, LIR_OprFact::illegalOpr);

 703   return result;
 704 }
 705 
 706 LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) {
 707   LIR_Opr result = new_register(type);
 708   value.load_item();
 709   // Because we want a 2-arg form of xchg and xadd
 710   __ move(value.result(), result);
 711   assert(type == T_INT LP64_ONLY( || type == T_LONG ), "unexpected type");
 712   __ xadd(addr, result, result, LIR_OprFact::illegalOpr);
 713   return result;
 714 }
 715 
 716 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
 717   assert(x->number_of_arguments() == 3, "wrong type");
 718   assert(UseFMA, "Needs FMA instructions support.");
 719   LIRItem value(x->argument_at(0), this);
 720   LIRItem value1(x->argument_at(1), this);
 721   LIRItem value2(x->argument_at(2), this);
 722 


1003       int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
1004       if(off.result()->is_constant()) {
1005         index = LIR_OprFact::illegalOpr;
1006        offset += off.result()->as_jint();
1007       }
1008       LIR_Opr base_op = buf.result();
1009 
1010 #ifndef _LP64
1011       if (!is_updateBytes) { // long b raw address
1012          base_op = new_register(T_INT);
1013          __ convert(Bytecodes::_l2i, buf.result(), base_op);
1014       }
1015 #else
1016       if (index->is_valid()) {
1017         LIR_Opr tmp = new_register(T_LONG);
1018         __ convert(Bytecodes::_i2l, index, tmp);
1019         index = tmp;
1020       }
1021 #endif
1022 




1023       LIR_Address* a = new LIR_Address(base_op,
1024                                        index,
1025                                        offset,
1026                                        T_BYTE);
1027       BasicTypeList signature(3);
1028       signature.append(T_INT);
1029       signature.append(T_ADDRESS);
1030       signature.append(T_INT);
1031       CallingConvention* cc = frame_map()->c_calling_convention(&signature);
1032       const LIR_Opr result_reg = result_register_for(x->type());
1033 
1034       LIR_Opr addr = new_pointer_register();
1035       __ leal(LIR_OprFact::address(a), addr);
1036 
1037       crc.load_item_force(cc->at(0));
1038       __ move(addr, cc->at(1));
1039       len.load_item_force(cc->at(2));
1040 
1041       __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
1042       __ move(result_reg, result);


1060   LIR_Opr result = rlock_result(x);
1061 
1062   LIRItem a(x->argument_at(0), this); // Object
1063   LIRItem aOffset(x->argument_at(1), this); // long
1064   LIRItem b(x->argument_at(2), this); // Object
1065   LIRItem bOffset(x->argument_at(3), this); // long
1066   LIRItem length(x->argument_at(4), this); // int
1067   LIRItem log2ArrayIndexScale(x->argument_at(5), this); // int
1068 
1069   a.load_item();
1070   aOffset.load_nonconstant();
1071   b.load_item();
1072   bOffset.load_nonconstant();
1073 
1074   long constant_aOffset = 0;
1075   LIR_Opr result_aOffset = aOffset.result();
1076   if (result_aOffset->is_constant()) {
1077     constant_aOffset = result_aOffset->as_jlong();
1078     result_aOffset = LIR_OprFact::illegalOpr;
1079   }
1080   LIR_Opr result_a = a.result();
1081 
1082   long constant_bOffset = 0;
1083   LIR_Opr result_bOffset = bOffset.result();
1084   if (result_bOffset->is_constant()) {
1085     constant_bOffset = result_bOffset->as_jlong();
1086     result_bOffset = LIR_OprFact::illegalOpr;
1087   }
1088   LIR_Opr result_b = b.result();
1089 
1090 #ifndef _LP64
1091   result_a = new_register(T_INT);
1092   __ convert(Bytecodes::_l2i, a.result(), result_a);
1093   result_b = new_register(T_INT);
1094   __ convert(Bytecodes::_l2i, b.result(), result_b);
1095 #endif
1096 
1097 
1098   LIR_Address* addr_a = new LIR_Address(result_a,
1099                                         result_aOffset,
1100                                         constant_aOffset,
1101                                         T_BYTE);
1102 
1103   LIR_Address* addr_b = new LIR_Address(result_b,
1104                                         result_bOffset,
1105                                         constant_bOffset,
1106                                         T_BYTE);
1107 
1108   BasicTypeList signature(4);




 657   }
 658   left.load_item();
 659   right.load_item();
 660   LIR_Opr reg = rlock_result(x);
 661 
 662   if (x->x()->type()->is_float_kind()) {
 663     Bytecodes::Code code = x->op();
 664     __ fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl));
 665   } else if (x->x()->type()->tag() == longTag) {
 666     __ lcmp2int(left.result(), right.result(), reg);
 667   } else {
 668     Unimplemented();
 669   }
 670 }
 671 
 672 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {
 673   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
 674   if (type == T_OBJECT || type == T_ARRAY) {
 675     cmp_value.load_item_force(FrameMap::rax_oop_opr);
 676     new_value.load_item();
 677     __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), new_register(T_OBJECT), new_register(T_OBJECT));
 678   } else if (type == T_INT) {
 679     cmp_value.load_item_force(FrameMap::rax_opr);
 680     new_value.load_item();
 681     __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 682   } else if (type == T_LONG) {
 683     cmp_value.load_item_force(FrameMap::long0_opr);
 684     new_value.load_item_force(FrameMap::long1_opr);
 685     __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 686   } else {
 687     Unimplemented();
 688   }
 689   LIR_Opr result = new_register(T_INT);
 690   __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
 691            result, type);
 692   return result;
 693 }
 694 
 695 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
 696   bool is_oop = type == T_OBJECT || type == T_ARRAY;
 697   LIR_Opr result = new_register(type);
 698   value.load_item();
 699   // Because we want a 2-arg form of xchg and xadd
 700   __ move(value.result(), result);
 701   assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type");
 702   LIR_Opr tmp = is_oop ? new_register(type) : LIR_OprFact::illegalOpr;
 703   __ xchg(addr, result, result, tmp);
 704   return result;
 705 }
 706 
 707 LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) {
 708   LIR_Opr result = new_register(type);
 709   value.load_item();
 710   // Because we want a 2-arg form of xchg and xadd
 711   __ move(value.result(), result);
 712   assert(type == T_INT LP64_ONLY( || type == T_LONG ), "unexpected type");
 713   __ xadd(addr, result, result, LIR_OprFact::illegalOpr);
 714   return result;
 715 }
 716 
 717 void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
 718   assert(x->number_of_arguments() == 3, "wrong type");
 719   assert(UseFMA, "Needs FMA instructions support.");
 720   LIRItem value(x->argument_at(0), this);
 721   LIRItem value1(x->argument_at(1), this);
 722   LIRItem value2(x->argument_at(2), this);
 723 


1004       int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
1005       if(off.result()->is_constant()) {
1006         index = LIR_OprFact::illegalOpr;
1007        offset += off.result()->as_jint();
1008       }
1009       LIR_Opr base_op = buf.result();
1010 
1011 #ifndef _LP64
1012       if (!is_updateBytes) { // long b raw address
1013          base_op = new_register(T_INT);
1014          __ convert(Bytecodes::_l2i, buf.result(), base_op);
1015       }
1016 #else
1017       if (index->is_valid()) {
1018         LIR_Opr tmp = new_register(T_LONG);
1019         __ convert(Bytecodes::_i2l, index, tmp);
1020         index = tmp;
1021       }
1022 #endif
1023 
1024       if (is_updateBytes) {
1025         base_op = access_resolve_for_read(IN_HEAP | IS_NOT_NULL, base_op, NULL);
1026       }
1027 
1028       LIR_Address* a = new LIR_Address(base_op,
1029                                        index,
1030                                        offset,
1031                                        T_BYTE);
1032       BasicTypeList signature(3);
1033       signature.append(T_INT);
1034       signature.append(T_ADDRESS);
1035       signature.append(T_INT);
1036       CallingConvention* cc = frame_map()->c_calling_convention(&signature);
1037       const LIR_Opr result_reg = result_register_for(x->type());
1038 
1039       LIR_Opr addr = new_pointer_register();
1040       __ leal(LIR_OprFact::address(a), addr);
1041 
1042       crc.load_item_force(cc->at(0));
1043       __ move(addr, cc->at(1));
1044       len.load_item_force(cc->at(2));
1045 
1046       __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
1047       __ move(result_reg, result);


1065   LIR_Opr result = rlock_result(x);
1066 
1067   LIRItem a(x->argument_at(0), this); // Object
1068   LIRItem aOffset(x->argument_at(1), this); // long
1069   LIRItem b(x->argument_at(2), this); // Object
1070   LIRItem bOffset(x->argument_at(3), this); // long
1071   LIRItem length(x->argument_at(4), this); // int
1072   LIRItem log2ArrayIndexScale(x->argument_at(5), this); // int
1073 
1074   a.load_item();
1075   aOffset.load_nonconstant();
1076   b.load_item();
1077   bOffset.load_nonconstant();
1078 
1079   long constant_aOffset = 0;
1080   LIR_Opr result_aOffset = aOffset.result();
1081   if (result_aOffset->is_constant()) {
1082     constant_aOffset = result_aOffset->as_jlong();
1083     result_aOffset = LIR_OprFact::illegalOpr;
1084   }
1085   LIR_Opr result_a = access_resolve_for_read(IN_HEAP, a.result(), NULL);
1086 
1087   long constant_bOffset = 0;
1088   LIR_Opr result_bOffset = bOffset.result();
1089   if (result_bOffset->is_constant()) {
1090     constant_bOffset = result_bOffset->as_jlong();
1091     result_bOffset = LIR_OprFact::illegalOpr;
1092   }
1093   LIR_Opr result_b = access_resolve_for_read(IN_HEAP, b.result(), NULL);
1094 
1095 #ifndef _LP64
1096   result_a = new_register(T_INT);
1097   __ convert(Bytecodes::_l2i, a.result(), result_a);
1098   result_b = new_register(T_INT);
1099   __ convert(Bytecodes::_l2i, b.result(), result_b);
1100 #endif
1101 
1102 
1103   LIR_Address* addr_a = new LIR_Address(result_a,
1104                                         result_aOffset,
1105                                         constant_aOffset,
1106                                         T_BYTE);
1107 
1108   LIR_Address* addr_b = new LIR_Address(result_b,
1109                                         result_bOffset,
1110                                         constant_bOffset,
1111                                         T_BYTE);
1112 
1113   BasicTypeList signature(4);


< prev index next >