qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 05/21] target/loongarch: Add fixed point shift instruction


From: Richard Henderson
Subject: Re: [PATCH v4 05/21] target/loongarch: Add fixed point shift instruction translation
Date: Sat, 4 Sep 2021 13:17:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 9/2/21 2:40 PM, Song Gao wrote:
+static bool gen_r2_ui6(DisasContext *ctx, arg_slli_d *a,
+                       void(*func)(TCGv, TCGv, TCGv))
+{
+    TCGv dest = gpr_dst(ctx, a->rd);
+    TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
+    TCGv src2 = tcg_constant_tl(a->ui6);
+
+    TCGv t0 = temp_new(ctx);
+
+    tcg_gen_andi_tl(t0, src2, 0x7f);

0x3f.

That said, these shouldn't require masking, because they've just come from the decoder as 5 and 6-bit operands.

You should prefer to use the tcg_gen_* functions that take integers:

    void (*func)(TCGv, TCGv, target_long)

passing tcg_gen_shli_tl, etc.  It will make all of these simpler.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]