On 8/23/21 9:40 AM, Philipp Tomsich wrote:
+static bool trans_clmulh(DisasContext *ctx, arg_clmulr *a)
+{
+    REQUIRE_ZBC(ctx);
+
+    /* Perform a clmulr ... */
+    gen_arith(ctx, a, gen_helper_clmulr);
+
+    /* ... then shift the result 1 bit to the right. */
+    TCGv dst = tcg_temp_new();
+    gen_get_gpr(dst, a->rd);
+    tcg_gen_shri_tl(dst, dst, 1);
+    gen_set_gpr(a->rd, dst);
+    tcg_temp_free(dst);

I think it would be better to place the shift into a helper, so that you leave all of the gpr manipulation to gen_arith.

E.g.

static void gen_clmulh(TCGv dst, TCGv src1, TCGv src2)
{
    gen_helper_clmulr(dst, src1, src2);
    tcg_gen_shri_tl(dst, dst, 1);
}


r~

Reply via email to