diff mbox series

[18/18] tcg/loongarch64: Enable v256 with LASX

Message ID 20240527211912.14060-19-richard.henderson@linaro.org
State New
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.h     |  2 +-
 tcg/loongarch64/tcg-target.c.inc | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé May 29, 2024, 6:39 a.m. UTC | #1
On 27/5/24 23:19, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/loongarch64/tcg-target.h     |  2 +-
>   tcg/loongarch64/tcg-target.c.inc | 11 ++++++++---
>   2 files changed, 9 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
> index e2b5aad5e3..0b41b807e3 100644
> --- a/tcg/loongarch64/tcg-target.c.inc
> +++ b/tcg/loongarch64/tcg-target.c.inc
> @@ -2484,9 +2484,14 @@ static void tcg_target_init(TCGContext *s)
>       tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S8);
>       tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9);
>   
> -    if (cpuinfo & CPUINFO_LSX) {
> -        tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
> -        tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
> +    if (cpuinfo & (CPUINFO_LSX | CPUINFO_LASX)) {
> +        if (cpuinfo & CPUINFO_LSX) {
> +            tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
> +            tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
> +        }
> +        if (cpuinfo & CPUINFO_LASX) {
> +            tcg_target_available_regs[TCG_TYPE_V256] = ALL_VECTOR_REGS;
> +        }

Out of curiosity, could we have LASX without LSX?
Song Gao June 18, 2024, 3:33 a.m. UTC | #2
在 2024/5/28 上午5:19, Richard Henderson 写道:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/loongarch64/tcg-target.h     |  2 +-
>   tcg/loongarch64/tcg-target.c.inc | 11 ++++++++---
>   2 files changed, 9 insertions(+), 4 deletions(-)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h
> index 990bad1d51..58bd7d258e 100644
> --- a/tcg/loongarch64/tcg-target.h
> +++ b/tcg/loongarch64/tcg-target.h
> @@ -173,7 +173,7 @@ typedef enum {
>   
>   #define TCG_TARGET_HAS_v64              (cpuinfo & CPUINFO_LSX)
>   #define TCG_TARGET_HAS_v128             (cpuinfo & CPUINFO_LSX)
> -#define TCG_TARGET_HAS_v256             0
> +#define TCG_TARGET_HAS_v256             (cpuinfo & CPUINFO_LASX)
>   
>   #define TCG_TARGET_HAS_not_vec          1
>   #define TCG_TARGET_HAS_neg_vec          1
> diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
> index e2b5aad5e3..0b41b807e3 100644
> --- a/tcg/loongarch64/tcg-target.c.inc
> +++ b/tcg/loongarch64/tcg-target.c.inc
> @@ -2484,9 +2484,14 @@ static void tcg_target_init(TCGContext *s)
>       tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S8);
>       tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9);
>   
> -    if (cpuinfo & CPUINFO_LSX) {
> -        tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
> -        tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
> +    if (cpuinfo & (CPUINFO_LSX | CPUINFO_LASX)) {
> +        if (cpuinfo & CPUINFO_LSX) {
> +            tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
> +            tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
> +        }
> +        if (cpuinfo & CPUINFO_LASX) {
> +            tcg_target_available_regs[TCG_TYPE_V256] = ALL_VECTOR_REGS;
> +        }
>           tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V24);
>           tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V25);
>           tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V26);
Song Gao June 18, 2024, 4 a.m. UTC | #3
在 2024/5/29 下午2:39, Philippe Mathieu-Daudé 写道:
> On 27/5/24 23:19, Richard Henderson wrote:
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   tcg/loongarch64/tcg-target.h     |  2 +-
>>   tcg/loongarch64/tcg-target.c.inc | 11 ++++++++---
>>   2 files changed, 9 insertions(+), 4 deletions(-)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
>> diff --git a/tcg/loongarch64/tcg-target.c.inc 
>> b/tcg/loongarch64/tcg-target.c.inc
>> index e2b5aad5e3..0b41b807e3 100644
>> --- a/tcg/loongarch64/tcg-target.c.inc
>> +++ b/tcg/loongarch64/tcg-target.c.inc
>> @@ -2484,9 +2484,14 @@ static void tcg_target_init(TCGContext *s)
>>       tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S8);
>>       tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9);
>>   -    if (cpuinfo & CPUINFO_LSX) {
>> -        tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
>> -        tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
>> +    if (cpuinfo & (CPUINFO_LSX | CPUINFO_LASX)) {
>> +        if (cpuinfo & CPUINFO_LSX) {
>> +            tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
>> +            tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
>> +        }
>> +        if (cpuinfo & CPUINFO_LASX) {
>> +            tcg_target_available_regs[TCG_TYPE_V256] = ALL_VECTOR_REGS;
>> +        }
>
> Out of curiosity, could we have LASX without LSX?
No.  LSX depends on FPU.  LASX depends on LSX.

Thanks.
Song Gao
diff mbox series

Patch

diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h
index 990bad1d51..58bd7d258e 100644
--- a/tcg/loongarch64/tcg-target.h
+++ b/tcg/loongarch64/tcg-target.h
@@ -173,7 +173,7 @@  typedef enum {
 
 #define TCG_TARGET_HAS_v64              (cpuinfo & CPUINFO_LSX)
 #define TCG_TARGET_HAS_v128             (cpuinfo & CPUINFO_LSX)
-#define TCG_TARGET_HAS_v256             0
+#define TCG_TARGET_HAS_v256             (cpuinfo & CPUINFO_LASX)
 
 #define TCG_TARGET_HAS_not_vec          1
 #define TCG_TARGET_HAS_neg_vec          1
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index e2b5aad5e3..0b41b807e3 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -2484,9 +2484,14 @@  static void tcg_target_init(TCGContext *s)
     tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S8);
     tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9);
 
-    if (cpuinfo & CPUINFO_LSX) {
-        tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
-        tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
+    if (cpuinfo & (CPUINFO_LSX | CPUINFO_LASX)) {
+        if (cpuinfo & CPUINFO_LSX) {
+            tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS;
+            tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS;
+        }
+        if (cpuinfo & CPUINFO_LASX) {
+            tcg_target_available_regs[TCG_TYPE_V256] = ALL_VECTOR_REGS;
+        }
         tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V24);
         tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V25);
         tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V26);