Re: [PATCH 35/56] disas/riscv: Chain "ret" pseudo off "jr" pseudo
Alistair <[email protected]>
| Newsgroups | org.nongnu.qemu-riscv,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2026-08-09 at 15:35 -0700, Richard Henderson wrote: > "jr" has already checked two conditions that apply to "ret". > > Signed-off-by: Richard Henderson <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > disas/riscv.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/disas/riscv.c b/disas/riscv.c > index bb4779614b..2fec135b5f 100644 > --- a/disas/riscv.c > +++ b/disas/riscv.c > @@ -1061,8 +1061,7 @@ static const rvc_constraint rvcc_bgez[] = { > rvc_rs2_eq_x0, rvc_end }; > static const rvc_constraint rvcc_bltz[] = { rvc_rs2_eq_x0, rvc_end > }; > static const rvc_constraint rvcc_bgtz[] = { rvc_rs1_eq_x0, rvc_end > }; > static const rvc_constraint rvcc_j[] = { rvc_rd_eq_x0, rvc_end }; > -static const rvc_constraint rvcc_ret[] = { rvc_rd_eq_x0, > rvc_rs1_eq_ra, > - rvc_end }; > +static const rvc_constraint rvcc_ret[] = { rvc_rs1_eq_ra, rvc_end }; > static const rvc_constraint rvcc_jr[] = { rvc_rd_eq_x0, > rvc_imm_eq_zero, > rvc_end }; > static const rvc_constraint rvcc_true[] = { rvc_end }; > @@ -1076,12 +1075,16 @@ static const rv_comp_data rvcp_jal[] = { > }; > > static const rv_comp_data rvcp_jalr[] = { > - { rv_op_ret, rvcc_ret }, > { rv_op_jr, rvcc_jr }, > { rv_op_jalr_ra, rvcc_jalr_ra }, > { }, > }; > > +static const rv_comp_data rvcp_jr[] = { > + { rv_op_ret, rvcc_ret }, > + { }, > +}; > + > static const rv_comp_data rvcp_beq[] = { > { rv_op_beqz, rvcc_beqz }, > { }, > @@ -1896,7 +1899,7 @@ static const rv_opcode_data rvi_opcode_data[] = > { > { }, > { "j", rv_codec_uj, rv_fmt_offset }, > { "ret", rv_codec_i, rv_fmt_none }, > - { "jr", rv_codec_i, rv_fmt_rs1 }, > + { "jr", rv_codec_i, rv_fmt_rs1, rvcp_jr }, > { "rdcycle", rv_codec_i_csr, rv_fmt_rd }, > { "rdtime", rv_codec_i_csr, rv_fmt_rd }, > { "rdinstret", rv_codec_i_csr, rv_fmt_rd },