+static bool gen_arith_simm_tl(DisasContext *ctx, arg_i *a,
+ void (*func)(TCGv, TCGv, TCGv))
+{
+ TCGv dest = gpr_dst(ctx, a->rd);
+ TCGv src1 = gpr_src_s(ctx, a->rs1);
+ TCGv src2 = tcg_constant_tl(a->imm);
+
+ (*func)(dest, src1, src2);
+ return true;
+}
+
+static bool gen_arith_uimm_tl(DisasContext *ctx, arg_i *a,
+ void (*func)(TCGv, TCGv, TCGv))
+{
+ TCGv dest = gpr_dst(ctx, a->rd);
+ TCGv src1 = gpr_src_u(ctx, a->rs1);
+ TCGv src2 = tcg_constant_tl(ctx->uxl32 ? a->imm & UINT32_MAX : a->imm);
+
+ (*func)(dest, src1, src2);
+ return true;
+}