From patchwork Sat Sep 16 22:01:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723628 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1032872wro; Sat, 16 Sep 2023 15:02:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgKl+q1xtpQ4Y2atVQYmvDFWNntKH+0dvY/xM5eVDrZLxw8nwVFetzq7SxbZMSmScE2GT2 X-Received: by 2002:a05:622a:c1:b0:403:fcd9:963 with SMTP id p1-20020a05622a00c100b00403fcd90963mr6000905qtw.67.1694901770976; Sat, 16 Sep 2023 15:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694901770; cv=none; d=google.com; s=arc-20160816; b=U2Gzy6ZJMe0qgKlih6/JdzZMTli3yGjW3fwYQBLOXVV9E2pTCq4OfpJ1kDrituIBpV vuq4XFa7zWPBUGVw9boM3W2qpQlZnIKLSdDGXRpBgX2NfLUUYQWN78sj+2BZwYiT2xyk p4X0Ortv39VsexpD+K2OSWh15weYh61sFZNcl+Srf4CZQOSs3qDAjUWnmFUQLc+lYP0x cslVPc4p1sJbPCJDImbw/WL6/DfT3x4wVmeoE0qbHi1NpF40FkUzk/8NGCrT5LoCTlu6 DWKbTqyr328A1ATPbYmKAo+0qIjLFj5FTmYTOZCQfTsFE6j7gL1JMyU0w6bQBjuTWG74 zJCA== 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=lqYg31kX0a+sV4HnqFcr75vBUreLp6z9YJ7du9LtFxI=; fh=ll3XkfyLycYodSF2dSurSb0crBEObgQmKfp9udf3myk=; b=RBiLib9T5x+H4hpnNWEeRl0FPQBlPovsi44jYgKdl5DHwnMlI3LBzSIh7zn4Z9fn1L vVDri/jXuAXPjwznmtaLOEyVziOb4pPBMmYRxpAdhygjDbWfWeK0nX05fDbJJ1bqsNWU g/Ap4/kpGLXf5akuGpcyZxBzCURzGyoOtEscxwsfQGHY9oU/qLNre+uQbVVX5nvo+CVE FAWJr5g+V5u+uYPw+2cLXYEh2FWdIG9vQM8tjT41kAtJqw7o5sxMs+YR6LYXyc2fDhhJ ZQz2ZzF9bhzz2vVZKXdRfCqqEUHDf8IOeaTJhBbnh3JNrPdd5RPl0Jb8kEpYonqzFSGp ZWJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xhkSdvkj; 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 w29-20020a05620a0e9d00b0076dbb17e788si4142514qkm.721.2023.09.16.15.02.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2023 15:02: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=xhkSdvkj; 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 1qhdMX-0006Ie-Jf; Sat, 16 Sep 2023 18:02:01 -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 1qhdMV-0006HV-Jk for qemu-devel@nongnu.org; Sat, 16 Sep 2023 18:01:59 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhdMT-00047V-KY for qemu-devel@nongnu.org; Sat, 16 Sep 2023 18:01:59 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3ab2436b57dso2150977b6e.0 for ; Sat, 16 Sep 2023 15:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694901716; x=1695506516; 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=lqYg31kX0a+sV4HnqFcr75vBUreLp6z9YJ7du9LtFxI=; b=xhkSdvkjBYC0W+pc+h/buWRfuy6J7/F20U4invS1qvDhh4BDQPP5izbPmTQhOBXQB4 Kx25KHFAxKO+6TB2Wktm0Ad7vlYHGcZnYD9Qjkg73bFXPduHYp6BHCsoR+90nVlxFSHD HYtvHnzIsCvKGGOANGiCVWsnwmUiHedSfDEitxX5XI65KEACbCTZmBDLYq+LXSceOxnx BUItna5WKQ53t/qADtvT83KlYH/4XBOpi21MRSLGXzXr0Nw4YV5uZu+zHIXAk/kARs/I JASShDdkayHjPZJKWojBRFUo0F6hjSf2f4a8d+vkh79ey8BD7clQSxyPjOYVVIDy+J6u pZkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694901716; x=1695506516; 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=lqYg31kX0a+sV4HnqFcr75vBUreLp6z9YJ7du9LtFxI=; b=VxiwZhO7u13AgC0ZgPS6g9pBxaotDXOXHAD1n3d2IJ0NBLyD8zlUZ/IeZwJgQS/Yxj LRLEEoqyYDoUldx2gP1IIZSmF23+WkGhdYKSeT/O191r6ivrH2ZPqel6VNXyem+Dx+aB K5Fe9t7bAdhMWu1k26+zWYG5GskxlmlcKLQLQrHnR6EiFE43t39JvrfWRbyy/Iv8eRTP KNI4fkCVN3DRHaxF2V1WCFfHdSGx2Jqw26h/h0ims9XoO0LLHYQCWgvfbDsrCdiW+cYD UJXEz4GpnliosDsLdFk56+x8iEec0+L82hKOYBHGaaDvPUuuRM6kTCICUWZ8lGRdbfJz 6ffw== X-Gm-Message-State: AOJu0Yze51sJtcPqpHq07ADVZuSqQd6emow+x4ScRlIj5pVjpDbqdSNn 5ehhUdCCIJqldQ3YM1SR4dPJaTcj4YBco2UuDjM= X-Received: by 2002:aca:1909:0:b0:3a7:7bd3:7ab7 with SMTP id l9-20020aca1909000000b003a77bd37ab7mr6194206oii.51.1694901716426; Sat, 16 Sep 2023 15:01:56 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id q3-20020a170902788300b001b531e8a000sm5707763pll.157.2023.09.16.15.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 15:01:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name, c@jia.je, gaosong@loongson.cn, yangxiaojuan@loongson.cn Subject: [PATCH 4/7] tcg/loongarch64: Use cpuinfo.h Date: Sat, 16 Sep 2023 15:01:48 -0700 Message-Id: <20230916220151.526140-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916220151.526140-1-richard.henderson@linaro.org> References: <20230916220151.526140-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22c.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 Signed-off-by: Richard Henderson Reviewed-by: Jiajie Chen --- tcg/loongarch64/tcg-target.h | 8 ++++---- tcg/loongarch64/tcg-target.c.inc | 8 +------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 03017672f6..1bea15b02e 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -29,6 +29,8 @@ #ifndef LOONGARCH_TCG_TARGET_H #define LOONGARCH_TCG_TARGET_H +#include "host/cpuinfo.h" + #define TCG_TARGET_INSN_UNIT_SIZE 4 #define TCG_TARGET_NB_REGS 64 @@ -85,8 +87,6 @@ typedef enum { TCG_VEC_TMP0 = TCG_REG_V23, } TCGReg; -extern bool use_lsx_instructions; - /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 @@ -171,10 +171,10 @@ extern bool use_lsx_instructions; #define TCG_TARGET_HAS_muluh_i64 1 #define TCG_TARGET_HAS_mulsh_i64 1 -#define TCG_TARGET_HAS_qemu_ldst_i128 use_lsx_instructions +#define TCG_TARGET_HAS_qemu_ldst_i128 (cpuinfo & CPUINFO_LSX) #define TCG_TARGET_HAS_v64 0 -#define TCG_TARGET_HAS_v128 use_lsx_instructions +#define TCG_TARGET_HAS_v128 (cpuinfo & CPUINFO_LSX) #define TCG_TARGET_HAS_v256 0 #define TCG_TARGET_HAS_not_vec 1 diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 40074c46b8..52f2c26ce1 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -32,8 +32,6 @@ #include "../tcg-ldst.c.inc" #include -bool use_lsx_instructions; - #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "zero", @@ -2316,10 +2314,6 @@ static void tcg_target_init(TCGContext *s) exit(EXIT_FAILURE); } - if (hwcap & HWCAP_LOONGARCH_LSX) { - use_lsx_instructions = 1; - } - tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS; tcg_target_available_regs[TCG_TYPE_I64] = ALL_GENERAL_REGS; @@ -2335,7 +2329,7 @@ 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 (use_lsx_instructions) { + if (cpuinfo & CPUINFO_LSX) { tcg_target_available_regs[TCG_TYPE_V128] = 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);