Skip to content

Commit 859ccd1

Browse files
committed
8299847: RISC-V: Improve PrintOptoAssembly output of CMoveI/L nodes
Reviewed-by: fjiang, shade
1 parent 240830d commit 859ccd1

File tree

1 file changed

+29
-40
lines changed

1 file changed

+29
-40
lines changed

src/hotspot/cpu/riscv/riscv.ad

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ definitions %{
940940
int_def LOAD_COST ( 300, 3 * DEFAULT_COST); // load, fpload
941941
int_def STORE_COST ( 100, 1 * DEFAULT_COST); // store, fpstore
942942
int_def XFER_COST ( 300, 3 * DEFAULT_COST); // mfc, mtc, fcvt, fmove, fcmp
943-
int_def BRANCH_COST ( 100, 1 * DEFAULT_COST); // branch, jmp, call
943+
int_def BRANCH_COST ( 200, 2 * DEFAULT_COST); // branch, jmp, call
944944
int_def IMUL_COST ( 1000, 10 * DEFAULT_COST); // imul
945945
int_def IDIVSI_COST ( 3400, 34 * DEFAULT_COST); // idivdi
946946
int_def IDIVDI_COST ( 6600, 66 * DEFAULT_COST); // idivsi
@@ -3817,13 +3817,13 @@ operand cmpOpULtGe()
38173817
format %{ "" %}
38183818
interface(COND_INTER) %{
38193819
equal(0x0, "eq");
3820-
greater(0x1, "gt");
3820+
greater(0x1, "gtu");
38213821
overflow(0x2, "overflow");
3822-
less(0x3, "lt");
3822+
less(0x3, "ltu");
38233823
not_equal(0x4, "ne");
3824-
less_equal(0x5, "le");
3824+
less_equal(0x5, "leu");
38253825
no_overflow(0x6, "no_overflow");
3826-
greater_equal(0x7, "ge");
3826+
greater_equal(0x7, "geu");
38273827
%}
38283828
%}
38293829

@@ -3839,13 +3839,13 @@ operand cmpOpUEqNeLeGt()
38393839
format %{ "" %}
38403840
interface(COND_INTER) %{
38413841
equal(0x0, "eq");
3842-
greater(0x1, "gt");
3842+
greater(0x1, "gtu");
38433843
overflow(0x2, "overflow");
3844-
less(0x3, "lt");
3844+
less(0x3, "ltu");
38453845
not_equal(0x4, "ne");
3846-
less_equal(0x5, "le");
3846+
less_equal(0x5, "leu");
38473847
no_overflow(0x6, "no_overflow");
3848-
greater_equal(0x7, "ge");
3848+
greater_equal(0x7, "geu");
38493849
%}
38503850
%}
38513851

@@ -4373,7 +4373,7 @@ pipe_class istore_reg_reg(iRegI dst, iRegI src)
43734373
LDST : MEM;
43744374
%}
43754375

4376-
//------- Store pipeline operations -----------------------
4376+
//------- Control transfer pipeline operations ------------
43774377

43784378
// Branch
43794379
pipe_class pipe_branch()
@@ -9890,112 +9890,101 @@ instruct cmovI_cmpI(iRegINoSp dst, iRegI src, iRegI op1, iRegI op2, cmpOp cop) %
98909890
ins_cost(ALU_COST + BRANCH_COST);
98919891

98929892
format %{
9893-
"bneg$cop $op1, $op2, skip\t#@cmovI_cmpI\n\t"
9894-
"mv $dst, $src\n\t"
9895-
"skip:"
9896-
%}
9893+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpI\n\t"
9894+
%}
98979895

98989896
ins_encode %{
98999897
__ enc_cmove($cop$$cmpcode,
99009898
as_Register($op1$$reg), as_Register($op2$$reg),
99019899
as_Register($dst$$reg), as_Register($src$$reg));
99029900
%}
99039901

9904-
ins_pipe(pipe_slow);
9902+
ins_pipe(pipe_class_compare);
99059903
%}
99069904

99079905
instruct cmovI_cmpU(iRegINoSp dst, iRegI src, iRegI op1, iRegI op2, cmpOpU cop) %{
99089906
match(Set dst (CMoveI (Binary cop (CmpU op1 op2)) (Binary dst src)));
99099907
ins_cost(ALU_COST + BRANCH_COST);
99109908

99119909
format %{
9912-
"bneg$cop $op1, $op2, skip\t#@cmovI_cmpU\n\t"
9913-
"mv $dst, $src\n\t"
9914-
"skip:"
9915-
%}
9910+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpU\n\t"
9911+
%}
99169912

