From patchwork Wed Dec 21 22:39:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 635644 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3781343pvb; Wed, 21 Dec 2022 14:49:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXvZOY6x7FBPJSIwu5OcmTDt/eOFCPvHf8o6z3UMEXLes6YXnu9X74ZBez87nBVlo7ElmDQI X-Received: by 2002:a05:6214:5490:b0:4c7:26a4:908e with SMTP id lg16-20020a056214549000b004c726a4908emr4634028qvb.47.1671662965833; Wed, 21 Dec 2022 14:49:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671662965; cv=none; d=google.com; s=arc-20160816; b=IENsj1Mw5W1LJZ83zqYPZYfA4EwMiYSEp/DeU12KY8mPteG2ANICcL4VV9+bl6krdn rqvBP5bpI72OaNiBLchX0umH0pCLgore7jGrCBvdL43TVueZuNnPeUOx/G7n996x54k3 iYHrQzjl0jrXFvxPnT8iUK8ap9dne5ggdvTaM/5xq95K3kKgCxlxpQEF1EU2kGPE9D78 lsHzHcgZEcCknAEGcP6jeJsn7ONJv9gzH71FvlT2SLSA1gUqyuRGpSJQPpT3RMmXItdA dn+cpYewQyAgHG7VZYrFRUJVfWwZw25K+l5mzalA7Cy3ZxUN4voVzfkFuw+9oX6kjecu 4Y7g== 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:wdcironportexception:ironport-sdr:ironport-sdr :dkim-signature; bh=DId2IK/2+8BZnCTJYolomatmHCIWF7rnT1qVyL6Lehc=; b=vjkCn+/gfneZCAPaDczMsDpD/d7I2sT/4yc93FASJmoBA3eIn6/0tSws0c8mfm1wHw ReJv3A6DjvNOIHSqcMF7ziWzfB/0L27GoZQHrmaTukdbxUOxWOduOoruDjGCIh3YnXcU knifydUF7BJk2HvHhzQeqFoYKDgz+pt7tgH0Tn7U9pS+98zj+MBzDM6HqKx+X24f3FGv VNjLYp5FDo7fILJe9Ab0ETvsW3IxELvBXf9AWEEzb9BTSxwp2T/NRAaeIAknEBdzm88j lWKMdr30ptklpTwynDHndvEJsAvQnKcCfsblPMoOS96w6HGj1EGbbUiz7yJbQihwqPY9 bC6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=hxfiUtfp; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=aoMbUVws; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cz6-20020a05620a36c600b006f9f3f0931fsi6470095qkb.148.2022.12.21.14.49.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Dec 2022 14:49:25 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=hxfiUtfp; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=aoMbUVws; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p87lh-0007NP-Ax; Wed, 21 Dec 2022 17:40:57 -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 1p87ld-0007M0-NM for qemu-devel@nongnu.org; Wed, 21 Dec 2022 17:40:54 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p87la-0000bQ-IA for qemu-devel@nongnu.org; Wed, 21 Dec 2022 17:40:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1671662450; x=1703198450; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SPaspSsWq01oD2q07tmSbRBBdO5kaHAHyKb++qDpmvA=; b=hxfiUtfpu2MBXcmsI0kRKvwLD1GNRkHx2TUN3Nx2glxVmBuZw5Co5eWK gmd6rp9gBAUekmK/zQJpYyETzrbiovEtcwfUBD1LK4vYjuthIaqEWQ87s x+37g3LhRQC3Gkb0PhoE/rbo8nJXW+MHQUWvYiGk+e54+E5I/OXwh5eBs xDJejkDVgC8McQyxGee+1TQHeWL0AcCgUf6kKJMhWgT/kyanndqgRqUed TzeHlcPlJRgxvNX2wAm4pl3pvBI4QbXvCeAuPUye9WI9L08VilxO4Vcbx 9mdzrsjfPz3+uHGfIMa7oIeAKVb8aeFMY3cmNcAup5fmPWdCxk2doId/L g==; X-IronPort-AV: E=Sophos;i="5.96,263,1665417600"; d="scan'208";a="323561281" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 22 Dec 2022 06:40:41 +0800 IronPort-SDR: +uxMfVgwk3wCwdnoDLxTmZA23VNPMqZ84UhvkVhhfyv/04soUj4PD26qvZU15VpCBy155c09cl xUCTORxvRX2H0AmMJFFg+1jKYf2t9WM7fJl3Dde/jlzjOm59cRrrp03HZJlg83HkLnUUhV6Dke wyrLYuSi1VRNuyf760z07gtkyLlXIWqVwMvBFwafstsLhjMBaax8FI+e5UGi3iutqqgluX4TLO A0Dp/RHMwKxQsL6MGWcePM8iJUE/gvq1ZnLjfM9i7538LAqnjTsTrwaG/4hTxIJWI6hrbCsFQg PYY= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 21 Dec 2022 13:53:08 -0800 IronPort-SDR: tEWB27miB/4tBOJvt6UG/k5AEKHr4Vu3nG2L3PkRIgauAyV33hV+Xua469SpCzsfLaevE2fcGd SiwpAnpqkGErdNJV60ELOipb2Go7QKssOxeDFqpzmbLcWJPBjSkCAzhiY9tTWMGULXIj318HjZ DrSzeasUHnSX5HKyZZsWJLiY/4e1m8W6JXk8EnLZ+zRBreXW0ngZ7+Q7182U8Q2/VBmJlPQoAq gc4c2EhOwrnjcIP7srHZzqnlU9XV/fQp0wNr6cne3XpjHjutYGzVL8/KdR4kMjn83WCAmQu3fu BW8= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 21 Dec 2022 14:40:40 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4NcpLb30fzz1RvTp for ; Wed, 21 Dec 2022 14:40:39 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1671662439; x=1674254440; bh=SPaspSsWq01oD2q07t mSbRBBdO5kaHAHyKb++qDpmvA=; b=aoMbUVwswy2g7fuyIRbVn+RxcY3FmvWNoZ z9Dh7FB+XlD49xD/L5NbxRj4jRyZvWnCTeI2w6eaY88O5YODK6A2A2r++DFUqhwI CyW16gW4KD4Zeq83mZ8X0+bLqJxCl4e0IB/0WmFlHT5s/1dfednqRG7786Hm6dEG R14ZW5rFIKRxx4gdwUWYaoU7griLtcQUT3adtW1AGg7jmONjvsKU1racI/u9/fJd eICJYBQZRYuKytH/VzQow8VhY3d2ZoORhh6zq89TmepBHfW3O9NyDAVY5hKTUC9d 6lYfuM4Mxf0r5Z85JQMnH5cxZDSVqCULpg24HpZX+JA1XDWis+Tw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id r5dBrs1uXF0K for ; Wed, 21 Dec 2022 14:40:39 -0800 (PST) Received: from toolbox.alistair23.me (unknown [10.225.167.8]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4NcpLY15CFz1Rwt8; Wed, 21 Dec 2022 14:40:36 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Richard Henderson , LIU Zhiwei , Alistair Francis Subject: [PULL v2 05/45] tcg/riscv: Fix reg overlap case in tcg_out_addsub2 Date: Thu, 22 Dec 2022 08:39:42 +1000 Message-Id: <20221221224022.425831-6-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221221224022.425831-1-alistair.francis@opensource.wdc.com> References: <20221221224022.425831-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.143.124; envelope-from=prvs=3472792e2=alistair.francis@opensource.wdc.com; helo=esa2.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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 From: Richard Henderson There was a typo using opc_addi instead of opc_add with the two registers. While we're at it, simplify the gating test to al == bl to improve dynamic scheduling even when the output register does not overlap the inputs. Reported-by: LIU Zhiwei Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Message-Id: <20221020233836.2341671-1-richard.henderson@linaro.org> Signed-off-by: Alistair Francis --- tcg/riscv/tcg-target.c.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 191197853f..2a84c57bec 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -700,9 +700,15 @@ static void tcg_out_addsub2(TCGContext *s, if (cbl) { tcg_out_opc_imm(s, opc_addi, rl, al, bl); tcg_out_opc_imm(s, OPC_SLTIU, TCG_REG_TMP0, rl, bl); - } else if (rl == al && rl == bl) { + } else if (al == bl) { + /* + * If the input regs overlap, this is a simple doubling + * and carry-out is the input msb. This special case is + * required when the output reg overlaps the input, + * but we might as well use it always. + */ tcg_out_opc_imm(s, OPC_SLTI, TCG_REG_TMP0, al, 0); - tcg_out_opc_reg(s, opc_addi, rl, al, bl); + tcg_out_opc_reg(s, opc_add, rl, al, al); } else { tcg_out_opc_reg(s, opc_add, rl, al, bl); tcg_out_opc_reg(s, OPC_SLTU, TCG_REG_TMP0,