From patchwork Sat Sep 16 22:01:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723627 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1032858wro; Sat, 16 Sep 2023 15:02:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGP7IDBbdMsyw9Wa4oZahheblhIWR7RW0/QlByYmXOcuOrDRgHXOYHHhhaVv1wOmAoxemRJ X-Received: by 2002:a0c:de07:0:b0:656:3c43:6bc5 with SMTP id t7-20020a0cde07000000b006563c436bc5mr4688262qvk.7.1694901769302; Sat, 16 Sep 2023 15:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694901769; cv=none; d=google.com; s=arc-20160816; b=SDsnlHzLHyOg8S9OLc/5LrZXe43GDzFnt0cA1QQdJmKIGQzLvK6bmNxIoZ7FWTsAZp 5r6LvcLy699VW6zkqVETBLCUQslhr3E6c39k21Kc43tWcvFzKUBq1EAy0DXr0k/0KgN4 Lhd/0nMrr0cgXON6AYfELvznzrX2ASqYtTEdOfhGVM35v5PnxlgI7iOiMKCGKPSeUHlt Qtv/7uSHpzcX4cZFfbdQAnHrwhBgPLa3iisj9zhM4aOVXWuIMjzJH26b23oX6gZeHROK xveMcq577JdJDxI9HB6db4ca+OuaSb3YjA1VdUXBilXKoKHt9OUQjYNWf2nMecDZt7uV v6MQ== 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=NkIKScugFstB2eLhoDZslzvtYewYtRAcc2oZTQwrpeE=; fh=ll3XkfyLycYodSF2dSurSb0crBEObgQmKfp9udf3myk=; b=CUzpOZuVjnzHh/8tawcbGzC4Pbq0+XFg4tzdXDPJ3LW9zmza30ZhCkMVYsh8RCS9Wa i6RQK7sUiUPy5lCi4afAe2qHfz6UGdN/6zfeUZV2w7w01fKfscxFQJDqcC6m4pcl7CC5 TEtmFw5nal81kMxNQwPJbjmDDe5Eq97fz/FW9nQWKFkkmHd96CWDYsyIkHdkxuR+COPD rqMk8xBNA//dPcNaVlTkzqKgQD39fd5TbXF0WigZU8wg804lPR5C8GZGCo/csn6IeeWX nhAHPU2aDrrO0ANs9LNgVRhTYO+U2sMRU1Mlo91dh8wfoQq6q17xQWmMikP9Wq79yvvA 7YgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IDMTpl0n; 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 q13-20020a0cf5cd000000b00655decdc357si4020033qvm.229.2023.09.16.15.02.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2023 15:02:49 -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=IDMTpl0n; 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 1qhdMV-0006Hp-Sv; Sat, 16 Sep 2023 18:01:59 -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 1qhdMU-0006GW-6e for qemu-devel@nongnu.org; Sat, 16 Sep 2023 18:01:58 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhdMS-00047F-FU for qemu-devel@nongnu.org; Sat, 16 Sep 2023 18:01:57 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c09673b006so25321065ad.1 for ; Sat, 16 Sep 2023 15:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694901715; x=1695506515; 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=NkIKScugFstB2eLhoDZslzvtYewYtRAcc2oZTQwrpeE=; b=IDMTpl0nrpwoYnEIkhmrOFGIeNzkKLJu6Vpj078AE9rqp5Y45VUSZqYVrNLcyhi2Pn 0qSRV27gEMiEDxs6R5WJ7PdOmCOVt/QrIbzYWDTRatGbKRi9ROpEk5svbiFzckEldaWd z5fwdZVwrPM8vBnAgHur6vVDcD2vR8Wf07IlTkviKRuOLgz8uC/w3EEcyuhUVdPRMWKG o1nt4AWIZkSFEGUe2ufGAmu0RNEpVsFy1+qngYHtEYuQzj+0kOoflj5wBFQIXPiWxJLc FMm59zDG3fS3fPX3x4CPA6tK5uG8SwhfpDngNJJLrY8NzQ96iHUhqXtjV4EUPoBH/989 Xxpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694901715; x=1695506515; 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=NkIKScugFstB2eLhoDZslzvtYewYtRAcc2oZTQwrpeE=; b=xLjTb47GAYFWmLZ40ffmBiA74f0YyhTuoXO6uxIFxF/T6KiT5hUUDFU7lI8PWP0P8H Nwz/T41agzCke7wniA3/RACqUoRC1RsCvA2z56CcdhkvlOHh8Fd0GVdiHot9oz0uEex0 BAO8bIjwNqkmwKpgxTkBBi1PlXaifZEHRMbhk6IGeGiXPYjuId68PxtIWOCdnMqtWvW4 qAEZjXfNrR/RgSrKPjwvP2nNvhDbhOoNe/JY6VM4FvaqSL9tE4U70pzWfljFxcPhAPLa drYIAxK866vdBlsZgO9jK7NnY9JyGn82rEq8qZm20xYVH7Trs6SM+qS1YhGVAB09VFeq FqWw== X-Gm-Message-State: AOJu0YxyUmORzqbvo5R+Xm5baFAFZmRHdiHQw9tKP5I2OPRYZATB3w3R ndYFRRuAMjJI6BoF/PE/gpvNgdZP6VeOGFlxts0= X-Received: by 2002:a17:902:ce84:b0:1be:e873:38b0 with SMTP id f4-20020a170902ce8400b001bee87338b0mr5908894plg.59.1694901714857; Sat, 16 Sep 2023 15:01:54 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id q3-20020a170902788300b001b531e8a000sm5707763pll.157.2023.09.16.15.01.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 15:01:54 -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 2/7] tcg/loongarch64: Use C_N2_I1 for INDEX_op_qemu_ld_a*_i128 Date: Sat, 16 Sep 2023 15:01:46 -0700 Message-Id: <20230916220151.526140-3-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 new registers for the output, so that we never overlap the input address, which could happen for user-only. This avoids a "tmp = addr + 0" in that case. Signed-off-by: Richard Henderson Reviewed-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 2 +- tcg/loongarch64/tcg-target.c.inc | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64/tcg-target-con-set.h index 77d62e38e7..cae6c2aad6 100644 --- a/tcg/loongarch64/tcg-target-con-set.h +++ b/tcg/loongarch64/tcg-target-con-set.h @@ -38,4 +38,4 @@ C_O1_I2(w, w, wM) C_O1_I2(w, w, wA) C_O1_I3(w, w, w, w) C_O1_I4(r, rZ, rJ, rZ, rZ) -C_O2_I1(r, r, r) +C_N2_I1(r, r, r) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index b701df50db..40074c46b8 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -1105,13 +1105,18 @@ static void tcg_out_qemu_ldst_i128(TCGContext *s, TCGReg data_lo, TCGReg data_hi } } else { /* Otherwise use a pair of LD/ST. */ - tcg_out_opc_add_d(s, TCG_REG_TMP0, h.base, h.index); + TCGReg base = h.base; + if (h.index != TCG_REG_ZERO) { + base = TCG_REG_TMP0; + tcg_out_opc_add_d(s, base, h.base, h.index); + } if (is_ld) { - tcg_out_opc_ld_d(s, data_lo, TCG_REG_TMP0, 0); - tcg_out_opc_ld_d(s, data_hi, TCG_REG_TMP0, 8); + tcg_debug_assert(base != data_lo); + tcg_out_opc_ld_d(s, data_lo, base, 0); + tcg_out_opc_ld_d(s, data_hi, base, 8); } else { - tcg_out_opc_st_d(s, data_lo, TCG_REG_TMP0, 0); - tcg_out_opc_st_d(s, data_hi, TCG_REG_TMP0, 8); + tcg_out_opc_st_d(s, data_lo, base, 0); + tcg_out_opc_st_d(s, data_hi, base, 8); } } @@ -2049,7 +2054,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_qemu_ld_a32_i128: case INDEX_op_qemu_ld_a64_i128: - return C_O2_I1(r, r, r); + return C_N2_I1(r, r, r); case INDEX_op_qemu_st_a32_i128: case INDEX_op_qemu_st_a64_i128: