From nobody Sat Apr 27 22:23:34 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641349647755345.63182489898804; Tue, 4 Jan 2022 18:27:27 -0800 (PST) Received: from localhost ([::1]:43976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4w1O-0004v2-OE for importer@patchew.org; Tue, 04 Jan 2022 21:27:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4vx5-0001Ha-1n for qemu-devel@nongnu.org; Tue, 04 Jan 2022 21:23:01 -0500 Received: from [2607:f8b0:4864:20::1036] (port=38893 helo=mail-pj1-x1036.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4vx3-0005Xs-4r for qemu-devel@nongnu.org; Tue, 04 Jan 2022 21:22:58 -0500 Received: by mail-pj1-x1036.google.com with SMTP id l10-20020a17090a384a00b001b22190e075so1824593pjf.3 for ; Tue, 04 Jan 2022 18:22:56 -0800 (PST) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id x19sm193593pgi.19.2022.01.04.18.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 18:22:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=myqKEKIIilGrtf+5BHRfjIFtKgmbKL8Q3XQqV6+1lbc=; b=B3EJxETK40jraOqTPZq98FJjmBIG9PDXOB8rXIYEoLdLEW5HyOezuxfSzE0qiar2Tw iLvf18FXBMo2CUQKb2czO6yLl3ffZHSIlLJIFn0GvkKBf6e2rxU5uulyraB4LBWYrj9Y 2q96Ach/yEbkEToJUMC+pHQTu7cfV6aukdTgEnmqHt42xhW4X3HPwBJZmK8Ct5oK/mp9 h9kbUwtUb333a6EM42ef8uRrv88UW6lLtGBV4484gjcxWGhHt+ZR+TkOyLh4bT/6O5AH wU28A25hNhPHEXMSUXRlPXd2pg/W3vWMXtGrlvKMXFpeN3WnDmng9iBtfyCyYsxrqkjD erwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=myqKEKIIilGrtf+5BHRfjIFtKgmbKL8Q3XQqV6+1lbc=; b=p6q2pMRrX2TJnPClL87HST2eYcbLFH5fw2wdCWcZspz2fXCBxfYvmxfppYU8eM+nMY pD9VWz0tKFHqZWdJQpXhlVx7PyoHJVa/RabhudObv4ISqxhJmC3R8167q5RpRYMOsuRc bo9QKKKM4em4/uVIUhcsebi9M2X60AR4IwNKEUG/MBT0R8xFFgiVUswwSnajQrobRDDv KQUIZurzR/UuBLqVoD5nBNAshsEDMVo51zbEwZO7OWH9ZcoWN6pNvAg2OE/tpliY9VJB UU2QHKB780Z9bqSgX3tCUb1ynWYoyEALrk8Lss/QKNUYmCEIz97z/NLakBg8S72z6NkF ieqw== X-Gm-Message-State: AOAM532ulzELmNHZXgATdFK3+0dvcJlwlvYEQbBTNKlbQIjrKT0AujUe idOAsCHY1+iDxOaP8ARDa24jLQdp9BRBqQ== X-Google-Smtp-Source: ABdhPJzifhy90jSzKgBKIipm7n/E9mHYnUGXdlHxJjO14C5PQaQROzEo+UhoClBlcCxlH90Ih4dzxg== X-Received: by 2002:a17:90b:8d:: with SMTP id bb13mr1538344pjb.156.1641349375703; Tue, 04 Jan 2022 18:22:55 -0800 (PST) From: frank.chang@sifive.com To: qemu-devel@nongnu.org Subject: [PATCH v2 1/3] target/riscv: rvv-1.0: Call the correct RVF/RVD check function for widening fp insns Date: Wed, 5 Jan 2022 10:22:44 +0800 Message-Id: <20220105022247.21131-2-frank.chang@sifive.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220105022247.21131-1-frank.chang@sifive.com> References: <20220105022247.21131-1-frank.chang@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1036 (failed) 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=2607:f8b0:4864:20::1036; envelope-from=frank.chang@sifive.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: qemu-riscv@nongnu.org, Frank Chang , Bin Meng , Richard Henderson , Palmer Dabbelt , Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641349650265100001 Content-Type: text/plain; charset="utf-8" From: Frank Chang Vector widening floating-point instructions should use require_scale_rvf() instead of require_rvf() to check whether RVF/RVD is enabled. Signed-off-by: Frank Chang Acked-by: Alistair Francis --- target/riscv/insn_trans/trans_rvv.c.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 5e3f7fdb77..8d92243f2b 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -2254,7 +2254,8 @@ GEN_OPFVF_TRANS(vfrsub_vf, opfvf_check) static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a) { return require_rvv(s) && - require_rvf(s) && + require_scale_rvf(s) && + (s->sew !=3D MO_8) && vext_check_isa_ill(s) && vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm); } @@ -2292,7 +2293,8 @@ GEN_OPFVV_WIDEN_TRANS(vfwsub_vv, opfvv_widen_check) static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a) { return require_rvv(s) && - require_rvf(s) && + require_scale_rvf(s) && + (s->sew !=3D MO_8) && vext_check_isa_ill(s) && vext_check_ds(s, a->rd, a->rs2, a->vm); } @@ -2321,7 +2323,8 @@ GEN_OPFVF_WIDEN_TRANS(vfwsub_vf) static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a) { return require_rvv(s) && - require_rvf(s) && + require_scale_rvf(s) && + (s->sew !=3D MO_8) && vext_check_isa_ill(s) && vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm); } @@ -2359,7 +2362,8 @@ GEN_OPFWV_WIDEN_TRANS(vfwsub_wv) static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a) { return require_rvv(s) && - require_rvf(s) && + require_scale_rvf(s) && + (s->sew !=3D MO_8) && vext_check_isa_ill(s) && vext_check_dd(s, a->rd, a->rs2, a->vm); } --=20 2.31.1 From nobody Sat Apr 27 22:23:34 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641349588598194.76798198191295; Tue, 4 Jan 2022 18:26:28 -0800 (PST) Received: from localhost ([::1]:42932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4w0Q-0004CA-QY for importer@patchew.org; Tue, 04 Jan 2022 21:26:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4vxG-0001Lo-NU for qemu-devel@nongnu.org; Tue, 04 Jan 2022 21:23:12 -0500 Received: from [2607:f8b0:4864:20::1035] (port=37444 helo=mail-pj1-x1035.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4vxF-0005YX-8D for qemu-devel@nongnu.org; Tue, 04 Jan 2022 21:23:10 -0500 Received: by mail-pj1-x1035.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so1857511pjj.2 for ; Tue, 04 Jan 2022 18:23:01 -0800 (PST) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id x19sm193593pgi.19.2022.01.04.18.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 18:23:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bCr1OXLLj1AnANQae2OL1jralQRJuDCEr6CZgNDTrlY=; b=CPRvkwP5HdSv78oBDKFFoz9g0k7vp5ugMuVqzc1xfmTnpY2whzAwNWJn52SBTIsKAI /Vpm/K0vXYIXPqzUbK/hLXYI9CJSRgJGn6398O12ItjAqSwjGp0MJnemJyfi70MNPpC3 rJYeUsw/Dez+U/d1pcouhVRXh+0k4WOKG7vmBT4CcMjol8Uv5vgpC9/bqkyDw3rjlsKX I7qMzQMYJG94QGOvnXMxuqnWA//q4G9HLP4skrfPCq88O52xfLaYplvdX30eEIfaasm5 Ph0szTwPDqm/CLTSaglMJmtx0X6ghZKW3n7OqY2QxRpixCbeua05GiVQUI3bVdrY8j8d 26xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bCr1OXLLj1AnANQae2OL1jralQRJuDCEr6CZgNDTrlY=; b=jYzfD2wkPu7V8nCMLDgjf0xAvV3bqB0hKsZFnlTZeoHmtnc7saMCwZ616W3WkOXIZr ZTzMLpNuZsrOLFNEVChol/vaNjQGlQFx7mbfp6Z0vyu1G3GF+sMUmvuKM6fxuJlPdNJp GFQuEq85qjlvaemjgnmcjVItswbXzG0/apkPXSngyVMKnpX+KbWsGkvkR67l6GZpuLsM alNb2ml3YKG+8ee5rPUDNgryLG6CdgIC0UnU6wm++UIMNaTkWhZrqm0sjaVO3E+FDZKG JXLJOeS2JiaKt17EaXamKJkZoXKH8Ujtcq4gqWt+r027ZFsQiUxU++isc1pSzKKu5ScO khDQ== X-Gm-Message-State: AOAM530H8Mng+qedo9B4Cyr/0qUoxA/OA+GK1MyuWclp386+eB31bVdn GRCFBiiUMlUjVF0PYao1cD8KbrmawzWAIg== X-Google-Smtp-Source: ABdhPJwQK+WUYhQDNlkqJqJVCVzMhqXgehOQz+NY7Re9NXCs5d6iR2BdJ2O6YjYig9QFBWfS0cmPcg== X-Received: by 2002:a17:90a:7023:: with SMTP id f32mr1540939pjk.226.1641349380775; Tue, 04 Jan 2022 18:23:00 -0800 (PST) From: frank.chang@sifive.com To: qemu-devel@nongnu.org Subject: [PATCH v2 2/3] target/riscv: rvv-1.0: Call the correct RVF/RVD check function for widening fp/int type-convert insns Date: Wed, 5 Jan 2022 10:22:45 +0800 Message-Id: <20220105022247.21131-3-frank.chang@sifive.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220105022247.21131-1-frank.chang@sifive.com> References: <20220105022247.21131-1-frank.chang@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1035 (failed) 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=2607:f8b0:4864:20::1035; envelope-from=frank.chang@sifive.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: qemu-riscv@nongnu.org, Frank Chang , Bin Meng , Richard Henderson , Palmer Dabbelt , Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641349590513100001 Content-Type: text/plain; charset="utf-8" From: Frank Chang vfwcvt.xu.f.v, vfwcvt.x.f.v, vfwcvt.rtz.xu.f.v and vfwcvt.rtz.x.f.v convert single-width floating-point to double-width integer. Therefore, should use require_rvf() to check whether RVF/RVD is enabled. vfwcvt.f.xu.v, vfwcvt.f.x.v convert single-width integer to double-width floating-point, and vfwcvt.f.f.v convert double-width floating-point to single-width floating-point. Therefore, should use require_scale_rvf() to check whether RVF/RVD is enabled. Signed-off-by: Frank Chang Acked-by: Alistair Francis --- target/riscv/insn_trans/trans_rvv.c.inc | 34 ++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 8d92243f2b..f1b44ccad2 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -2613,16 +2613,27 @@ GEN_OPFV_CVT_TRANS(vfcvt_rtz_x_f_v, vfcvt_x_f_v, RI= SCV_FRM_RTZ) static bool opfv_widen_check(DisasContext *s, arg_rmr *a) { return require_rvv(s) && - require_scale_rvf(s) && - (s->sew !=3D MO_8) && vext_check_isa_ill(s) && vext_check_ds(s, a->rd, a->rs2, a->vm); } =20 -#define GEN_OPFV_WIDEN_TRANS(NAME, HELPER, FRM) \ +static bool opxfv_widen_check(DisasContext *s, arg_rmr *a) +{ + return opfv_widen_check(s, a) && + require_rvf(s); +} + +static bool opffv_widen_check(DisasContext *s, arg_rmr *a) +{ + return opfv_widen_check(s, a) && + require_scale_rvf(s) && + (s->sew !=3D MO_8); +} + +#define GEN_OPFV_WIDEN_TRANS(NAME, CHECK, HELPER, FRM) \ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ { \ - if (opfv_widen_check(s, a)) { \ + if (CHECK(s, a)) { \ if (FRM !=3D RISCV_FRM_DYN) { \ gen_set_rm(s, RISCV_FRM_DYN); \ } \ @@ -2649,12 +2660,17 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *= a) \ return false; \ } =20 -GEN_OPFV_WIDEN_TRANS(vfwcvt_xu_f_v, vfwcvt_xu_f_v, RISCV_FRM_DYN) -GEN_OPFV_WIDEN_TRANS(vfwcvt_x_f_v, vfwcvt_x_f_v, RISCV_FRM_DYN) -GEN_OPFV_WIDEN_TRANS(vfwcvt_f_f_v, vfwcvt_f_f_v, RISCV_FRM_DYN) +GEN_OPFV_WIDEN_TRANS(vfwcvt_xu_f_v, opxfv_widen_check, vfwcvt_xu_f_v, + RISCV_FRM_DYN) +GEN_OPFV_WIDEN_TRANS(vfwcvt_x_f_v, opxfv_widen_check, vfwcvt_x_f_v, + RISCV_FRM_DYN) +GEN_OPFV_WIDEN_TRANS(vfwcvt_f_f_v, opffv_widen_check, vfwcvt_f_f_v, + RISCV_FRM_DYN) /* Reuse the helper functions from vfwcvt.xu.f.v and vfwcvt.x.f.v */ -GEN_OPFV_WIDEN_TRANS(vfwcvt_rtz_xu_f_v, vfwcvt_xu_f_v, RISCV_FRM_RTZ) -GEN_OPFV_WIDEN_TRANS(vfwcvt_rtz_x_f_v, vfwcvt_x_f_v, RISCV_FRM_RTZ) +GEN_OPFV_WIDEN_TRANS(vfwcvt_rtz_xu_f_v, opxfv_widen_check, vfwcvt_xu_f_v, + RISCV_FRM_RTZ) +GEN_OPFV_WIDEN_TRANS(vfwcvt_rtz_x_f_v, opxfv_widen_check, vfwcvt_x_f_v, + RISCV_FRM_RTZ) =20 static bool opfxv_widen_check(DisasContext *s, arg_rmr *a) { --=20 2.31.1 From nobody Sat Apr 27 22:23:34 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641349591839316.97494630795416; Tue, 4 Jan 2022 18:26:31 -0800 (PST) Received: from localhost ([::1]:43038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4w0U-0004Fm-Ki for importer@patchew.org; Tue, 04 Jan 2022 21:26:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4vxI-0001MP-35 for qemu-devel@nongnu.org; Tue, 04 Jan 2022 21:23:12 -0500 Received: from [2607:f8b0:4864:20::62d] (port=37649 helo=mail-pl1-x62d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4vxF-0005Yl-Lx for qemu-devel@nongnu.org; Tue, 04 Jan 2022 21:23:11 -0500 Received: by mail-pl1-x62d.google.com with SMTP id j13so28320545plx.4 for ; Tue, 04 Jan 2022 18:23:05 -0800 (PST) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id x19sm193593pgi.19.2022.01.04.18.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 18:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ooreh3rb7r9FjgRMrvUAmcp7hG8h0BcZ1KVzhQuCEks=; b=b59hyNHvarTN5IJrwke8y/5CByJbdfgIOyh4Ye+vXZepHwe90Vyuxf1muv90QvRBwE UD4lPlsc90p3hbRufx1yvwbiFKvVKhNx4gbNwRlcagLx/3r8iwe8Ur9dOwbwAOb7Re8a t6/x10kNI7JVAk0bJB5631kAUBfhLi5tlUrrsJ58+37wHS2jVL3d0lyZUkRWz9/BH/EI OxOYAHvBmxUwVX0lahZ5yIEM3qbJPRljTtgvOz8YRz2nLX7aaXg5HRViS2XB2KeIYCgc 1irsNrXg36UtJuwsY7gGxXjfpJy2jXbrp3KYDZmZQzkKPPBgwSoyKGO0US/EeIAGVwPr Gibw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ooreh3rb7r9FjgRMrvUAmcp7hG8h0BcZ1KVzhQuCEks=; b=VkvskSAkLPRxfi8WBxS1dsQXsseZCuej9yeOlkZZ8UC/h3SNrCFnQ8O6O3bBOUan5H 5oz+fZLrsz1jyGs+NpCFqELUyPpynklyaZKSCfQpg732J8bJrQKEOOK5cUQhz6vREE+J MNVyZeTtjrpGKPF3kpWB3dnb1hCu3sT5xgCwj23ZWWWHvUgyaT8Gfj+jzHNsWrC+xoET M2I0CUGZWPtgAk5XZPG99EArk3K+ZJsbyARl6HMqWEakdica+NySM47NxLmoTI0dLWY6 J5GECszZYhnvMs3Okp+zlsKWSGqak/6zItOCrNPAQyph8tkmiASMQQs8qjKG2jAlSIOj vgng== X-Gm-Message-State: AOAM5305L7O59F3pa4TTkh1rIF7knuYhIPBmmo9dlxSukV3X+r1KPjP1 AyT05qWqVjTJTo4wE7Zxm1VaICdzDmd7eg== X-Google-Smtp-Source: ABdhPJwT698Myz11xkomSjgtxL/cJvysS7DtrY8HCgBie6/aRQZjdSqX801WY4ZDvaSGNrvQcaMX4g== X-Received: by 2002:a17:90b:4ac5:: with SMTP id mh5mr1576125pjb.2.1641349384535; Tue, 04 Jan 2022 18:23:04 -0800 (PST) From: frank.chang@sifive.com To: qemu-devel@nongnu.org Subject: [PATCH v2 3/3] target/riscv: rvv-1.0: Call the correct RVF/RVD check function for narrowing fp/int type-convert insns Date: Wed, 5 Jan 2022 10:22:46 +0800 Message-Id: <20220105022247.21131-4-frank.chang@sifive.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220105022247.21131-1-frank.chang@sifive.com> References: <20220105022247.21131-1-frank.chang@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62d (failed) 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=2607:f8b0:4864:20::62d; envelope-from=frank.chang@sifive.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: qemu-riscv@nongnu.org, Frank Chang , Bin Meng , Richard Henderson , Palmer Dabbelt , Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641349592494100003 Content-Type: text/plain; charset="utf-8" From: Frank Chang vfncvt.f.xu.w, vfncvt.f.x.w convert double-width integer to single-width floating-point. Therefore, should use require_rvf() to check whether RVF/RVD is enabled. vfncvt.f.f.w, vfncvt.rod.f.f.w convert double-width floating-point to single-width integer. Therefore, should use require_scale_rvf() to check whether RVF/RVD is enabled. Signed-off-by: Frank Chang Acked-by: Alistair Francis --- target/riscv/insn_trans/trans_rvv.c.inc | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index f1b44ccad2..6c285c958b 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -2719,17 +2719,29 @@ GEN_OPFXV_WIDEN_TRANS(vfwcvt_f_x_v) static bool opfv_narrow_check(DisasContext *s, arg_rmr *a) { return require_rvv(s) && - require_rvf(s) && - (s->sew !=3D MO_64) && vext_check_isa_ill(s) && /* OPFV narrowing instructions ignore vs1 check */ vext_check_sd(s, a->rd, a->rs2, a->vm); } =20 -#define GEN_OPFV_NARROW_TRANS(NAME, HELPER, FRM) \ +static bool opfxv_narrow_check(DisasContext *s, arg_rmr *a) +{ + return opfv_narrow_check(s, a) && + require_rvf(s) && + (s->sew !=3D MO_64); +} + +static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) +{ + return opfv_narrow_check(s, a) && + require_scale_rvf(s) && + (s->sew !=3D MO_8); +} + +#define GEN_OPFV_NARROW_TRANS(NAME, CHECK, HELPER, FRM) \ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ { \ - if (opfv_narrow_check(s, a)) { \ + if (CHECK(s, a)) { \ if (FRM !=3D RISCV_FRM_DYN) { \ gen_set_rm(s, RISCV_FRM_DYN); \ } \ @@ -2756,11 +2768,15 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *= a) \ return false; \ } =20 -GEN_OPFV_NARROW_TRANS(vfncvt_f_xu_w, vfncvt_f_xu_w, RISCV_FRM_DYN) -GEN_OPFV_NARROW_TRANS(vfncvt_f_x_w, vfncvt_f_x_w, RISCV_FRM_DYN) -GEN_OPFV_NARROW_TRANS(vfncvt_f_f_w, vfncvt_f_f_w, RISCV_FRM_DYN) +GEN_OPFV_NARROW_TRANS(vfncvt_f_xu_w, opfxv_narrow_check, vfncvt_f_xu_w, + RISCV_FRM_DYN) +GEN_OPFV_NARROW_TRANS(vfncvt_f_x_w, opfxv_narrow_check, vfncvt_f_x_w, + RISCV_FRM_DYN) +GEN_OPFV_NARROW_TRANS(vfncvt_f_f_w, opffv_narrow_check, vfncvt_f_f_w, + RISCV_FRM_DYN) /* Reuse the helper function from vfncvt.f.f.w */ -GEN_OPFV_NARROW_TRANS(vfncvt_rod_f_f_w, vfncvt_f_f_w, RISCV_FRM_ROD) +GEN_OPFV_NARROW_TRANS(vfncvt_rod_f_f_w, opffv_narrow_check, vfncvt_f_f_w, + RISCV_FRM_ROD) =20 static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) { --=20 2.31.1