From patchwork Mon May 27 21:18:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 799260 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a08:0:b0:354:fb4b:99cd with SMTP id m8csp26399wru; Mon, 27 May 2024 14:22:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdwhmeRha6H+rPfUQp32QD51HlTS5ETPGe7tYoL36th+IVcI4ykA3sJJ//QQXoZ3PtaXDx+LSMzqCndIRpM1nT X-Google-Smtp-Source: AGHT+IGp4XdHZ2GEvVagQg7VqHgFJZ3VwKkNIHgba70iyeR9otvUfgM83tbE/2j1mI7sozytaeLY X-Received: by 2002:a05:6214:3382:b0:6ad:85d0:572f with SMTP id 6a1803df08f44-6ad85d05944mr34813486d6.16.1716844921841; Mon, 27 May 2024 14:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716844921; cv=none; d=google.com; s=arc-20160816; b=VGa6Seh/NLYMVLjEqqFb+6YOKaQxho0DQ8FhZPK/KDiVl0vq1PhNvYX8/bfQGoBpoX xqMfnuVznxMOXLTscIBNyAsnOUmt/Z3kuDs/7eKdrKA3LHQOVzvnqZpx/79RMFNJNU3k UQlMvYq6o7CiPH9Zn/QfjCky5MbFCElYwTczK8QKKd5ONKG5fLdub9gbCfG4rLZAgpl5 HgIwLpB3SnHk7DlyjSIyd2LAOuMU6IaOdvf7EiDoQGM8Ovg23EuVgdsY+78o9qKnTV5y 8gWWucU2BE9ndpY2kkyCIq6gD7/k7FF6lC7/AMqC9YIDVaie84NAEzJJHT8AJv2QKe/y uc8w== 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=qr9QrkkbS3DLNP2flOzNz6V1gGD5UBleYXp2ByqRSSQ=; fh=hzNNYKTacOnX/pFrTgMTyElWGK9kyvH1o007fnxf7fU=; b=V7k0nNcBT1eQMqQTkut8HQtbkx2wDAX6gWMjzhBvQ9hJ3IsM+bVJgzT6CLXwAMHZXO u7nZmtlLgjpR9PU3ik/OqGdqYRJ1Y3gkRM5VcBf6M9P7qdXYr2sRjL+spw6LOi9J8S1A dNqKFsmObGlh9TARXLcq+XMB1ZyU4qyc3BsqhKgYCVuGNO0TbXNDDT2OfUoNAxT2cGSX 3aAvbioBu2/J6V53XQjfymNlVW2akr6w1/0WJR6cDNNf7Fq1PVt+DJG6imYtWMUpOcbS WDN69YgKT06b5EzJAdH2iMvoXBuxOyVqYkFHHu8o01p333c+4Qx6EK5f7RzIXs9JfHo6 FjmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k0WlpivP; 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 6a1803df08f44-6ad7548b68fsi53881966d6.330.2024.05.27.14.22.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 May 2024 14:22:01 -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=k0WlpivP; 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 1sBhkZ-0007Ae-FG; Mon, 27 May 2024 17:19:23 -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 1sBhkX-00079N-J2 for qemu-devel@nongnu.org; Mon, 27 May 2024 17:19:21 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBhkV-0003cp-AN for qemu-devel@nongnu.org; Mon, 27 May 2024 17:19:21 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6f4ed9dc7beso133205b3a.1 for ; Mon, 27 May 2024 14:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716844758; x=1717449558; 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=qr9QrkkbS3DLNP2flOzNz6V1gGD5UBleYXp2ByqRSSQ=; b=k0WlpivPGRwSTDMuZzQ04K780U2x3L2QzS470p5lVe2Mp30YQHZmtFqlFT2jDLkYIy 90XC4ngocw2RCtoyu2yggJiszDLWttWUCTbL/rM3dOraHr5G3Y4bI/Akwqsmq9x2ZFO9 ZHJkkcs/SxJxNmJKBy7tFyQXwKn/LexG7bEaC1LFE4BhN+k/q87yOMsYtzPl4lQURZSi IHFTLinUzcHnGzagX00BPO2yNTZBUZWbPHkyTwe2bejwND2c3yIBxZ1Td1Vn6tyN/xWM eEf4tf4EtzwuYO24d1T3wlqMZXWNZ8zCbb2mSg+amDaFv06PNLFDXTvdNUtzcvFiEFE9 USoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716844758; x=1717449558; 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=qr9QrkkbS3DLNP2flOzNz6V1gGD5UBleYXp2ByqRSSQ=; b=rJtHiqv+arPCW5aqzQ9nySJC6HSnE9nKAZW8rN/tGZUZ2H3NmUO1LYU3+TAAjGzpmw h2Uu6PXKbDky33coC/mDcB2VSS0BwNhPjSVJt0pRjcbF7LLvEbWueJifhY24FrPUwHDg LequRcuf4jrnu87dMdTdXpU0mIawi1SEk2A17zlwK3pCIOboOBEhvxVrheCesFRD9v5J bdX7OHtBs50LnJ3X5mE6KpJLbs+a7vGOhGMGdynFQd5KgIvvItKgIYMgzhzWOdovTXs0 NONr3s8PfbFRhOWR1Ir+7zs8oC0UEkuaUnzHzmWdMPlJjm4Q7/dpiQTEBvd3rmXQw3hd zdfg== X-Gm-Message-State: AOJu0YwigcyAKa2WjMdRogyWcfuG2gk3XDmGSU+9VFXVDnDRYSupJMiU i6waTRYn69YqrsOnY4VbYpjaW8O470C0lRVIk7NXgzrVFhhZvAaivkzoJJQQ9MWHBwqfaxeSGJO Z X-Received: by 2002:a05:6a00:1d93:b0:6ff:7ea6:d5ae with SMTP id d2e1a72fcca58-6ff7ea70f30mr8772233b3a.6.1716844757859; Mon, 27 May 2024 14:19:17 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fd1d4d5fsm5265876b3a.165.2024.05.27.14.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 14:19:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name, gaosong@loongson.cn Subject: [PATCH 04/18] tcg/loongarch64: Support TCG_TYPE_V64 Date: Mon, 27 May 2024 14:18:58 -0700 Message-Id: <20240527211912.14060-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527211912.14060-1-richard.henderson@linaro.org> References: <20240527211912.14060-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 We can implement this with fld_d, fst_d for load and store, and then use the normal v128 operations in registers. This will improve support for guests which use v64. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Song Gao --- tcg/loongarch64/tcg-target.h | 2 +- tcg/loongarch64/tcg-target.c.inc | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 29e4860d20..990bad1d51 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -171,7 +171,7 @@ typedef enum { #define TCG_TARGET_HAS_tst 0 -#define TCG_TARGET_HAS_v64 0 +#define TCG_TARGET_HAS_v64 (cpuinfo & CPUINFO_LSX) #define TCG_TARGET_HAS_v128 (cpuinfo & CPUINFO_LSX) #define TCG_TARGET_HAS_v256 0 diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index de5369536e..980ea10211 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -321,6 +321,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) } } break; + case TCG_TYPE_V64: case TCG_TYPE_V128: tcg_out_opc_vori_b(s, ret, arg, 0); break; @@ -838,6 +839,7 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg dest, } break; case TCG_TYPE_I64: + case TCG_TYPE_V64: if (dest < TCG_REG_V0) { tcg_out_ldst(s, OPC_LD_D, dest, base, offset); } else { @@ -869,6 +871,7 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg src, } break; case TCG_TYPE_I64: + case TCG_TYPE_V64: if (src < TCG_REG_V0) { tcg_out_ldst(s, OPC_ST_D, src, base, offset); } else { @@ -1880,8 +1883,8 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, a2 = args[2]; a3 = args[3]; - /* Currently only supports V128 */ - tcg_debug_assert(type == TCG_TYPE_V128); + /* Currently only supports V64 & V128 */ + tcg_debug_assert(type == TCG_TYPE_V64 || type == TCG_TYPE_V128); switch (opc) { case INDEX_op_st_vec: @@ -2394,6 +2397,7 @@ static void tcg_target_init(TCGContext *s) tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9); if (cpuinfo & CPUINFO_LSX) { + tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS; 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);