diff mbox series

[1/2] util: Add lasx cpuinfo for loongarch64

Message ID 20240605093213.2191929-2-maobibo@loongson.cn (mailing list archive)
State New, archived
Headers show
Series Add simd optimization with function buffer_is_zero | expand

Commit Message

Bibo Mao June 5, 2024, 9:32 a.m. UTC
Lasx is 256bit vector FPU capability, lsx is 128bit vector VFP. lsx
is added already, lasx is added here.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 host/include/loongarch64/host/cpuinfo.h | 1 +
 util/cpuinfo-loongarch.c                | 1 +
 2 files changed, 2 insertions(+)

Comments

Philippe Mathieu-Daudé June 5, 2024, 11:53 a.m. UTC | #1
On 5/6/24 11:32, Bibo Mao wrote:
> Lasx is 256bit vector FPU capability, lsx is 128bit vector VFP. lsx
> is added already, lasx is added here.
> 
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   host/include/loongarch64/host/cpuinfo.h | 1 +
>   util/cpuinfo-loongarch.c                | 1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/host/include/loongarch64/host/cpuinfo.h b/host/include/loongarch64/host/cpuinfo.h
> index fab664a10b..d7bf27501d 100644
> --- a/host/include/loongarch64/host/cpuinfo.h
> +++ b/host/include/loongarch64/host/cpuinfo.h
> @@ -8,6 +8,7 @@
>   
>   #define CPUINFO_ALWAYS          (1u << 0)  /* so cpuinfo is nonzero */
>   #define CPUINFO_LSX             (1u << 1)
> +#define CPUINFO_LASX            (1u << 2)
>   
>   /* Initialized with a constructor. */
>   extern unsigned cpuinfo;
> diff --git a/util/cpuinfo-loongarch.c b/util/cpuinfo-loongarch.c
> index 08b6d7460c..bb1f7f698b 100644
> --- a/util/cpuinfo-loongarch.c
> +++ b/util/cpuinfo-loongarch.c
> @@ -29,6 +29,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
>   
>       info = CPUINFO_ALWAYS;
>       info |= (hwcap & HWCAP_LOONGARCH_LSX ? CPUINFO_LSX : 0);
> +    info |= (hwcap & HWCAP_LOONGARCH_LASX ? CPUINFO_LASX : 0);
>   
>       cpuinfo = info;
>       return info;

This is 
https://lore.kernel.org/qemu-devel/20240527211912.14060-6-richard.henderson@linaro.org/
Bibo Mao June 6, 2024, 2:17 a.m. UTC | #2
On 2024/6/5 下午7:53, Philippe Mathieu-Daudé wrote:
> On 5/6/24 11:32, Bibo Mao wrote:
>> Lasx is 256bit vector FPU capability, lsx is 128bit vector VFP. lsx
>> is added already, lasx is added here.
>>
>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
>> ---
>>   host/include/loongarch64/host/cpuinfo.h | 1 +
>>   util/cpuinfo-loongarch.c                | 1 +
>>   2 files changed, 2 insertions(+)
>>
>> diff --git a/host/include/loongarch64/host/cpuinfo.h 
>> b/host/include/loongarch64/host/cpuinfo.h
>> index fab664a10b..d7bf27501d 100644
>> --- a/host/include/loongarch64/host/cpuinfo.h
>> +++ b/host/include/loongarch64/host/cpuinfo.h
>> @@ -8,6 +8,7 @@
>>   #define CPUINFO_ALWAYS          (1u << 0)  /* so cpuinfo is nonzero */
>>   #define CPUINFO_LSX             (1u << 1)
>> +#define CPUINFO_LASX            (1u << 2)
>>   /* Initialized with a constructor. */
>>   extern unsigned cpuinfo;
>> diff --git a/util/cpuinfo-loongarch.c b/util/cpuinfo-loongarch.c
>> index 08b6d7460c..bb1f7f698b 100644
>> --- a/util/cpuinfo-loongarch.c
>> +++ b/util/cpuinfo-loongarch.c
>> @@ -29,6 +29,7 @@ unsigned __attribute__((constructor)) 
>> cpuinfo_init(void)
>>       info = CPUINFO_ALWAYS;
>>       info |= (hwcap & HWCAP_LOONGARCH_LSX ? CPUINFO_LSX : 0);
>> +    info |= (hwcap & HWCAP_LOONGARCH_LASX ? CPUINFO_LASX : 0);
>>       cpuinfo = info;
>>       return info;
> 
> This is 
> https://lore.kernel.org/qemu-devel/20240527211912.14060-6-richard.henderson@linaro.org/ 
oops, I did not notice this.

And I will drop patch 1 and refresh the patch based on this weblink.

Regards
Bibo Mao
diff mbox series

Patch

diff --git a/host/include/loongarch64/host/cpuinfo.h b/host/include/loongarch64/host/cpuinfo.h
index fab664a10b..d7bf27501d 100644
--- a/host/include/loongarch64/host/cpuinfo.h
+++ b/host/include/loongarch64/host/cpuinfo.h
@@ -8,6 +8,7 @@ 
 
 #define CPUINFO_ALWAYS          (1u << 0)  /* so cpuinfo is nonzero */
 #define CPUINFO_LSX             (1u << 1)
+#define CPUINFO_LASX            (1u << 2)
 
 /* Initialized with a constructor. */
 extern unsigned cpuinfo;
diff --git a/util/cpuinfo-loongarch.c b/util/cpuinfo-loongarch.c
index 08b6d7460c..bb1f7f698b 100644
--- a/util/cpuinfo-loongarch.c
+++ b/util/cpuinfo-loongarch.c
@@ -29,6 +29,7 @@  unsigned __attribute__((constructor)) cpuinfo_init(void)
 
     info = CPUINFO_ALWAYS;
     info |= (hwcap & HWCAP_LOONGARCH_LSX ? CPUINFO_LSX : 0);
+    info |= (hwcap & HWCAP_LOONGARCH_LASX ? CPUINFO_LASX : 0);
 
     cpuinfo = info;
     return info;