qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v11 04/26] target/loongarch: Add fixed point arithmetic instr


From: Richard Henderson
Subject: Re: [PATCH v11 04/26] target/loongarch: Add fixed point arithmetic instruction translation
Date: Sat, 20 Nov 2021 08:10:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 11/19/21 7:13 AM, Song Gao wrote:
+static void gen_mulh_w(TCGv dest, TCGv src1, TCGv src2)
+{
+    tcg_gen_mul_i64(dest, src1, src2);
+    tcg_gen_sari_i64(dest, dest, 32);
+}
+
+static void gen_mulh_wu(TCGv dest, TCGv src1, TCGv src2)
+{
+    tcg_gen_mul_i64(dest, src1, src2);
+    tcg_gen_sari_i64(dest, dest, 32);
+}

These two are the same; you only need one of them. The difference between the two insns is in the EXT_{SIGN,ZERO} parameter that precedes these callbacks.

+static void gen_alsl_w(TCGv dest, TCGv src1, TCGv src2,
+                       TCGv temp, target_long sa)
+{
+    tcg_gen_shli_tl(temp, src1, sa);
+    tcg_gen_add_tl(dest, temp, src2);
+}
+
+static void gen_alsl_wu(TCGv dest, TCGv src1, TCGv src2,
+                        TCGv temp, target_long sa)
+{
+    tcg_gen_shli_tl(temp, src1, sa);
+    tcg_gen_add_tl(dest, temp, src2);
+}
+
+static void gen_alsl_d(TCGv dest, TCGv src1, TCGv src2,
+                       TCGv temp, target_long sa)
+{
+    tcg_gen_shli_tl(temp, src1, sa);
+    tcg_gen_add_tl(dest, temp, src2);
+}

Likewise, these are identical.


r~



reply via email to

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