diff mbox series

[14/18] tcg/loongarch64: Support LASX in tcg_out_{mov,ld,st}

Message ID 20240527211912.14060-15-richard.henderson@linaro.org (mailing list archive)
State New, archived
Headers show
Series tcg/loongarch64: Support v64 and v256 | expand

Commit Message

Richard Henderson May 27, 2024, 9:19 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/loongarch64/tcg-target.c.inc | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

gaosong June 18, 2024, 2:37 a.m. UTC | #1
在 2024/5/28 上午5:19, Richard Henderson 写道:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/loongarch64/tcg-target.c.inc | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
> index 5f4915c6ac..e633d268d0 100644
> --- a/tcg/loongarch64/tcg-target.c.inc
> +++ b/tcg/loongarch64/tcg-target.c.inc
> @@ -325,6 +325,9 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
>       case TCG_TYPE_V128:
>           tcg_out_opc_vori_b(s, ret, arg, 0);
>           break;
> +    case TCG_TYPE_V256:
> +        tcg_out_opc_xvori_b(s, ret, arg, 0);
> +        break;
>       default:
>           g_assert_not_reached();
>       }
> @@ -854,6 +857,14 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg dest,
>               tcg_out_opc_vldx(s, dest, base, TCG_REG_TMP0);
>           }
>           break;
> +    case TCG_TYPE_V256:
> +        if (-0x800 <= offset && offset <= 0x7ff) {
> +            tcg_out_opc_xvld(s, dest, base, offset);
> +        } else {
> +            tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset);
> +            tcg_out_opc_xvldx(s, dest, base, TCG_REG_TMP0);
> +        }
> +        break;
>       default:
>           g_assert_not_reached();
>       }
> @@ -886,6 +897,14 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg src,
>               tcg_out_opc_vstx(s, src, base, TCG_REG_TMP0);
>           }
>           break;
> +    case TCG_TYPE_V256:
> +        if (-0x800 <= offset && offset <= 0x7ff) {
> +            tcg_out_opc_xvst(s, src, base, offset);
> +        } else {
> +            tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset);
> +            tcg_out_opc_xvstx(s, src, base, TCG_REG_TMP0);
> +        }
> +        break;
>       default:
>           g_assert_not_reached();
>       }
diff mbox series

Patch

diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index 5f4915c6ac..e633d268d0 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -325,6 +325,9 @@  static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
     case TCG_TYPE_V128:
         tcg_out_opc_vori_b(s, ret, arg, 0);
         break;
+    case TCG_TYPE_V256:
+        tcg_out_opc_xvori_b(s, ret, arg, 0);
+        break;
     default:
         g_assert_not_reached();
     }
@@ -854,6 +857,14 @@  static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg dest,
             tcg_out_opc_vldx(s, dest, base, TCG_REG_TMP0);
         }
         break;
+    case TCG_TYPE_V256:
+        if (-0x800 <= offset && offset <= 0x7ff) {
+            tcg_out_opc_xvld(s, dest, base, offset);
+        } else {
+            tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset);
+            tcg_out_opc_xvldx(s, dest, base, TCG_REG_TMP0);
+        }
+        break;
     default:
         g_assert_not_reached();
     }
@@ -886,6 +897,14 @@  static void tcg_out_st(TCGContext *s, TCGType type, TCGReg src,
             tcg_out_opc_vstx(s, src, base, TCG_REG_TMP0);
         }
         break;
+    case TCG_TYPE_V256:
+        if (-0x800 <= offset && offset <= 0x7ff) {
+            tcg_out_opc_xvst(s, src, base, offset);
+        } else {
+            tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset);
+            tcg_out_opc_xvstx(s, src, base, TCG_REG_TMP0);
+        }
+        break;
     default:
         g_assert_not_reached();
     }