Skip to content

Commit e022ea6

Browse files
DingliZhangzifeihan
authored andcommitted
8299847: RISC-V: Improve PrintOptoAssembly output of CMoveI/L nodes
Reviewed-by: fyang, gcao, mli Backport-of: 859ccd1a150653c42ebbcd3402994ef9ff4c810f
1 parent eff8723 commit e022ea6

File tree

1 file changed

+28
-40
lines changed

1 file changed

+28
-40
lines changed

src/hotspot/cpu/riscv/riscv.ad

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ definitions %{
672672
int_def LOAD_COST ( 300, 3 * DEFAULT_COST); // load, fpload
673673
int_def STORE_COST ( 100, 1 * DEFAULT_COST); // store, fpstore
674674
int_def XFER_COST ( 300, 3 * DEFAULT_COST); // mfc, mtc, fcvt, fmove, fcmp
675-
int_def BRANCH_COST ( 100, 1 * DEFAULT_COST); // branch, jmp, call
675+
int_def BRANCH_COST ( 200, 2 * DEFAULT_COST); // branch, jmp, call
676676
int_def IMUL_COST ( 1000, 10 * DEFAULT_COST); // imul
677677
int_def IDIVSI_COST ( 3400, 34 * DEFAULT_COST); // idivdi
678678
int_def IDIVDI_COST ( 6600, 66 * DEFAULT_COST); // idivsi
@@ -3424,13 +3424,13 @@ operand cmpOpULtGe()
34243424
format %{ "" %}
34253425
interface(COND_INTER) %{
34263426
equal(0x0, "eq");
3427-
greater(0x1, "gt");
3427+
greater(0x1, "gtu");
34283428
overflow(0x2, "overflow");
3429-
less(0x3, "lt");
3429+
less(0x3, "ltu");
34303430
not_equal(0x4, "ne");
3431-
less_equal(0x5, "le");
3431+
less_equal(0x5, "leu");
34323432
no_overflow(0x6, "no_overflow");
3433-
greater_equal(0x7, "ge");
3433+
greater_equal(0x7, "geu");
34343434
%}
34353435
%}
34363436

@@ -3446,13 +3446,13 @@ operand cmpOpUEqNeLeGt()
34463446
format %{ "" %}
34473447
interface(COND_INTER) %{
34483448
equal(0x0, "eq");
3449-
greater(0x1, "gt");
3449+
greater(0x1, "gtu");
34503450
overflow(0x2, "overflow");
3451-
less(0x3, "lt");
3451+
less(0x3, "ltu");
34523452
not_equal(0x4, "ne");
3453-
less_equal(0x5, "le");
3453+
less_equal(0x5, "leu");
34543454
no_overflow(0x6, "no_overflow");
3455-
greater_equal(0x7, "ge");
3455+
greater_equal(0x7, "geu");
34563456
%}
34573457
%}
34583458

@@ -3936,7 +3936,7 @@ pipe_class iload_reg_reg(iRegI dst, iRegI src)
39363936
LDST : MEM;
39373937
%}
39383938

3939-
//------- Store pipeline operations -----------------------
3939+
//------- Control transfer pipeline operations ------------
39403940

39413941
// Store - zr, mem
39423942
// E.g. SD zr, mem
@@ -9497,112 +9497,100 @@ instruct cmovI_cmpI(iRegINoSp dst, iRegI src, iRegI op1, iRegI op2, cmpOp cop) %
94979497
ins_cost(ALU_COST + BRANCH_COST);
94989498

94999499
format %{
9500-
"bneg$cop $op1, $op2, skip\t#@cmovI_cmpI\n\t"
9501-
"mv $dst, $src\n\t"
9502-
"skip:"
9503-
%}
9500+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpI\n\t"
9501+
%}
95049502

95059503
ins_encode %{
95069504
__ enc_cmove($cop$$cmpcode,
95079505
as_Register($op1$$reg), as_Register($op2$$reg),
95089506
as_Register($dst$$reg), as_Register($src$$reg));
95099507
%}
95109508

9511-
ins_pipe(pipe_slow);
9509+
ins_pipe(pipe_class_compare);
95129510
%}
95139511

95149512
instruct cmovI_cmpU(iRegINoSp dst, iRegI src, iRegI op1, iRegI op2, cmpOpU cop) %{
95159513
match(Set dst (CMoveI (Binary cop (CmpU op1 op2)) (Binary dst src)));
95169514
ins_cost(ALU_COST + BRANCH_COST);
95179515

95189516
format %{
9519-
"bneg$cop $op1, $op2, skip\t#@cmovI_cmpU\n\t"
9520-
"mv $dst, $src\n\t"
9521-
"skip:"
9522-
%}
9517+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpU\n\t"
9518+
%}
95239519

