From nobody Tue May 21 00:06:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553230676976730.5115518752042; Thu, 21 Mar 2019 21:57:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:51865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7CFb-0002Zu-ML for importer@patchew.org; Fri, 22 Mar 2019 00:57:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7CED-0001VB-LX for qemu-devel@nongnu.org; Fri, 22 Mar 2019 00:56:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7C6k-00079n-Je for qemu-devel@nongnu.org; Fri, 22 Mar 2019 00:48:44 -0400 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]:42329) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h7C6k-000712-7P for qemu-devel@nongnu.org; Fri, 22 Mar 2019 00:48:42 -0400 Received: by mail-lf1-x142.google.com with SMTP id p1so451155lfk.9 for ; Thu, 21 Mar 2019 21:48:41 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net. (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id n2sm1398344lfe.71.2019.03.21.21.48.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Mar 2019 21:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=44PwBGRo+W54Suu4/KBhFeGxIPMz2gWj1jNRT+r1Fzg=; b=lxdbfHPGODJvHENg6oxwueOVefCA+0TIYk1Y/Exo0V6w/Ynp/ItU/5woFCKMjBKom8 zParGrZVcnMkGwWctzDsYFTnjeDpBGxOeIMQVP2QscSpVD/4rop9CshhFZq+6ZsBkx62 oDd5zPbn+2wJXaeRr05GGsatNnqi3b0Thl4GOwvI2E/2+VZ2RpjcsRSwy0I0s8FiQaNi YEOSmNOcM3lIcZJ2fB8UvYdsRPmAsQ1YOWjVEHdf6QxQwqJWR4r2sRfbdU0c2ti0K0S6 nRr3eEL+lujd7Uc1tDST66vvptPQWomjAbDpZHJpeLkfK00Fw4su57px8dWNIdqz+LMY Frbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=44PwBGRo+W54Suu4/KBhFeGxIPMz2gWj1jNRT+r1Fzg=; b=UgTdnYc4QlcwRuGPJQA5yHwnSw2sW/cLwKWrelr+QulA+60GJMQdZLzHlN7gBXZVwT ddzUA7t+UA5dqRu4P3hPte6GeTHIt4zeF+6ZS2A15u5JvWo8/WOH7PEIN1VdMChxAfGi 1HTfgP8dRg0OsXBY/vhBXtwsHnQOcaDzO8vOS0PCMaBoPynvST0ZNguJSm4K+snN2npa kE9vvzOEQJTszDLJ7UsBRZwvkhTSRypuPU5pNb4+aK3TgEBbx/3KnpSlvF/umEnNgZ8c BRMBRv/iDnuGffSFy4ilGSXWPZIYKISTxL/9Cd4TDvfNlapbhD37aHtS1uTdhVfbXwvt 4kbA== X-Gm-Message-State: APjAAAW3L0cxG7YZJPg0CoYw2NDRjQ9CjngG3GoLdsnNpbppI3QSyHsQ kwYuRuNdQGp5qyMadJPWRVJiwybk X-Google-Smtp-Source: APXvYqxga81MGGiz5O17PcgLoOFqLsyFGnlOUsArDSRd9g8NHAOKmtRXIIuJw2oB4sY7WEdCeg3UHA== X-Received: by 2002:a19:9145:: with SMTP id y5mr4213667lfj.35.1553230118516; Thu, 21 Mar 2019 21:48:38 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Thu, 21 Mar 2019 21:48:20 -0700 Message-Id: <20190322044820.27774-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::142 Subject: [Qemu-devel] [PATCH] target/xtensa: fix break_dependency for repeated resources X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" break_dependency incorrectly handles the case of dependency on an opcode that references the same register multiple times. E.g. the following instruction is translated incorrectly: { or a2, a3, a3 ; or a3, a2, a2 } This happens because resource indices of both dependency graph nodes are incremented, and a copy for the second instance of the same register in the ending node is not done. Only increment resource index of the ending node of the dependency. Add test. Signed-off-by: Max Filippov --- target/xtensa/translate.c | 1 - tests/tcg/xtensa/test_flix.S | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 77bc04d6b0f6..65561d2c4972 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1041,7 +1041,6 @@ static bool break_dependency(struct slot_prop *a, copy[n].resource =3D b->in[j].resource; copy[n].arg =3D b->arg + index; ++n; - ++i; ++j; rv =3D true; } diff --git a/tests/tcg/xtensa/test_flix.S b/tests/tcg/xtensa/test_flix.S index 7c259e701897..7af06b2b8882 100644 --- a/tests/tcg/xtensa/test_flix.S +++ b/tests/tcg/xtensa/test_flix.S @@ -55,6 +55,23 @@ test sum .previous test_end =20 +test rep_dependency + + { + movi a2, 1 + movi a3, 2 + nop + } + { + or a2, a3, a3 + or a3, a2, a2 + nop + } + assert eqi, a2, 2 + assert eqi, a3, 1 + +test_end + #endif =20 test_suite_end --=20 2.11.0