< prev index next >

src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 654   ValueTag tag = x->x()->type()->tag();
 655   if (tag == longTag) {
 656     left.set_destroys_register();
 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, T_INT);
 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) {


   1 /*
   2  * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 654   ValueTag tag = x->x()->type()->tag();
 655   if (tag == longTag) {
 656     left.set_destroys_register();
 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 (is_reference_type(type)) {
 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, T_INT);
 692   return result;
 693 }
 694 
 695 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
 696   bool is_oop = is_reference_type(type);
 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) {


< prev index next >