|
From: | Richard Henderson |
Subject: | Re: [PATCH v3 07/15] target/riscv: Add instructions of the Zbc-extension |
Date: | Mon, 23 Aug 2021 10:17:19 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |