From nobody Fri Nov 1 05:41:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1708025446; cv=none; d=zohomail.com; s=zohoarc; b=gJIRp9zgatHAJ63aJ44XaBeH8IWRjj7WjCXZLxZcB4j7t9vcwzWlbEvU+KuDyNpwNq7pPcpawFU2RIzytkKrA48neMoWsOFV24TlHDpTK7HYgfREdN/wdjUqhL4xqO4HNXaEVSKFvcfQENmZyPlmyK+rO7I6aQ5kDx18I82tawc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708025446; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QW83A0gGAC5k+fWtH60j37LLDzdUuqaercnK+L70kbg=; b=iP2Tlp8iPEN70vQrDQSZkTN48etAY3Ks63Dg1PkG2xaAxtU3G8WU9M1mXgQJhTGqB4Fcyl+UgyPiFwNS/dIuwq1PVziLbfEQ0vmKUrnPCrt2pZbus9QHf+mM9jlZ3i4fTD7tJnUHtkZgxJ9SeeNinw6Mcp4gfmCCvqhcMTnUtZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708025446233743.066333229887; Thu, 15 Feb 2024 11:30:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rahPs-0001dn-19; Thu, 15 Feb 2024 14:29:04 -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 1rahPp-0001d9-V7 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:01 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rahPR-0004gw-Fa for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:01 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1d72f71f222so10297925ad.1 for ; Thu, 15 Feb 2024 11:28:35 -0800 (PST) Received: from duncan.localdomain (114-35-142-126.hinet-ip.hinet.net. [114.35.142.126]) by smtp.gmail.com with ESMTPSA id u8-20020a170902a60800b001db5ee73fe9sm1618653plq.114.2024.02.15.11.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708025314; x=1708630114; darn=nongnu.org; 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=QW83A0gGAC5k+fWtH60j37LLDzdUuqaercnK+L70kbg=; b=jtRQL4VJJtrTWj6tHERaodTWHqIjVqAisFj/f6w+TA61FwHHrz5tJR9F9A6n/4741z xQ0B3IJj4P1HJVeVBLDbfhF63xfK0F5z4qzuUtPCsBZfMywi7ugD+DHEK0ugEYHt7e8f v1xLy86EPHM3dA+aILvRKGNoXAsP4SKZulXuAS/6myAtp8d7zJi90OBDzEeTwt4+4ICT th0yuWI0KftDsxCbih0f5E0xl2IR92G2xyMO0zl7hXkLgYAVXVl3/C4MI4KIOjVQhMnS WTtDT8mUlDDPJd7rjAvr+OL0AhK9wU5ymM4HwXpvbb+7mW7pP7tM5N4WgE/y6H6DDhgP 4yQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708025314; x=1708630114; 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=QW83A0gGAC5k+fWtH60j37LLDzdUuqaercnK+L70kbg=; b=lNt0+WGSpC1Ag9QJb6rxO35StB/SxNz8kRuvHQTFkIAz0FzPqvkGxULoRvsfZmh3pT V489HRwgCzp4mtFbkpl974OpZ6qicIUkSGqqwiq0wRyl1SpqlwpKNcfTtBW3Yox0/nxa YbU+TsCZuWM8mnAm4kd1YNqnCcc2HPXAVaWyyWp1qm7Qxkb7QuWwkN0axouMBOJiC1uq QXHRy+4gAIdPY15NPeZs4UPw96Dlzri0CZKznNa7VKdABf8MXPcD84Q+lEsraLH111ig HJCF5vZjYLbmvwCJ4fm2rmlfiDV086WYWZIy6CUgdblokNLqGaiCjd86ZHQl0Q6bfy5C XyNQ== X-Gm-Message-State: AOJu0YyFP3O7khG4w/c/cCg+UGlRD1GegwFyjHm3R36T4zMhhFFF4WvU O6m3TQx6WZ6f6pPCNJW1rCiRIPefBWAeEQrmAZFdnn45vVXWcqOsPLIZZMQgURxv813zqEgCFqD 1DxIHfxiNnf5eulQ32G5ZtZLoqx7/V0IFpJp1Y4D1X2gH3pFYm7oS+ktuBaWTBuqLndW1kzpi6H luDKvbIWvrZV1ZRQyZsSeM+Zkl7oCVaLGd/Xi5B1UJ X-Google-Smtp-Source: AGHT+IFoF6FsR2Rio4oDdz1n5oVrhHIaT1Pw5UsSUcdAluhuK7sNic1WojHYS4NGZJV5rYY/tca0mQ== X-Received: by 2002:a17:902:b20a:b0:1d9:a647:5579 with SMTP id t10-20020a170902b20a00b001d9a6475579mr2431187plr.1.1708025314095; Thu, 15 Feb 2024 11:28:34 -0800 (PST) From: Max Chou To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: dbarboza@ventanamicro.com, Max Chou , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Richard Henderson , Junqiang Wang Subject: [RFC PATCH 1/6] target/riscv: Seperate vector segment ld/st instructions Date: Fri, 16 Feb 2024 03:28:12 +0800 Message-Id: <20240215192823.729209-2-max.chou@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215192823.729209-1-max.chou@sifive.com> References: <20240215192823.729209-1-max.chou@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=max.chou@sifive.com; helo=mail-pl1-x62d.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, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1708025448850100003 Content-Type: text/plain; charset="utf-8" This commit seperate the helper function implementations of vector segment load/store instructions from other vector load/store instructions. This can improve performance by avoiding unnecessary segment operation when NF =3D 1. Signed-off-by: Max Chou --- target/riscv/helper.h | 4 + target/riscv/insn32.decode | 11 ++- target/riscv/insn_trans/trans_rvv.c.inc | 61 +++++++++++++++ target/riscv/vector_helper.c | 100 +++++++++++++++++++++--- 4 files changed, 164 insertions(+), 12 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index 8a635238514..8b6ddc4cb88 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -157,18 +157,22 @@ DEF_HELPER_FLAGS_3(hyp_hsv_d, TCG_CALL_NO_WG, void, e= nv, tl, tl) /* Vector functions */ DEF_HELPER_3(vsetvl, tl, env, tl, tl) DEF_HELPER_5(vle8_v, void, ptr, ptr, tl, env, i32) +DEF_HELPER_5(vlsege8_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle16_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle32_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle64_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle8_v_mask, void, ptr, ptr, tl, env, i32) +DEF_HELPER_5(vlsege8_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle16_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle32_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vle64_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse8_v, void, ptr, ptr, tl, env, i32) +DEF_HELPER_5(vssege8_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse16_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse32_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse64_v, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse8_v_mask, void, ptr, ptr, tl, env, i32) +DEF_HELPER_5(vssege8_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse16_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse32_v_mask, void, ptr, ptr, tl, env, i32) DEF_HELPER_5(vse64_v_mask, void, ptr, ptr, tl, env, i32) diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index f22df04cfd1..0712e9f6314 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -77,6 +77,7 @@ @r2 ....... ..... ..... ... ..... ....... &r2 %rs1 %rd @r2_vm_1 ...... . ..... ..... ... ..... ....... &rmr vm=3D1 %rs2 %rd @r2_nfvm ... ... vm:1 ..... ..... ... ..... ....... &r2nfvm %nf %rs1 %rd +@r2_nf_1_vm ... ... vm:1 ..... ..... ... ..... ....... &r2nfvm nf=3D1 %rs1= %rd @r2_vm ...... vm:1 ..... ..... ... ..... ....... &rmr %rs2 %rd @r1_vm ...... vm:1 ..... ..... ... ..... ....... %rd @r_nfvm ... ... vm:1 ..... ..... ... ..... ....... &rnfvm %nf %rs2 %rs1 %= rd @@ -349,11 +350,17 @@ hsv_d 0110111 ..... ..... 100 00000 1110011 @r= 2_s =20 # *** Vector loads and stores are encoded within LOADFP/STORE-FP *** # Vector unit-stride load/store insns. -vle8_v ... 000 . 00000 ..... 000 ..... 0000111 @r2_nfvm +{ + vle8_v 000 000 . 00000 ..... 000 ..... 0000111 @r2_nf_1_vm + vlsege8_v ... 000 . 00000 ..... 000 ..... 0000111 @r2_nfvm +} vle16_v ... 000 . 00000 ..... 101 ..... 0000111 @r2_nfvm vle32_v ... 000 . 00000 ..... 110 ..... 0000111 @r2_nfvm vle64_v ... 000 . 00000 ..... 111 ..... 0000111 @r2_nfvm -vse8_v ... 000 . 00000 ..... 000 ..... 0100111 @r2_nfvm +{ + vse8_v 000 000 . 00000 ..... 000 ..... 0100111 @r2_nf_1_vm + vssege8_v ... 000 . 00000 ..... 000 ..... 0100111 @r2_nfvm +} vse16_v ... 000 . 00000 ..... 101 ..... 0100111 @r2_nfvm vse32_v ... 000 . 00000 ..... 110 ..... 0100111 @r2_nfvm vse64_v ... 000 . 00000 ..... 111 ..... 0100111 @r2_nfvm diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 9e101ab4343..04fc6329359 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -690,6 +690,40 @@ GEN_VEXT_TRANS(vle16_v, MO_16, r2nfvm, ld_us_op, ld_us= _check) GEN_VEXT_TRANS(vle32_v, MO_32, r2nfvm, ld_us_op, ld_us_check) GEN_VEXT_TRANS(vle64_v, MO_64, r2nfvm, ld_us_op, ld_us_check) =20 +static bool ld_us_seg_op(DisasContext *s, arg_r2nfvm *a, uint8_t eew) +{ + uint32_t data =3D 0; + gen_helper_ldst_us *fn; + static gen_helper_ldst_us * const fns[2][4] =3D { + /* masked unit stride load */ + { gen_helper_vlsege8_v_mask, gen_helper_vle16_v_mask, + gen_helper_vle32_v_mask, gen_helper_vle64_v_mask }, + /* unmasked unit stride load */ + { gen_helper_vlsege8_v, gen_helper_vle16_v, + gen_helper_vle32_v, gen_helper_vle64_v } + }; + + fn =3D fns[a->vm][eew]; + if (fn =3D=3D NULL) { + return false; + } + + /* + * Vector load/store instructions have the EEW encoded + * directly in the instructions. The maximum vector size is + * calculated with EMUL rather than LMUL. + */ + uint8_t emul =3D vext_get_emul(s, eew); + data =3D FIELD_DP32(data, VDATA, VM, a->vm); + data =3D FIELD_DP32(data, VDATA, LMUL, emul); + data =3D FIELD_DP32(data, VDATA, NF, a->nf); + data =3D FIELD_DP32(data, VDATA, VTA, s->vta); + data =3D FIELD_DP32(data, VDATA, VMA, s->vma); + return ldst_us_trans(a->rd, a->rs1, data, fn, s, false); +} + +GEN_VEXT_TRANS(vlsege8_v, MO_8, r2nfvm, ld_us_seg_op, ld_us_check) + static bool st_us_op(DisasContext *s, arg_r2nfvm *a, uint8_t eew) { uint32_t data =3D 0; @@ -727,6 +761,33 @@ GEN_VEXT_TRANS(vse16_v, MO_16, r2nfvm, st_us_op, st_us= _check) GEN_VEXT_TRANS(vse32_v, MO_32, r2nfvm, st_us_op, st_us_check) GEN_VEXT_TRANS(vse64_v, MO_64, r2nfvm, st_us_op, st_us_check) =20 +static bool st_us_seg_op(DisasContext *s, arg_r2nfvm *a, uint8_t eew) +{ + uint32_t data =3D 0; + gen_helper_ldst_us *fn; + static gen_helper_ldst_us * const fns[2][4] =3D { + /* masked unit stride store */ + { gen_helper_vssege8_v_mask, gen_helper_vse16_v_mask, + gen_helper_vse32_v_mask, gen_helper_vse64_v_mask }, + /* unmasked unit stride store */ + { gen_helper_vssege8_v, gen_helper_vse16_v, + gen_helper_vse32_v, gen_helper_vse64_v } + }; + + fn =3D fns[a->vm][eew]; + if (fn =3D=3D NULL) { + return false; + } + + uint8_t emul =3D vext_get_emul(s, eew); + data =3D FIELD_DP32(data, VDATA, VM, a->vm); + data =3D FIELD_DP32(data, VDATA, LMUL, emul); + data =3D FIELD_DP32(data, VDATA, NF, a->nf); + return ldst_us_trans(a->rd, a->rs1, data, fn, s, true); +} + +GEN_VEXT_TRANS(vssege8_v, MO_8, r2nfvm, st_us_seg_op, st_us_check) + /* *** unit stride mask load and store */ diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 84cec73eb20..e8fbb921449 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -201,6 +201,32 @@ vext_ldst_stride(void *vd, void *v0, target_ulong base, uint32_t desc, uint32_t vm, vext_ldst_elem_fn *ldst_elem, uint32_t log2_esz, uintptr_t ra) +{ + uint32_t i; + uint32_t max_elems =3D vext_max_elems(desc, log2_esz); + uint32_t esz =3D 1 << log2_esz; + uint32_t vma =3D vext_vma(desc); + + for (i =3D env->vstart; i < env->vl; i++, env->vstart++) { + if (!vm && !vext_elem_mask(v0, i)) { + /* set masked-off elements to 1s */ + vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz); + continue; + } + target_ulong addr =3D base + stride * i; + ldst_elem(env, adjust_addr(env, addr), i, vd, ra); + } + env->vstart =3D 0; + + vext_set_tail_elems_1s(env->vl, vd, desc, 1, esz, max_elems); +} + +static void +vext_ldst_stride_segment(void *vd, void *v0, target_ulong base, + target_ulong stride, CPURISCVState *env, + uint32_t desc, uint32_t vm, + vext_ldst_elem_fn *ldst_elem, + uint32_t log2_esz, uintptr_t ra) { uint32_t i, k; uint32_t nf =3D vext_nf(desc); @@ -234,8 +260,8 @@ void HELPER(NAME)(void *vd, void * v0, target_ulong bas= e, \ uint32_t desc) \ { \ uint32_t vm =3D vext_vm(desc); \ - vext_ldst_stride(vd, v0, base, stride, env, desc, vm, LOAD_FN, \ - ctzl(sizeof(ETYPE)), GETPC()); \ + vext_ldst_stride_segment(vd, v0, base, stride, env, desc, vm, \ + LOAD_FN, ctzl(sizeof(ETYPE)), GETPC()); \ } =20 GEN_VEXT_LD_STRIDE(vlse8_v, int8_t, lde_b) @@ -249,8 +275,8 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong base= , \ uint32_t desc) \ { \ uint32_t vm =3D vext_vm(desc); \ - vext_ldst_stride(vd, v0, base, stride, env, desc, vm, STORE_FN, \ - ctzl(sizeof(ETYPE)), GETPC()); \ + vext_ldst_stride_segment(vd, v0, base, stride, env, desc, vm, \ + STORE_FN, ctzl(sizeof(ETYPE)), GETPC()); \ } =20 GEN_VEXT_ST_STRIDE(vsse8_v, int8_t, ste_b) @@ -267,6 +293,26 @@ static void vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t des= c, vext_ldst_elem_fn *ldst_elem, uint32_t log2_esz, uint32_t evl, uintptr_t ra) +{ + uint32_t i; + uint32_t max_elems =3D vext_max_elems(desc, log2_esz); + uint32_t esz =3D 1 << log2_esz; + + /* load bytes from guest memory */ + for (i =3D env->vstart; i < evl; i++, env->vstart++) { + target_ulong addr =3D base + (i << log2_esz); + ldst_elem(env, adjust_addr(env, addr), i, vd, ra); + } + env->vstart =3D 0; + + vext_set_tail_elems_1s(evl, vd, desc, 1, esz, max_elems); +} + +/* unmasked unit-stride segment load and store operation */ +static void +vext_ldst_us_segment(void *vd, target_ulong base, CPURISCVState *env, + uint32_t desc, vext_ldst_elem_fn *ldst_elem, + uint32_t log2_esz, uint32_t evl, uintptr_t ra) { uint32_t i, k; uint32_t nf =3D vext_nf(desc); @@ -308,10 +354,27 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong ba= se, \ ctzl(sizeof(ETYPE)), env->vl, GETPC()); \ } =20 +#define GEN_VEXT_LD_US_SEG(NAME, ETYPE, LOAD_FN) \ +void HELPER(NAME##_mask)(void *vd, void *v0, target_ulong base, \ + CPURISCVState *env, uint32_t desc) \ +{ \ + uint32_t stride =3D vext_nf(desc) << ctzl(sizeof(ETYPE)); \ + vext_ldst_stride_segment(vd, v0, base, stride, env, desc, false, \ + LOAD_FN, ctzl(sizeof(ETYPE)), GETPC()); \ +} \ + \ +void HELPER(NAME)(void *vd, void *v0, target_ulong base, \ + CPURISCVState *env, uint32_t desc) \ +{ \ + vext_ldst_us_segment(vd, base, env, desc, LOAD_FN, \ + ctzl(sizeof(ETYPE)), env->vl, GETPC()); \ +} + GEN_VEXT_LD_US(vle8_v, int8_t, lde_b) -GEN_VEXT_LD_US(vle16_v, int16_t, lde_h) -GEN_VEXT_LD_US(vle32_v, int32_t, lde_w) -GEN_VEXT_LD_US(vle64_v, int64_t, lde_d) +GEN_VEXT_LD_US_SEG(vlsege8_v, int8_t, lde_b) +GEN_VEXT_LD_US_SEG(vle16_v, int16_t, lde_h) +GEN_VEXT_LD_US_SEG(vle32_v, int32_t, lde_w) +GEN_VEXT_LD_US_SEG(vle64_v, int64_t, lde_d) =20 #define GEN_VEXT_ST_US(NAME, ETYPE, STORE_FN) \ void HELPER(NAME##_mask)(void *vd, void *v0, target_ulong base, \ @@ -329,10 +392,27 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong ba= se, \ ctzl(sizeof(ETYPE)), env->vl, GETPC()); \ } =20 +#define GEN_VEXT_ST_US_SEG(NAME, ETYPE, STORE_FN) \ +void HELPER(NAME##_mask)(void *vd, void *v0, target_ulong base, \ + CPURISCVState *env, uint32_t desc) \ +{ \ + uint32_t stride =3D vext_nf(desc) << ctzl(sizeof(ETYPE)); = \ + vext_ldst_stride_segment(vd, v0, base, stride, env, desc, false, \ + STORE_FN, ctzl(sizeof(ETYPE)), GETPC()); \ +} \ + \ +void HELPER(NAME)(void *vd, void *v0, target_ulong base, \ + CPURISCVState *env, uint32_t desc) \ +{ \ + vext_ldst_us_segment(vd, base, env, desc, STORE_FN, \ + ctzl(sizeof(ETYPE)), env->vl, GETPC()); \ +} + GEN_VEXT_ST_US(vse8_v, int8_t, ste_b) -GEN_VEXT_ST_US(vse16_v, int16_t, ste_h) -GEN_VEXT_ST_US(vse32_v, int32_t, ste_w) -GEN_VEXT_ST_US(vse64_v, int64_t, ste_d) +GEN_VEXT_ST_US_SEG(vssege8_v, int8_t, ste_b) +GEN_VEXT_ST_US_SEG(vse16_v, int16_t, ste_h) +GEN_VEXT_ST_US_SEG(vse32_v, int32_t, ste_w) +GEN_VEXT_ST_US_SEG(vse64_v, int64_t, ste_d) =20 /* * unit stride mask load and store, EEW =3D 1 --=20 2.34.1 From nobody Fri Nov 1 05:41:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1708025423; cv=none; d=zohomail.com; s=zohoarc; b=b8t8+DKgqE6XzlLD/heE8FYZNC5OfgJ7lpTgL8JZWTymvOuZwlAQjANdQBhYwfdAP0Blix/SbjLgm23I97P+P9QDGw9LCSEJYfD7iS//NgIEI+T3D+rV8h7KnDo09XhQ0gs4csknqx8cjGGEGM0dMjrq/zwXPW4Wl4GvNjQU1P8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708025423; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3KR/e7xd2t/WfUhq1nU3nYx+Y5DrBWOVXBN9h9UKvfc=; b=L5mVGLqsJENqbMr9FVXi5PfvinBZR2C8CbKQlN3TbmYu9WxnaI0uCWTAKdUyQw1ZN2BzAHpS8FXq48gaIQGKHy4dtzfOLzUv0Ki3j5LaGytzGLXc/Dyn0nZrataoraVkn3P5LtvWUwSXjVgFr9ZFcMFgYEqWT2SOgJOUw5SLpj0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708025423209260.2504788160509; Thu, 15 Feb 2024 11:30:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rahPw-0001f6-Ai; Thu, 15 Feb 2024 14:29:08 -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 1rahPt-0001dr-AK for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:05 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rahPZ-0004hF-71 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:03 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d51ba18e1bso12737315ad.0 for ; Thu, 15 Feb 2024 11:28:40 -0800 (PST) Received: from duncan.localdomain (114-35-142-126.hinet-ip.hinet.net. [114.35.142.126]) by smtp.gmail.com with ESMTPSA id u8-20020a170902a60800b001db5ee73fe9sm1618653plq.114.2024.02.15.11.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708025318; x=1708630118; darn=nongnu.org; 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=3KR/e7xd2t/WfUhq1nU3nYx+Y5DrBWOVXBN9h9UKvfc=; b=RjVJwxAdZRI1wo40etlhF1Ffh0FaC5Eutzl9iHNbDcox3hjElCl5OZdAnojTDOU93c i2STawdRueljR01Pttx+pztyy1Ddx8yf2aAHvyp80wvlkRBtZ8e55jYJH8yguGS1015p ZCne2UufDLVif8tHNbMSMDseCE6TGmjuuBqJtNa9cynltNPN/nmzSIFC4TwoOxxOjQKt aIKMYdrjTFVFiv2mltNIXVzwUhRPOvhu5C7jRTebUnVRCrGPlMGeTZRgpsoWPuGDWosC 1IfEO8K7+MFrfF1WOUu3ZYWnQSOGb7/lP7LBoW0PWe9o6Rg4DGMH5mIy8GPSR7bJfFyZ xhJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708025318; x=1708630118; 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=3KR/e7xd2t/WfUhq1nU3nYx+Y5DrBWOVXBN9h9UKvfc=; b=Lp8zTnqb8wiKCkd3tnqs0Scl2WRZO4iQePTm92yuMNPMy+v7RXn9IWAkhSsb+Ek2A/ Hgeaz/2pFfOwh2C8cuZpnrM/8GDHA1baCpJtor1ZXQE+I3TFqwVGuOGnXA2KVPzkP/QE JWTJcWzzO7XspbaxUVGTeOqGoSZbAghs8SqqUP3PSMys8esilsJ69o3U35wCc0jMbIo1 Q8tJPy6NuUX+i71CQixQyaQqbmUmASLmg2fswjR4N3YSNI4tPoT0At6zL8GfjFG6c3Wf r1oMDZTX1Yg9ekg3tpI0ON2Jo5MWKCBWk227RrMIKB8/wpAwomuEHv8Wq7rNKVqZMmqE M89g== X-Gm-Message-State: AOJu0YwgK8SyBmG5Rag5rJFoexdnyEwZJ1iAQT616b8IviDGsYTv+4R5 lQTKHl7OoCxkTuf8CYidYELZv7KgiFb/GVBf0erDfWl9hozth2HvGfSLwLU3eTM6pCo6rzX+IWz W2hcT/WgVgO2k0UmE5Zjr23SyOfHXSN13BlmJOJ0UKRhPq4EOBNnHoeJvegUKk7nz4ZOmveyCal d89+mcWYZixtnr6NUaAggXILnHxULDAAnX+T/Qa9JH X-Google-Smtp-Source: AGHT+IHH07zKpvDk6lvEZgaiG7tRGZgTkNUFnN8TiRSiVQbRRAR2azynSv/UhmuI4NuIotPhoe4okg== X-Received: by 2002:a17:902:8218:b0:1db:5eaa:e9a2 with SMTP id x24-20020a170902821800b001db5eaae9a2mr2529567pln.64.1708025317939; Thu, 15 Feb 2024 11:28:37 -0800 (PST) From: Max Chou To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: dbarboza@ventanamicro.com, Max Chou , Richard Henderson , Paolo Bonzini Subject: [RFC PATCH 2/6] accel/tcg: Avoid uncessary call overhead from qemu_plugin_vcpu_mem_cb Date: Fri, 16 Feb 2024 03:28:13 +0800 Message-Id: <20240215192823.729209-3-max.chou@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215192823.729209-1-max.chou@sifive.com> References: <20240215192823.729209-1-max.chou@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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::62a; envelope-from=max.chou@sifive.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1708025423682100001 Content-Type: text/plain; charset="utf-8" If there are not any QEMU plugin memory callback functions, checking before calling the qemu_plugin_vcpu_mem_cb function can reduce the function call overhead. Signed-off-by: Max Chou --- accel/tcg/ldst_common.c.inc | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/accel/tcg/ldst_common.c.inc b/accel/tcg/ldst_common.c.inc index c82048e377e..bf24986c562 100644 --- a/accel/tcg/ldst_common.c.inc +++ b/accel/tcg/ldst_common.c.inc @@ -134,7 +134,9 @@ uint8_t cpu_ldb_mmu(CPUArchState *env, abi_ptr addr, Me= mOpIdx oi, uintptr_t ra) =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_UB); ret =3D do_ld1_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_load_cb(env, addr, oi); + } return ret; } =20 @@ -145,7 +147,9 @@ uint16_t cpu_ldw_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_16); ret =3D do_ld2_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_load_cb(env, addr, oi); + } return ret; } =20 @@ -156,7 +160,9 @@ uint32_t cpu_ldl_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_32); ret =3D do_ld4_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_load_cb(env, addr, oi); + } return ret; } =20 @@ -167,7 +173,9 @@ uint64_t cpu_ldq_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_64); ret =3D do_ld8_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_load_cb(env, addr, oi); + } return ret; } =20 @@ -178,7 +186,9 @@ Int128 cpu_ld16_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_128); ret =3D do_ld16_mmu(env_cpu(env), addr, oi, ra); - plugin_load_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_load_cb(env, addr, oi); + } return ret; } =20 @@ -195,7 +205,9 @@ void cpu_stb_mmu(CPUArchState *env, abi_ptr addr, uint8= _t val, MemOpIdx oi, uintptr_t retaddr) { helper_stb_mmu(env, addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_store_cb(env, addr, oi); + } } =20 void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint16_t val, @@ -203,7 +215,9 @@ void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint1= 6_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_16); do_st2_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_store_cb(env, addr, oi); + } } =20 void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint32_t val, @@ -211,7 +225,9 @@ void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint3= 2_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_32); do_st4_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_store_cb(env, addr, oi); + } } =20 void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint64_t val, @@ -219,7 +235,9 @@ void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint6= 4_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_64); do_st8_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_store_cb(env, addr, oi); + } } =20 void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val, @@ -227,7 +245,9 @@ void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int1= 28 val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_128); do_st16_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + plugin_store_cb(env, addr, oi); + } } =20 /* --=20 2.34.1 From nobody Fri Nov 1 05:41:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1708025400; cv=none; d=zohomail.com; s=zohoarc; b=EFrHdCfBkx/VRAdMoh8hNJDGzDKNtRp7vim4wRa6z6IDQfxrZdU3cgFjQUlgNMcvrF3Vdpl+S3lnWONxipslJj+5H3zIObO2E/FbmEqCaxWdM+Q+vZjJOKB4UygvEBJVLTnPIJsIHK7DaHcV5rvPvnyriR/vxe84Tj3CEFXsTv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708025400; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PqJOdAFlOLuV8CILgRx55cvxXityDOLPppAKVjprA0M=; b=lNYLM0wIHYMsMu9x4zE0Ii5yJYQr/xzXDu9DwWgDF6wIFEew9/frXw/JS664iMktFPQYG0/yw7tnciG6Y8G/3Uup7K35R49N9ITOiCDZ9rV3QyNlZMiNvPWE23ryNPDe2vTrshuv1PJ0dGpaaA2Sbl/9m8wRYfiPuFTlyVRbyT0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708025400571616.2525669400937; Thu, 15 Feb 2024 11:30:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rahPz-0001io-IU; Thu, 15 Feb 2024 14:29:11 -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 1rahPx-0001iC-Sz for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:09 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rahPg-0004hX-Jc for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:09 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1db640fc901so11587705ad.0 for ; Thu, 15 Feb 2024 11:28:47 -0800 (PST) Received: from duncan.localdomain (114-35-142-126.hinet-ip.hinet.net. [114.35.142.126]) by smtp.gmail.com with ESMTPSA id u8-20020a170902a60800b001db5ee73fe9sm1618653plq.114.2024.02.15.11.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708025322; x=1708630122; darn=nongnu.org; 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=PqJOdAFlOLuV8CILgRx55cvxXityDOLPppAKVjprA0M=; b=SR+6R8q8d+O9K5ZjJsH/LxdGOsB2RRGKTAifaG9fnl01MF8NA/sQvi1NngGKD/ff3k fRRYwD3wD3sgBfjR8zytGwS4UEt4z94w6AyY7mUrYyy++FAUr3pOJQ1o7XYI5vBF66wr /MEYXaIqXobrAJfW632Fk63vHNtsvYg4agNxeSSkhYJVt7DSai1vwAqbCSGdX9uml9/7 PuvbISa2ocHkOOPqgL3LpKAT9s81nymchZxbxLA6mx/KPMEuPqA6YQcd8HmU+Bbss3DL iK95ul/aS4b9vyTKSiKDOLGx5NwGJW0eBH+AlJo+q01O8OrFZ21HHtKpH+gYuiV7SwHX bzDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708025322; x=1708630122; 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=PqJOdAFlOLuV8CILgRx55cvxXityDOLPppAKVjprA0M=; b=kJTMGRuSP64afwWexBnkCqHMA7LoGE2MP9ich39T597qOvKHNMembFXQzi9YfTnRFz VcSovY2PZZimag9mTHOZ9ylKtcEl03d+bWIIEi/6xskQWtjkzbync78a3VobIiCrp8sx 4TJ3wwsxvmAkiCriqJS3ICD/4YQ4Pkza9jwlj/cKuv4TiSeOTCUMPmibErXG/veyMgXW Xt72S4O6VfK2gOr6k92aSEsFlsivY6AKTnkG/46O0Wyv2AVoBRUra7ugEZ1Q0qVmIWyx VK8Ejs10a+vTgaySaMQwK2cOaJF6SQcL/ilR+Gvf2m1/7TkJjR9mVxlaSYxFj1e7JMaR +/vg== X-Gm-Message-State: AOJu0Yzqb0CNu0zm73f8enMyn0hM+V9OBYPjMXWp1/jxpwwfOhjJdjio QiT6Mk/0Xug8m85fvsF2uubVogYbJJ0G7vrsThXz9wEnNpf5YYU32IPsWexstTBFTpFTQ18WIFa CFqsRrUpzGi/KlrvX+W7nBI9f9I6UFQ/t499XFMqqX/F5qPwhQA8B4lxYl2DawB71FhLiAEg/SV e34uXTFgnfhuYSzInU+s6whMo7Wrj7zIKdS47iv7ec X-Google-Smtp-Source: AGHT+IGG99BIj2DOfKEYVErGN6NYizRM/krbGTsBNJ/Cse47yT3eBsPe+SAt74cbFA/GMmDjybeAuw== X-Received: by 2002:a17:902:8a96:b0:1d8:d5b0:aadb with SMTP id p22-20020a1709028a9600b001d8d5b0aadbmr2168871plo.66.1708025321984; Thu, 15 Feb 2024 11:28:41 -0800 (PST) From: Max Chou To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: dbarboza@ventanamicro.com, Max Chou , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei Subject: [RFC PATCH 3/6] target/riscv: Inline vext_ldst_us and coressponding function for performance Date: Fri, 16 Feb 2024 03:28:14 +0800 Message-Id: <20240215192823.729209-4-max.chou@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215192823.729209-1-max.chou@sifive.com> References: <20240215192823.729209-1-max.chou@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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::62c; envelope-from=max.chou@sifive.com; helo=mail-pl1-x62c.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1708025401683100003 Content-Type: text/plain; charset="utf-8" In the vector unit-stride load/store helper functions. the vext_ldst_us function corresponding most of the execution time. Inline the functions can avoid the function call overhead to imperove the helper function performance. Signed-off-by: Max Chou Reviewed-by: Richard Henderson --- target/riscv/vector_helper.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index e8fbb921449..866f77d321d 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -149,25 +149,27 @@ static inline void vext_set_elem_mask(void *v0, int i= ndex, typedef void vext_ldst_elem_fn(CPURISCVState *env, abi_ptr addr, uint32_t idx, void *vd, uintptr_t retaddr); =20 -#define GEN_VEXT_LD_ELEM(NAME, ETYPE, H, LDSUF) \ -static void NAME(CPURISCVState *env, abi_ptr addr, \ - uint32_t idx, void *vd, uintptr_t retaddr)\ -{ \ - ETYPE *cur =3D ((ETYPE *)vd + H(idx)); \ - *cur =3D cpu_##LDSUF##_data_ra(env, addr, retaddr); \ -} \ +#define GEN_VEXT_LD_ELEM(NAME, ETYPE, H, LDSUF) \ +static inline QEMU_ALWAYS_INLINE \ +void NAME(CPURISCVState *env, abi_ptr addr, \ + uint32_t idx, void *vd, uintptr_t retaddr) \ +{ \ + ETYPE *cur =3D ((ETYPE *)vd + H(idx)); \ + *cur =3D cpu_##LDSUF##_data_ra(env, addr, retaddr); \ +} \ =20 GEN_VEXT_LD_ELEM(lde_b, int8_t, H1, ldsb) GEN_VEXT_LD_ELEM(lde_h, int16_t, H2, ldsw) GEN_VEXT_LD_ELEM(lde_w, int32_t, H4, ldl) GEN_VEXT_LD_ELEM(lde_d, int64_t, H8, ldq) =20 -#define GEN_VEXT_ST_ELEM(NAME, ETYPE, H, STSUF) \ -static void NAME(CPURISCVState *env, abi_ptr addr, \ - uint32_t idx, void *vd, uintptr_t retaddr)\ -{ \ - ETYPE data =3D *((ETYPE *)vd + H(idx)); \ - cpu_##STSUF##_data_ra(env, addr, data, retaddr); \ +#define GEN_VEXT_ST_ELEM(NAME, ETYPE, H, STSUF) \ +static inline QEMU_ALWAYS_INLINE \ +void NAME(CPURISCVState *env, abi_ptr addr, \ + uint32_t idx, void *vd, uintptr_t retaddr) \ +{ \ + ETYPE data =3D *((ETYPE *)vd + H(idx)); \ + cpu_##STSUF##_data_ra(env, addr, data, retaddr); \ } =20 GEN_VEXT_ST_ELEM(ste_b, int8_t, H1, stb) @@ -289,7 +291,7 @@ GEN_VEXT_ST_STRIDE(vsse64_v, int64_t, ste_d) */ =20 /* unmasked unit-stride load and store operation */ -static void +static inline QEMU_ALWAYS_INLINE void vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t des= c, vext_ldst_elem_fn *ldst_elem, uint32_t log2_esz, uint32_t evl, uintptr_t ra) --=20 2.34.1 From nobody Fri Nov 1 05:41:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1708025399; cv=none; d=zohomail.com; s=zohoarc; b=YqMa7i58nmDU9QPeOuWK36Ztl0Sx8BsKvnZOlFwvHkXzkcNgUJVIde89QGxsKoAnHTyUR0xSy2ImrCr+oYCpfBGQqjRHeyyL0t1BKy0ibZ+4B/nNH53tK4cwJQbViQd/e3VtNvcJt9Dc6A83BnZ7u4Q0IHZq7g4TuFlnfXqzG54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708025399; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aY2GQ2qh0XeeuvRECl5CCzJvBtPvf5PTqd8C4F8QamY=; b=NzbWlVt2p74j/ADyivtHwCIKyadMjrw0/5FXOIghIaBTeAXF4UbzJTiOcRRG34dNqEI5Rpogl2QZBXNgNgSHJOkRCoeWzicU/y60fMKVARIpUTO2A7Wx6Vo5F6aXGnPayjPXrFzlF2CYtWuvRFwa0fL08SwD/fj/F6EDBOs5fbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708025399948924.2866072033781; Thu, 15 Feb 2024 11:29:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rahQB-0001ne-Jt; Thu, 15 Feb 2024 14:29:23 -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 1rahQ8-0001mD-NU for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:20 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rahPg-0004hp-DX for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:19 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1d7393de183so10668955ad.3 for ; Thu, 15 Feb 2024 11:28:48 -0800 (PST) Received: from duncan.localdomain (114-35-142-126.hinet-ip.hinet.net. [114.35.142.126]) by smtp.gmail.com with ESMTPSA id u8-20020a170902a60800b001db5ee73fe9sm1618653plq.114.2024.02.15.11.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:28:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708025325; x=1708630125; darn=nongnu.org; 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=aY2GQ2qh0XeeuvRECl5CCzJvBtPvf5PTqd8C4F8QamY=; b=Lr9neBHW2U6psaW+xZqiqL3vVcdNOWTuKglnkguwba6Hl8HLtfkewIM40jsKyFPoGE KiPHsTMzJ0Nl9qMyfbeduW8fTQfgTufT4zeyp+hmpNoVUuocLa/nq/DCskcbr5hTCa/1 wrcSkX5DKPjcLspGlED9lKs+Fn/uR+V+O2hLxLo/DS+84mjHYzhBxqVvFpbcCcvjVL0k tSniwdiEFLO0T0IcumvDvq+na85mKj7fu9qGKDZ/OB33Y7YAVz2A9gzigI3SvW4TKyTm hNGZbo4Ngyh/pgUoovYuNwk1S6k8Ms7+TAmDuNW4sVgbUiMmSiaPmVUWbaRB1P9m4Xuf o5FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708025325; x=1708630125; 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=aY2GQ2qh0XeeuvRECl5CCzJvBtPvf5PTqd8C4F8QamY=; b=a96CgphfcwdPyTKYz8kBUTuBmejnl9Trig8D1QI70J+/4URcEiUQE+X7v13fPrlNZ4 LZNpS/UlAf9rh/P6+1N2XQvBLsIh1koPrGNkMXyhYfGqNllaoTCiuKXST6x4dxProihm ClJqSxLDy4HHwnyKzQ1HIsKrckCcEmE3jaw5S6QDdByGXxUnzT+W43Q+o2iHfr7r9OdB cWiLRkfiawDuUEM84UsdgkkkNnmCTS+64FEVihvjtcz/8YxzF1IfTO2p2YXucRPmnla6 YhkQSm4D/6FxTneUYG1Aj/4QukpBzA0UktC4vz1Zqfl4Wcxg6Z4dZoyO4toQOnHU59Ry 3PIA== X-Gm-Message-State: AOJu0YzQo/gLpWXjXN7KnEN2toyI8fL6KHIJoWeY41aPxuBiGM3YGScl g4xU4A+X79uR1fdDxETTM4K35MvLVda/Xe3K8uTeard2By2KOHhSEyBgG5ke+BdBJ6c16o+z0tA stYfVuKAaW5e4tpECAz7YoxUa1Omlb8kJPdH2ceW0dW2SI0fWXTU4uKDTekxjkQG+6+6Wrc5lZX 071WiVcXebsyNFkp1loVKKYZJ3d3NyIZFUmHStsbu5 X-Google-Smtp-Source: AGHT+IEr5o8CE3vDUoaj1VJw5ztI2DVXDsB6xUJRSWSZa/Sb69YA4XaF7abySA7YnUhjty3OTnZJig== X-Received: by 2002:a17:903:2281:b0:1db:7052:2f75 with SMTP id b1-20020a170903228100b001db70522f75mr3277770plh.49.1708025325471; Thu, 15 Feb 2024 11:28:45 -0800 (PST) From: Max Chou To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: dbarboza@ventanamicro.com, Max Chou , Riku Voipio , Richard Henderson , Paolo Bonzini Subject: [RFC PATCH 4/6] accel/tcg: Inline cpu_mmu_lookup function Date: Fri, 16 Feb 2024 03:28:15 +0800 Message-Id: <20240215192823.729209-5-max.chou@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215192823.729209-1-max.chou@sifive.com> References: <20240215192823.729209-1-max.chou@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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::62c; envelope-from=max.chou@sifive.com; helo=mail-pl1-x62c.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, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1708025401732100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Chou --- accel/tcg/user-exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 68b252cb8e8..c5453810eee 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -942,8 +942,11 @@ void page_reset_target_data(target_ulong start, target= _ulong last) { } =20 /* The system-mode versions of these helpers are in cputlb.c. */ =20 -static void *cpu_mmu_lookup(CPUState *cpu, vaddr addr, - MemOp mop, uintptr_t ra, MMUAccessType type) +static inline QEMU_ALWAYS_INLINE void *cpu_mmu_lookup(CPUState *cpu, + vaddr addr, + MemOp mop, + uintptr_t ra, + MMUAccessType type) { int a_bits =3D get_alignment_bits(mop); void *ret; --=20 2.34.1 From nobody Fri Nov 1 05:41:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1708025457; cv=none; d=zohomail.com; s=zohoarc; b=cx4RffA5bxT8w9MS/jFOwObXg8FLggn+gfAClplE2P8BtY8J10u+nNpOGZo2S44QXhiwh5Jd60hwdVoe1W5d6lVlq67pDkoSmsj3MajE/55vGfYiD+Vzkcc0hQDRDlSjYu3DwHo6y5KYA7wajGtR0SM+w3+conLtIPfsCi9xxHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708025457; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gEt4deq/UXy6XjJi0lNE/l34mZOHICza+3YtE+V4xPU=; b=P0v8zM6uXsTuRr3BB5mb7U8RkkjwZ2Xo38fIj2s/cQ3SPAppMWLCyEjCgw5ZeygohVX7ST/gI82ilAwuO3ysfsT8kz/UJdK6zgpegUSq1QpUVjaia0FQXYCxo9Bg5agNr683ovVA1iTjK/AK23oVY+QC0qCE4Dg5PLAvwORScvY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170802545711418.69509449936993; Thu, 15 Feb 2024 11:30:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rahQ2-0001k0-GV; Thu, 15 Feb 2024 14:29:14 -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 1rahQ0-0001ir-N7 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:12 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rahPj-0004i7-GF for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:11 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1d7881b1843so11201095ad.3 for ; Thu, 15 Feb 2024 11:28:51 -0800 (PST) Received: from duncan.localdomain (114-35-142-126.hinet-ip.hinet.net. [114.35.142.126]) by smtp.gmail.com with ESMTPSA id u8-20020a170902a60800b001db5ee73fe9sm1618653plq.114.2024.02.15.11.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708025329; x=1708630129; darn=nongnu.org; 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=gEt4deq/UXy6XjJi0lNE/l34mZOHICza+3YtE+V4xPU=; b=aLXYWJAH7BfLmCtSEjsfLQENezwx4n7JvzqGWJuc0o6ZUU03Yb3fYU2RWYziSbT1uL kwueU/j4N9mirvNqZ+BfjQ6tiKuma1DwHTzw4R5XC2bDvRsjj+VFXme5aUNdhmovB5j+ agyWb/Z/BjvkSw+q3p/Uc4d5KAtugPz6zPw7BdZsqJP6Njhx+ma+HbiAav8z+Pl1ruXM 4TWzxKqB614QgmcB616Js3X0Ir4JK+ncQtL/ekDn11Hu/GeAt3hfU9Z7TbFBjgfxy7Z5 QCq/3ZwnbBUDwLkrSdyePr7El0q2BaiUSiXAf/MLivlvXQS1ir4K9ZsMO2h8zH7atXUB uZKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708025329; x=1708630129; 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=gEt4deq/UXy6XjJi0lNE/l34mZOHICza+3YtE+V4xPU=; b=HFuleJygEI3SrbfSQ3/n0QVYOq1jgPRN64onxX7hkM1AwXFi80v2gixAukx1VrWR7A 1y14/cOm+L6tHDx3JMC18EPDUSBQ9La4sVQ2TyA8FGr1hpRLlILDfZsi6fqZxZysYSbn r2caXYzwdx+RkqbBtSvY2nHLLWkh5GhJSWkV7bGO76XFmrngw57ekLCOq3XiGNoMuTYA Jyjb2u33R2w7gFK8FU5CpYyhmKZF70afrRDKjm8PB1j/gpEuUQE8uV6z7ZuOFZYZz2lJ AA/VktFfq6MSkOob7G4hfYIzJraSfiH2bzHzb36saW4yAlZzQdHPdDUNA6JGIfzvwd3M /PbQ== X-Gm-Message-State: AOJu0YwZwc9TB5gGjbUgZ5sf+v1U9QKSuDQbWpoS6pbzu2gJ86FGaMR1 G7cFLLJQdFGHyC37AwkOSQAZn7OuyrrrxztdYzuhle9MubF24TnTqA/rPia9yMShWBkdPpj+K+6 F06Eh4SOOA8sM/5blEIXFtshraucPNtv7f2TVrfAoo+XoFH1iVzic1jAys0F/tPcoyIaJnI/rJZ GWp2mmiew7pRcNY2wJuK+0Y61PyV99KY5aepl/ieFU X-Google-Smtp-Source: AGHT+IGHAHX1Tw7jQlHnb04leAp3wxKMj30AYnshK4kIzS48wvnjbVhwfahXCANJ18i+CPSkRl/wkw== X-Received: by 2002:a17:903:24c:b0:1d4:cd4d:923b with SMTP id j12-20020a170903024c00b001d4cd4d923bmr3115439plh.54.1708025329019; Thu, 15 Feb 2024 11:28:49 -0800 (PST) From: Max Chou To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: dbarboza@ventanamicro.com, Max Chou , Riku Voipio , Richard Henderson , Paolo Bonzini Subject: [RFC PATCH 5/6] accel/tcg: Inline do_ld1_mmu function Date: Fri, 16 Feb 2024 03:28:16 +0800 Message-Id: <20240215192823.729209-6-max.chou@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215192823.729209-1-max.chou@sifive.com> References: <20240215192823.729209-1-max.chou@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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::62b; envelope-from=max.chou@sifive.com; helo=mail-pl1-x62b.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, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1708025457859100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Chou --- accel/tcg/user-exec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index c5453810eee..803c271df11 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -963,8 +963,9 @@ static inline QEMU_ALWAYS_INLINE void *cpu_mmu_lookup(C= PUState *cpu, =20 #include "ldst_atomicity.c.inc" =20 -static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi, - uintptr_t ra, MMUAccessType access_type) +static inline QEMU_ALWAYS_INLINE uint8_t do_ld1_mmu(CPUState *cpu, vaddr a= ddr, + MemOpIdx oi, uintptr_t= ra, + MMUAccessType access_t= ype) { void *haddr; uint8_t ret; --=20 2.34.1 From nobody Fri Nov 1 05:41:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1708025490; cv=none; d=zohomail.com; s=zohoarc; b=mM/83wFagsG3ZMq6LLDfTmH5cCPoiTDYLg2Xx2H+x0Yyl916qgSAvu8XalKx2O86RHSK3gGkS7ZtlKxSGocJffA6OAEbdNRa7WaY4VmxandJnLbJDIvT66VPzTCHNClYhkZFQqYV8WRI92Xcdkbd/DAWXoQp4idC27K4rVoE3MY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708025490; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hnoQZWyM3IQrdfNlHpKnjwy/1Zr4Y+mdXFsSbK4jOXc=; b=Va98TTnANiIZOe+m5uK0umQdP9vDBWXC3snDkC1Wy0m8bQCChJ9558ywsva6TxIpFQKUWTe6pUw8gnlEpogJlT5v55gadDGtkdrwGISplqmFtGeGGZZVhrur5FWnkmmKNTQbIUWflO53zxuVMYao5V7JaLlg64xRypbw+6R9pbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708025490200559.3193072956634; Thu, 15 Feb 2024 11:31:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rahQ6-0001lG-BS; Thu, 15 Feb 2024 14:29:19 -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 1rahQ3-0001kY-Od for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:16 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rahPj-0004iZ-72 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 14:29:15 -0500 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-296cca9169bso1060323a91.3 for ; Thu, 15 Feb 2024 11:28:53 -0800 (PST) Received: from duncan.localdomain (114-35-142-126.hinet-ip.hinet.net. [114.35.142.126]) by smtp.gmail.com with ESMTPSA id u8-20020a170902a60800b001db5ee73fe9sm1618653plq.114.2024.02.15.11.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708025332; x=1708630132; darn=nongnu.org; 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=hnoQZWyM3IQrdfNlHpKnjwy/1Zr4Y+mdXFsSbK4jOXc=; b=CtdvXNJ4VbnpEP0ovK72hVQ2e6ihvnIHCCvhQ5BFEq3My4WXqYYvmIMyN/PtfFL5uN FnRnHw+zOcpYl79z4uQZfjUgNYr9NtndKML7XPMcN1fYvONv8ZvV3lbU7s3MViuy4y0g Y4Dx27UFdLgDfzVoD3YV17SKPTT+HqBIONrSxcQN84uRsu7JmAYP6EtA9i/WB1i6kMSo ZJFmBWtcieSSuPrrqan932hvPB5YjYekqWsljeGq5+uahqoX5tKKTcMmPVfKondu/A40 3gEl1DfRTm8fFGe6GnGlJFP4AYQ3y8HmjOJJd9cD66V22N34YmaOErdweeYBh2/szn5e 25Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708025332; x=1708630132; 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=hnoQZWyM3IQrdfNlHpKnjwy/1Zr4Y+mdXFsSbK4jOXc=; b=Pk2gFk7JAV2loiW7tEbus/0417PihjfkUn+T9JmvQJlmrtp/k9/OlgnjMLKo4++03d 7GYVBxpt88Ifv6syj9MKehyKSwtF8hLG2mwPC311pQaFPQm3w9lpdh9kLLFSCPAE4L7F psH/3Jy6CWbcKfGSd9kdRoH4efyvI0b/pnAOhp7Tla922DtmRTivPlUoxoVZ7Wu7qGrH AgiNusZ0JcbElQa3gfcolDlhBsP2aHGBfdra3E+ONgFperzm3j/5F8fgA25sFws7obrU boQavF4F5dbkxttzumtnwK5NK1nXTnsjY18yw0xP49zPo111EVEG3b3hyQ9SjZyDqluW lEZA== X-Gm-Message-State: AOJu0Yxur88s4f7Ztr9yWV6HoQq5sxbuYio4Vr5Lv0MMfkS5rTmkLfa9 joSEyeAtzUDUQ+H4kNfzM40RpiUX8UmPPQsmMhX4QHPZsVE/Yl5gYmAsFtkZp9VXgnNywt7qImE rUN/aw2A2gbldji44is5Z6/NidEbJu5gmV0ZrPjGm3zMMf+1cpamNOhjvJ0O+/cqSri9mA8eJT1 zFr/6WMaJ57L2Kq4cTq2Egz9kVTuJ/siNJsJNta3lK X-Google-Smtp-Source: AGHT+IG5YuTs6vjhF3Bi69Xsf/3ASVE8egLuLKosMtoQKuXI34cy1tP7UDdbE3vL9XaQUz9VElWqJw== X-Received: by 2002:a17:90b:154b:b0:299:ed7:24fc with SMTP id ig11-20020a17090b154b00b002990ed724fcmr1910269pjb.49.1708025332282; Thu, 15 Feb 2024 11:28:52 -0800 (PST) From: Max Chou To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: dbarboza@ventanamicro.com, Max Chou , Riku Voipio , Richard Henderson , Paolo Bonzini Subject: [RFC PATCH 6/6] accel/tcg: Inline do_st1_mmu function Date: Fri, 16 Feb 2024 03:28:17 +0800 Message-Id: <20240215192823.729209-7-max.chou@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215192823.729209-1-max.chou@sifive.com> References: <20240215192823.729209-1-max.chou@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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::102f; envelope-from=max.chou@sifive.com; helo=mail-pj1-x102f.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1708025492097100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Chou --- accel/tcg/user-exec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 803c271df11..9ef35a22279 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -1050,8 +1050,9 @@ static Int128 do_ld16_mmu(CPUState *cpu, abi_ptr addr, return ret; } =20 -static void do_st1_mmu(CPUState *cpu, vaddr addr, uint8_t val, - MemOpIdx oi, uintptr_t ra) +static inline QEMU_ALWAYS_INLINE void do_st1_mmu(CPUState *cpu, vaddr addr, + uint8_t val, MemOpIdx oi, + uintptr_t ra) { void *haddr; =20 --=20 2.34.1