95249520
ins_encode %{
95259521
__ enc_cmove($cop$$cmpcode | MacroAssembler::unsigned_branch_mask,
95269522
as_Register($op1$$reg), as_Register($op2$$reg),
95279523
as_Register($dst$$reg), as_Register($src$$reg));
95289524
%}
95299525

9530-
ins_pipe(pipe_slow);
9526+
ins_pipe(pipe_class_compare);
95319527
%}
95329528

95339529
instruct cmovI_cmpL(iRegINoSp dst, iRegI src, iRegL op1, iRegL op2, cmpOp cop) %{
95349530
match(Set dst (CMoveI (Binary cop (CmpL op1 op2)) (Binary dst src)));
95359531
ins_cost(ALU_COST + BRANCH_COST);
95369532

95379533
format %{
9538-
"bneg$cop $op1, $op2, skip\t#@cmovI_cmpL\n\t"
9539-
"mv $dst, $src\n\t"
9540-
"skip:"
9541-
%}
9534+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpL\n\t"
9535+
%}
95429536

95439537
ins_encode %{
95449538
__ enc_cmove($cop$$cmpcode,
95459539
as_Register($op1$$reg), as_Register($op2$$reg),
95469540
as_Register($dst$$reg), as_Register($src$$reg));
95479541
%}
95489542

9549-
ins_pipe(pipe_slow);
9543+
ins_pipe(pipe_class_compare);
95509544
%}
95519545

95529546
instruct cmovL_cmpL(iRegLNoSp dst, iRegL src, iRegL op1, iRegL op2, cmpOp cop) %{
95539547
match(Set dst (CMoveL (Binary cop (CmpL op1 op2)) (Binary dst src)));
95549548
ins_cost(ALU_COST + BRANCH_COST);
95559549

95569550
format %{
9557-
"bneg$cop $op1, $op2, skip\t#@cmovL_cmpL\n\t"
9558-
"mv $dst, $src\n\t"
9559-
"skip:"
9560-
%}
9551+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovL_cmpL\n\t"
9552+
%}
95619553

95629554
ins_encode %{
95639555
__ enc_cmove($cop$$cmpcode,
95649556
as_Register($op1$$reg), as_Register($op2$$reg),
95659557
as_Register($dst$$reg), as_Register($src$$reg));
95669558
%}
95679559

9568-
ins_pipe(pipe_slow);
9560+
ins_pipe(pipe_class_compare);
95699561
%}
95709562

95719563
instruct cmovL_cmpUL(iRegLNoSp dst, iRegL src, iRegL op1, iRegL op2, cmpOpU cop) %{
95729564
match(Set dst (CMoveL (Binary cop (CmpUL op1 op2)) (Binary dst src)));
95739565
ins_cost(ALU_COST + BRANCH_COST);
95749566

95759567
format %{
9576-
"bneg$cop $op1, $op2, skip\t#@cmovL_cmpUL\n\t"
9577-
"mv $dst, $src\n\t"
9578-
"skip:"
9579-
%}
9568+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovL_cmpUL\n\t"
9569+
%}
95809570

95819571
ins_encode %{
95829572
__ enc_cmove($cop$$cmpcode | MacroAssembler::unsigned_branch_mask,
95839573
as_Register($op1$$reg), as_Register($op2$$reg),
95849574
as_Register($dst$$reg), as_Register($src$$reg));
95859575
%}
95869576

9587-
ins_pipe(pipe_slow);
9577+
ins_pipe(pipe_class_compare);
95889578
%}
95899579

95909580
instruct cmovI_cmpUL(iRegINoSp dst, iRegI src, iRegL op1, iRegL op2, cmpOpU cop) %{
95919581
match(Set dst (CMoveI (Binary cop (CmpUL op1 op2)) (Binary dst src)));
95929582
ins_cost(ALU_COST + BRANCH_COST);
95939583
format %{
9594-
"bneg$cop $op1, $op2\t#@cmovI_cmpUL\n\t"
9595-
"mv $dst, $src\n\t"
9596-
"skip:"
9597-
%}
9584+
"CMove $dst, ($op1 $cop $op2), $dst, $src\t#@cmovI_cmpUL\n\t"
9585+
%}
95989586

95999587
ins_encode %{
96009588
__ enc_cmove($cop$$cmpcode | MacroAssembler::unsigned_branch_mask,
96019589
as_Register($op1$$reg), as_Register($op2$$reg),
96029590
as_Register($dst$$reg), as_Register($src$$reg));
96039591
%}
96049592

9605-
ins_pipe(pipe_slow);
9593+
ins_pipe(pipe_class_compare);
96069594
%}
96079595

96089596

0 commit comments

Comments
 (0)