[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
>
>
- Re: [Qemu-devel] [RFC PATCH v3 03/46] target/i386: reduce scope of variable aflag, (continued)
- [Qemu-devel] [RFC PATCH v3 01/46] target/i386: Push rex_r into DisasContext, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 08/46] target/i386: make variable b1 const, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 09/46] target/i386: make variable is_xmm const, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 10/46] target/i386: add vector register file alignment constraints, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 05/46] target/i386: use prefix from DisasContext, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 04/46] target/i386: use dflag from DisasContext, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 11/46] target/i386: introduce gen_(ld, st)d_env_A0, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 14/46] target/i386: introduce mnemonic aliases for several gvec operations, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 15/46] target/i386: introduce function ck_cpuid, Jan Bobek, 2019/08/14
- Re: [Qemu-devel] [RFC PATCH v3 15/46] target/i386: introduce function ck_cpuid,
Aleksandar Markovic <=
- [Qemu-devel] [RFC PATCH v3 06/46] target/i386: Simplify gen_exception arguments, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 07/46] target/i386: use pc_start from DisasContext, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 12/46] target/i386: introduce gen_sse_ng, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 13/46] target/i386: disable unused function warning temporarily, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 17/46] target/i386: introduce generic operand alias, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 16/46] target/i386: introduce instruction operand infrastructure, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 21/46] target/i386: introduce modrm operand, Jan Bobek, 2019/08/14
- [Qemu-devel] [RFC PATCH v3 18/46] target/i386: introduce generic either-or operand, Jan Bobek, 2019/08/14