99179913
ins_encode %{
99189914
__ enc_cmove($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask,
99199915
as_Register($op1$$reg), as_Register($op2$$reg),
99209916
as_Register($dst$$reg), as_Register($src$$reg));
99219917
%}
99229918

9923-
ins_pipe(pipe_slow);
9919+
ins_pipe(pipe_class_compare);
99249920
%}
99259921

99269922
instruct cmovI_cmpL(iRegINoSp dst, iRegI src, iRegL op1, iRegL op2, cmpOp cop) %{
99279923
match(Set dst (CMoveI (Binary cop (CmpL op1 op2)) (Binary dst src)));
99289924
ins_cost(ALU_COST + BRANCH_COST);
99299925

99309926
format %{
9931-
"bneg$cop $op1, $op2, skip\t#@cmovI_cmpL\n\t"
9932-
"mv $dst, $src\n\t"
9933-
"skip:"
9934-
%}
9927+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpL\n\t"
9928+
%}
99359929

99369930
ins_encode %{
99379931
__ enc_cmove($cop$$cmpcode,
99389932
as_Register($op1$$reg), as_Register($op2$$reg),
99399933
as_Register($dst$$reg), as_Register($src$$reg));
99409934
%}
99419935

9942-
ins_pipe(pipe_slow);
9936+
ins_pipe(pipe_class_compare);
99439937
%}
99449938

99459939
instruct cmovL_cmpL(iRegLNoSp dst, iRegL src, iRegL op1, iRegL op2, cmpOp cop) %{
99469940
match(Set dst (CMoveL (Binary cop (CmpL op1 op2)) (Binary dst src)));
99479941
ins_cost(ALU_COST + BRANCH_COST);
99489942

99499943
format %{
9950-
"bneg$cop $op1, $op2, skip\t#@cmovL_cmpL\n\t"
9951-
"mv $dst, $src\n\t"
9952-
"skip:"
9953-
%}
9944+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovL_cmpL\n\t"
9945+
%}
99549946

99559947
ins_encode %{
99569948
__ enc_cmove($cop$$cmpcode,
99579949
as_Register($op1$$reg), as_Register($op2$$reg),
99589950
as_Register($dst$$reg), as_Register($src$$reg));
99599951
%}
99609952

9961-
ins_pipe(pipe_slow);
9953+
ins_pipe(pipe_class_compare);
99629954
%}
99639955

99649956
instruct cmovL_cmpUL(iRegLNoSp dst, iRegL src, iRegL op1, iRegL op2, cmpOpU cop) %{
99659957
match(Set dst (CMoveL (Binary cop (CmpUL op1 op2)) (Binary dst src)));
99669958
ins_cost(ALU_COST + BRANCH_COST);
99679959

99689960
format %{
9969-
"bneg$cop $op1, $op2, skip\t#@cmovL_cmpUL\n\t"
9970-
"mv $dst, $src\n\t"
9971-
"skip:"
9972-
%}
9961+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovL_cmpUL\n\t"
9962+
%}
99739963

99749964
ins_encode %{
99759965
__ enc_cmove($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask,
99769966
as_Register($op1$$reg), as_Register($op2$$reg),
99779967
as_Register($dst$$reg), as_Register($src$$reg));
99789968
%}
99799969

9980-
ins_pipe(pipe_slow);
9970+
ins_pipe(pipe_class_compare);
99819971
%}
99829972

99839973
instruct cmovI_cmpUL(iRegINoSp dst, iRegI src, iRegL op1, iRegL op2, cmpOpU cop) %{
99849974
match(Set dst (CMoveI (Binary cop (CmpUL op1 op2)) (Binary dst src)));
99859975
ins_cost(ALU_COST + BRANCH_COST);
9976+
99869977
format %{
9987-
"bneg$cop $op1, $op2\t#@cmovI_cmpUL\n\t"
9988-
"mv $dst, $src\n\t"
9989-
"skip:"
9990-
%}
9978+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpUL\n\t"
9979+
%}
99919980

99929981
ins_encode %{
99939982
__ enc_cmove($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask,
99949983
as_Register($op1$$reg), as_Register($op2$$reg),
99959984
as_Register($dst$$reg), as_Register($src$$reg));
99969985
%}
99979986

9998-
ins_pipe(pipe_slow);
9987+
ins_pipe(pipe_class_compare);
99999988
%}
100009989

100019990

0 commit comments

Comments
 (0)