From nobody Tue Nov 26 09:20:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; arc=pass (i=1 dmarc=pass fromdomain=starfivetech.com) ARC-Seal: i=2; a=rsa-sha256; t=1708784586; cv=pass; d=zohomail.com; s=zohoarc; b=T9DaPiwb3of8rFN2yX7IHg/uS70ZQhJ6ryfA4Pk6fFpWv8/l8IJERjqp91CMCykWJ//mDM7Aeknr/TThPGkxK+E/3GrFYVGwyOP8ShXrebOdFgI3gxoTCHcKFEt7bOJfk1bUS9rb61N4wGDS5TSLDJhw2NRw2thv83dF/IM2b6Q= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708784586; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cWauh5qbR7+5H40NhmX90nMlGZMSJkHhCWDRtBrFsaQ=; b=c91Hmpn69oeD2K4pem0enwFAR6FuW0xHFT9QmmeRjzrLat9DYcWyjk17H1m2Vnb0JyfceJiVEJJqA+ygc2StVC+DQ6Y+n5y2JiV7dIPH6S4EwhME14UjV6Emle/IegsHPnfbhevh3IHTeGbEE/yYvE+ISXWZkJbXnapmjh5HPpY= ARC-Authentication-Results: i=2; mx.zohomail.com; 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; arc=pass (i=1 dmarc=pass fromdomain=starfivetech.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708784586353918.2680821759058; Sat, 24 Feb 2024 06:23:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsvU-0001O2-Pc; Sat, 24 Feb 2024 09:22:52 -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 1rdrgA-0002wY-6d; Sat, 24 Feb 2024 08:02:58 -0500 Received: from mail-sh0chn02on20711.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::711] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdrg8-0001VP-1w; Sat, 24 Feb 2024 08:02:57 -0500 Received: from ZQ0PR01MB1063.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:d::13) by ZQ0PR01MB1319.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:1c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.47; Sat, 24 Feb 2024 13:02:43 +0000 Received: from ZQ0PR01MB1063.CHNPR01.prod.partner.outlook.cn ([fe80::21d1:48e1:7ca0:1d76]) by ZQ0PR01MB1063.CHNPR01.prod.partner.outlook.cn ([fe80::21d1:48e1:7ca0:1d76%4]) with mapi id 15.20.7270.047; Sat, 24 Feb 2024 13:02:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uf6WtkmWpu9Ohem9XfTM1NhO/5Q5wz9OxY0rVk39prpNyXcSAx3ZjI8OoJIZo55KLGs8Z3/ttXjV/t65MiEiynnO5m2Mn3eadu3YYwMloDpSib6XfKCXyV/VUEQFtri4rkDFs6Jy0v13chGthxHpET32VFQQZFk5BcGIu14GE9F/TQJcaGhHGm7rObayoSm3HUIYz4+0IM/EOOuTZKaG0a5nJMrLutI5uugbqDDkWWHGOvcgFY1ZTw+5Nv2ttFlLTzm+ZH/LcWbdEyK/p1hSdAvYC2ZlRV22Epts+VydAg9vnOdAPV6LoxS2VcCFXac1yKdTJjCPByObSTGLoatd3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cWauh5qbR7+5H40NhmX90nMlGZMSJkHhCWDRtBrFsaQ=; b=HmKx9NkTm5qU2oKyXhcwSYVCD4VA3KXWIkm6oi6B6KUDetvFztwDU/PKBhSEm0IqQPqZP7DVd9I1V2nYjp4uuw+y8pxOGeuegZijvzinG5YNbWz2+q9q5nmyMlWO2NskY55W9PLZX/4gO+RmeDngtIXIF9z+BUHTztXYQPAo0mffWRACOySf3ArOKS4nB4U9zMmjdHo8IguH9vpFJRjYup+aoAOjcpZZ0cR4UDJ0Ra7Fg7ZQC9VwDzs5Dfni3qf70mZ5m4yk/452x9S2/vAd+9V8ZzEMInAAOeNfbkj4YsoYAyE/RZmBma2O6xpo/k85wMOastadBmag03FV6dR1hA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; From: "demin.han" To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, dbarboza@ventanamicro.com, alistair.francis@wdc.com Subject: [PATCH] target/riscv: Fix shift count overflow Date: Sat, 24 Feb 2024 21:02:35 +0800 Message-ID: <20240224130235.340584-1-demin.han@starfivetech.com> X-Mailer: git-send-email 2.43.2 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: NT0PR01CA0027.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:c::20) To ZQ0PR01MB1063.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZQ0PR01MB1063:EE_|ZQ0PR01MB1319:EE_ X-MS-Office365-Filtering-Correlation-Id: 13792232-4dff-4275-0093-08dc3538e393 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RFhmKHqpxBsnSEWqt/oPJwIL9231b+dYKGSlcneo0aiOM/qAYeTBVyfV+jOk6gAtY3Wbi+TuPzsvPDxJizaL2YFRawz3+aetCi8ShelRsfWKNF5JSv1uvyFKyNrx0ersQHm0q1qhEekkDzsaZWjwztf+rt+BsafUupao50k0h1JLLPAmsalb06dH21tdRkggckp34H02mNgC8ymbf7toq2X5VA+5Rf7kTt+Afa0yr7y/3rbpmasjlP9ZBXdESPpf2B34EXOqt/OaFrzRjyFbTrOQDQR+DG2eh+ITxLQalA9c3oNqagv7uQcF2RjHvzx1XIjAWRugVYCTbtz2el0C+SdmCBDTJrW7IJkoFK3hPWahoL+3yadE+Wvkkh8AyyE7vEc9ylNodvj7H3/XePkbPDRqf/IOjxp/e1MZiLBKLAbvTKfTZ9pIk87SzEkh6RtPN2JoQJP+Y6xqbCoQzqx8xodA/qCROerPZUA+ee1AztrxxN9yngPHSenZm4kqt8wT9osXHHE7QMllzHU8Aiqih3zCPY206O6n9bYcN2qJ6+lU70VwLaHFiQZqS6+goVYN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:ZQ0PR01MB1063.CHNPR01.prod.partner.outlook.cn; PTR:; CAT:NONE; SFS:(13230031)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yQL57qfIPNp7kp+8wfsKIlPlkJI0zn5jRWKvX+yS+VhZ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J49HSg/CNicbd7m3rYPoy6CGUZ/+wm9IxejmHsX8AhgC?= =?us-ascii?Q?LRKmooVVvJL/FxezTWJSTEG14zNUP3JT1YIZWkx5DdDkQwJFoFWMd+YQfg9/?= =?us-ascii?Q?7lOAVLtvAyD8mWUYcdO/m9RhXfXdS9J61iMn4/M7m/regdRu/KzzqFOthaX+?= =?us-ascii?Q?+OmzA6sFV4QVopZWVPRe/YN2yl45hnDlaAESd3BU724CuBkUnEkZO1wsH0h4?= =?us-ascii?Q?KbXJDi8WuxPkQha5jUA7VCeiqB41uS4bG4q0YhIFu1I0JHe32DU2Hyy4wwU6?= =?us-ascii?Q?jQXVL3KCr5tgLjQGkYIXb8huRTQk2C+v4yGbx0gcYwpC1VFMEJTmoK2n/WHZ?= =?us-ascii?Q?p5+DLwiQeUdKY96kdxM1Oxp6deF3g/ThDKEVkEpemSbldUqOLkXlE/NsD3qu?= =?us-ascii?Q?IDqiygZwJBcaxf2fbp+XU0tE8MQWNeqRpUbbDD8yOaJQ8nAVKBeZFfAzdLYd?= =?us-ascii?Q?UXqU6enAm84fWnw9jZ6KQh36TEyTCb0CI60bKaxbxd7MAjRUtdWihd0yFMEY?= =?us-ascii?Q?O/A08xDU/3o4oZu91xm14HgEFwYp0Zk49KGcyCB9bTudbRhwBmbrE0gHauvF?= =?us-ascii?Q?40cfHMPxQIZkD2U2q9spa8JwBX2+KAYfIOYmloqY5mSExeUwLMzBgYDKPkl8?= =?us-ascii?Q?S31dXZ50Z6QMEEc9EbZqNmpkqXRXUzvu7pZw09sHrlDC5a5qRcVAwivKVjP1?= =?us-ascii?Q?AQ=3D=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13792232-4dff-4275-0093-08dc3538e393 X-MS-Exchange-CrossTenant-AuthSource: ZQ0PR01MB1063.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2024 13:02:43.5363 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: D6EI5SbmX0bAdmoduyoME5NqCdijP0s8SQogQr2QTPmLuXhCOjhDuQPp1MCKvyRw71Mb927bqC4VceghIpG3TWXii1+cSou4sQ7j+LTmXGs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZQ0PR01MB1319 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=2406:e500:4420:2::711; envelope-from=demin.han@starfivetech.com; helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 24 Feb 2024 09:22:42 -0500 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1708784588504100001 Content-Type: text/plain; charset="utf-8" The result of (8 - 3 - vlmul) is negtive when vlmul >=3D 6, and results in wrong vill. Signed-off-by: demin.han --- target/riscv/vector_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 84cec73eb2..ced0aca633 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -53,10 +53,9 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_u= long s1, * VLEN * LMUL >=3D SEW * VLEN >> (8 - lmul) >=3D sew * (vlenb << 3) >> (8 - lmul) >=3D sew - * vlenb >> (8 - 3 - lmul) >=3D sew */ if (vlmul =3D=3D 4 || - cpu->cfg.vlenb >> (8 - 3 - vlmul) < sew) { + (cpu->cfg.vlenb << 3) >> (8 - vlmul) < sew) { vill =3D true; } } --=20 2.43.2