From patchwork Tue Nov 7 02:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741767 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415840wrr; Mon, 6 Nov 2023 18:54:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEMv4EikpZaVTSH/Zxeo9h6It5+1RHz5U5B6y0gqU7WvGiTU/9MMNha0h+tPNjI4v4NWzQ X-Received: by 2002:a05:620a:44ca:b0:775:ce76:474a with SMTP id y10-20020a05620a44ca00b00775ce76474amr41068839qkp.52.1699325672425; Mon, 06 Nov 2023 18:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325672; cv=none; d=google.com; s=arc-20160816; b=a20tEZGIVNOmJ4Ea5ghWl8+d+3rWi5PRCBtB7ubEAp7SxtZlcwtoI0zvhE9QZQT9Vq ROAXAcYaK1/Cu6pgzQxIj10JWid/5IMMEopyVdTeDA63xuU5DNSNtdVIqIi1fQBNNnjG FFUT1LQUW72IeVS3O9wPzBXwNfxPP91o/RwcQHRTSM3CEarqmWg8VzaJmMhoYlYvqqh1 jN2fzwJDUV0hY+/qsG3AYR0limBC2Rhc2nrJH/I7RmESR/eU4/Fa9akdw+k4ai3T6NPV h+CXRPsB+uHd1J9r7gNGnpjt5R8/PPO4dVFvOeXyQpiWWqyxzLuO3xThin/sFmEFQE3h vkMA== 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=Q3O8/mcQ+FXQ1L4q0gH6GTHD/Q1jUKjZFDP8Gx7yZ+4=; fh=XdZcuDF0lIDVBff2CYkB4/gQzRNs362lYRoE1KF8IAU=; b=vZrHpkxeeKxqR/4c5rZv5ud/WXY1OGdmBn169QcEerMIR4HvX4HcfR51m2LMrj6U54 qlKayN1BQxrltv5rrnuvtu7hu5GaLDfJOVJgrqkCyFoVTMLYfms4dW/PJR6MitcRdSze qSx4GJhSmOQ9ar8fz1dVWzA4e7X46nfnbmEIQN/k9nugsIai2wb+yn9HfSh2UHnYZRC9 uHRzeiQ9qC4jarcA1IDkz7WaADf+qY8CRKcf6VAUU1+nTFyWiqARAXAWAwa/E3sgwxvg Ot6ggoR1Rl43hC+E10bfwSRCHIkmc7SZVjXSevdOy+Wl/lnTrc7JoQjnDnjPRtlFzsmT GUTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oG5Pu8Sh; 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 v5-20020a05622a014500b00418175f3a84si6473957qtw.138.2023.11.06.18.54.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:54:32 -0800 (PST) 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=oG5Pu8Sh; 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 1r0C96-0008BD-Oz; Mon, 06 Nov 2023 21:48:52 -0500 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 1r0C94-0008AY-Vo for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:50 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C93-0005q0-86 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:50 -0500 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6c320a821c4so4636758b3a.2 for ; Mon, 06 Nov 2023 18:48:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325328; x=1699930128; 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=Q3O8/mcQ+FXQ1L4q0gH6GTHD/Q1jUKjZFDP8Gx7yZ+4=; b=oG5Pu8ShiJLPO2OPdMIGdvf6x69sf+2oWmJzF6zDzMxApvDu1ZTYyPQSftGfmFwX4D U3VdZGBg98igwo2Ekf0tUf6DgDy9LriFHnHAcNFMX0NdJZREFDfbgnkuxDF5o0U+H/oj lf94vSpL019qnVnwlbYIIbWp0JFw6x76eJqWwR1ymlBkKxUDlcVMKIJXGaIpNlaMOV0D 2D+m9dUCQoiU8pZHpGlXbEGgen4/qaHIr/3rJdiv3kRJm15GINnuEJFUBBgpRexbrklV PaXQoEtcVrPOBkAbpiGSn7UnF9jjMXZVbYStZOjwcCIkjJm+GPjnVhttB5lcB7/dZcOZ IjrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325328; x=1699930128; 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=Q3O8/mcQ+FXQ1L4q0gH6GTHD/Q1jUKjZFDP8Gx7yZ+4=; b=uRkebovY+a+Dzv//rmmYKk582bJjzDRzKW7gwwJN0v7V8+sUrnvhevNS20f4hcpomn Ad8Ba+oa5jcSq4giJw8cFi7sbl5R4ioU3oDVRhIA1/kp6fTdDDZCrMhy4jeE8vxdikJC CYIM/PaljHtT26afcxadJp3oF0ZCgjK8Ph3w0D3cjp1CKuE/Ff0PLWpv9/6qPfDP8UkM jqHbwGLr8pf/txCei5awBiKxn90vyj5rrK6tUNyOloJkkCwV4Trr1JaWfV6mARvTm73m L1jdIGU67duC+2ARsCcyz7uFwGwjTRAiEaRCMPS7Q29FEI+P4S5lFncuixDAVxxklrwh 7H0g== X-Gm-Message-State: AOJu0Yz+1h/57bNShdnG/5rSa9h5qHTUGYw293L2sW/SNVB0r5zFvR7c RCzmgI+ClsWLRA8xSQYyrPeivl7eboLPSJRm/DM= X-Received: by 2002:a05:6a00:1345:b0:6bd:f760:6ab1 with SMTP id k5-20020a056a00134500b006bdf7606ab1mr29533980pfu.14.1699325327870; Mon, 06 Nov 2023 18:48:47 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jiajie Chen Subject: [PATCH 05/35] tcg/loongarch64: Use cpuinfo.h Date: Mon, 6 Nov 2023 18:48:12 -0800 Message-Id: <20231107024842.7650-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Message-Id: <20230916220151.526140-5-richard.henderson@linaro.org> --- 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 a1a387df31..ae13c1f666 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", @@ -2314,10 +2312,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; @@ -2333,7 +2327,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);