Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jqQRi-0004Nf-3F for mharc-qemu-riscv@gnu.org; Tue, 30 Jun 2020 20:17:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqQRf-0004Mo-9z; Tue, 30 Jun 2020 20:17:47 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:44608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqQRc-0003re-GV; Tue, 30 Jun 2020 20:17:47 -0400 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.1038864|-1; CH=green; DM=|CONTINUE|false|; DS=CONTINUE|ham_regular_dialog|0.0204555-0.0355056-0.944039; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03294; MF=zhiwei_liu@c-sky.com; NM=1; PH=DS; RN=6; RT=6; SR=0; TI=SMTPD_---.HvSiHYq_1593562652; Received: from 30.225.208.18(mailfrom:zhiwei_liu@c-sky.com fp:SMTPD_---.HvSiHYq_1593562652) by smtp.aliyun-inc.com(10.147.40.26); Wed, 01 Jul 2020 08:17:33 +0800 Subject: Re: [PATCH v1 3/3] target/riscv: Regen floating point rounding mode in dynamic mode To: Richard Henderson , Alistair Francis , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: alistair23@gmail.com, palmer@dabbelt.com References: From: LIU Zhiwei Message-ID: Date: Wed, 1 Jul 2020 08:17:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: none client-ip=121.197.200.217; envelope-from=zhiwei_liu@c-sky.com; helo=smtp2200-217.mail.aliyun.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 20:17:36 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] 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_NONE=0.001, SPF_NONE=0.001, UNPARSEABLE_RELAY=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2020 00:17:47 -0000 On 2020/7/1 5:51, Richard Henderson wrote: > On 6/30/20 1:12 PM, Alistair Francis wrote: >> When a guest specificies the the rounding mode should be dynamic 0b111 >> then we want to re-caclulate the rounding mode on each instruction. The >> gen_helper_set_rounding_mode() function will correctly check the >> rounding mode and handle a dynamic rounding, we just need to make sure >> it's always called if dynamic rounding is selected. >> >> Fixes: 1885350 ("RISCV dynamic rounding mode is not behaving correctly") >> Signed-off-by: Alistair Francis >> --- >> target/riscv/translate.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/target/riscv/translate.c b/target/riscv/translate.c >> index ce71ca7a92..a39eba679a 100644 >> --- a/target/riscv/translate.c >> +++ b/target/riscv/translate.c >> @@ -490,7 +490,7 @@ static void gen_set_rm(DisasContext *ctx, int rm) >> { >> TCGv_i32 t0; >> >> - if (ctx->frm == rm) { >> + if (ctx->frm == rm && rm != 7) { >> return; > This should not be necessary. > > It was my understanding that after the set to the csr, that we would end the > TB. That's certainly what I see in RISCV_OP_CSR_POST. > > The next TB will begin wiht ctx->frm = -1, so we will reset the rounding mode > with 7. It would be good to understand what's really going on here. Agree. I think the 'bug '  is false positive. Although the round mode process code is  confusing, it it right. Zhiwei > > r~