aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-05-27 16:53:01 +0000
committerRichard Henderson <richard.henderson@linaro.org>2024-06-19 10:55:12 -0700
commit3a7a53c3526771d20443dbe2cc44c7d768b074bd (patch)
treeda1321a064ac17f81e9992846c2a0067396f3ac0 /tcg
parent3e261310410948fc9c44d2df9f759dac293d9fd6 (diff)
tcg/loongarch64: Handle i32 and i64 moves between gr and fr
Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/loongarch64/tcg-target.c.inc22
1 files changed, 17 insertions, 5 deletions
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index b9078ac793..de5369536e 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -303,11 +303,23 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
switch (type) {
case TCG_TYPE_I32:
case TCG_TYPE_I64:
- /*
- * Conventional register-register move used in LoongArch is
- * `or dst, src, zero`.
- */
- tcg_out_opc_or(s, ret, arg, TCG_REG_ZERO);
+ if (ret < TCG_REG_V0) {
+ if (arg < TCG_REG_V0) {
+ /*
+ * Conventional register-register move used in LoongArch is
+ * `or dst, src, zero`.
+ */
+ tcg_out_opc_or(s, ret, arg, TCG_REG_ZERO);
+ } else {
+ tcg_out_opc_movfr2gr_d(s, ret, arg);
+ }
+ } else {
+ if (arg < TCG_REG_V0) {
+ tcg_out_opc_movgr2fr_d(s, ret, arg);
+ } else {
+ tcg_out_opc_fmov_d(s, ret, arg);
+ }
+ }
break;
case TCG_TYPE_V128:
tcg_out_opc_vori_b(s, ret, arg, 0);