src/hotspot/cpu/x86/x86_64.ad
changeset 54960 e46fe26d7f77
parent 54780 f8d182aedc92
child 55105 9ad765641e8f
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54959:00425a850a2f 54960:e46fe26d7f77
   916   if (framesize) {
   916   if (framesize) {
   917     st->print_cr("addq    rsp, %d\t# Destroy frame", framesize);
   917     st->print_cr("addq    rsp, %d\t# Destroy frame", framesize);
   918     st->print("\t");
   918     st->print("\t");
   919   }
   919   }
   920 
   920 
   921   st->print_cr("popq   rbp");
   921   st->print_cr("popq    rbp");
   922   if (do_polling() && C->is_method_compilation()) {
   922   if (do_polling() && C->is_method_compilation()) {
   923     st->print("\t");
   923     st->print("\t");
   924     if (SafepointMechanism::uses_thread_local_poll()) {
   924     if (SafepointMechanism::uses_thread_local_poll()) {
   925       st->print_cr("movq   rscratch1, poll_offset[r15_thread] #polling_page_address\n\t"
   925       st->print_cr("movq    rscratch1, poll_offset[r15_thread] #polling_page_address\n\t"
   926                    "testl  rax, [rscratch1]\t"
   926                    "testl   rax, [rscratch1]\t"
   927                    "# Safepoint: poll for GC");
   927                    "# Safepoint: poll for GC");
   928     } else if (Assembler::is_polling_page_far()) {
   928     } else if (Assembler::is_polling_page_far()) {
   929       st->print_cr("movq   rscratch1, #polling_page_address\n\t"
   929       st->print_cr("movq    rscratch1, #polling_page_address\n\t"
   930                    "testl  rax, [rscratch1]\t"
   930                    "testl   rax, [rscratch1]\t"
   931                    "# Safepoint: poll for GC");
   931                    "# Safepoint: poll for GC");
   932     } else {
   932     } else {
   933       st->print_cr("testl  rax, [rip + #offset_to_poll_page]\t"
   933       st->print_cr("testl   rax, [rip + #offset_to_poll_page]\t"
   934                    "# Safepoint: poll for GC");
   934                    "# Safepoint: poll for GC");
   935     }
   935     }
   936   }
   936   }
   937 }
   937 }
   938 #endif
   938 #endif
 10301 instruct cadd_cmpLTMask(rRegI p, rRegI q, rRegI y, rFlagsReg cr)
 10301 instruct cadd_cmpLTMask(rRegI p, rRegI q, rRegI y, rFlagsReg cr)
 10302 %{
 10302 %{
 10303   match(Set p (AddI (AndI (CmpLTMask p q) y) (SubI p q)));
 10303   match(Set p (AddI (AndI (CmpLTMask p q) y) (SubI p q)));
 10304   effect(KILL cr);
 10304   effect(KILL cr);
 10305   ins_cost(300);
 10305   ins_cost(300);
 10306   format %{ "subl   $p,$q\t# cadd_cmpLTMask\n\t"
 10306   format %{ "subl    $p,$q\t# cadd_cmpLTMask\n\t"
 10307             "jge    done\n\t"
 10307             "jge     done\n\t"
 10308             "addl   $p,$y\n"
 10308             "addl    $p,$y\n"
 10309             "done:  " %}
 10309             "done:   " %}
 10310   ins_encode %{
 10310   ins_encode %{
 10311     Register Rp = $p$$Register;
 10311     Register Rp = $p$$Register;
 10312     Register Rq = $q$$Register;
 10312     Register Rq = $q$$Register;
 10313     Register Ry = $y$$Register;
 10313     Register Ry = $y$$Register;
 10314     Label done;
 10314     Label done;
 10326   match(Set y (AndI (CmpLTMask p q) y));
 10326   match(Set y (AndI (CmpLTMask p q) y));
 10327   effect(KILL cr);
 10327   effect(KILL cr);
 10328 
 10328 
 10329   ins_cost(300);
 10329   ins_cost(300);
 10330 
 10330 
 10331   format %{ "cmpl     $p, $q\t# and_cmpLTMask\n\t"
 10331   format %{ "cmpl    $p, $q\t# and_cmpLTMask\n\t"
 10332             "jlt      done\n\t"
 10332             "jlt     done\n\t"
 10333             "xorl     $y, $y\n"
 10333             "xorl    $y, $y\n"
 10334             "done:  " %}
 10334             "done:   " %}
 10335   ins_encode %{
 10335   ins_encode %{
 10336     Register Rp = $p$$Register;
 10336     Register Rp = $p$$Register;
 10337     Register Rq = $q$$Register;
 10337     Register Rq = $q$$Register;
 10338     Register Ry = $y$$Register;
 10338     Register Ry = $y$$Register;
 10339     Label done;
 10339     Label done;
 11886 
 11886 
 11887 instruct testU_reg(rFlagsRegU cr, rRegI src, immI0 zero)
 11887 instruct testU_reg(rFlagsRegU cr, rRegI src, immI0 zero)
 11888 %{
 11888 %{
 11889   match(Set cr (CmpU src zero));
 11889   match(Set cr (CmpU src zero));
 11890 
 11890 
 11891   format %{ "testl  $src, $src\t# unsigned" %}
 11891   format %{ "testl   $src, $src\t# unsigned" %}
 11892   opcode(0x85);
 11892   opcode(0x85);
 11893   ins_encode(REX_reg_reg(src, src), OpcP, reg_reg(src, src));
 11893   ins_encode(REX_reg_reg(src, src), OpcP, reg_reg(src, src));
 11894   ins_pipe(ialu_cr_reg_imm);
 11894   ins_pipe(ialu_cr_reg_imm);
 11895 %}
 11895 %}
 11896 
 11896 
 12429 instruct jmpConU(cmpOpU cop, rFlagsRegU cmp, label labl) %{
 12429 instruct jmpConU(cmpOpU cop, rFlagsRegU cmp, label labl) %{
 12430   match(If cop cmp);
 12430   match(If cop cmp);
 12431   effect(USE labl);
 12431   effect(USE labl);
 12432 
 12432 
 12433   ins_cost(300);
 12433   ins_cost(300);
 12434   format %{ "j$cop,u  $labl" %}
 12434   format %{ "j$cop,u   $labl" %}
 12435   size(6);
 12435   size(6);
 12436   ins_encode %{
 12436   ins_encode %{
 12437     Label* L = $labl$$label;
 12437     Label* L = $labl$$label;
 12438     __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump
 12438     __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump
 12439   %}
 12439   %}
 12443 instruct jmpConUCF(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{
 12443 instruct jmpConUCF(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{
 12444   match(If cop cmp);
 12444   match(If cop cmp);
 12445   effect(USE labl);
 12445   effect(USE labl);
 12446 
 12446 
 12447   ins_cost(200);
 12447   ins_cost(200);
 12448   format %{ "j$cop,u  $labl" %}
 12448   format %{ "j$cop,u   $labl" %}
 12449   size(6);
 12449   size(6);
 12450   ins_encode %{
 12450   ins_encode %{
 12451     Label* L = $labl$$label;
 12451     Label* L = $labl$$label;
 12452     __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump
 12452     __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump
 12453   %}
 12453   %}
 12459   effect(USE labl);
 12459   effect(USE labl);
 12460 
 12460 
 12461   ins_cost(200);
 12461   ins_cost(200);
 12462   format %{ $$template
 12462   format %{ $$template
 12463     if ($cop$$cmpcode == Assembler::notEqual) {
 12463     if ($cop$$cmpcode == Assembler::notEqual) {
 12464       $$emit$$"jp,u   $labl\n\t"
 12464       $$emit$$"jp,u    $labl\n\t"
 12465       $$emit$$"j$cop,u   $labl"
 12465       $$emit$$"j$cop,u   $labl"
 12466     } else {
 12466     } else {
 12467       $$emit$$"jp,u   done\n\t"
 12467       $$emit$$"jp,u    done\n\t"
 12468       $$emit$$"j$cop,u   $labl\n\t"
 12468       $$emit$$"j$cop,u   $labl\n\t"
 12469       $$emit$$"done:"
 12469       $$emit$$"done:"
 12470     }
 12470     }
 12471   %}
 12471   %}
 12472   ins_encode %{
 12472   ins_encode %{
 12664   effect(USE labl);
 12664   effect(USE labl);
 12665 
 12665 
 12666   ins_cost(300);
 12666   ins_cost(300);
 12667   format %{ $$template
 12667   format %{ $$template
 12668     if ($cop$$cmpcode == Assembler::notEqual) {
 12668     if ($cop$$cmpcode == Assembler::notEqual) {
 12669       $$emit$$"jp,u,s   $labl\n\t"
 12669       $$emit$$"jp,u,s  $labl\n\t"
 12670       $$emit$$"j$cop,u,s   $labl"
 12670       $$emit$$"j$cop,u,s  $labl"
 12671     } else {
 12671     } else {
 12672       $$emit$$"jp,u,s   done\n\t"
 12672       $$emit$$"jp,u,s  done\n\t"
 12673       $$emit$$"j$cop,u,s  $labl\n\t"
 12673       $$emit$$"j$cop,u,s  $labl\n\t"
 12674       $$emit$$"done:"
 12674       $$emit$$"done:"
 12675     }
 12675     }
 12676   %}
 12676   %}
 12677   size(4);
 12677   size(4);
 12743 %{
 12743 %{
 12744   predicate(!Assembler::is_polling_page_far() && SafepointMechanism::uses_global_page_poll());
 12744   predicate(!Assembler::is_polling_page_far() && SafepointMechanism::uses_global_page_poll());
 12745   match(SafePoint);
 12745   match(SafePoint);
 12746   effect(KILL cr);
 12746   effect(KILL cr);
 12747 
 12747 
 12748   format %{ "testl  rax, [rip + #offset_to_poll_page]\t"
 12748   format %{ "testl   rax, [rip + #offset_to_poll_page]\t"
 12749             "# Safepoint: poll for GC" %}
 12749             "# Safepoint: poll for GC" %}
 12750   ins_cost(125);
 12750   ins_cost(125);
 12751   ins_encode %{
 12751   ins_encode %{
 12752     AddressLiteral addr(os::get_polling_page(), relocInfo::poll_type);
 12752     AddressLiteral addr(os::get_polling_page(), relocInfo::poll_type);
 12753     __ testl(rax, addr);
 12753     __ testl(rax, addr);
 12759 %{
 12759 %{
 12760   predicate(Assembler::is_polling_page_far() && SafepointMechanism::uses_global_page_poll());
 12760   predicate(Assembler::is_polling_page_far() && SafepointMechanism::uses_global_page_poll());
 12761   match(SafePoint poll);
 12761   match(SafePoint poll);
 12762   effect(KILL cr, USE poll);
 12762   effect(KILL cr, USE poll);
 12763 
 12763 
 12764   format %{ "testl  rax, [$poll]\t"
 12764   format %{ "testl   rax, [$poll]\t"
 12765             "# Safepoint: poll for GC" %}
 12765             "# Safepoint: poll for GC" %}
 12766   ins_cost(125);
 12766   ins_cost(125);
 12767   ins_encode %{
 12767   ins_encode %{
 12768     __ relocate(relocInfo::poll_type);
 12768     __ relocate(relocInfo::poll_type);
 12769     __ testl(rax, Address($poll$$Register, 0));
 12769     __ testl(rax, Address($poll$$Register, 0));
 12775 %{
 12775 %{
 12776   predicate(SafepointMechanism::uses_thread_local_poll());
 12776   predicate(SafepointMechanism::uses_thread_local_poll());
 12777   match(SafePoint poll);
 12777   match(SafePoint poll);
 12778   effect(KILL cr, USE poll);
 12778   effect(KILL cr, USE poll);
 12779 
 12779 
 12780   format %{ "testl  rax, [$poll]\t"
 12780   format %{ "testl   rax, [$poll]\t"
 12781             "# Safepoint: poll for GC" %}
 12781             "# Safepoint: poll for GC" %}
 12782   ins_cost(125);
 12782   ins_cost(125);
 12783   size(4); /* setting an explicit size will cause debug builds to assert if size is incorrect */
 12783   size(4); /* setting an explicit size will cause debug builds to assert if size is incorrect */
 12784   ins_encode %{
 12784   ins_encode %{
 12785     __ relocate(relocInfo::poll_type);
 12785     __ relocate(relocInfo::poll_type);