Re: [PATCH 36/56] disas/riscv: Chain "nop" pseudo off "mv" 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:
> "mv" has already checked a condition that applies to "nop".
> 
> Signed-off-by: Richard Henderson <[email protected]>

Reviewed-by: Alistair Francis <[email protected]>

Alistair

> ---
>  disas/riscv.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/disas/riscv.c b/disas/riscv.c
> index 2fec135b5f..37f6440831 100644
> --- a/disas/riscv.c
> +++ b/disas/riscv.c
> @@ -1035,7 +1035,7 @@ static const rvc_constraint rvcc_jal_ra[] = {
> rvc_rd_eq_ra, rvc_end };
>  static const rvc_constraint rvcc_jalr_ra[] = { rvc_rd_eq_ra,
> rvc_imm_eq_zero,
>                                                 rvc_end };
>  static const rvc_constraint rvcc_nop[] = { rvc_rd_eq_x0,
> rvc_rs1_eq_x0,
> -                                           rvc_imm_eq_zero, rvc_end
> };
> +                                           rvc_end };
>  static const rvc_constraint rvcc_mv[] = { rvc_imm_eq_zero, rvc_end
> };
>  static const rvc_constraint rvcc_not[] = { rvc_imm_eq_n1, rvc_end };
>  static const rvc_constraint rvcc_neg[] = { rvc_rs1_eq_x0, rvc_end };
> @@ -1108,11 +1108,15 @@ static const rv_comp_data rvcp_bge[] = {
>  };
>  
>  static const rv_comp_data rvcp_addi[] = {
> -    { rv_op_nop, rvcc_nop },
>      { rv_op_mv, rvcc_mv },
>      { },
>  };
>  
> +static const rv_comp_data rvcp_mv[] = {
> +    { rv_op_nop, rvcc_nop },
> +    { },
> +};
> +
>  static const rv_comp_data rvcp_sltiu[] = {
>      { rv_op_seqz, rvcc_seqz },
>      { },
> @@ -1869,7 +1873,7 @@ static const rv_opcode_data rvi_opcode_data[] =
> {
>      { "c.lqsp", rv_codec_ci_lqsp, NULL, DECOMP(rv_op_lq) },
>      { "c.sqsp", rv_codec_css_sqsp, NULL, DECOMP(rv_op_sq) },
>      { "nop", rv_codec_i, rv_fmt_none },
> -    { "mv", rv_codec_i, rv_fmt_rd_rs1 },
> +    { "mv", rv_codec_i, rv_fmt_rd_rs1, rvcp_mv },
>      { "not", rv_codec_i, rv_fmt_rd_rs1 },
>      { "neg", rv_codec_r, rv_fmt_rd_rs2 },
>      { "negw", rv_codec_r, rv_fmt_rd_rs2 },
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.