< prev index next >

src/cpu/aarch64/vm/aarch64.ad

Print this page
rev 8967 : 8136615: aarch64: elide DecodeN when followed by CmpP 0
Summary: remove DecodeN when comparing a narrow oop with 0
Reviewed-by: duke


13269 
13270 instruct cmpP_imm0_branch(cmpOp cmp, iRegP op1, immP0 op2, label labl, rFlagsReg cr) %{
13271   match(If cmp (CmpP op1 op2));
13272   predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
13273             || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
13274   effect(USE labl);
13275 
13276   ins_cost(BRANCH_COST);
13277   format %{ "cb$cmp   $op1, $labl" %}
13278   ins_encode %{
13279     Label* L = $labl$$label;
13280     Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode;
13281     if (cond == Assembler::EQ)
13282       __ cbz($op1$$Register, *L);
13283     else
13284       __ cbnz($op1$$Register, *L);
13285   %}
13286   ins_pipe(pipe_cmp_branch);
13287 %}
13288 



















13289 // Conditional Far Branch
13290 // Conditional Far Branch Unsigned
13291 // TODO: fixme
13292 
13293 // counted loop end branch near
13294 instruct branchLoopEnd(cmpOp cmp, rFlagsReg cr, label lbl)
13295 %{
13296   match(CountedLoopEnd cmp cr);
13297 
13298   effect(USE lbl);
13299 
13300   ins_cost(BRANCH_COST);
13301   // short variant.
13302   // ins_short_branch(1);
13303   format %{ "b$cmp $lbl \t// counted loop end" %}
13304 
13305   ins_encode(aarch64_enc_br_con(cmp, lbl));
13306 
13307   ins_pipe(pipe_branch);
13308 %}




13269 
13270 instruct cmpP_imm0_branch(cmpOp cmp, iRegP op1, immP0 op2, label labl, rFlagsReg cr) %{
13271   match(If cmp (CmpP op1 op2));
13272   predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
13273             || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
13274   effect(USE labl);
13275 
13276   ins_cost(BRANCH_COST);
13277   format %{ "cb$cmp   $op1, $labl" %}
13278   ins_encode %{
13279     Label* L = $labl$$label;
13280     Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode;
13281     if (cond == Assembler::EQ)
13282       __ cbz($op1$$Register, *L);
13283     else
13284       __ cbnz($op1$$Register, *L);
13285   %}
13286   ins_pipe(pipe_cmp_branch);
13287 %}
13288 
13289 instruct cmpP_narrowOop_imm0_branch(cmpOp cmp, iRegN oop, immP0 zero, label labl, rFlagsReg cr) %{
13290   match(If cmp (CmpP (DecodeN oop) zero));
13291   predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
13292             || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
13293   effect(USE labl);
13294 
13295   ins_cost(BRANCH_COST);
13296   format %{ "cb$cmp   $oop, $labl" %}
13297   ins_encode %{
13298     Label* L = $labl$$label;
13299     Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode;
13300     if (cond == Assembler::EQ)
13301       __ cbzw($oop$$Register, *L);
13302     else
13303       __ cbnzw($oop$$Register, *L);
13304   %}
13305   ins_pipe(pipe_cmp_branch);
13306 %}
13307 
13308 // Conditional Far Branch
13309 // Conditional Far Branch Unsigned
13310 // TODO: fixme
13311 
13312 // counted loop end branch near
13313 instruct branchLoopEnd(cmpOp cmp, rFlagsReg cr, label lbl)
13314 %{
13315   match(CountedLoopEnd cmp cr);
13316 
13317   effect(USE lbl);
13318 
13319   ins_cost(BRANCH_COST);
13320   // short variant.
13321   // ins_short_branch(1);
13322   format %{ "b$cmp $lbl \t// counted loop end" %}
13323 
13324   ins_encode(aarch64_enc_br_con(cmp, lbl));
13325 
13326   ins_pipe(pipe_branch);
13327 %}


< prev index next >