From patchwork Mon Dec 19 02:16:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 635103 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2094383pvb; Sun, 18 Dec 2022 18:30:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyjEohKY5jhSjL5qQ54VucEDKILEW1D08+EazBQyIz3Qb7WWbRD1/DpxxRc3UDUPpTwrd+ X-Received: by 2002:ac8:1248:0:b0:3a9:8353:aeeb with SMTP id g8-20020ac81248000000b003a98353aeebmr6614746qtj.5.1671417001843; Sun, 18 Dec 2022 18:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671417001; cv=none; d=google.com; s=arc-20160816; b=gzC1mFXrKals93e4r1g64DEm2uAcYNxQxjdd+7VsQw/y/0bbH+L8XOsS2jT1Ixf/i1 C/SHp/mx/qnt2ZMUbqbP6FiiQ49X7g50UhA7FlbIlpjAkkUVoHanyM44aIV6zYKt3y0s cPmHXoeutwwwpr806dBCmItxZeE8w+jJ9s3/7nu4prW+rYLqK6uOK6dUrYPnOmzvYBGs lzHVybdPEgp6SD8gYFNlkR2kO9B0z2iPBFQPK54EVxc52JSeKmcADg0LBAJE/PYF1Kka beQeXgiX41DVg3Vp0fCvJXNPzbgYchEHGSbl6Q6NbMJsZ0yiFCNr4P2offrYNG/aggqQ s/+A== 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=tY4SXvhyRDBX7AYtaolf2JOjX8GH+DX2b7c7HyzzVyoU12Yi3VjOlAeHxQZNu+LCq4 YkAOZ2cMs8cLUL3XtIEpwGdb4I6IIArs619w4mDjlHW2uOzb21iImOZm3yyikkHMh8DR SjTW0uCfCUV9y7YpZR7a07haC23NduxUcvXH4ct4Wi+BW6JbHc7/+fOBqT4rPgPux/RE FUze3BcXtrps8BmJ9pT0c+WzlaxnlFRxu4gLyhyWaBLEMiEyGS/6V2cDpF8DnnhfA20f k7WiOux2ZMvf/6f8GYUjnaj/CAFQuqDXXik522Js3qS/qy0Lf+4bApMvcReS1arJT2mN M+6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=gKgk5P8c; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=hYcQMFqZ; 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 g19-20020a05620a40d300b006fec4c91e8fsi3619306qko.631.2022.12.18.18.30.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Dec 2022 18:30:01 -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=gKgk5P8c; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=hYcQMFqZ; 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 1p75ic-0008CL-DL; Sun, 18 Dec 2022 21:17:30 -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 1p75iZ-0008BW-Oz for qemu-devel@nongnu.org; Sun, 18 Dec 2022 21:17:28 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p75iY-00013c-5v for qemu-devel@nongnu.org; Sun, 18 Dec 2022 21:17:27 -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=1671416246; x=1702952246; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SPaspSsWq01oD2q07tmSbRBBdO5kaHAHyKb++qDpmvA=; b=gKgk5P8cujLoFicGG8Yml/TFUr5vYYdKLeZSy+qHYHOEy5+D11Ry0PUY WKOaverep5osuE7Sxf9Tdou6cKw5bM0LIwNoHvKWnPr9UBNkJx1cvx7rj 2af5/bnMgKMnStJFVcakm4us4dw2JrCzmPmjPNGW+5kwPjGm4BjpGqHMk fiNQgVW2fD1RFqNwPYMmHrihvFLki1YTGe8lMFaQeb3/Z+5DM3LQqcnh4 PNdim4gJnFGew9ohlI7uUiP2mHPkBdZhHzs+OpMhgLOTjjr2FpSOvj7ox JN+xuWjAYRCvti+/8GjlKZnVK5Duk6RvxMB+Fnr5mGZ4wm7WfcBdK1IOn Q==; X-IronPort-AV: E=Sophos;i="5.96,254,1665417600"; d="scan'208";a="217199285" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Dec 2022 10:17:25 +0800 IronPort-SDR: L+WRbhLXu0bUfvAlxc3tgHZC7RSJZYqx1wb82d7+X3/Xp7g0YzdyQQ2sjuR4iuOOW1fxpQ9OdJ NFw5eBXnTMKQG04SvjaqKw/JiONndsp+uKk5/y2LP0VKPP/A1CdeHanvINsFxgT4PdoyVU/qft jydY8jTGwZ/A3oyE/QojP7J+an/GYltsJHNEhFyMj0L5ShqSnErEJ9L1MELAbPSMp6/8v5NbAW vSW9YCHNK5DaCdZtxV+zn5YCAuzxjfvJ7Ae/KYO6uI1US/vdcP9K5qkx+02mPPONWcZMdtG+le X28= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Dec 2022 17:29:58 -0800 IronPort-SDR: bgaF0dua5T4TqfCWoLbsRGqoPPS4hVBgERE12y6bDxH0T/JNyljor4P7LaJHG2+swvh0vXE7SG xRZKQWGsmL7o5lsN7/LknY2g+06fHVam3zzlF/GhRsycpO9fAHzbBoRHHvYriL/yXh6/mEt1RM wkjZyFnuzmRTZz7EU1lavhxReQGB8S6fvgMZxTw040TxePHcMBDo3p31ZhoP0FF5Lgy6iWNTYS JDUUl6k8a+8+OS0oLVPTybVfxGSWVYN1M7h6eW9CWvVEPjZiD5s+zqyyKpCUdDiwyDMyKvrdKD t6c= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Dec 2022 18:17:25 -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 4Nb3J52TQvz1RwqL for ; Sun, 18 Dec 2022 18:17:25 -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=1671416244; x=1674008245; bh=SPaspSsWq01oD2q07t mSbRBBdO5kaHAHyKb++qDpmvA=; b=hYcQMFqZSZmJi7Q8ElNuLmEQ7WngmTMEiJ 2VR1A2MSV8yCHMykL8l7HuRQSeubtDlzKJknXlyCE/FJ4MRehM1Rrs3fewkL4oGS caPLl2anRUzEqtHbO0lFR4SlW+0lYMbpffcTJSRtFb341t5Z//JP2jBHX03mGcgK bXVGvSLbSMAoyjjFlZU1CvlyFGHmbkqSRQdOZDwlbo3N9ZZGUL1ZE6VF7v7VrL2l Tuf60i7lcy5duHFHaJoUrdVAF4mKZ05SmyPQihfDSapc3iF4nd1Q71c9EFbyDtFC Yb6y/cbadXNIjB8gw2j/201JzkMo7N+Y2nePqZHqdDEkmchmAd0A== 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 Cn0HROBpbPIw for ; Sun, 18 Dec 2022 18:17:24 -0800 (PST) Received: from toolbox.alistair23.me (unknown [10.225.167.4]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Nb3J31PW3z1Rwrq; Sun, 18 Dec 2022 18:17:22 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Richard Henderson , LIU Zhiwei , Alistair Francis Subject: [PULL 05/45] tcg/riscv: Fix reg overlap case in tcg_out_addsub2 Date: Mon, 19 Dec 2022 12:16:23 +1000 Message-Id: <20221219021703.20473-6-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221219021703.20473-1-alistair.francis@opensource.wdc.com> References: <20221219021703.20473-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.42; envelope-from=prvs=345d64987=alistair.francis@opensource.wdc.com; helo=esa4.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,