|
From: | Richard Henderson |
Subject: | Re: [PATCH v2 08/22] target/loongarch: Add fixed point shift instruction translation |
Date: | Thu, 22 Jul 2021 14:51:42 -1000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 7/20/21 11:53 PM, Song Gao wrote:
+/* Fixed point shift operation instruction translation */ +static bool trans_sll_w(DisasContext *ctx, arg_sll_w *a) +{ + TCGv t0, t1; + TCGv Rd = cpu_gpr[a->rd]; + + if (a->rd == 0) { + /* Nop */ + return true; + } + + t0 = tcg_temp_new(); + t1 = get_gpr(a->rj); + + gen_load_gpr(t0, a->rk); + + tcg_gen_andi_tl(t0, t0, 0x1f); + tcg_gen_shl_tl(t0, t1, t0); + tcg_gen_ext32s_tl(Rd, t0); + + tcg_temp_free(t0); + + return true; +}
Again, you should be using common helper functions for this instead of replicating the same pattern 16 times.
r~
[Prev in Thread] | Current Thread | [Next in Thread] |