qemu-devel
[Top][All Lists]
Advanced

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

[risu PATCH v2 4/6] loongarch: Add clean_lsx_result()


From: Song Gao
Subject: [risu PATCH v2 4/6] loongarch: Add clean_lsx_result()
Date: Wed, 13 Dec 2023 16:18:37 +0800

The result of the LSX instruction is in the low 128 bits
of the vreg register. We use clean_lsx_result() to clean up
the high 128 bits of the vreg register.

Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 risugen_loongarch64.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/risugen_loongarch64.pm b/risugen_loongarch64.pm
index f8b1612..98fbd48 100644
--- a/risugen_loongarch64.pm
+++ b/risugen_loongarch64.pm
@@ -81,6 +81,18 @@ sub nanbox_s($)
     return $fpreg;
 }
 
+sub clean_lsx_result($)
+{
+    my ($vreg) = @_;
+
+    # xvinsgr2vr.d vd, r0, 2;
+    insn32(0x76ebe000 | 2 << 10 | $vreg);
+    # xvinsgr2vr.d vd, r0, 3;
+    insn32(0x76ebe000 | 3 << 10 | $vreg);
+
+    return $vreg;
+}
+
 sub align($)
 {
     my ($a) = @_;
-- 
2.25.1




reply via email to

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