On 10/5/20 2:12 AM, Frank Chang wrote: > I think you want to be sharing the code between vsetvl and vsetvli now. > Just > pass in a TCGv value to a common helper. > > > The only difference now between vsetvl and vsetvli is the format of zimm and > s2 > fields. > But they have different formats and are queried by different functions, > i.e. s2 = tcg_const_tl(a->zimm); and gen_get_gpr(s2, a->rs2); > > Is there any elegant way to retrieve the values of zimm and s2 by shared > common > codes?
Yes, like I (too briefly) described: static bool do_vsetvl(DisasContext *ctx, int rd, int rs1, TCGv s2) { // existing contents of trans_vsetvl // do continue to free s2. } static bool trans_vsetvl(DisasContext *ctx, arg_vsetvl *a) { TCGv s2 = tcg_temp_new(); gen_get_gpr(s2, a->rs2); return do_vsetvl(ctx, a->rd, a->rs1, s2); } static bool trans_vsetvli(DisasContext *ctx, arg_vsetvli *a) { TCGv s2 = tcg_const_tl(a->zimm); return do_vsetvl(ctx, a->rd, a->rs1, s2); } r~