qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v3 15/46] target/i386: introduce function ck


From: Aleksandar Markovic
Subject: Re: [Qemu-devel] [RFC PATCH v3 15/46] target/i386: introduce function ck_cpuid
Date: Thu, 15 Aug 2019 17:01:33 +0200

15.08.2019. 04.23, "Jan Bobek" <address@hidden> је написао/ла:
>
> Introduce a helper function to take care of instruction CPUID checks.
>
> Signed-off-by: Jan Bobek <address@hidden>
> ---

Jan, what is the origin of "CK"? If it is a QEMU internal thing, perhaps
use "CHECK".

The function should be called check_cpuid(), imho. I know, Richard would
like c_ci(), or simpler cc(), better.

Aleksandar

>  target/i386/translate.c | 48 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index 6296a02991..0cffa2226b 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -4500,6 +4500,54 @@ static void gen_sse(CPUX86State *env, DisasContext
*s, int b)
>  #define tcg_gen_gvec_cmpgt(vece, dofs, aofs, bofs, oprsz, maxsz)        \
>      tcg_gen_gvec_cmp(TCG_COND_GT, vece, dofs, aofs, bofs, oprsz, maxsz)
>
> +typedef enum {
> +    CK_CPUID_MMX = 1,
> +    CK_CPUID_3DNOW,
> +    CK_CPUID_SSE,
> +    CK_CPUID_SSE2,
> +    CK_CPUID_CLFLUSH,
> +    CK_CPUID_SSE3,
> +    CK_CPUID_SSSE3,
> +    CK_CPUID_SSE4_1,
> +    CK_CPUID_SSE4_2,
> +    CK_CPUID_SSE4A,
> +    CK_CPUID_AVX,
> +    CK_CPUID_AVX2,
> +} CkCpuidFeat;
> +
> +static int ck_cpuid(CPUX86State *env, DisasContext *s, CkCpuidFeat feat)
> +{
> +    switch (feat) {
> +    case CK_CPUID_MMX:
> +        return !(s->cpuid_features & CPUID_MMX)
> +            || !(s->cpuid_ext2_features & CPUID_EXT2_MMX);
> +    case CK_CPUID_3DNOW:
> +        return !(s->cpuid_ext2_features & CPUID_EXT2_3DNOW);
> +    case CK_CPUID_SSE:
> +        return !(s->cpuid_features & CPUID_SSE);
> +    case CK_CPUID_SSE2:
> +        return !(s->cpuid_features & CPUID_SSE2);
> +    case CK_CPUID_CLFLUSH:
> +        return !(s->cpuid_features & CPUID_CLFLUSH);
> +    case CK_CPUID_SSE3:
> +        return !(s->cpuid_ext_features & CPUID_EXT_SSE3);
> +    case CK_CPUID_SSSE3:
> +        return !(s->cpuid_ext_features & CPUID_EXT_SSSE3);
> +    case CK_CPUID_SSE4_1:
> +        return !(s->cpuid_ext_features & CPUID_EXT_SSE41);
> +    case CK_CPUID_SSE4_2:
> +        return !(s->cpuid_ext_features & CPUID_EXT_SSE42);
> +    case CK_CPUID_SSE4A:
> +        return !(s->cpuid_ext3_features & CPUID_EXT3_SSE4A);
> +    case CK_CPUID_AVX:
> +        return !(s->cpuid_ext_features & CPUID_EXT_AVX);
> +    case CK_CPUID_AVX2:
> +        return !(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_AVX2);
> +    default:
> +        g_assert_not_reached();
> +    }
> +}
> +
>  static void gen_sse_ng(CPUX86State *env, DisasContext *s, int b)
>  {
>      enum {
> --
> 2.20.1
>
>


reply via email to

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