src/hotspot/cpu/ppc/ppc.ad
changeset 49455 848864ed9b17
parent 48810 1f7ebe9dd5b2
child 50095 bf2f27b92064
equal deleted inserted replaced
49454:689ebcfe04fd 49455:848864ed9b17
  1272   if (entry_point_toc_addr == NULL) {
  1272   if (entry_point_toc_addr == NULL) {
  1273     ciEnv::current()->record_out_of_memory_failure();
  1273     ciEnv::current()->record_out_of_memory_failure();
  1274     return offsets;
  1274     return offsets;
  1275   }
  1275   }
  1276   const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
  1276   const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
  1277   
  1277 
  1278   // Emit the trampoline stub which will be related to the branch-and-link below.
  1278   // Emit the trampoline stub which will be related to the branch-and-link below.
  1279   CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
  1279   CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
  1280   if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
  1280   if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
  1281   __ relocate(rtype);
  1281   __ relocate(rtype);
  1282   
  1282 
  1283   // Note: At this point we do not have the address of the trampoline
  1283   // Note: At this point we do not have the address of the trampoline
  1284   // stub, and the entry point might be too far away for bl, so __ pc()
  1284   // stub, and the entry point might be too far away for bl, so __ pc()
  1285   // serves as dummy and the bl will be patched later.
  1285   // serves as dummy and the bl will be patched later.
  1286   __ bl((address) __ pc());
  1286   __ bl((address) __ pc());
  1287 
  1287 
  1524 #endif
  1524 #endif
  1525   if (!method_is_frameless) {
  1525   if (!method_is_frameless) {
  1526     // Save return pc.
  1526     // Save return pc.
  1527     ___(std) std(return_pc, _abi(lr), callers_sp);
  1527     ___(std) std(return_pc, _abi(lr), callers_sp);
  1528   }
  1528   }
  1529   
  1529 
  1530   C->set_frame_complete(cbuf.insts_size());
  1530   C->set_frame_complete(cbuf.insts_size());
  1531 }
  1531 }
  1532 #undef ___
  1532 #undef ___
  1533 #undef ___stop
  1533 #undef ___stop
  1534 #undef ___advance
  1534 #undef ___advance
  2693     const_toc_addr = __ long_constant((jlong)$src$$constant);
  2693     const_toc_addr = __ long_constant((jlong)$src$$constant);
  2694     if (const_toc_addr == NULL) {
  2694     if (const_toc_addr == NULL) {
  2695       ciEnv::current()->record_out_of_memory_failure();
  2695       ciEnv::current()->record_out_of_memory_failure();
  2696       return;
  2696       return;
  2697     }
  2697     }
  2698     
  2698 
  2699     // Get the constant's TOC offset.
  2699     // Get the constant's TOC offset.
  2700     toc_offset = __ offset_to_method_toc(const_toc_addr);
  2700     toc_offset = __ offset_to_method_toc(const_toc_addr);
  2701     
  2701 
  2702     // Keep the current instruction offset in mind.
  2702     // Keep the current instruction offset in mind.
  2703     ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
  2703     ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
  2704   
  2704 
  2705     __ ld($dst$$Register, toc_offset, $toc$$Register);
  2705     __ ld($dst$$Register, toc_offset, $toc$$Register);
  2706   %}
  2706   %}
  2707 
  2707 
  2708   enc_class enc_load_long_constL_hi(iRegLdst dst, iRegLdst toc, immL src) %{
  2708   enc_class enc_load_long_constL_hi(iRegLdst dst, iRegLdst toc, immL src) %{
  2709     // TODO: PPC port $archOpcode(ppc64Opcode_addis);
  2709     // TODO: PPC port $archOpcode(ppc64Opcode_addis);
  2817   xxspltdNode     *_replicated;
  2817   xxspltdNode     *_replicated;
  2818   loadConLNode    *_small;
  2818   loadConLNode    *_small;
  2819   MachNode        *_last;
  2819   MachNode        *_last;
  2820 } loadConLReplicatedNodesTuple;
  2820 } loadConLReplicatedNodesTuple;
  2821 
  2821 
  2822 loadConLReplicatedNodesTuple loadConLReplicatedNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Node *toc, immLOper *immSrc, 
  2822 loadConLReplicatedNodesTuple loadConLReplicatedNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Node *toc, immLOper *immSrc,
  2823                                                  vecXOper *dst, immI_0Oper *zero,
  2823                                                  vecXOper *dst, immI_0Oper *zero,
  2824                                                  OptoReg::Name reg_second, OptoReg::Name reg_first,
  2824                                                  OptoReg::Name reg_second, OptoReg::Name reg_first,
  2825                                                  OptoReg::Name reg_vec_second, OptoReg::Name reg_vec_first) {
  2825                                                  OptoReg::Name reg_vec_second, OptoReg::Name reg_vec_first) {
  2826   loadConLReplicatedNodesTuple nodes;
  2826   loadConLReplicatedNodesTuple nodes;
  2827 
  2827 
  3156 
  3156 
  3157     MacroAssembler _masm(&cbuf);
  3157     MacroAssembler _masm(&cbuf);
  3158     Label skip_storestore;
  3158     Label skip_storestore;
  3159 
  3159 
  3160 #if 0 // TODO: PPC port
  3160 #if 0 // TODO: PPC port
  3161     // Check CMSCollectorCardTableModRefBSExt::_requires_release and do the
  3161     // Check CMSCollectorCardTableBarrierSetBSExt::_requires_release and do the
  3162     // StoreStore barrier conditionally.
  3162     // StoreStore barrier conditionally.
  3163     __ lwz(R0, 0, $releaseFieldAddr$$Register);
  3163     __ lwz(R0, 0, $releaseFieldAddr$$Register);
  3164     __ cmpwi($crx$$CondRegister, R0, 0);
  3164     __ cmpwi($crx$$CondRegister, R0, 0);
  3165     __ beq_predict_taken($crx$$CondRegister, skip_storestore);
  3165     __ beq_predict_taken($crx$$CondRegister, skip_storestore);
  3166 #endif
  3166 #endif
  6850 //----------Store Instructions With Zeros--------------------------------------
  6850 //----------Store Instructions With Zeros--------------------------------------
  6851 
  6851 
  6852 // Card-mark for CMS garbage collection.
  6852 // Card-mark for CMS garbage collection.
  6853 // This cardmark does an optimization so that it must not always
  6853 // This cardmark does an optimization so that it must not always
  6854 // do a releasing store. For this, it gets the address of
  6854 // do a releasing store. For this, it gets the address of
  6855 // CMSCollectorCardTableModRefBSExt::_requires_release as input.
  6855 // CMSCollectorCardTableBarrierSetBSExt::_requires_release as input.
  6856 // (Using releaseFieldAddr in the match rule is a hack.)
  6856 // (Using releaseFieldAddr in the match rule is a hack.)
  6857 instruct storeCM_CMS(memory mem, iRegLdst releaseFieldAddr, flagsReg crx) %{
  6857 instruct storeCM_CMS(memory mem, iRegLdst releaseFieldAddr, flagsReg crx) %{
  6858   match(Set mem (StoreCM mem releaseFieldAddr));
  6858   match(Set mem (StoreCM mem releaseFieldAddr));
  6859   effect(TEMP crx);
  6859   effect(TEMP crx);
  6860   predicate(false);
  6860   predicate(false);
  6869 %}
  6869 %}
  6870 
  6870 
  6871 // Card-mark for CMS garbage collection.
  6871 // Card-mark for CMS garbage collection.
  6872 // This cardmark does an optimization so that it must not always
  6872 // This cardmark does an optimization so that it must not always
  6873 // do a releasing store. For this, it needs the constant address of
  6873 // do a releasing store. For this, it needs the constant address of
  6874 // CMSCollectorCardTableModRefBSExt::_requires_release.
  6874 // CMSCollectorCardTableBarrierSetBSExt::_requires_release.
  6875 // This constant address is split off here by expand so we can use
  6875 // This constant address is split off here by expand so we can use
  6876 // adlc / matcher functionality to load it from the constant section.
  6876 // adlc / matcher functionality to load it from the constant section.
  6877 instruct storeCM_CMS_ExEx(memory mem, immI_0 zero) %{
  6877 instruct storeCM_CMS_ExEx(memory mem, immI_0 zero) %{
  6878   match(Set mem (StoreCM mem zero));
  6878   match(Set mem (StoreCM mem zero));
  6879   predicate(UseConcMarkSweepGC);
  6879   predicate(UseConcMarkSweepGC);
  6880 
  6880 
  6881   expand %{
  6881   expand %{
  6882     immL baseImm %{ 0 /* TODO: PPC port (jlong)CMSCollectorCardTableModRefBSExt::requires_release_address() */ %}
  6882     immL baseImm %{ 0 /* TODO: PPC port (jlong)CMSCollectorCardTableBarrierSetBSExt::requires_release_address() */ %}
  6883     iRegLdst releaseFieldAddress;
  6883     iRegLdst releaseFieldAddress;
  6884     flagsReg crx;
  6884     flagsReg crx;
  6885     loadConL_Ex(releaseFieldAddress, baseImm);
  6885     loadConL_Ex(releaseFieldAddress, baseImm);
  6886     storeCM_CMS(mem, releaseFieldAddress, crx);
  6886     storeCM_CMS(mem, releaseFieldAddress, crx);
  6887   %}
  6887   %}
 13663   ins_pipe(pipe_class_default);
 13663   ins_pipe(pipe_class_default);
 13664 %}
 13664 %}
 13665 
 13665 
 13666 instruct mtvsrwz(vecX temp1, iRegIsrc src) %{
 13666 instruct mtvsrwz(vecX temp1, iRegIsrc src) %{
 13667   effect(DEF temp1, USE src);
 13667   effect(DEF temp1, USE src);
 13668   
 13668 
 13669   size(4);
 13669   size(4);
 13670   ins_encode %{
 13670   ins_encode %{
 13671     __ mtvsrwz($temp1$$VectorSRegister, $src$$Register);
 13671     __ mtvsrwz($temp1$$VectorSRegister, $src$$Register);
 13672   %}
 13672   %}
 13673   ins_pipe(pipe_class_default);
 13673   ins_pipe(pipe_class_default);
 13676 instruct xxspltw(vecX dst, vecX src, immI8 imm1) %{
 13676 instruct xxspltw(vecX dst, vecX src, immI8 imm1) %{
 13677   effect(DEF dst, USE src, USE imm1);
 13677   effect(DEF dst, USE src, USE imm1);
 13678 
 13678 
 13679   size(4);
 13679   size(4);
 13680   ins_encode %{
 13680   ins_encode %{
 13681     __ xxspltw($dst$$VectorSRegister, $src$$VectorSRegister, $imm1$$constant); 
 13681     __ xxspltw($dst$$VectorSRegister, $src$$VectorSRegister, $imm1$$constant);
 13682   %}
 13682   %}
 13683   ins_pipe(pipe_class_default);
 13683   ins_pipe(pipe_class_default);
 13684 %}
 13684 %}
 13685 
 13685 
 13686 //---------- Replicate Vector Instructions ------------------------------------
 13686 //---------- Replicate Vector Instructions ------------------------------------
 13841   predicate(n->as_Vector()->length() == 8);
 13841   predicate(n->as_Vector()->length() == 8);
 13842 
 13842 
 13843   expand %{
 13843   expand %{
 13844     iRegLdst tmpL;
 13844     iRegLdst tmpL;
 13845     vecX tmpV;
 13845     vecX tmpV;
 13846     immI8  zero %{ (int)  0 %} 
 13846     immI8  zero %{ (int)  0 %}
 13847     moveReg(tmpL, src);
 13847     moveReg(tmpL, src);
 13848     repl48(tmpL);
 13848     repl48(tmpL);
 13849     repl32(tmpL);
 13849     repl32(tmpL);
 13850     mtvsrd(tmpV, tmpL);
 13850     mtvsrd(tmpV, tmpL);
 13851     xxpermdi(dst, tmpV, tmpV, zero);
 13851     xxpermdi(dst, tmpV, tmpV, zero);
 13913 instruct repl4I_reg_Ex(vecX dst, iRegIsrc src) %{
 13913 instruct repl4I_reg_Ex(vecX dst, iRegIsrc src) %{
 13914   match(Set dst (ReplicateI src));
 13914   match(Set dst (ReplicateI src));
 13915   predicate(n->as_Vector()->length() == 4);
 13915   predicate(n->as_Vector()->length() == 4);
 13916   ins_cost(2 * DEFAULT_COST);
 13916   ins_cost(2 * DEFAULT_COST);
 13917 
 13917 
 13918   expand %{ 
 13918   expand %{
 13919     iRegLdst tmpL;
 13919     iRegLdst tmpL;
 13920     vecX tmpV;
 13920     vecX tmpV;
 13921     immI8  zero %{ (int)  0 %} 
 13921     immI8  zero %{ (int)  0 %}
 13922     moveReg(tmpL, src);
 13922     moveReg(tmpL, src);
 13923     repl32(tmpL);
 13923     repl32(tmpL);
 13924     mtvsrd(tmpV, tmpL);
 13924     mtvsrd(tmpV, tmpL);
 13925     xxpermdi(dst, tmpV, tmpV, zero);
 13925     xxpermdi(dst, tmpV, tmpV, zero);
 13926   %}
 13926   %}
 14055   expand %{
 14055   expand %{
 14056     stackSlotL tmpS;
 14056     stackSlotL tmpS;
 14057     iRegIdst tmpI;
 14057     iRegIdst tmpI;
 14058     iRegLdst tmpL;
 14058     iRegLdst tmpL;
 14059     vecX tmpV;
 14059     vecX tmpV;
 14060     immI8  zero %{ (int)  0 %} 
 14060     immI8  zero %{ (int)  0 %}
 14061 
 14061 
 14062     moveF2I_reg_stack(tmpS, src);   // Move float to stack.
 14062     moveF2I_reg_stack(tmpS, src);   // Move float to stack.
 14063     moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
 14063     moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
 14064     moveReg(tmpL, tmpI);             // Move int to long reg.
 14064     moveReg(tmpL, tmpI);             // Move int to long reg.
 14065     repl32(tmpL);                    // Replicate bitpattern.
 14065     repl32(tmpL);                    // Replicate bitpattern.
 14094   expand %{
 14094   expand %{
 14095     stackSlotL tmpS;
 14095     stackSlotL tmpS;
 14096     iRegLdst tmpL;
 14096     iRegLdst tmpL;
 14097     iRegLdst tmp;
 14097     iRegLdst tmp;
 14098     vecX tmpV;
 14098     vecX tmpV;
 14099     immI8  zero %{ (int)  0 %} 
 14099     immI8  zero %{ (int)  0 %}
 14100     moveD2L_reg_stack(tmpS, src);
 14100     moveD2L_reg_stack(tmpS, src);
 14101     moveD2L_stack_reg(tmpL, tmpS);
 14101     moveD2L_stack_reg(tmpL, tmpS);
 14102     mtvsrd(tmpV, tmpL);
 14102     mtvsrd(tmpV, tmpL);
 14103     xxpermdi(dst, tmpV, tmpV, zero);
 14103     xxpermdi(dst, tmpV, tmpV, zero);
 14104   %}
 14104   %}
 14130 
 14130 
 14131 instruct mtvsrd(vecX dst, iRegLsrc src) %{
 14131 instruct mtvsrd(vecX dst, iRegLsrc src) %{
 14132   predicate(false);
 14132   predicate(false);
 14133   effect(DEF dst, USE src);
 14133   effect(DEF dst, USE src);
 14134 
 14134 
 14135   format %{ "MTVSRD      $dst, $src \t// Move to 16-byte register"%} 
 14135   format %{ "MTVSRD      $dst, $src \t// Move to 16-byte register"%}
 14136   size(4);
 14136   size(4);
 14137   ins_encode %{
 14137   ins_encode %{
 14138     __ mtvsrd($dst$$VectorSRegister, $src$$Register);
 14138     __ mtvsrd($dst$$VectorSRegister, $src$$Register);
 14139   %}
 14139   %}
 14140   ins_pipe(pipe_class_default);
 14140   ins_pipe(pipe_class_default);
 14145 
 14145 
 14146   format %{ "XXSPLATD      $dst, $src, $zero \t// Permute 16-byte register"%}
 14146   format %{ "XXSPLATD      $dst, $src, $zero \t// Permute 16-byte register"%}
 14147   size(4);
 14147   size(4);
 14148   ins_encode %{
 14148   ins_encode %{
 14149     __ xxpermdi($dst$$VectorSRegister, $src$$VectorSRegister, $src$$VectorSRegister, $zero$$constant);
 14149     __ xxpermdi($dst$$VectorSRegister, $src$$VectorSRegister, $src$$VectorSRegister, $zero$$constant);
 14150   %} 
 14150   %}
 14151   ins_pipe(pipe_class_default);
 14151   ins_pipe(pipe_class_default);
 14152 %}
 14152 %}
 14153 
 14153 
 14154 instruct xxpermdi(vecX dst, vecX src1, vecX src2, immI8 zero) %{
 14154 instruct xxpermdi(vecX dst, vecX src1, vecX src2, immI8 zero) %{
 14155   effect(DEF dst, USE src1, USE src2, USE zero);
 14155   effect(DEF dst, USE src1, USE src2, USE zero);
 14156 
 14156 
 14157   format %{ "XXPERMDI      $dst, $src1, $src2, $zero \t// Permute 16-byte register"%}
 14157   format %{ "XXPERMDI      $dst, $src1, $src2, $zero \t// Permute 16-byte register"%}
 14158   size(4);
 14158   size(4);
 14159   ins_encode %{
 14159   ins_encode %{
 14160     __ xxpermdi($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister, $zero$$constant);
 14160     __ xxpermdi($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister, $zero$$constant);
 14161   %} 
 14161   %}
 14162   ins_pipe(pipe_class_default);
 14162   ins_pipe(pipe_class_default);
 14163 %}
 14163 %}
 14164 
 14164 
 14165 instruct repl2L_reg_Ex(vecX dst, iRegLsrc src) %{
 14165 instruct repl2L_reg_Ex(vecX dst, iRegLsrc src) %{
 14166   match(Set dst (ReplicateL src));
 14166   match(Set dst (ReplicateL src));
 14167   predicate(n->as_Vector()->length() == 2);
 14167   predicate(n->as_Vector()->length() == 2);
 14168   expand %{
 14168   expand %{
 14169     vecX tmpV;
 14169     vecX tmpV;
 14170     immI8  zero %{ (int)  0 %} 
 14170     immI8  zero %{ (int)  0 %}
 14171     mtvsrd(tmpV, src); 
 14171     mtvsrd(tmpV, src);
 14172     xxpermdi(dst, tmpV, tmpV, zero);
 14172     xxpermdi(dst, tmpV, tmpV, zero);
 14173   %}
 14173   %}
 14174 %}
 14174 %}
 14175 
 14175 
 14176 instruct repl2L_immI0(vecX dst, immI_0 zero) %{
 14176 instruct repl2L_immI0(vecX dst, immI_0 zero) %{