On 12/15/20 8:01 PM, frank.ch...@sifive.com wrote: > +static bool trans_ror(DisasContext *ctx, arg_ror *a) > { > + REQUIRE_EXT(ctx, RVB); > + return gen_arith(ctx, a, &tcg_gen_rotr_tl); > +}
Use gen_shift. > +static bool trans_rori(DisasContext *ctx, arg_rori *a) > +{ > + REQUIRE_EXT(ctx, RVB); > + > + if (a->shamt >= TARGET_LONG_BITS) { > + return false; > + } > + > + TCGv source1 = tcg_temp_new(); > + > + gen_get_gpr(source1, a->rs1); > + tcg_gen_rotri_tl(source1, source1, a->shamt); > + gen_set_gpr(a->rd, source1); Use gen_shifti. > +static bool trans_rol(DisasContext *ctx, arg_rol *a) > +{ > + REQUIRE_EXT(ctx, RVB); > + return gen_arith(ctx, a, &tcg_gen_rotl_tl); > +} Use gen_shift. > +static bool trans_rorw(DisasContext *ctx, arg_rorw *a) > +{ > + REQUIRE_EXT(ctx, RVB); > + return gen_shiftw(ctx, a, &gen_rorw); > +} > + > +static bool trans_roriw(DisasContext *ctx, arg_roriw *a) > +{ > + REQUIRE_EXT(ctx, RVB); > + > + if (a->shamt >= 32) { > + return false; > + } Test is impossible due to @sh5. > + if (a->shamt == 0) { > + TCGv t = tcg_temp_new(); > + gen_get_gpr(t, a->rs1); > + tcg_gen_ext32s_tl(t, t); > + gen_set_gpr(a->rd, t); > + tcg_temp_free(t); > + return true; > + } Why do you need this special case? The general expansion would appear to work fine, and surely this needs no special optimization. r~