From patchwork Sun Jan 15 16:06:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 642945 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp167268pvb; Sun, 15 Jan 2023 08:08:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXt0tZb3rmQedxQZxG4eXjOalaqrVezYgo/Ri6Ybl7x+j/CZhOusXEPlS9SFxmceqcr+3WtU X-Received: by 2002:ac8:5498:0:b0:3a9:82cb:8d1b with SMTP id h24-20020ac85498000000b003a982cb8d1bmr30564929qtq.16.1673798920781; Sun, 15 Jan 2023 08:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673798920; cv=none; d=google.com; s=arc-20160816; b=hFHRTRaTrbNAIc3zfWOq0VZIGjcgmkMM36CeRQnAuR+gUj9YUfuITS4KzOZ4giA7nK 0mLnQsZS/ZpQMgchLr2W0nlNPJ0mHnVOHjlNqblsM6dn9jA/XJLkaKj1s69ReymHxAQc RkkHk5vx3JKvXFzNCrzFhxiXkAIbk28ZEcgzjIexQcP27sCv490hsYHCbXyQ5H4WkOMo DBaCRfqfobQ8zXZknszvwtnAZarBqdJ6UusFh82qo8fzIr2WZ19f+ugh0yFtVOaJrgLl Ol1ZpZa8zSXnuZFBTuEzneenOWNGdsDgoStAIl2aCRTdbk0EvrP9ehsSoO2TK51I7l3N UwEw== 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; bh=UWv9juEM30TaG2ZFbroRk3W9f3EJ/62euGE8qgUSwqI=; b=FxjIQvzgwXmZhDZiX2vRLUPjvX0h8snRZbcv47SheLtUmlyx8SIK9vja/lUaJtXJf9 BlwYw6DSRZHUSwtGsHTK0QT7NfJwM4lorygtysyNsMf28bS0kGsQV2MWLT/8IgYlgfGP G+NEP73HuP0N0lZSE3R/mxswB6zuJa6B5ILpgR9DTaULioZpVO3q+AaM1RaBp+fXEskU akYaXmlAW9/4FQ9PdtQNl+hPs8Ra4f7T7jv0QBtHrV0oV2efNokeKmXDbUjq4gbOwUH2 zp4AC9lbsxBlHA6vNW+LY69KeQggrGAt9eCszaCLP1Cb+nx1QTH51foQI37sG96+ly8Q KflQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=drpqhCMr; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ca25-20020a05622a1f1900b003abdabfa3ebsi15881339qtb.86.2023.01.15.08.08.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Jan 2023 08:08:40 -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=pass header.i=@linaro.org header.s=google header.b=drpqhCMr; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pH5Xe-0003zA-Pc; Sun, 15 Jan 2023 11:07:31 -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 1pH5XH-0003tl-6G for qemu-devel@nongnu.org; Sun, 15 Jan 2023 11:07:08 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pH5XF-0002l7-2U for qemu-devel@nongnu.org; Sun, 15 Jan 2023 11:07:06 -0500 Received: by mail-pj1-x102a.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so28900740pjj.4 for ; Sun, 15 Jan 2023 08:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UWv9juEM30TaG2ZFbroRk3W9f3EJ/62euGE8qgUSwqI=; b=drpqhCMrAm+voinh4wQ4z+vF4cdkJ9MMQXohQytUB6e33Memlg+pjisHGZIJ8/4WMz ElcgkhoTxEPNwvsNZ//f1E7Equ7NQArfC9Pq2PHE3ZDfE/PL9wEi4IaTiK+N6zbAXhB6 WAKKpb/huIEFcS7VZAhMR1U4xAmMEn1faPof5rgrWOfEb9PfCAUzubmeLk/zGZiN2iJw k3oFQfFKc0PPpOg7XNBMYIDrhqHOyqknZKSwdWlNUapX9hnu+vRatGSz4GuURxoFlqU5 S7NCTGY9hYLeKV1ugsqCUqYv2HUdy0Az0hx69g2FWtfYRQWkiLlrWIG1GN+iT4Oc/vlM tb5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UWv9juEM30TaG2ZFbroRk3W9f3EJ/62euGE8qgUSwqI=; b=P6Md+UaGJJQKwusckE0KbvVPM+zC8G0x9CRHoWThQ31ILmdR+8tFa2mz1zWsB0PcYd QDG1ShoTw6uijcNw3Fn2nHBeIlWOdIq0jlUNn5H4V31H4iItznK0xQ2P/ONBsdYd0gsO /MoyZwriDFAS7gTIDUdmzGwkHc/Uu8FiEYU16CMJA96R2sLBXj+GkVY5/F7ne4uKveYz 1OluMExiqL9MrFKjDgOPM5jEkjF74fQnzYZ1Xe7swwaVxx2cRA6n8g9DLSeqH0IXkbae wjn/OGjGwp4g8E4y+FB9x65Xp9i8ZmPOwJxu5ebJiPqz9yEcxQ72+RPnCtPF+E26Yuqo c+DQ== X-Gm-Message-State: AFqh2kpeDQKMwbPV4n9Q8sPaLz3tUPFS0mKIYOmSzGjFCsE0fgg2kU/0 yHyWi+FK4CaQ0Es7vvIM1WB+Sz89fcTDTY8/ X-Received: by 2002:a05:6a20:1a8a:b0:b8:65b8:a37 with SMTP id ci10-20020a056a201a8a00b000b865b80a37mr2911364pzb.53.1673798822892; Sun, 15 Jan 2023 08:07:02 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id c76-20020a624e4f000000b00589c467ed88sm11422735pfb.69.2023.01.15.08.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 08:07:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bin.meng@windriver.com, abdulras@google.com Subject: [PATCH 1/2] target/arm: Introduce helper_set_rounding_mode_chkfrm Date: Sun, 15 Jan 2023 06:06:56 -1000 Message-Id: <20230115160657.3169274-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230115160657.3169274-1-richard.henderson@linaro.org> References: <20230115160657.3169274-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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.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 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 --- 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 Sun Jan 15 16:06:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 642944 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp167267pvb; Sun, 15 Jan 2023 08:08:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXvehKCih6+rEHTThoxLn15OTm+lqwsNjLBmfSI4pp2BHH4DTeL3Tmyizh9U7mDtUSRIhhyF X-Received: by 2002:ac8:60cd:0:b0:3ab:76f0:bd93 with SMTP id i13-20020ac860cd000000b003ab76f0bd93mr104020108qtm.15.1673798920778; Sun, 15 Jan 2023 08:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673798920; cv=none; d=google.com; s=arc-20160816; b=hTDeY3Vjz2m++GCAIyoIbfMlXYbAEM6fxO5fBCwxw/fZdPCbN+AzSDCiiGU/NsIS9F f9BgyjPW2H+EeAYKBDOtA+ERr7OO8dC4QAeee0zb6+tr+8h2ZCX3RkGVLuuQ7UorBnsX BiI3HhIrORsmZmjeMRIU90uwvySj2X9z+0HG3ihlWooRzWprFtgkkhqlcnExKrdcQ3GX bm+EeBMG+kjrgOIpMHR6a7ZLOWkTaEFmcy+q9RBO6JhhqC/2Ij1fJGw1jShMo7YRkFim TMgxCoX2hFfZ4MERrjXMRNrqBJ7yKsNGGyeuAuNWqCEK5tYNl0UR8enoo3Fe+fxoNs0l G7sw== 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; bh=XP1mndVM3IiukMxTyvVrQ+ffw9ega/+GFt5gwvN3oKI=; b=eBtVaikVm+r4qBj7qwM6RTOrkf+J02E3wdcOJ2ZA8Gp1U/60JOcmQc9AtmFdmqg/oK ejDRow8zZ+WQv8J5WZKY4jNggkZbSgp53jhrsTGezCKOukj8UzyllrlZrV3UEV6hEN4J CQKf/qUBE7IKnD3C2Mbeokomq6JmEssD0HgA++wfqW9Ao3F6GR1T4ZomFNBFi20K1qNz /PSc0brN2RtsLBvAXNGxEH/Z85FL+NZ41rvG9cJSRc/oVuLCRzKZFHMEuM/hT6P8rGl7 BzLEhdGjE1PkrD5p7nWai42VQ+TSqscF6VnDnjwhVOe0khe8ME+AGUxshYkJensdJszq fJzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sj9f7iiJ; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e188-20020a37b5c5000000b006f64a82024esi15021491qkf.721.2023.01.15.08.08.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Jan 2023 08:08:40 -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=pass header.i=@linaro.org header.s=google header.b=sj9f7iiJ; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pH5Xe-0003zC-PU; Sun, 15 Jan 2023 11:07:31 -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 1pH5XI-0003tu-Bu for qemu-devel@nongnu.org; Sun, 15 Jan 2023 11:07:09 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pH5XF-0002lM-TP for qemu-devel@nongnu.org; Sun, 15 Jan 2023 11:07:08 -0500 Received: by mail-pf1-x436.google.com with SMTP id 127so2092730pfe.4 for ; Sun, 15 Jan 2023 08:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XP1mndVM3IiukMxTyvVrQ+ffw9ega/+GFt5gwvN3oKI=; b=sj9f7iiJg+F9AHu/KHluKcdJK5UZK+qDWgcaLqEpGW9OlTbfGa9oG1YNR69uR54Ben g/P2O/lU3z5lOJmRi54TJTDr3h16Rba7P3I3IinfSRdqfbL/wk19QOGRzpNCXwJ/MSmL +Fr7b4/zAE9W7FTW7v/yyFbnB48dPEWIAUBgXirV+dKPYYDtgntnBov71N4oGDg99doq m3NVpx6K5MgEyqMZLzthlliSlNI/OMafVeU89To/8thYNU1xRaqNap6PiodABSbIxGWq p2XuvK/6YTIzcrpWBKJb6e0JsDbN3FVBMlqr3q1VXt/TUgwrLrlg8KfUfcFrwyrmPnie A9wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XP1mndVM3IiukMxTyvVrQ+ffw9ega/+GFt5gwvN3oKI=; b=Oba7oGcA79hB/j9X7nBunHda80+z3na6XNac1+GL7OqVQ69AISg3Hud0Aisbv3sntd k3ksyUps8Y4HhTCPgAdopY6WrJYi9YksC62KZw4HnBo7rjuKjUtT7e1rLX4w8lXsxJON lDimhCjiubThc4g0zKZ2HgdoB7hoOYT/Y2bns30VWLZY+LHvI2fBUlenEwFwdo46zMIt rK+gsXW5fd7/BmS/E+ZwRDHxcIqi3ruHirt0Q6w0PSYhiCoOZ0gowOceoV4EiTW2FaFy 7k8erT59nkH7H1nziRk8H+cyyeGb3e5UKiHHUaU7VvfzqXk8+VYYenc7lc3rd70KWZBx XQDw== X-Gm-Message-State: AFqh2koIaObSvPd48fEWkh352BqWZ1czpNScUCC6jjzl50mr5pNBbdzu lGWB6iVAy7vPpJINn+y4yA/BA9GMhlrLO/t8 X-Received: by 2002:aa7:983b:0:b0:58b:aaaa:82a9 with SMTP id q27-20020aa7983b000000b0058baaaa82a9mr12249097pfl.25.1673798824640; Sun, 15 Jan 2023 08:07:04 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id c76-20020a624e4f000000b00589c467ed88sm11422735pfb.69.2023.01.15.08.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 08:07:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bin.meng@windriver.com, abdulras@google.com Subject: [PATCH 2/2] target/riscv: Remove helper_set_rod_rounding_mode Date: Sun, 15 Jan 2023 06:06:57 -1000 Message-Id: <20230115160657.3169274-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230115160657.3169274-1-richard.henderson@linaro.org> References: <20230115160657.3169274-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 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 --- 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;