From nobody Tue May 21 02:39:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1614950954; cv=none; d=zohomail.com; s=zohoarc; b=hdKbJ5TDw9ja1r49/eD3ILVy9xaBVwdTD6Gz1JfehsTdyrijtBxx+Z44r6WgChtgerkw4C2BTsuPQa2mMHfY/9IJJnKBcyJBaqPRa1Imf0y3GUqpWefpc/eYTWovhlmmPTSoPM1oTRKyJcyQYwZe7q+tQL+WI6l8tUAxBOrHMqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614950954; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xIFPhIVz/cMZpDsN9NS/mjyoEH3gC8Wbe+EYFEcfWC0=; b=S9QOjno31FYX5YKwscriZcowTO5t3pcRKViIV4jT5AA5Vph57QYBpZoti1560mv9bzvG2z8z3esuyDqLmOXl0QfmN408R+Fj4nE76g7tMDgV2XYDUreehli1SHE69X7TygVrmhEaxM7Ig2e5nxNO3cRmnpi/mNSz3BY7LCNCZ5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1614950954332940.3366625826351; Fri, 5 Mar 2021 05:29:14 -0800 (PST) Received: from localhost ([::1]:44206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIAW0-0003po-DV for importer@patchew.org; Fri, 05 Mar 2021 08:29:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIATv-0002ZO-Jy for qemu-devel@nongnu.org; Fri, 05 Mar 2021 08:27:03 -0500 Received: from hoth.uni-paderborn.de ([2001:638:502:c003::19]:52260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIATs-00023D-09 for qemu-devel@nongnu.org; Fri, 05 Mar 2021 08:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xIFPhIVz/cMZpDsN9NS/mjyoEH3gC8Wbe+EYFEcfWC0=; b=Gn6BO2M05yNvuNlrX6KeKZAZ3B GavfT38y7sqCSI91SZShLY9uAf0MLun3ZhswelB8WJU5sIBv8CglZ07E0g0xjFYFmGYpscAbjJNH3 XLRyYOzNlJz89GliVIBmm+oEnGZp0YAAAexrQyVm6zUkvmDbxXTtvjy0+MITO4DYcxMM=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PATCH 1/2] target/tricore: Fix imask OPC2_32_RRPW_IMASK for r3+1 == r2 Date: Fri, 5 Mar 2021 14:26:28 +0100 Message-Id: <20210305132629.755627-2-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305132629.755627-1-kbastian@mail.uni-paderborn.de> References: <20210305132629.755627-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.5.131818, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=30588200, da=102559881, mc=522, sc=4, hc=518, sp=0, fso=30588200, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2001:638:502:c003::19; envelope-from=kbastian@mail.uni-paderborn.de; helo=hoth.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kbastian@mail.uni-paderborn.de, david.brenken@efs-auto.de, georg.hofstetter@efs-auto.de, andreas.konopik@efs-auto.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" if r3+1 and r2 are the same then we would overwrite r2 with our first move and use the wrong result for the shift. Thus we store the result from the mov in a temp. Signed-off-by: Bastian Koppelmann Reviewed-by: Richard Henderson --- target/tricore/translate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index ebeddf8f4a..67a7f646a2 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -6989,6 +6989,7 @@ static void decode_rrpw_extract_insert(DisasContext *= ctx) uint32_t op2; int r1, r2, r3; int32_t pos, width; + TCGv temp; =20 op2 =3D MASK_OP_RRPW_OP2(ctx->opcode); r1 =3D MASK_OP_RRPW_S1(ctx->opcode); @@ -7021,10 +7022,15 @@ static void decode_rrpw_extract_insert(DisasContext= *ctx) break; case OPC2_32_RRPW_IMASK: CHECK_REG_PAIR(r3); + temp =3D tcg_temp_new(); + if (pos + width <=3D 32) { - tcg_gen_movi_tl(cpu_gpr_d[r3+1], ((1u << width) - 1) << pos); + tcg_gen_movi_tl(temp, ((1u << width) - 1) << pos); tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r2], pos); + tcg_gen_mov_tl(cpu_gpr_d[r3+1], temp); } + + tcg_temp_free(temp); break; case OPC2_32_RRPW_INSERT: if (pos + width <=3D 32) { --=20 2.30.1 From nobody Tue May 21 02:39:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1614950954; cv=none; d=zohomail.com; s=zohoarc; b=dXmFVETx0cDZYbhnnXVV87hTP7nhtYJE7V+maWmq7Pn7F3AHAI3rN8U3reiZOxmxyk3V9KkmH6OEcbLDDVkQ1/8QkjFvDLMfQJgye/pLSlntd5X07QY+lM7S+xNi3k7lcRM+0wj+bFYqaWzBFDvDeD4qB/Ry1VAgtZC8akMOOFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614950954; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yIAXfwirLoiYvOspHSlsnTP6N7PsbWc5bt46yW0Tvig=; b=G9MDv4c26NSd57YXzcs/hzm1TnRHEDQBrt3Zy9zZt92QJeEOAJfc0I2XT9eu8Wmt5dvHBp07UV/x51mhlnnZghrwxnsLrfEVBvtsUihGIm9pbcPgQbWAcIWtI8ueDCltfeN7oXqHnGLyCV3pmaCp8/t3+5rf9dcBX4rtpu8yjtI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1614950954669510.82026676339376; Fri, 5 Mar 2021 05:29:14 -0800 (PST) Received: from localhost ([::1]:44402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIAW1-0003uN-Kj for importer@patchew.org; Fri, 05 Mar 2021 08:29:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIATx-0002Zu-RC for qemu-devel@nongnu.org; Fri, 05 Mar 2021 08:27:05 -0500 Received: from collins.uni-paderborn.de ([2001:638:502:c003::14]:50386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIATt-00024Y-Vb for qemu-devel@nongnu.org; Fri, 05 Mar 2021 08:27:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yIAXfwirLoiYvOspHSlsnTP6N7PsbWc5bt46yW0Tvig=; b=TOSJYfpQKHwRLqjQsOj2X9ccwN ffRsBuqtJTSUVKgmet6hWM6sTWyrI+8vrLfz1ZpPBy2bngIqAPAq36Q7hW/JiOUeo+4/STyn1bnEN bTqInGwu75Qcvvy4kJiEjj+NxKRpJ0zj+GAKnaoVgLZ3+KLyC0BykeiSJS7Uh8m77xCk=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PATCH 2/2] target/tricore: Fix OPC2_32_RRPW_EXTR for width=0 Date: Fri, 5 Mar 2021 14:26:29 +0100 Message-Id: <20210305132629.755627-3-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305132629.755627-1-kbastian@mail.uni-paderborn.de> References: <20210305132629.755627-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.5.131517, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=30588201, da=102559882, mc=524, sc=4, hc=520, sp=0, fso=30588201, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2001:638:502:c003::14; envelope-from=kbastian@mail.uni-paderborn.de; helo=collins.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kbastian@mail.uni-paderborn.de, david.brenken@efs-auto.de, georg.hofstetter@efs-auto.de, andreas.konopik@efs-auto.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" if width was 0 we would run into the assertion: qemu-system-tricore: ../upstream/tcg/tcg-op.c:217: tcg_gen_sari_i32: Assert= ion `arg2 >=3D 0 && arg2 < 32' failed.o The instruction manuel specifies undefined behaviour for this case. So we bring this in line with the golden Infineon simlator 'tsim', which simply writes 0 to the result in case of width=3D0. Signed-off-by: Bastian Koppelmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/tricore/translate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 67a7f646a2..d8b773ab37 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -6998,10 +6998,16 @@ static void decode_rrpw_extract_insert(DisasContext= *ctx) pos =3D MASK_OP_RRPW_POS(ctx->opcode); width =3D MASK_OP_RRPW_WIDTH(ctx->opcode); =20 + switch (op2) { case OPC2_32_RRPW_EXTR: + if (width =3D=3D 0) { + tcg_gen_movi_tl(cpu_gpr_d[r3], 0); + break; + } + if (pos + width <=3D 32) { - /* optimize special cases */ + /* optimize special cases */ if ((pos =3D=3D 0) && (width =3D=3D 8)) { tcg_gen_ext8s_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); } else if ((pos =3D=3D 0) && (width =3D=3D 16)) { --=20 2.30.1