Skip to content
forked from openjdk/jdk

Commit

Permalink
Update (2023.03.28) (openjdk#32)
Browse files Browse the repository at this point in the history
30225: remove a Chinese punctuation
30090: [C2] Fix typo for umodL_Reg_Reg instruction
29982: [C2] Add CountedLoopEnd_reg_imm12_short and branchConIU_reg_imm12_short
  • Loading branch information
loongson-jvm authored Mar 28, 2023
1 parent a9b8a19 commit 331190d
Showing 1 changed file with 55 additions and 13 deletions.
68 changes: 55 additions & 13 deletions src/hotspot/cpu/loongarch/loongarch_64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -5299,12 +5299,12 @@ instruct jmpDir_long(label labl) %{
%}

// Jump Direct Conditional - Label defines a relative address from Jcc+1
instruct jmpLoopEnd_long(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
instruct CountedLoopEnd_reg_reg_long(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
match(CountedLoopEnd cop (CmpI src1 src2));
effect(USE labl);

ins_cost(300);
format %{ "J$cop $src1, $src2, $labl\t# Loop end @ jmpLoopEnd_long" %}
format %{ "J$cop $src1, $src2, $labl\t# Loop end @ CountedLoopEnd_reg_reg_long" %}
ins_encode %{
Register op1 = $src1$$Register;
Register op2 = $src2$$Register;
Expand All @@ -5317,30 +5317,53 @@ instruct jmpLoopEnd_long(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
ins_pc_relative(1);
%}

instruct jmpLoopEnd_reg_imm12_long(cmpOp cop, mRegI src1, immI12 src2, label labl) %{
match(CountedLoopEnd cop (CmpI src1 src2));
// Note: LA does not have a branching instruction with an immediate number
// The purpose of retaining CountedLoopEnd_reg_imm12_short/long and branchConIU_reg_imm12_short/long
// is to reduce the long lifecycle of shared nodes.
// see #29437
instruct CountedLoopEnd_reg_imm12_short(cmpOp cop, mRegI src1, immI12 imm, label labl) %{
match(CountedLoopEnd cop (CmpI src1 imm));
effect(USE labl);

ins_cost(300);
format %{ "J$cop $src1, $imm, $labl\t# Loop end @ CountedLoopEnd_reg_imm12_short" %}
ins_encode %{
Register op1 = $src1$$Register;
Label &L = *($labl$$label);
int flag = $cop$$cmpcode;

__ addi_d(AT, R0, $imm$$constant);
__ cmp_branch_short(flag, op1, AT, L, true /* signed */);
%}
ins_pipe( pipe_jump );
ins_pc_relative(1);
ins_short_branch(1);
%}

instruct CountedLoopEnd_reg_imm12_long(cmpOp cop, mRegI src1, immI12 imm, label labl) %{
match(CountedLoopEnd cop (CmpI src1 imm));
effect(USE labl);

ins_cost(300);
format %{ "J$cop $src1, $src2, $labl\t# Loop end @ jmpLoopEnd_reg_imm12_long" %}
format %{ "J$cop $src1, $imm, $labl\t# Loop end @ CountedLoopEnd_reg_imm12_long" %}
ins_encode %{
Register op1 = $src1$$Register;
Label* L = $labl$$label;
int flag = $cop$$cmpcode;

__ addi_d(AT, R0, $src2$$constant);
__ addi_d(AT, R0, $imm$$constant);
__ cmp_branch_long(flag, op1, AT, L, true /* signed */);
%}
ins_pipe( pipe_jump );
ins_pc_relative(1);
%}

instruct jmpLoopEnd_reg_zero_long(cmpOp cop, mRegI src1, immI_0 zero, label labl) %{
instruct CountedLoopEnd_reg_zero_long(cmpOp cop, mRegI src1, immI_0 zero, label labl) %{
match(CountedLoopEnd cop (CmpI src1 zero));
effect(USE labl);

ins_cost(300);
format %{ "J$cop $src1, $zero, $labl\t# Loop end @ jmpLoopEnd_reg_zero_long" %}
format %{ "J$cop $src1, $zero, $labl\t# Loop end @ CountedLoopEnd_reg_zero_long" %}
ins_encode %{
Register op1 = $src1$$Register;
Label* L = $labl$$label;
Expand Down Expand Up @@ -5481,6 +5504,25 @@ instruct cmpN_reg_branch_long(cmpOp cmp, mRegN op1, mRegN op2, label labl) %{
ins_pipe( pipe_alu_branch );
%}

instruct branchConIU_reg_imm12_short(cmpOp cmp, mRegI src1, immI12 imm, label labl) %{
match( If cmp (CmpU src1 imm) );
effect(USE labl);
format %{ "BR$cmp $src1, $imm, $labl #@branchConIU_reg_imm12_short" %}

ins_encode %{
Register op1 = $src1$$Register;
Label &L = *($labl$$label);
int flag = $cmp$$cmpcode;
int imm = $imm$$constant;
__ addi_d(AT, R0, imm);
__ cmp_branch_short(flag, op1, AT, L, false /* unsigned*/);
%}

ins_short_branch(1);
ins_pc_relative(1);
ins_pipe( pipe_alu_branch );
%}

instruct branchConIU_reg_imm12_long(cmpOp cmp, mRegI src1, immI12 src2, label labl) %{
match( If cmp (CmpU src1 src2) );
effect(USE labl);
Expand Down Expand Up @@ -5768,12 +5810,12 @@ instruct jmpDir_short(label labl) %{
%}

// Jump Direct Conditional - Label defines a relative address from Jcc+1
instruct jmpLoopEnd_short(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
instruct CountedLoopEnd_reg_reg_short(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
match(CountedLoopEnd cop (CmpI src1 src2));
effect(USE labl);

ins_cost(300);
format %{ "J$cop $src1, $src2, $labl\t# Loop end @ jmpLoopEnd_short" %}
format %{ "J$cop $src1, $src2, $labl\t# Loop end @ CountedLoopEnd_reg_reg_short" %}
ins_encode %{
Register op1 = $src1$$Register;
Register op2 = $src2$$Register;
Expand All @@ -5787,12 +5829,12 @@ instruct jmpLoopEnd_short(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
ins_short_branch(1);
%}

instruct jmpLoopEnd_reg_zero_short(cmpOp cop, mRegI src1, immI_0 zero, label labl) %{
instruct CountedLoopEnd_reg_zero_short(cmpOp cop, mRegI src1, immI_0 zero, label labl) %{
match(CountedLoopEnd cop (CmpI src1 zero));
effect(USE labl);

ins_cost(300);
format %{ "J$cop $src1, $zero, $labl\t# Loop end @ jmpLoopEnd_reg_immI_short" %}
format %{ "J$cop $src1, $zero, $labl\t# Loop end @ CountedLoopEnd_reg_zero_short" %}
ins_encode %{
Register op1 = $src1$$Register;
Label &L = *($labl$$label);
Expand Down Expand Up @@ -9099,7 +9141,7 @@ instruct umodI_Reg_Reg(mRegI dst, mRegIorL2I src1, mRegIorL2I src2) %{
%}

instruct umodL_Reg_Reg(mRegL dst, mRegLorI2L src1, mRegLorI2L src2) %{
match(Set dst (UModI src1 src2));
match(Set dst (UModL src1 src2));
format %{ "mod.du $dst, $src1, $src2 @ umodL_Reg_Reg" %}
ins_encode %{
Register dst = $dst$$Register;
Expand Down

0 comments on commit 331190d

Please sign in to comment.