From patchwork Thu Oct 26 00:13:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738226 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554957wrq; Wed, 25 Oct 2023 17:25:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFV/UwC6DxoBADJW/zMYxpUm0T5w/NX3ARx+p87X12fdbn8r2ldWQs8HWbkTQCkuxk1J+9B X-Received: by 2002:a5d:58d4:0:b0:32d:ba1e:5cee with SMTP id o20-20020a5d58d4000000b0032dba1e5ceemr11882090wrf.45.1698279950714; Wed, 25 Oct 2023 17:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279950; cv=none; d=google.com; s=arc-20160816; b=S7qyBkT0E8dgQNZ7nbU5uRjlfkYbH4fq5kgYJbC1gP0ZV3eHnpR78daDUM+NCImZI8 J+q7ihJHEMHBlmJKc6X9DJ1wL+bXlgE0fK1FTsNHFGt9J3Gty9okUJglGF0NS3/qISVy b5zgmzGvck++TvXocHOdIZKeTeedbFwkwICPK61Qlzlt2sHKieOKGKcQK3kNRU/qSqAv Wz/vssp1tY4imJXnozH/6uk4C/cg3wbDLjcM5r48iGfsYfoce9K13QBdNYT+YGTAl3ps UuOdgAN3S067Y4/H2fuQjkfJ3SD+4k/CZCOcx7OTtJRr8L+nMUZ9fZ+4P3wTayEop9qJ ktiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=clLDX0OMwpp8pXeARARKHNXdrMJ0cLB2t4O0gfCmBGk=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=eoGhPZ5Do9ev311h/Gnom1mXrGyK+VWCAmwXaLRMJLWhniEfi84BbSgIvrKRbwOd9F UW0wQiGJG7V2+NnHcxm+/lRvmsWhdvtJh/PtR9gPDA62iLTWGTCJvBkGOj9dV6T3C4P7 V3DMF155h9INdNjiM+mvQeN1/UjValrf/STRdOzpW5VNpABgSUP25GgCuimJRV2Ku5TS 15V5PDRY9mmVTzdOYnEkdC5gKJVO5QGLGIFmhchY6wRRelB4zuAy6WJ3bIuT8sWYAaN8 fBqJQ9jGdlMDT/5Zq7gphrINHlgBOVieZ5n7fizFbc//QI30MGB1aEjq+r5e9I/ltwd/ sxnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o7XB5Smb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o17-20020adfcf11000000b0031752d46de5si8382396wrj.1027.2023.10.25.17.25.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:25:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o7XB5Smb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvo2n-00072J-FK; Wed, 25 Oct 2023 20:16:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2i-00070M-SD for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:08 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2e-0004qu-Mf for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:07 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c9a1762b43so2235295ad.1 for ; Wed, 25 Oct 2023 17:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279355; x=1698884155; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=clLDX0OMwpp8pXeARARKHNXdrMJ0cLB2t4O0gfCmBGk=; b=o7XB5SmbbyNIB7uzCnNjuJC8J8yBhT8kWM+1kLRFygp64p/7I8IBi6NX34pE1UQT/M XoU9r933vcDSCvgtEVBh4xs0YSd4K1yq2SenowVixy6CO6HALD2hIZ62hP+jetKqTaLq mZrQui1VkWVOGGWtbpXocc9GKdBpZLkDriNSO29eECwEfM7OHxeOhmls5eqM1lnMpYlm Hjd8o7ArITIYhPZ8nUqJgFXRHzBgsqMbpTK/KokkHow9E7bzyRpYqTAwLqSd+F9hjDkZ lIDfEeNZVoIYJ5p5eQZ4bB3Ceb6ENQLjJp68dYpN4+B71R/WwRzSuZAFtuV8pO66IKuc 1Zpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279355; x=1698884155; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=clLDX0OMwpp8pXeARARKHNXdrMJ0cLB2t4O0gfCmBGk=; b=p9DE3df8As2ruPvmlwr9+qdE2KLsmpI+XJ5De7t0nCvDaYq1TfR5t96yQ8TrDcxOdJ UMlJTIk1iqHSu0HnZQbaJodUoYJzjetnvbHPtuem/OVRYQnwfTCK7utNkjFTjBgR6oJY uzKAzoYQHbIiN7nANGBV8cHoqZgPSTjf6YYJIklKiouEx/75ny0+0Y2PPrfCRDEFxWk3 dTH+iGWtUefX9dvr6Rp6pIAIYYio6IYqfvwt2+62MEPvkWhaoa95kHK7GTD5JI4KrX9n ie3SYRyyeQzTxU3j16vWPt0ylh+WwOrLYU39JuIlEhF0ugOQjLFn+QFgQuennyawRUyu +0FA== X-Gm-Message-State: AOJu0YwrQEe2toET8zvv31vWbEPr+kR1yT9/5ehWeeS7TPV6xuK7iz5s LCesnKqkhq4aJ+g608KOdF433Dn6iAGL6EfY36I= X-Received: by 2002:a17:902:ef8e:b0:1c7:2697:ec0a with SMTP id iz14-20020a170902ef8e00b001c72697ec0amr16853834plb.30.1698279355212; Wed, 25 Oct 2023 17:15:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 07/94] target/sparc: Use CPU_FEATURE_BIT_* for cpu properties Date: Wed, 25 Oct 2023 17:13:52 -0700 Message-Id: <20231026001542.1141412-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use symbols not integer constants for the bit positions. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/cpu.c | 72 ++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 8ba96ae225..330b7bead3 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -545,21 +545,22 @@ static const sparc_def_t sparc_defs[] = { #endif }; +/* This must match sparc_cpu_properties[]. */ static const char * const feature_name[] = { - "float", - "float128", - "swap", - "mul", - "div", - "flush", - "fsqrt", - "fmul", - "vis1", - "vis2", - "fsmuld", - "hypv", - "cmt", - "gl", + [CPU_FEATURE_BIT_FLOAT] = "float", + [CPU_FEATURE_BIT_FLOAT128] = "float128", + [CPU_FEATURE_BIT_SWAP] = "swap", + [CPU_FEATURE_BIT_MUL] = "mul", + [CPU_FEATURE_BIT_DIV] = "div", + [CPU_FEATURE_BIT_FLUSH] = "flush", + [CPU_FEATURE_BIT_FSQRT] = "fsqrt", + [CPU_FEATURE_BIT_FMUL] = "fmul", + [CPU_FEATURE_BIT_VIS1] = "vis1", + [CPU_FEATURE_BIT_VIS2] = "vis2", + [CPU_FEATURE_BIT_FSMULD] = "fsmuld", + [CPU_FEATURE_BIT_HYPV] = "hypv", + [CPU_FEATURE_BIT_CMT] = "cmt", + [CPU_FEATURE_BIT_GL] = "gl", }; static void print_features(uint32_t features, const char *prefix) @@ -835,21 +836,36 @@ static PropertyInfo qdev_prop_nwindows = { .set = sparc_set_nwindows, }; +/* This must match feature_name[]. */ static Property sparc_cpu_properties[] = { - DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, 0, false), - DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, 1, false), - DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, 2, false), - DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, 3, false), - DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, 4, false), - DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, 5, false), - DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, 6, false), - DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, 7, false), - DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, 8, false), - DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, 9, false), - DEFINE_PROP_BIT("fsmuld", SPARCCPU, env.def.features, 10, false), - DEFINE_PROP_BIT("hypv", SPARCCPU, env.def.features, 11, false), - DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, 12, false), - DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, 13, false), + DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLOAT, false), + DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLOAT128, false), + DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_SWAP, false), + DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_MUL, false), + DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_DIV, false), + DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLUSH, false), + DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSQRT, false), + DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FMUL, false), + DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_VIS1, false), + DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_VIS2, false), + DEFINE_PROP_BIT("fsmuld", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSMULD, false), + DEFINE_PROP_BIT("hypv", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_HYPV, false), + DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_CMT, false), + DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_GL, false), DEFINE_PROP_UNSIGNED("iu-version", SPARCCPU, env.def.iu_version, 0, qdev_prop_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),