From patchwork Fri Jan 20 07:39:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 644621 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp646284pvb; Thu, 19 Jan 2023 23:47:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXsf2HInPljhLwR3Ovap0gb02tGSg97OcERGEC811JrvSXo2+G9xOo/pDDGNQa/r6sfhgmeq X-Received: by 2002:ad4:4983:0:b0:534:9c81:2c15 with SMTP id u3-20020ad44983000000b005349c812c15mr19435843qvx.3.1674200869802; Thu, 19 Jan 2023 23:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674200869; cv=none; d=google.com; s=arc-20160816; b=ITgLZOl3PqdH1SL2KicIo2k5HdpsLYvE9K5Zc23Duhq1UbFoEJWtsVQd4d3AXctUJt COs+guPf6GzLYj81Samfs5axyKi3dQ2+T6EfvCMAOsgo6bbUC3Ak838eCE/JvfoQcuMx 7mFakTpGAJutGxoGM9S8DtS1eLf+QflZd+KUD5Yc8YFQIYLMgm0hCyrtmlXxRfoSENfh CDGWha2CRdbdAtcSlBd/bGO39WWlaXrBVK0+87/QeZwVFKKGdQ2A22SQjDDAPfnQyYHI 9Fl218mWkuT2EdgkAcCBTATdBSs6aSQTUAGNvAvyv9Dmws07SiTaYE9SnDdDMpLZHzaa 2brw== 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=8PeYL7B3y7Yju7ziUrwhoeaF0RHocxel9X/S+xTtAtM=; b=i0PI/Rl5dfIHcchd4BAzHtSPRMauM/N4HDpJaPcfKJCHxUaF3Uim6flC9S+rH4A+Cd IboRuK7kc2fMMCWjyP6cVrQ7qQpwZCWgy67sumO9+YpO/nAZyXaDhAOt3h7LoKb61raV XxD4BHcVsfcWLvaZxAfS/OnnKUIjcC8k3IylTXY83guGx17fn46K21iL6x2Ww2NeuYaa GKP67kO6RqeRkBK8AZ6TjLNtpEjfDJtRTvPPuzqNuUfNG1NGo6s++BHT89ni2z7VTt+m wKsxYp3IKcOpJNP/mt1FVNl0hCThXHeM2Tja7B6wxzZJMRWwuwrdVHhejyTGW/lQJAhK M9KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=JJ2tzNai; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=UXoiUpzJ; 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 y23-20020a37f617000000b007067199e960si7917454qkj.643.2023.01.19.23.47.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 23:47:49 -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=JJ2tzNai; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=UXoiUpzJ; 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 1pIm1u-00036o-RG; Fri, 20 Jan 2023 02:41:42 -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 1pIm1h-0001zZ-42 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 02:41:29 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIm1f-0004qg-65 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 02:41:28 -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=1674200487; x=1705736487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cDRw4IBpTpo6zSRlPlUYTu4a56emOYbfmxDFaCQi4Bc=; b=JJ2tzNai6Ke/nRud3qSspDcIZbwY5eToGst3bgcfyFOVWspwa0WdnABs 142A/yUpQr1DGLSeL9iYzcBEKVrpusaBx54IfstNDx34uSHrD6rI8/VMY fEDQwVR7Ew2u05cJxGvTazBaqbjHm1TPl34Ti5AI0CAohabhyOe411Hu7 3KPnRutxZ7jRjDREmLYn54q/1uIk+5sj1SU0JFKZVBC5SoHWjR8w0u8cK yni43YGA3F9OHJ9kR4nZBZQgVpBE/759NSRp/kDpo5hu21XOELL4QQDd/ 75khiOLBFm84CXc8rPx4Vw5Q7j9SSrqensLFtHSdrulFCbKc0n6B/GOAz g==; X-IronPort-AV: E=Sophos;i="5.97,231,1669046400"; d="scan'208";a="221176766" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Jan 2023 15:40:31 +0800 IronPort-SDR: 19xCBPmQaoG7hsa08tjpoRStfhjrWSx3A7GQAJj3pFGg/nuD4GWyZ/jHZzD7b7KMjj3Yc5Mxw6 vWvF+yYJsoM+8MUNjd6zpviVm1GtaSvM4AG4KUIOwg34I1WMnP27xcMUblaTHUTOoicDUNqvZo y1Yk+KiKL5lW7luRY1MdpD2lMeKl8JhpiXbpLL5oShLR9EfLWzFQYEZO+zu3s85IUkgarPqZJf nHEKrjUrkmOZzhFQu+gNfnDtkvjkq9NjDIvRhzl8Flw7MUpVYmNP38G6gejAQ3iHQudXFF8ZzY UQw= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Jan 2023 22:58:09 -0800 IronPort-SDR: yWKQFK3FuTE/7eqISQ9116oqx8P+1oUCw0DgMwP3pS4HjQISo8WYR1MxCEQCJjn+5jsMJ8FWfQ IUKYKasxCTdJ8fTrc320PlLQ0HhkWTYnWitUEnQ4HlGuNNjs7Q0XO+S4NdqJA/jTTiw+FOprZZ /nEq4szuMwtJB+IiRozAe2uehLE5aCXoImabcDLI+WiKQAWrnPo+Zpwp+1LdBI+dEU/CuQYMup 6dHmbAhJgIHvyWBv0o2OqqaKcYLAUTwpSNaYQ5pmmftCXlXjCq8S0dNfO2miqhd4t3aEWgv9VY VSw= 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; 19 Jan 2023 23:40:31 -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 4Nyry71SQkz1RvLy for ; Thu, 19 Jan 2023 23:40:31 -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=1674200430; x=1676792431; bh=cDRw4IBpTpo6zSRlPl UYTu4a56emOYbfmxDFaCQi4Bc=; b=UXoiUpzJW5wFplIwVgec0bbuEEONVSFnYE K2sPyKc8m2qAbFv4lt7zinP37swnuWVxb9lLy5GKosic8JMGnYkZHsfjRYUhlrAj KC1jJFXUVWT05YAQw7GY/Cno86i2UNeRacdfv2APsfKhTtqLB8M5PPTw0kaFTQmC hWbAu3msPANJ6SjdLTmOLDQGEb+2wLSml2Ep+JbnaqUcUPYcIl09KnBJAGzZL+VM TXDXebMbuW9QHY5TfkftUvGe5GcM4uaZ/ZgON7226vqg5X1FfrEpRhBhBGM3L6ZB YS+TlRjiLdir8hC7ndpjPHhKoVHkU12w+jv9JJcWHZWAbJfsrQ1Q== 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 yyZYE4UyPuGW for ; Thu, 19 Jan 2023 23:40:30 -0800 (PST) Received: from toolbox.wdc.com (unknown [10.225.167.38]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Nyry55ZYzz1Rwrq; Thu, 19 Jan 2023 23:40:29 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Richard Henderson , Alistair Francis Subject: [PULL 34/37] tcg/riscv: Use tcg_pcrel_diff in tcg_out_ldst Date: Fri, 20 Jan 2023 17:39:10 +1000 Message-Id: <20230120073913.1028407-35-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120073913.1028407-1-alistair.francis@opensource.wdc.com> References: <20230120073913.1028407-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.144; envelope-from=prvs=37747d9ec=alistair.francis@opensource.wdc.com; helo=esa5.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 We failed to update this with the w^x split, so misses the fact that true pc-relative offsets are usually small. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Message-Id: <20230117230415.354239-1-richard.henderson@linaro.org> Signed-off-by: Alistair Francis --- tcg/riscv/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index fc0edd811f..01cb67ef7b 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -599,7 +599,7 @@ static void tcg_out_ldst(TCGContext *s, RISCVInsn opc, TCGReg data, intptr_t imm12 = sextreg(offset, 0, 12); if (offset != imm12) { - intptr_t diff = offset - (uintptr_t)s->code_ptr; + intptr_t diff = tcg_pcrel_diff(s, (void *)offset); if (addr == TCG_REG_ZERO && diff == (int32_t)diff) { imm12 = sextreg(diff, 0, 12); From patchwork Fri Jan 20 07:39:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 644619 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp645414pvb; Thu, 19 Jan 2023 23:44:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXv/m8YCDh/x95VGTltlLTFP9QiEq3Un9kX3k4ku5ZfWzdBtbh2jQdHQqmcXodqTsjutX1Ce X-Received: by 2002:a05:6214:2f06:b0:531:557a:63c4 with SMTP id od6-20020a0562142f0600b00531557a63c4mr24384684qvb.39.1674200684822; Thu, 19 Jan 2023 23:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674200684; cv=none; d=google.com; s=arc-20160816; b=QOJNlg/deLxS156D31C7KSTrPukCmPzhiuyqblej8dZ1TTfRSqNosLqm3KYwoL7Xqn Fa4fj50WiSYr15r79DkD5QCX5ZW0eXXzQGIpUnEFrwT6Vwy2qJ4ljPCVPZbnSdF0eNxJ yDlSLgYl7Y0wnEn1AYi2L2kSg5CiufEtIB47x11NiEhtOLyeJP/xMkOXK9m2QGjzZ+4a 2RDs+yS7YLFuGw+rV94Mvs7SvmlhGL6Dyp/ZnImWyhU0OiYZPsIqnK1SVuGLuneLyL13 hIr5/BUl7AnpKtUnKgze+VRfeIeLgaU3IQHpw/AYhSawuUDHWFoDnTD1j9ZEFtDrjupQ y8qw== 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=vmxqb8bnwzvQPsjq+04DRY9vXm3b4sKkycfg8++1Ohs=; b=hBElXy0Nznb2iq0o8yPJaf0InfJHRzgiLbeLAKEMg7nDR/ETuFTFKqkNwcFNXPRVoS kkNr3NgDkugjb5MO40AnYlsnpQfqZrvn67EhQvY7Ua88qXUFzjf83MW5ojeOwR4QCAlO e2dJRl0Hp75x2e0pmyc+SfJMKKisxDwXKNFXgorBIg9kf/PS0qF64SOffLF7j+wRFiQh pjwlyICkJMZ8PNRcChIVRnbpRb3jFzhMlTHZIKV7xBR+53kT1jktXl/IGv6a07wjBLuE ArAWiUhx63Tw1qytYcWbQVNUyBrBi4nJLVkoUh/n7uGnGGMC11uzTbbXFHsCw2vAdkpX tPMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=HAHlibSf; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=Oe1tXcYK; 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 l24-20020a37f918000000b007067470045csi2723175qkj.21.2023.01.19.23.44.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 23:44:44 -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=HAHlibSf; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=Oe1tXcYK; 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 1pIm1w-0003FW-8U; Fri, 20 Jan 2023 02:41:44 -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 1pIm1r-0002xc-PZ for qemu-devel@nongnu.org; Fri, 20 Jan 2023 02:41:40 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIm1n-0004pU-WB for qemu-devel@nongnu.org; Fri, 20 Jan 2023 02:41:37 -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=1674200495; x=1705736495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q7SUXXHsk115w6NotA000eLTiwAW407mCxAvfoZAmt8=; b=HAHlibSfWvPN1Dhef7ZxN5qVSQ8TIfBLJj9nXaRKU9G4X8rx/lo93iUk Ktv+VnSFGHyEBH5U/WlzNQqOrSl10MuHbVKi4sNz01fP2OZ6ETdzA8aJH /jYk4mER4qaH1c7uQ92aZiPBWhGv8fnUL1eWnlwvf5wy/nDlDsOsxP0Zi zlAT/GCvuyZF61cDT9WyqiweMyHFL773NffdFARJH0V3YOkz8gSTO7AyJ lTzsQajrNru8loCf5eyc5P9UIvkSbs+OmxOYVLIr7PiZmdwSRqZKvW8xg V7uRk05F3L80sLvLhn79ikArUXo6t+JseRN4rz/hruwIfGH7/6atbZiQ/ Q==; X-IronPort-AV: E=Sophos;i="5.97,231,1669046400"; d="scan'208";a="221176769" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Jan 2023 15:40:34 +0800 IronPort-SDR: i7WrkKmj13Yw60Gzbje4nqTFKFcJl5h2iNnHoxbL8Cp/dr+qdoI48g8+bBMaWeHgJhfiZ/+Q/q ufsZLYbgteo9g6/WQnTzVUG6uZZEpzxn5KkU9dNiva0SXmY4d1TVzd0hOtA5drjkAC+s9jG2jI YY6EdjO4rDfaOvYxdjyR5S02h7z34JxH8iBp2zQ7ya2xOR/O5Ytu4ggkS2ydWGaOpU8C1gzyWQ DRylqrff5xpydcKTStqyXqtPWdpF6KpscV3j8FNMajrVFBfy2Cu51IkMi1Thvn0drNS1fPgRjR Za0= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Jan 2023 22:58:12 -0800 IronPort-SDR: Xu68GPZIHi61sFc9m5oV8ACgE4yJh6Q/qQ5/CQBXOC2n/cxgcEAz24aYvu+1MZZghgeVRRLlNO KNQiI/ht/CkkNL7jBChwiuZ0Ath/pnpVeZut2V0YExL2/rrZl7t39RfwGnhy1fiSMqIumgRj/r QaS8Jqra7Spy7zoBJks1Q5Fi/Ok6pQi3+QlHGONS/LM4EF0VBYJZT/IMt37f+57hq3Fj7KIrib Xj2yFqn4b2vhSPJBV3g5VOX0Dfo1rfgzvOzSMh+kid0I68++pEx1r3uUU7RSIZBtkbWGfCQeTM 5nY= 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; 19 Jan 2023 23:40:34 -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 4NyryB0Bjkz1RwqL for ; Thu, 19 Jan 2023 23:40:34 -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=1674200433; x=1676792434; bh=Q7SUXXHsk115w6NotA 000eLTiwAW407mCxAvfoZAmt8=; b=Oe1tXcYKgYLITM3MBsN2SaNwZQ1wKllxar EoC7t2Opdz2bzhp0lxXcZtl3PqU9sAGgUkkHZ9NkQu4f+26UpxazycIGLxSdN55a CL4UWfvXkS0zsS8Tb5sRK7K9bqrA5XNQzQocYP1XdEJBEU4hkE2HIlrJRwjJrMbX A9HocHE5DQJN+wPuTOXv5tD46YqDFFESU9ra2ju9LiTZaZ6Pvih3hAyQpNApHQVW nVrVrS1ZKKKWYHhjhQWYs40o0VFb/H+Xe295fargS+f7qE3vELBMDvdIWJpobgGN yUYccDkg7TxWmk/auwGIxUvU/floZN1Kmuepxo/tO+PD+F6pG+kg== 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 adnr-s40hkFG for ; Thu, 19 Jan 2023 23:40:33 -0800 (PST) Received: from toolbox.wdc.com (unknown [10.225.167.38]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Nyry72Wkhz1Rwrq; Thu, 19 Jan 2023 23:40:31 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Richard Henderson , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 35/37] target/riscv: Introduce helper_set_rounding_mode_chkfrm Date: Fri, 20 Jan 2023 17:39:11 +1000 Message-Id: <20230120073913.1028407-36-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120073913.1028407-1-alistair.francis@opensource.wdc.com> References: <20230120073913.1028407-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.144; envelope-from=prvs=37747d9ec=alistair.francis@opensource.wdc.com; helo=esa5.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 The new helper always validates the contents of FRM, even if the new rounding mode is not DYN. This is required by the vector unit. Track whether we've validated FRM separately from whether we've updated fp_status with a given rounding mode, so that we can elide calls correctly. This partially reverts d6c4d3f2a69 which attempted the to do the same thing, but with two calls to gen_set_rm(), which is both inefficient and tickles an assertion in decode_save_opc. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1441 Signed-off-by: Richard Henderson Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis Message-Id: <20230115160657.3169274-2-richard.henderson@linaro.org> Signed-off-by: Alistair Francis --- target/riscv/helper.h | 1 + target/riscv/fpu_helper.c | 37 +++++++++++++++++++++++++ target/riscv/translate.c | 19 +++++++++++++ target/riscv/insn_trans/trans_rvv.c.inc | 24 +++------------- 4 files changed, 61 insertions(+), 20 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index 227c7122ef..9792ab5086 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -3,6 +3,7 @@ DEF_HELPER_2(raise_exception, noreturn, env, i32) /* Floating Point - rounding mode */ DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(set_rounding_mode_chkfrm, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_1(set_rod_rounding_mode, TCG_CALL_NO_WG, void, env) /* Floating Point - fused */ diff --git a/target/riscv/fpu_helper.c b/target/riscv/fpu_helper.c index 5699c9517f..96817df8ef 100644 --- a/target/riscv/fpu_helper.c +++ b/target/riscv/fpu_helper.c @@ -81,6 +81,43 @@ void helper_set_rounding_mode(CPURISCVState *env, uint32_t rm) set_float_rounding_mode(softrm, &env->fp_status); } +void helper_set_rounding_mode_chkfrm(CPURISCVState *env, uint32_t rm) +{ + int softrm; + + /* Always validate frm, even if rm != DYN. */ + if (unlikely(env->frm >= 5)) { + riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); + } + if (rm == RISCV_FRM_DYN) { + rm = env->frm; + } + switch (rm) { + case RISCV_FRM_RNE: + softrm = float_round_nearest_even; + break; + case RISCV_FRM_RTZ: + softrm = float_round_to_zero; + break; + case RISCV_FRM_RDN: + softrm = float_round_down; + break; + case RISCV_FRM_RUP: + softrm = float_round_up; + break; + case RISCV_FRM_RMM: + softrm = float_round_ties_away; + break; + case RISCV_FRM_ROD: + softrm = float_round_to_odd; + break; + default: + g_assert_not_reached(); + } + + set_float_rounding_mode(softrm, &env->fp_status); +} + void helper_set_rod_rounding_mode(CPURISCVState *env) { set_float_rounding_mode(float_round_to_odd, &env->fp_status); diff --git a/target/riscv/translate.c b/target/riscv/translate.c index df38db7553..493c3815e1 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -114,6 +114,8 @@ typedef struct DisasContext { bool pm_base_enabled; /* Use icount trigger for native debug */ bool itrigger; + /* FRM is known to contain a valid value. */ + bool frm_valid; /* TCG of the current insn_start */ TCGOp *insn_start; } DisasContext; @@ -674,12 +676,29 @@ static void gen_set_rm(DisasContext *ctx, int rm) gen_helper_set_rod_rounding_mode(cpu_env); return; } + if (rm == RISCV_FRM_DYN) { + /* The helper will return only if frm valid. */ + ctx->frm_valid = true; + } /* The helper may raise ILLEGAL_INSN -- record binv for unwind. */ decode_save_opc(ctx); gen_helper_set_rounding_mode(cpu_env, tcg_constant_i32(rm)); } +static void gen_set_rm_chkfrm(DisasContext *ctx, int rm) +{ + if (ctx->frm == rm && ctx->frm_valid) { + return; + } + ctx->frm = rm; + ctx->frm_valid = true; + + /* The helper may raise ILLEGAL_INSN -- record binv for unwind. */ + decode_save_opc(ctx); + gen_helper_set_rounding_mode_chkfrm(cpu_env, tcg_constant_i32(rm)); +} + static int ex_plus_1(DisasContext *ctx, int nf) { return nf + 1; diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc index d455acedbf..bbb5c3a7b5 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -2679,13 +2679,9 @@ static bool do_opfv(DisasContext *s, arg_rmr *a, int rm) { if (checkfn(s, a)) { - if (rm != RISCV_FRM_DYN) { - gen_set_rm(s, RISCV_FRM_DYN); - } - uint32_t data = 0; TCGLabel *over = gen_new_label(); - gen_set_rm(s, rm); + gen_set_rm_chkfrm(s, rm); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); @@ -2882,17 +2878,13 @@ static bool opffv_widen_check(DisasContext *s, arg_rmr *a) static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ { \ if (CHECK(s, a)) { \ - if (FRM != RISCV_FRM_DYN) { \ - gen_set_rm(s, RISCV_FRM_DYN); \ - } \ - \ uint32_t data = 0; \ static gen_helper_gvec_3_ptr * const fns[2] = { \ gen_helper_##HELPER##_h, \ gen_helper_##HELPER##_w, \ }; \ TCGLabel *over = gen_new_label(); \ - gen_set_rm(s, FRM); \ + gen_set_rm_chkfrm(s, FRM); \ tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \ \ @@ -3005,17 +2997,13 @@ static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ { \ if (CHECK(s, a)) { \ - if (FRM != RISCV_FRM_DYN) { \ - gen_set_rm(s, RISCV_FRM_DYN); \ - } \ - \ uint32_t data = 0; \ static gen_helper_gvec_3_ptr * const fns[2] = { \ gen_helper_##HELPER##_h, \ gen_helper_##HELPER##_w, \ }; \ TCGLabel *over = gen_new_label(); \ - gen_set_rm(s, FRM); \ + gen_set_rm_chkfrm(s, FRM); \ tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \ \ @@ -3060,10 +3048,6 @@ static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ { \ if (opxfv_narrow_check(s, a)) { \ - if (FRM != RISCV_FRM_DYN) { \ - gen_set_rm(s, RISCV_FRM_DYN); \ - } \ - \ uint32_t data = 0; \ static gen_helper_gvec_3_ptr * const fns[3] = { \ gen_helper_##HELPER##_b, \ @@ -3071,7 +3055,7 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ gen_helper_##HELPER##_w, \ }; \ TCGLabel *over = gen_new_label(); \ - gen_set_rm(s, FRM); \ + gen_set_rm_chkfrm(s, FRM); \ tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \ \ From patchwork Fri Jan 20 07:39:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 644620 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp646101pvb; Thu, 19 Jan 2023 23:47:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXunOipV8fd4lTkRKGX2Se+B/M6/AovQnC6oc+FXDj8nbpAyyqKtZ1PZMNIxhKEfFRGeZ5an X-Received: by 2002:ac8:524f:0:b0:3b6:2e12:4d25 with SMTP id y15-20020ac8524f000000b003b62e124d25mr26642292qtn.31.1674200824712; Thu, 19 Jan 2023 23:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674200824; cv=none; d=google.com; s=arc-20160816; b=mYZBBFA0gopurMdmXFEhfNhEuWBaI/MRU0lYSm+0RgI5URkka7wTd3YX6f/BLaNdDA FfUSD2cR9D2NR/GgTR3ZAox/Yk+ocA8Xr5Lx4q1oNZK6xvBUM7AOEMAcN0fTs8KCRp83 Mjrl7gC2Rhxw0pzciSMkNKxEcuB99xSBX6vuUvgrkEwEBbk6thGCnz4oWUq1aLs+wCf3 qRz6L5+l8snYA7KTRhhnYGCjHkd6ZXBBaM2ffwYx7bHROlD9nhh03/y75S9aj6C0Ntib 6t2dgCaHWfOHDXEiK5OEU/JhhmJNF8+6ivayogEn28XhndGfP9hBN90DP6k9YFJtd/Ef svng== 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=5gAy0x5fYlZtFQn16koQNGoYMJRve1HhQjFsiRsEvwk=; b=yEi3xObx0AIX2r9fjvIdSCfggM8ECnYNaiVbTBBvoNzXchIFFHwB6r/DKOFqMgCT9f pbj4kahsi7oAVv2omCgFNxZ8Njbva0MNVZjqVT/GmnuQiGdJcoeszw0/x44hgXXUX+RM ghXQJmrbTbiwswgMqbQRW/XX6pFf4L4+X+ZTFguB1zlZjju2SWYGQcb2S3yx20ArqbuA QjOlas3qSEBBxYNPPWXVvPjrIkNmlC6uanoH0N1A9ZaT1UtcrISxOI++PCVVAOB7KrC1 qqXVZKR4WnG0YMAdxj2e2LYDgjHIUt4hmBs2Kodz7LvlzXt28UFB7S/7LPdgbWlLXbh0 Ygzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=V+Zgg8wk; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b="Ox2/4sAl"; 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 f22-20020a05620a409600b00706ab5a015bsi7209626qko.344.2023.01.19.23.47.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 23:47:04 -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=V+Zgg8wk; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b="Ox2/4sAl"; 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 1pIm1y-0003RX-A2; Fri, 20 Jan 2023 02:41:46 -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 1pIm1t-00032w-TF for qemu-devel@nongnu.org; Fri, 20 Jan 2023 02:41:42 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIm1q-0004pk-D2 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 02:41:41 -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=1674200498; x=1705736498; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V1q2bPXNx5watuA0eVCbXFLIyzs7v/eKbDfzC1VncD8=; b=V+Zgg8wkJK4mWrgWFjCSDIFiwMI/+T0k85eAQR1Vl+ykzJ5vs4ueDG3r 0wIaNU606L6jUWCUc9LNKMCIt8xAY5skSnh3MUEoBD1YsajDz0lQbu9io WZ/OKNSqlyCTw3L0jd3ral8h5MEeqf27u+SQzenFpt8FYhPZvqiLDYs5h wYDdYSPBJlFkIIuQ9AyMO0LXI9gzCc6r/S4NMc1HDdmie5khe2hlBVt4r LY8e5vlAcQ1Cl+4P+kRKE//HfFEpbTF3oDKDoUOgXI6yC2WjZ6P5QijMI +tlC+pNHCyMuUS9R3qzvRhwODfnAi7T+NtBxdjSoSdEw2MpknmnVfZfaY A==; X-IronPort-AV: E=Sophos;i="5.97,231,1669046400"; d="scan'208";a="221176774" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Jan 2023 15:40:35 +0800 IronPort-SDR: roJn0FhaqZ2SKFjvJ3cW/4M7iM9oRhNXeZtbmAo7hmGjkOq+KLejyGHenaMFQdUOorfrFci20T A0S4bsCUyH2sNMFM23HTxnolNmCGRhDkm5JkXu9GDdqj6UHbJ1bNvLXzo/xSd1wCsV7hEOOulP KMyn3jQ4cMcynW6GbhTdTNcxILUVCG4ck1iFSCgIt1zzyaelb9TVQqD/jZZxkLJgHkK336JT51 ludiYAQ2eUhJ5bhdo8BviXcG5oYp99AKxSUH5ajB4bJoJ8k223tX+Dwg8tV0AtXFPeiw2udL6q zp0= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Jan 2023 22:58:13 -0800 IronPort-SDR: yVDCo1Y9NfM2CTfFzdclPbFZR/YkmuYElWP+Q82ZkV6ihLEl6kQ8lY8duauV1HxrvwLl89RtBz qZurbk/7u9LS8AOplGvde8UQsiveSk4U+zuxTirSQJb8rOrJZ4OuI9BjCWlpjG+wJ/nHVsUA4n G1tZzo6M2c3Pg7A9KHv0OqUyZWMtMKQbO+bXGnpU8wvMtiyRBmWJ0VcpEklOXhq2gFqcbS3PB4 7FZcjSsI1ZPtvhCux2XavJmoxcQqBPcHPch4BolQUBWqfk5DMnWYW1q2BO9HbbcduY/iPbGgcS Y90= 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; 19 Jan 2023 23:40:35 -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 4NyryC2xVHz1RvTr for ; Thu, 19 Jan 2023 23:40:35 -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=1674200434; x=1676792435; bh=V1q2bPXNx5watuA0eV CbXFLIyzs7v/eKbDfzC1VncD8=; b=Ox2/4sAlLf3p1rUZCrP06r2Cy+sZcPzeLz ziF9aufQHza4aVuXvs2vvq/5Jrd6bGpHUVnTafPhGBWm5E8hAAG/JakYneDJC3gG l9q6N1axDl+pyZ3ty9706dvX4a33TxBwYWYnTZP10Kq+QU6b4yXQHUxOh3zFDSa5 c745FZ4P39Z6QRKNtelIpOSwQrZk1iVd8y5OVfN2vsP68tvesAAVdZ1tsOKQ2dtl uHNAiyHf/YHJKxRnjmuXvdWA49uxtFmT3ItShkiFKSQSiGP51yh+3Cq1cW0Rrflb qzftt1yAb/cTpvnIgNE44aAVZho2FKzZTGyOiNHpIvPu9Z4NUK/g== 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 WUwlz7TzvutL for ; Thu, 19 Jan 2023 23:40:34 -0800 (PST) Received: from toolbox.wdc.com (unknown [10.225.167.38]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Nyry94Jmkz1RvLy; Thu, 19 Jan 2023 23:40:33 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Richard Henderson , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 36/37] target/riscv: Remove helper_set_rod_rounding_mode Date: Fri, 20 Jan 2023 17:39:12 +1000 Message-Id: <20230120073913.1028407-37-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120073913.1028407-1-alistair.francis@opensource.wdc.com> References: <20230120073913.1028407-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.144; envelope-from=prvs=37747d9ec=alistair.francis@opensource.wdc.com; helo=esa5.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 The only setting of RISCV_FRM_ROD is from the vector unit, and now handled by helper_set_rounding_mode_chkfrm. This helper is now unused. Signed-off-by: Richard Henderson Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-Id: <20230115160657.3169274-3-richard.henderson@linaro.org> Signed-off-by: Alistair Francis --- target/riscv/helper.h | 1 - target/riscv/fpu_helper.c | 5 ----- target/riscv/translate.c | 4 ---- 3 files changed, 10 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index 9792ab5086..58a30f03d6 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -4,7 +4,6 @@ DEF_HELPER_2(raise_exception, noreturn, env, i32) /* Floating Point - rounding mode */ DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_2(set_rounding_mode_chkfrm, TCG_CALL_NO_WG, void, env, i32) -DEF_HELPER_FLAGS_1(set_rod_rounding_mode, TCG_CALL_NO_WG, void, env) /* Floating Point - fused */ DEF_HELPER_FLAGS_4(fmadd_s, TCG_CALL_NO_RWG, i64, env, i64, i64, i64) diff --git a/target/riscv/fpu_helper.c b/target/riscv/fpu_helper.c index 96817df8ef..449d236df6 100644 --- a/target/riscv/fpu_helper.c +++ b/target/riscv/fpu_helper.c @@ -118,11 +118,6 @@ void helper_set_rounding_mode_chkfrm(CPURISCVState *env, uint32_t rm) set_float_rounding_mode(softrm, &env->fp_status); } -void helper_set_rod_rounding_mode(CPURISCVState *env) -{ - set_float_rounding_mode(float_round_to_odd, &env->fp_status); -} - static uint64_t do_fmadd_h(CPURISCVState *env, uint64_t rs1, uint64_t rs2, uint64_t rs3, int flags) { diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 493c3815e1..01cc30a365 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -672,10 +672,6 @@ static void gen_set_rm(DisasContext *ctx, int rm) } ctx->frm = rm; - if (rm == RISCV_FRM_ROD) { - gen_helper_set_rod_rounding_mode(cpu_env); - return; - } if (rm == RISCV_FRM_DYN) { /* The helper will return only if frm valid. */ ctx->frm_valid = true;