On 10/20/18 8:14 AM, Bastian Koppelmann wrote: > static bool trans_srli(DisasContext *ctx, arg_srli *a, uint32_t insn) > { > - gen_arith_imm(ctx, OPC_RISC_SHIFT_RIGHT_I, a->rd, a->rs1, a->shamt); > + if (a->rd != 0) { > + TCGv t = tcg_temp_new(); > + gen_get_gpr(t, a->rs1); > + tcg_gen_extract_tl(t, t, a->shamt, 64 - a->shamt);
tcg_gen_shri_tl(t, t, a->shamt); This is a mis-translation of the original code which handled srliw too. You should be able to see this assert on riscv32. > static bool trans_srai(DisasContext *ctx, arg_srai *a, uint32_t insn) > { > - gen_arith_imm(ctx, OPC_RISC_SHIFT_RIGHT_I, a->rd, a->rs1, a->shamt | > 0x400); > + if (a->rd != 0) { > + TCGv t = tcg_temp_new(); > + gen_get_gpr(t, a->rs1); > + tcg_gen_sextract_tl(t, t, a->shamt, 64 - a->shamt); Similarly. r~