From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544196; cv=none; d=zohomail.com; s=zohoarc; b=YAENhgOF6DBR/YkxDwM7W6CPOpslFBehTv2IqQb5arVOi3dJ7HBVD+MajHafn5vnXts4ikmCZ8IrYP24zHGcNPOPbsn/JAjiGraNwoHpL9iSlQz4XASybRCiVHU8dTK5mHG3MExFf7PSxLzvEltcKyVJElNwhIC0PYLfI+L4KZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544196; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wvg9WjX7UAO8KXTCCv7ywlSMjmb3tOgzFJrxv4AFZHA=; b=ks9yFzc3jDjOkJOWtMERg5yamE7A3C0D/9rN4QO6fEBuqQbVegIcuJqxF5Mv2xT2lmmNzFhA/omWtg/ycCg5kqOo0HPTKIS0MvsxW78kZau7wXtLgyeVGvxlL5QyCQ1n1FhWl52ESIXEcijsxX3bUnMrciJoDvAuS29AORswMhY= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544196845339.71152832315806; Tue, 27 Apr 2021 10:23:16 -0700 (PDT) Received: from localhost ([::1]:43106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRQZ-00048y-M9 for importer@patchew.org; Tue, 27 Apr 2021 13:23:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLa-0001Gx-FR; Tue, 27 Apr 2021 13:18:06 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLY-00023I-SP; Tue, 27 Apr 2021 13:18:06 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:52 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 166EC8013BA; Tue, 27 Apr 2021 14:16:52 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 01/15] decodetree: Add support for 64-bit instructions Date: Tue, 27 Apr 2021 14:16:35 -0300 Message-Id: <20210427171649.364699-2-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:52.0277 (UTC) FILETIME=[1D889E50:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, Luis Pires , lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Allow '64' to be specified for the instruction width command line params and use the appropriate insn/field data types, mask, extract and deposit functions in that case. This will be used to implement the new 64-bit Power ISA 3.1 instructions. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Luis Pires Message-Id: Signed-off-by: Richard Henderson --- docs/devel/decodetree.rst | 5 +++-- scripts/decodetree.py | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst index 74f66bf46e..d776dae14f 100644 --- a/docs/devel/decodetree.rst +++ b/docs/devel/decodetree.rst @@ -40,8 +40,9 @@ and returns an integral value extracted from there. =20 A field with no ``unnamed_fields`` and no ``!function`` is in error. =20 -FIXME: the fields of the structure into which this result will be stored -is restricted to ``int``. Which means that we cannot expand 64-bit items. +The fields of the structure into which this result will be stored are +defined as ``int`` when the instruction size is set to 16 or 32 bits +and as ``int64_t`` when the instruction size is set to 64 bits. =20 Field examples: =20 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 4637b633e7..26156dfc36 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -42,6 +42,10 @@ output_fd =3D None insntype =3D 'uint32_t' decode_function =3D 'decode' +field_data_type =3D 'int' +extract_function =3D 'extract32' +sextract_function =3D 'sextract32' +deposit_function =3D 'deposit32' =20 # An identifier for C. re_C_ident =3D '[a-zA-Z][a-zA-Z0-9_]*' @@ -185,9 +189,9 @@ def __str__(self): =20 def str_extract(self): if self.sign: - extr =3D 'sextract32' + extr =3D sextract_function else: - extr =3D 'extract32' + extr =3D extract_function return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len) =20 def __eq__(self, other): @@ -215,8 +219,9 @@ def str_extract(self): if pos =3D=3D 0: ret =3D f.str_extract() else: - ret =3D 'deposit32({0}, {1}, {2}, {3})' \ - .format(ret, pos, 32 - pos, f.str_extract()) + ret =3D '{4}({0}, {1}, {2}, {3})' \ + .format(ret, pos, insnwidth - pos, + f.str_extract(), deposit_function) pos +=3D f.len return ret =20 @@ -311,7 +316,7 @@ def output_def(self): if not self.extern: output('typedef struct {\n') for n in self.fields: - output(' int ', n, ';\n') + output(' ', field_data_type, ' ', n, ';\n') output('} ', self.struct_name(), ';\n\n') # end Arguments =20 @@ -1264,6 +1269,10 @@ def main(): global insntype global insnmask global decode_function + global extract_function + global sextract_function + global deposit_function + global field_data_type global variablewidth global anyextern =20 @@ -1293,6 +1302,13 @@ def main(): if insnwidth =3D=3D 16: insntype =3D 'uint16_t' insnmask =3D 0xffff + elif insnwidth =3D=3D 64: + insntype =3D 'uint64_t' + insnmask =3D 0xffffffffffffffff + field_data_type =3D 'int64_t' + extract_function =3D 'extract64' + sextract_function =3D 'sextract64' + deposit_function =3D 'deposit64' elif insnwidth !=3D 32: error(0, 'cannot handle insns of width', insnwidth) else: --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544184; cv=none; d=zohomail.com; s=zohoarc; b=h35Qh59YsZtLXugIPDay2uFIwwjOu80x7RQVRS7ZgG6hdsRiMYz3YM+kBdqzoGA4a09XDDM1hyNeOFmrQirc1bliW+gKxPIz9TSMLxlDzr1cjnEnmXJBm1x+WWdXtlz3fbidEJl45DemqqdY2s0C6eDNUuss8xFHJOpZWN814d8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544184; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e0bGutImhsMzFyA73ym1jQzVbj47BrvoKZKLxMAUQjM=; b=ZK9YAGYQXHol0YL0AlNjdxyOkZSpVukFx32h1mRF0mz3Q2d95N+JuCimpLR8WyhxoPOwvtRPXrFNERnAMI4U9g0NRPjSS+kw1n3GLSiDpwbPWsyhDS06W3mImVTrr3GYdaojzAy/bCCBZSaqXcTSMh7gq3+yX5364pxqKzICwIY= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544184622532.2260684837601; Tue, 27 Apr 2021 10:23:04 -0700 (PDT) Received: from localhost ([::1]:42428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRQN-0003rd-Ft for importer@patchew.org; Tue, 27 Apr 2021 13:23:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLd-0001Kn-Bw; Tue, 27 Apr 2021 13:18:09 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLb-00023I-Hb; Tue, 27 Apr 2021 13:18:09 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:52 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 4231D80139F; Tue, 27 Apr 2021 14:16:52 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 02/15] target/ppc: Add cia field to DisasContext Date: Tue, 27 Apr 2021 14:16:36 -0300 Message-Id: <20210427171649.364699-3-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:52.0449 (UTC) FILETIME=[1DA2DD10:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/translate.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 0984ce637b..ee25badba2 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -154,6 +154,7 @@ void ppc_translate_init(void) /* internal defines */ struct DisasContext { DisasContextBase base; + target_ulong cia; /* current instruction address */ uint32_t opcode; uint32_t exception; /* Routine used to access memory */ @@ -254,7 +255,7 @@ static void gen_exception_err(DisasContext *ctx, uint32= _t excp, uint32_t error) * faulting instruction */ if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { - gen_update_nip(ctx, ctx->base.pc_next - 4); + gen_update_nip(ctx, ctx->cia); } t0 =3D tcg_const_i32(excp); t1 =3D tcg_const_i32(error); @@ -273,7 +274,7 @@ static void gen_exception(DisasContext *ctx, uint32_t e= xcp) * faulting instruction */ if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { - gen_update_nip(ctx, ctx->base.pc_next - 4); + gen_update_nip(ctx, ctx->cia); } t0 =3D tcg_const_i32(excp); gen_helper_raise_exception(cpu_env, t0); @@ -3113,7 +3114,7 @@ static void gen_eieio(DisasContext *ctx) */ if (!(ctx->insns_flags2 & PPC2_ISA300)) { qemu_log_mask(LOG_GUEST_ERROR, "invalid eieio using bit 6 at @" - TARGET_FMT_lx "\n", ctx->base.pc_next - 4); + TARGET_FMT_lx "\n", ctx->cia); } else { bar =3D TCG_MO_ST_LD; } @@ -3782,14 +3783,14 @@ static void gen_b(DisasContext *ctx) li =3D LI(ctx->opcode); li =3D (li ^ 0x02000000) - 0x02000000; if (likely(AA(ctx->opcode) =3D=3D 0)) { - target =3D ctx->base.pc_next + li - 4; + target =3D ctx->cia + li; } else { target =3D li; } if (LK(ctx->opcode)) { gen_setlr(ctx, ctx->base.pc_next); } - gen_update_cfar(ctx, ctx->base.pc_next - 4); + gen_update_cfar(ctx, ctx->cia); gen_goto_tb(ctx, 0, target); } =20 @@ -3888,11 +3889,11 @@ static void gen_bcond(DisasContext *ctx, int type) } tcg_temp_free_i32(temp); } - gen_update_cfar(ctx, ctx->base.pc_next - 4); + gen_update_cfar(ctx, ctx->cia); if (type =3D=3D BCOND_IM) { target_ulong li =3D (target_long)((int16_t)(BD(ctx->opcode))); if (likely(AA(ctx->opcode) =3D=3D 0)) { - gen_goto_tb(ctx, 0, ctx->base.pc_next + li - 4); + gen_goto_tb(ctx, 0, ctx->cia + li); } else { gen_goto_tb(ctx, 0, li); } @@ -4008,7 +4009,7 @@ static void gen_rfi(DisasContext *ctx) if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } - gen_update_cfar(ctx, ctx->base.pc_next - 4); + gen_update_cfar(ctx, ctx->cia); gen_helper_rfi(cpu_env); gen_sync_exception(ctx); #endif @@ -4025,7 +4026,7 @@ static void gen_rfid(DisasContext *ctx) if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } - gen_update_cfar(ctx, ctx->base.pc_next - 4); + gen_update_cfar(ctx, ctx->cia); gen_helper_rfid(cpu_env); gen_sync_exception(ctx); #endif @@ -4042,7 +4043,7 @@ static void gen_rfscv(DisasContext *ctx) if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } - gen_update_cfar(ctx, ctx->base.pc_next - 4); + gen_update_cfar(ctx, ctx->cia); gen_helper_rfscv(cpu_env); gen_sync_exception(ctx); #endif @@ -4338,7 +4339,7 @@ static inline void gen_op_mfspr(DisasContext *ctx) if (sprn !=3D SPR_PVR) { qemu_log_mask(LOG_GUEST_ERROR, "Trying to read privileged = spr " "%d (0x%03x) at " TARGET_FMT_lx "\n", sprn, = sprn, - ctx->base.pc_next - 4); + ctx->cia); } gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG); } @@ -4352,7 +4353,7 @@ static inline void gen_op_mfspr(DisasContext *ctx) /* Not defined */ qemu_log_mask(LOG_GUEST_ERROR, "Trying to read invalid spr %d (0x%03x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - = 4); + TARGET_FMT_lx "\n", sprn, sprn, ctx->cia); =20 /* * The behaviour depends on MSR:PR and SPR# bit 0x10, it can @@ -4516,7 +4517,7 @@ static void gen_mtspr(DisasContext *ctx) /* Privilege exception */ qemu_log_mask(LOG_GUEST_ERROR, "Trying to write privileged spr= " "%d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, - ctx->base.pc_next - 4); + ctx->cia); gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG); } } else { @@ -4530,7 +4531,7 @@ static void gen_mtspr(DisasContext *ctx) /* Not defined */ qemu_log_mask(LOG_GUEST_ERROR, "Trying to write invalid spr %d (0x%03x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - = 4); + TARGET_FMT_lx "\n", sprn, sprn, ctx->cia); =20 =20 /* @@ -8002,6 +8003,7 @@ static void ppc_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cs) LOG_DISAS("nip=3D" TARGET_FMT_lx " super=3D%d ir=3D%d\n", ctx->base.pc_next, ctx->mem_idx, (int)msr_ir); =20 + ctx->cia =3D ctx->base.pc_next; ctx->opcode =3D translator_ldl_swap(env, ctx->base.pc_next, need_byteswap(ctx)); =20 @@ -8031,7 +8033,7 @@ static void ppc_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cs) TARGET_FMT_lx " %d\n", opc1(ctx->opcode), opc2(ctx->opcode), opc3(ctx->opcode), opc4(ctx->opcode), - ctx->opcode, ctx->base.pc_next - 4, (int)msr_ir); + ctx->opcode, ctx->cia, (int)msr_ir); } else { uint32_t inval; =20 @@ -8048,7 +8050,7 @@ static void ppc_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cs) TARGET_FMT_lx "\n", ctx->opcode & inval, opc1(ctx->opcode), opc2(ctx->opcode), opc3(ctx->opcode), opc4(ctx->opcode), - ctx->opcode, ctx->base.pc_next - 4); + ctx->opcode, ctx->cia); gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); ctx->base.is_jmp =3D DISAS_NORETURN; return; --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544495; cv=none; d=zohomail.com; s=zohoarc; b=dvu76QemTSKqKnwNJOS0BuchVyHlyRsHgXqQEwFHKJN/WMV74A6qN4l7O93n0pHi4TGa/qHb7t54arP5B1q144K60QAJwVx9VFpa3Y0y7IIYwuZ9DkNzqCe5cTTQS6ghBv8z1aGEngjsEj9ItPcJk0/gCkWrYBPuJEuVetDqDJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544495; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rtOufBOxqjh/9BCDauGsAzoNAvaxo0UdFXvpQ0A0brM=; b=eCll69XMSYTMJbvrFrYNOw33CJ7x+NwScdikqrrFh5RL62o9cYHaqh5E8B9DYz9HiaWO8eUNrdPEAZO5nZ0+rVUMy5ZPX9h+b0TEAeRTlggA8u3CSxvjkEAlU2yYHqZeyuXiLf8j1G8Lwez9GvoCYpBIrBq7i2QlcnB5MeghisE= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544495899979.1655445703083; Tue, 27 Apr 2021 10:28:15 -0700 (PDT) Received: from localhost ([::1]:52494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRVO-00089F-Lf for importer@patchew.org; Tue, 27 Apr 2021 13:28:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLh-0001Qa-6R; Tue, 27 Apr 2021 13:18:13 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLe-00023I-D1; Tue, 27 Apr 2021 13:18:12 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:52 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 6B7A68013BA; Tue, 27 Apr 2021 14:16:52 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 03/15] target/ppc: Split out decode_legacy Date: Tue, 27 Apr 2021 14:16:37 -0300 Message-Id: <20210427171649.364699-4-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:52.0667 (UTC) FILETIME=[1DC420B0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/translate.c | 115 +++++++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 51 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index ee25badba2..ebe5afe7ae 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -7876,6 +7876,62 @@ void ppc_cpu_dump_statistics(CPUState *cs, int flags) #endif } =20 +static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t ins= n) +{ + opc_handler_t **table, *handler; + uint32_t inval; + + ctx->opcode =3D insn; + + LOG_DISAS("translate opcode %08x (%02x %02x %02x %02x) (%s)\n", + insn, opc1(insn), opc2(insn), opc3(insn), opc4(insn), + ctx->le_mode ? "little" : "big"); + + table =3D cpu->opcodes; + handler =3D table[opc1(insn)]; + if (is_indirect_opcode(handler)) { + table =3D ind_table(handler); + handler =3D table[opc2(insn)]; + if (is_indirect_opcode(handler)) { + table =3D ind_table(handler); + handler =3D table[opc3(insn)]; + if (is_indirect_opcode(handler)) { + table =3D ind_table(handler); + handler =3D table[opc4(insn)]; + } + } + } + + /* Is opcode *REALLY* valid ? */ + if (unlikely(handler->handler =3D=3D &gen_invalid)) { + qemu_log_mask(LOG_GUEST_ERROR, "invalid/unsupported opcode: " + "%02x - %02x - %02x - %02x (%08x) " + TARGET_FMT_lx "\n", + opc1(insn), opc2(insn), opc3(insn), opc4(insn), + insn, ctx->cia); + return false; + } + + if (unlikely(handler->type & (PPC_SPE | PPC_SPE_SINGLE | PPC_SPE_DOUBL= E) + && Rc(insn))) { + inval =3D handler->inval2; + } else { + inval =3D handler->inval1; + } + + if (unlikely((insn & inval) !=3D 0)) { + qemu_log_mask(LOG_GUEST_ERROR, "invalid bits: %08x for opcode: " + "%02x - %02x - %02x - %02x (%08x) " + TARGET_FMT_lx "\n", insn & inval, + opc1(insn), opc2(insn), opc3(insn), opc4(insn), + insn, ctx->cia); + return false; + } + + handler->handler(ctx); + return true; +} + static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *= cs) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); @@ -7997,66 +8053,23 @@ static void ppc_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cs) DisasContext *ctx =3D container_of(dcbase, DisasContext, base); PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D cs->env_ptr; - opc_handler_t **table, *handler; + uint32_t insn; + bool ok; =20 LOG_DISAS("----------------\n"); LOG_DISAS("nip=3D" TARGET_FMT_lx " super=3D%d ir=3D%d\n", ctx->base.pc_next, ctx->mem_idx, (int)msr_ir); =20 ctx->cia =3D ctx->base.pc_next; - ctx->opcode =3D translator_ldl_swap(env, ctx->base.pc_next, - need_byteswap(ctx)); - - LOG_DISAS("translate opcode %08x (%02x %02x %02x %02x) (%s)\n", - ctx->opcode, opc1(ctx->opcode), opc2(ctx->opcode), - opc3(ctx->opcode), opc4(ctx->opcode), - ctx->le_mode ? "little" : "big"); + insn =3D translator_ldl_swap(env, ctx->base.pc_next, need_byteswap(ctx= )); ctx->base.pc_next +=3D 4; - table =3D cpu->opcodes; - handler =3D table[opc1(ctx->opcode)]; - if (is_indirect_opcode(handler)) { - table =3D ind_table(handler); - handler =3D table[opc2(ctx->opcode)]; - if (is_indirect_opcode(handler)) { - table =3D ind_table(handler); - handler =3D table[opc3(ctx->opcode)]; - if (is_indirect_opcode(handler)) { - table =3D ind_table(handler); - handler =3D table[opc4(ctx->opcode)]; - } - } - } - /* Is opcode *REALLY* valid ? */ - if (unlikely(handler->handler =3D=3D &gen_invalid)) { - qemu_log_mask(LOG_GUEST_ERROR, "invalid/unsupported opcode: " - "%02x - %02x - %02x - %02x (%08x) " - TARGET_FMT_lx " %d\n", - opc1(ctx->opcode), opc2(ctx->opcode), - opc3(ctx->opcode), opc4(ctx->opcode), - ctx->opcode, ctx->cia, (int)msr_ir); - } else { - uint32_t inval; =20 - if (unlikely(handler->type & (PPC_SPE | PPC_SPE_SINGLE | PPC_SPE_D= OUBLE) - && Rc(ctx->opcode))) { - inval =3D handler->inval2; - } else { - inval =3D handler->inval1; - } - - if (unlikely((ctx->opcode & inval) !=3D 0)) { - qemu_log_mask(LOG_GUEST_ERROR, "invalid bits: %08x for opcode:= " - "%02x - %02x - %02x - %02x (%08x) " - TARGET_FMT_lx "\n", ctx->opcode & inval, - opc1(ctx->opcode), opc2(ctx->opcode), - opc3(ctx->opcode), opc4(ctx->opcode), - ctx->opcode, ctx->cia); - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); - ctx->base.is_jmp =3D DISAS_NORETURN; - return; - } + ok =3D decode_legacy(cpu, ctx, insn); + if (!ok) { + gen_invalid(ctx); + ctx->base.is_jmp =3D DISAS_NORETURN; } - (*(handler->handler))(ctx); + #if defined(DO_PPC_STATISTICS) handler->count++; #endif --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544307; cv=none; d=zohomail.com; s=zohoarc; b=YlffQ0cnS41ghmNm1D8WKaDbpBOdnR8BYeQHk2h8DUblUBtlgOKDFre4+1IP9dbP9rR3uAgl3XINpoHKKELoe5JETy+uCfYY6wCFbRnGFga1aNKgaqUAVimCuZPdumsWhTXmh8dfC2uug8upIeFGDfadihO1UZFoLyBPYedhss4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544307; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V7aR1GAJzVZB/Wz7J/qSkYqZtugmVo6x9KAz3g5iLRY=; b=ePU7HaAuPyzE6Zgru9SOYre+OTFGwjnWRhhwow0ni0+mQWG69GPNvVhLkrGKeBCSPasqCe+Uyf0KBwrbZsny8A78ny+5Vy7ePlsnx/ZW2AfjaHl7Lntc8HQ0fmq9s9Yf7sSGs7gagTgVf9w/zEddOT9mela6ypbHdvBkWf90FaA= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544307746687.1360366108662; Tue, 27 Apr 2021 10:25:07 -0700 (PDT) Received: from localhost ([::1]:47034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRSM-0005oX-Bn for importer@patchew.org; Tue, 27 Apr 2021 13:25:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLk-0001Wf-Iv; Tue, 27 Apr 2021 13:18:16 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLi-00023I-8n; Tue, 27 Apr 2021 13:18:16 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:52 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 9ED0D80139F; Tue, 27 Apr 2021 14:16:52 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 04/15] target/ppc: Move DISAS_NORETURN setting into gen_exception* Date: Tue, 27 Apr 2021 14:16:38 -0300 Message-Id: <20210427171649.364699-5-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:52.0870 (UTC) FILETIME=[1DE31A60:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, Luis Pires , lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson There are other valid settings for is_jmp besides DISAS_NEXT and DISAS_NORETURN, so eliminating that dichotomy from ppc_tr_translate_insn is helpful. Signed-off-by: Richard Henderson Signed-off-by: Luis Pires --- target/ppc/translate.c | 65 ++++++++++++++++----------------- target/ppc/translate_init.c.inc | 42 ++++++++++----------- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index ebe5afe7ae..46de2dab27 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -263,6 +263,7 @@ static void gen_exception_err(DisasContext *ctx, uint32= _t excp, uint32_t error) tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); ctx->exception =3D (excp); + ctx->base.is_jmp =3D DISAS_NORETURN; } =20 static void gen_exception(DisasContext *ctx, uint32_t excp) @@ -280,6 +281,7 @@ static void gen_exception(DisasContext *ctx, uint32_t e= xcp) gen_helper_raise_exception(cpu_env, t0); tcg_temp_free_i32(t0); ctx->exception =3D (excp); + ctx->base.is_jmp =3D DISAS_NORETURN; } =20 static void gen_exception_nip(DisasContext *ctx, uint32_t excp, @@ -292,6 +294,7 @@ static void gen_exception_nip(DisasContext *ctx, uint32= _t excp, gen_helper_raise_exception(cpu_env, t0); tcg_temp_free_i32(t0); ctx->exception =3D (excp); + ctx->base.is_jmp =3D DISAS_NORETURN; } =20 /* @@ -337,6 +340,7 @@ static void gen_debug_exception(DisasContext *ctx) t0 =3D tcg_const_i32(EXCP_DEBUG); gen_helper_raise_exception(cpu_env, t0); tcg_temp_free_i32(t0); + ctx->base.is_jmp =3D DISAS_NORETURN; } =20 static inline void gen_inval_exception(DisasContext *ctx, uint32_t error) @@ -357,20 +361,18 @@ static inline void gen_hvpriv_exception(DisasContext = *ctx, uint32_t error) } =20 /* Stop translation */ -static inline void gen_stop_exception(DisasContext *ctx) +static inline void gen_end_tb_exception(DisasContext *ctx, uint32_t excp) { - gen_update_nip(ctx, ctx->base.pc_next); - ctx->exception =3D POWERPC_EXCP_STOP; + /* No need to update nip for SYNC/BRANCH, as execution flow will chang= e */ + if ((excp !=3D POWERPC_EXCP_SYNC) && + (excp !=3D POWERPC_EXCP_BRANCH)) + { + gen_update_nip(ctx, ctx->base.pc_next); + } + ctx->exception =3D excp; + ctx->base.is_jmp =3D DISAS_NORETURN; } =20 -#ifndef CONFIG_USER_ONLY -/* No need to update nip here, as execution flow will change */ -static inline void gen_sync_exception(DisasContext *ctx) -{ - ctx->exception =3D POWERPC_EXCP_SYNC; -} -#endif - #define GEN_HANDLER(name, opc1, opc2, opc3, inval, type) = \ GEN_OPCODE(name, opc1, opc2, opc3, inval, type, PPC_NONE) =20 @@ -1863,7 +1865,7 @@ static void gen_darn(DisasContext *ctx) gen_helper_darn64(cpu_gpr[rD(ctx->opcode)]); } if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } } @@ -3159,7 +3161,7 @@ static void gen_isync(DisasContext *ctx) gen_check_tlb_flush(ctx, false); } tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } =20 #define MEMOP_GET_SIZE(x) (1 << ((x) & MO_SIZE)) @@ -3778,7 +3780,8 @@ static void gen_b(DisasContext *ctx) { target_ulong li, target; =20 - ctx->exception =3D POWERPC_EXCP_BRANCH; + gen_end_tb_exception(ctx, POWERPC_EXCP_BRANCH); + /* sign extend LI */ li =3D LI(ctx->opcode); li =3D (li ^ 0x02000000) - 0x02000000; @@ -3804,7 +3807,8 @@ static void gen_bcond(DisasContext *ctx, int type) uint32_t bo =3D BO(ctx->opcode); TCGLabel *l1; TCGv target; - ctx->exception =3D POWERPC_EXCP_BRANCH; + + gen_end_tb_exception(ctx, POWERPC_EXCP_BRANCH); =20 if (type =3D=3D BCOND_LR || type =3D=3D BCOND_CTR || type =3D=3D BCOND= _TAR) { target =3D tcg_temp_local_new(); @@ -4011,7 +4015,7 @@ static void gen_rfi(DisasContext *ctx) } gen_update_cfar(ctx, ctx->cia); gen_helper_rfi(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif } =20 @@ -4028,7 +4032,7 @@ static void gen_rfid(DisasContext *ctx) } gen_update_cfar(ctx, ctx->cia); gen_helper_rfid(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif } =20 @@ -4045,7 +4049,7 @@ static void gen_rfscv(DisasContext *ctx) } gen_update_cfar(ctx, ctx->cia); gen_helper_rfscv(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif } #endif @@ -4058,7 +4062,7 @@ static void gen_hrfid(DisasContext *ctx) /* Restore CPU state */ CHK_HV; gen_helper_hrfid(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif } #endif @@ -4444,7 +4448,7 @@ static void gen_mtmsrd(DisasContext *ctx) gen_helper_store_msr(cpu_env, cpu_gpr[rS(ctx->opcode)]); } /* Must stop the translation as machine state (may have) changed */ - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); #endif /* !defined(CONFIG_USER_ONLY) */ } #endif /* defined(TARGET_PPC64) */ @@ -4489,7 +4493,7 @@ static void gen_mtmsr(DisasContext *ctx) tcg_temp_free(msr); } /* Must stop the translation as machine state (may have) changed */ - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); #endif } =20 @@ -5944,7 +5948,7 @@ static void gen_rfsvc(DisasContext *ctx) CHK_SV; =20 gen_helper_rfsvc(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6324,7 +6328,7 @@ static void gen_rfci_40x(DisasContext *ctx) CHK_SV; /* Restore CPU state */ gen_helper_40x_rfci(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6336,7 +6340,7 @@ static void gen_rfci(DisasContext *ctx) CHK_SV; /* Restore CPU state */ gen_helper_rfci(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6351,7 +6355,7 @@ static void gen_rfdi(DisasContext *ctx) CHK_SV; /* Restore CPU state */ gen_helper_rfdi(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6364,7 +6368,7 @@ static void gen_rfmci(DisasContext *ctx) CHK_SV; /* Restore CPU state */ gen_helper_rfmci(cpu_env); - gen_sync_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_SYNC); #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6626,7 +6630,7 @@ static void gen_wrtee(DisasContext *ctx) * Stop translation to have a chance to raise an exception if we * just set msr_ee to 1 */ - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6640,7 +6644,7 @@ static void gen_wrteei(DisasContext *ctx) if (ctx->opcode & 0x00008000) { tcg_gen_ori_tl(cpu_msr, cpu_msr, (1 << MSR_EE)); /* Stop translation to have a chance to raise an exception */ - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } else { tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(1 << MSR_EE)); } @@ -8037,7 +8041,6 @@ static bool ppc_tr_breakpoint_check(DisasContextBase = *dcbase, CPUState *cs, DisasContext *ctx =3D container_of(dcbase, DisasContext, base); =20 gen_debug_exception(ctx); - dcbase->is_jmp =3D DISAS_NORETURN; /* * The address covered by the breakpoint must be included in * [tb->pc, tb->pc + tb->size) in order to for it to be properly @@ -8067,7 +8070,6 @@ static void ppc_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cs) ok =3D decode_legacy(cpu, ctx, insn); if (!ok) { gen_invalid(ctx); - ctx->base.is_jmp =3D DISAS_NORETURN; } =20 #if defined(DO_PPC_STATISTICS) @@ -8088,9 +8090,6 @@ static void ppc_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cs) "temporaries\n", opc1(ctx->opcode), opc2(ctx->opcode), opc3(ctx->opcode), opc4(ctx->opcode), ctx->opcode); } - - ctx->base.is_jmp =3D ctx->exception =3D=3D POWERPC_EXCP_NONE ? - DISAS_NEXT : DISAS_NORETURN; } =20 static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.= inc index c03a7c4f52..48c713be7e 100644 --- a/target/ppc/translate_init.c.inc +++ b/target/ppc/translate_init.c.inc @@ -188,7 +188,7 @@ static void spr_read_decr(DisasContext *ctx, int gprn, = int sprn) } gen_helper_load_decr(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -199,7 +199,7 @@ static void spr_write_decr(DisasContext *ctx, int sprn,= int gprn) } gen_helper_store_decr(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } #endif @@ -214,7 +214,7 @@ static void spr_read_tbl(DisasContext *ctx, int gprn, i= nt sprn) gen_helper_load_tbl(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -226,7 +226,7 @@ static void spr_read_tbu(DisasContext *ctx, int gprn, i= nt sprn) gen_helper_load_tbu(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -251,7 +251,7 @@ static void spr_write_tbl(DisasContext *ctx, int sprn, = int gprn) gen_helper_store_tbl(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -263,7 +263,7 @@ static void spr_write_tbu(DisasContext *ctx, int sprn, = int gprn) gen_helper_store_tbu(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -288,7 +288,7 @@ static void spr_read_purr(DisasContext *ctx, int gprn, = int sprn) } gen_helper_load_purr(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -299,7 +299,7 @@ static void spr_write_purr(DisasContext *ctx, int sprn,= int gprn) } gen_helper_store_purr(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -312,7 +312,7 @@ static void spr_read_hdecr(DisasContext *ctx, int gprn,= int sprn) gen_helper_load_hdecr(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -324,7 +324,7 @@ static void spr_write_hdecr(DisasContext *ctx, int sprn= , int gprn) gen_helper_store_hdecr(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -335,7 +335,7 @@ static void spr_read_vtb(DisasContext *ctx, int gprn, i= nt sprn) } gen_helper_load_vtb(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -346,7 +346,7 @@ static void spr_write_vtb(DisasContext *ctx, int sprn, = int gprn) } gen_helper_store_vtb(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -357,7 +357,7 @@ static void spr_write_tbu40(DisasContext *ctx, int sprn= , int gprn) } gen_helper_store_tbu40(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -534,7 +534,7 @@ static void spr_write_hid0_601(DisasContext *ctx, int s= prn, int gprn) { gen_helper_store_hid0_601(cpu_env, cpu_gpr[gprn]); /* Must stop the translation as endianness may have changed */ - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } #endif =20 @@ -571,7 +571,7 @@ static void spr_read_40x_pit(DisasContext *ctx, int gpr= n, int sprn) } gen_helper_load_40x_pit(cpu_gpr[gprn], cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -582,7 +582,7 @@ static void spr_write_40x_pit(DisasContext *ctx, int sp= rn, int gprn) } gen_helper_store_40x_pit(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -594,9 +594,9 @@ static void spr_write_40x_dbcr0(DisasContext *ctx, int = sprn, int gprn) gen_store_spr(sprn, cpu_gpr[gprn]); gen_helper_store_40x_dbcr0(cpu_env, cpu_gpr[gprn]); /* We must stop translation as we may have rebooted */ - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -607,7 +607,7 @@ static void spr_write_40x_sler(DisasContext *ctx, int s= prn, int gprn) } gen_helper_store_40x_sler(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -618,7 +618,7 @@ static void spr_write_booke_tcr(DisasContext *ctx, int = sprn, int gprn) } gen_helper_store_booke_tcr(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } =20 @@ -629,7 +629,7 @@ static void spr_write_booke_tsr(DisasContext *ctx, int = sprn, int gprn) } gen_helper_store_booke_tsr(cpu_env, cpu_gpr[gprn]); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { - gen_stop_exception(ctx); + gen_end_tb_exception(ctx, POWERPC_EXCP_STOP); } } #endif --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544826; cv=none; d=zohomail.com; s=zohoarc; b=bh4y1JYwIC0+Ar72SVuaeuEdw7KbvGthQ7pgW69WastX1hWwtqmYAfxBpG05sL/XShnhMYelN2uxDJAwzMes3SUHeRLqdr1zw5tCN55tL/hTQdpT7KVhWwnEBRkppdAk0EaxglWEjGTtHCda6tvMt1Ix0vToYH8vozKIf6OPCXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544826; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9Y9AxyUmmFGts0Bkm35WFg9H+vuXJQtEQLkOMkhWK6w=; b=SvnYPxPcuYITmAhsX4cKnp3mwUIxpRP2XI6RB8YXVkxH58yLVoQK/LoWZ88DHDnDd4Zh0ntpvobGPpcOV9oBwD0UBF8ZxTYnEc0mHxbWhV0vtl3P+jfqglG7R1TQoP0alai/DWN2/YN0C4x9BvA9Dx6BsD0/F+kmcf78SXtktgA= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544826632829.9484567538082; Tue, 27 Apr 2021 10:33:46 -0700 (PDT) Received: from localhost ([::1]:59964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRaj-0002xg-1t for importer@patchew.org; Tue, 27 Apr 2021 13:33:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLn-0001b1-4V; Tue, 27 Apr 2021 13:18:19 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLl-00023I-Ld; Tue, 27 Apr 2021 13:18:18 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:52 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id D01C78013BA; Tue, 27 Apr 2021 14:16:52 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 05/15] target/ppc: Tidy exception vs exit_tb Date: Tue, 27 Apr 2021 14:16:39 -0300 Message-Id: <20210427171649.364699-6-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:53.0011 (UTC) FILETIME=[1DF89E30:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson We do not need to emit an exit_tb after an exception, as the latter will exit via longjmp. Signed-off-by: Richard Henderson --- target/ppc/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 46de2dab27..b18ad8ec2c 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3744,8 +3744,9 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx) } else if (sse & (CPU_SINGLE_STEP | CPU_BRANCH_STEP)) { uint32_t excp =3D gen_prep_dbgex(ctx); gen_exception(ctx, excp); + } else { + tcg_gen_exit_tb(NULL, 0); } - tcg_gen_exit_tb(NULL, 0); } else { tcg_gen_lookup_and_goto_ptr(); } @@ -8101,9 +8102,10 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cs) } else if (ctx->exception !=3D POWERPC_EXCP_BRANCH) { if (unlikely(ctx->base.singlestep_enabled)) { gen_debug_exception(ctx); + } else { + /* Generate the return instruction */ + tcg_gen_exit_tb(NULL, 0); } - /* Generate the return instruction */ - tcg_gen_exit_tb(NULL, 0); } } =20 --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544484; cv=none; d=zohomail.com; s=zohoarc; b=ILAv1i2ZzlhfjOBEq+Ium5sCkFaLdAOYXWXluTorzHTzuTgEVtUMTvXQV8EYOTEJaArQMhQ5Xl783AIGyNVMCMiFNCaXOWw120I09pRaa9Sn4RKkBnPwt+TOqZnTeQ9eIzT+dKrm4SafwgDduxste6k4eL5TeecSAtusfH0bTvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544484; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mVGm4EvhS0o7G2HBXZfDoppz2ZnVbiyl/FAo4hAXmoY=; b=GPT6yZPQerznrwUGjZfhVTmFYov+xJ4EYh0q77+tz/mBK9l6Hd0vbGeZaDszUdGHo7jdOTxqOfD2BmNw882xNLNrJ7T7lNw+JKGjXJDYmQBxoT705fsQkLHt1Ig291g/LzEpYwy087XfEur00E2qy12EqIUeUGFzdvBROcdK54A= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544484228397.1233744328273; Tue, 27 Apr 2021 10:28:04 -0700 (PDT) Received: from localhost ([::1]:51852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRVD-0007tD-2w for importer@patchew.org; Tue, 27 Apr 2021 13:28:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLp-0001er-QB; Tue, 27 Apr 2021 13:18:21 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLo-00023I-6s; Tue, 27 Apr 2021 13:18:21 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:53 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 02A4C80139F; Tue, 27 Apr 2021 14:16:53 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 06/15] target/ppc: Mark helper_raise_exception* as noreturn Date: Tue, 27 Apr 2021 14:16:40 -0300 Message-Id: <20210427171649.364699-7-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:53.0199 (UTC) FILETIME=[1E154DF0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/helper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 6a4dccf70c..af5b3586d1 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -1,5 +1,5 @@ -DEF_HELPER_FLAGS_3(raise_exception_err, TCG_CALL_NO_WG, void, env, i32, i3= 2) -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_3(raise_exception_err, TCG_CALL_NO_WG, noreturn, env, i32= , i32) +DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) DEF_HELPER_FLAGS_4(tw, TCG_CALL_NO_WG, void, env, tl, tl, i32) #if defined(TARGET_PPC64) DEF_HELPER_FLAGS_4(td, TCG_CALL_NO_WG, void, env, tl, tl, i32) --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544547; cv=none; d=zohomail.com; s=zohoarc; b=fP2Ndga8jB84pnOm0lNwDgOUvPYhSq7K0uAFezdGrihNR1dPicClwGPstBfmy2DbcARrd1r5wne8jribn/AhNCEh9iB2J5rtaQ1ae+HSXcFmjS3LDCYFPnFGXYg+ws5fMuytih7kOdiuYhjEJSlzHPdrmn8DqsfFUjunlvKycFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544547; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zh6hlra2MHUQFl9gg8GOWW0+yxSOAtb5DXCaaw4B0/s=; b=HXTG/uik/GfxQ5TU2bi9/aJV0Se+HK7E5BUS/Me4b0jGKhrQ4177lnuuNCj/GV2Jx6W/bC80LPwGkH3Hpkt0ViI4AMvhrcWamhaJjgcfBR+H4rfrq9UnuB0HsEuwgoXZJ4YU0C7vpDCRORDJrAqXaN2RBzMeuLsG0OIxe69VqLM= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544547783369.23089320407064; Tue, 27 Apr 2021 10:29:07 -0700 (PDT) Received: from localhost ([::1]:53874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRWE-0000Fq-Jd for importer@patchew.org; Tue, 27 Apr 2021 13:29:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLu-0001gm-AI; Tue, 27 Apr 2021 13:18:27 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLq-00023I-RX; Tue, 27 Apr 2021 13:18:25 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:53 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 314688013BA; Tue, 27 Apr 2021 14:16:53 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 07/15] target/ppc: Use translator_loop_temp_check Date: Tue, 27 Apr 2021 14:16:41 -0300 Message-Id: <20210427171649.364699-8-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:53.0372 (UTC) FILETIME=[1E2FB3C0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson The special logging is unnecessary. It will have been done immediately before in the log file. Signed-off-by: Richard Henderson --- target/ppc/translate.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index b18ad8ec2c..dd34f22704 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -8086,11 +8086,7 @@ static void ppc_tr_translate_insn(DisasContextBase *= dcbase, CPUState *cs) gen_exception_nip(ctx, excp, ctx->base.pc_next); } =20 - if (tcg_check_temp_count()) { - qemu_log("Opcode %02x %02x %02x %02x (%08x) leaked " - "temporaries\n", opc1(ctx->opcode), opc2(ctx->opcode), - opc3(ctx->opcode), opc4(ctx->opcode), ctx->opcode); - } + translator_loop_temp_check(&ctx->base); } =20 static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544841; cv=none; d=zohomail.com; s=zohoarc; b=Cwws26EcNGLp4tNzMEi9VwRAwEPO5khz7nozuX0ME16KPpk87vSbhL4KYcNbTrkSj86GlirsRMYclp3BMvoGDJI73v1lb+N0HESmJDSyuTo2niNAtJw4R8JYDwOCMT1fj6AS0defSjfv9isbss7RHnQBzghUJVMymlnQPwLTpSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544841; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3EO7SzUuuzflPDnPdle0eqcGBzxnOPYcqN0PaR5KqZ0=; b=XkEmsV1WGa0tFPGHi1s+TieiiUE8xgJlc+qpezDJ3UxolnlbHlChMvZeAld58kFnYtVulHGrxNiTU78Y4w71LjKZLiHbm+Ad7tLzYYW7j1cDkuiv9elBTGoeSRBULzEL5Ijtx5cS8IScrF3MJi+7VQF4qjDjq5lod0Ft3Vb8l10= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544841350242.76810128186696; Tue, 27 Apr 2021 10:34:01 -0700 (PDT) Received: from localhost ([::1]:60486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRax-0003Am-Ts for importer@patchew.org; Tue, 27 Apr 2021 13:34:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRM0-0001ia-09; Tue, 27 Apr 2021 13:18:33 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLw-00023I-4S; Tue, 27 Apr 2021 13:18:31 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:53 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 5744980139F; Tue, 27 Apr 2021 14:16:53 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 08/15] target/ppc: Add infrastructure for prefixed insns Date: Tue, 27 Apr 2021 14:16:42 -0300 Message-Id: <20210427171649.364699-9-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:53.0559 (UTC) FILETIME=[1E4C3C70:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, Luis Pires , lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Luis Pires --- target/ppc/cpu.h | 1 + target/ppc/insn32.decode | 18 +++++++++ target/ppc/insn64.decode | 18 +++++++++ target/ppc/meson.build | 9 +++++ target/ppc/translate.c | 45 +++++++++++++++++----- target/ppc/translate/fixedpoint-impl.c.inc | 18 +++++++++ 6 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 target/ppc/insn32.decode create mode 100644 target/ppc/insn64.decode create mode 100644 target/ppc/translate/fixedpoint-impl.c.inc diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index e73416da68..9bb2805a22 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -148,6 +148,7 @@ enum { POWERPC_EXCP_ALIGN_PROT =3D 0x04, /* Access cross protection bound= ary */ POWERPC_EXCP_ALIGN_BAT =3D 0x05, /* Access cross a BAT/seg bounda= ry */ POWERPC_EXCP_ALIGN_CACHE =3D 0x06, /* Impossible dcbz access = */ + POWERPC_EXCP_ALIGN_INSN =3D 0x07, /* Pref. insn x-ing 64-byte boun= dary */ /* Exception subtypes for POWERPC_EXCP_PROGRAM = */ /* FP exceptions = */ POWERPC_EXCP_FP =3D 0x10, diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode new file mode 100644 index 0000000000..b175441209 --- /dev/null +++ b/target/ppc/insn32.decode @@ -0,0 +1,18 @@ +# +# Power ISA decode for 32-bit insns (opcode space 0) +# +# Copyright (c) 2021 Luis Pires +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . +# diff --git a/target/ppc/insn64.decode b/target/ppc/insn64.decode new file mode 100644 index 0000000000..9fc45d0614 --- /dev/null +++ b/target/ppc/insn64.decode @@ -0,0 +1,18 @@ +# +# Power ISA decode for 64-bit prefixed insns (opcode space 0 and 1) +# +# Copyright (c) 2021 Luis Pires +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . +# diff --git a/target/ppc/meson.build b/target/ppc/meson.build index bbfef90e08..e604e56c6a 100644 --- a/target/ppc/meson.build +++ b/target/ppc/meson.build @@ -15,6 +15,15 @@ ppc_ss.add(files( =20 ppc_ss.add(libdecnumber) =20 +gen =3D [ + decodetree.process('insn32.decode', + extra_args: '--static-decode=3Ddecode_insn32'), + decodetree.process('insn64.decode', + extra_args: ['--static-decode=3Ddecode_insn64', + '--insnwidth=3D64']), +] +ppc_ss.add(gen) + ppc_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('k= vm-stub.c')) ppc_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user_only_helper.c')) =20 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index dd34f22704..83f08950b4 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6906,6 +6906,11 @@ static inline void set_avr64(int regno, TCGv_i64 src= , bool high) tcg_gen_st_i64(src, cpu_env, avr64_offset(regno, high)); } =20 +#include "decode-insn64.c.inc" +#include "decode-insn32.c.inc" + +#include "translate/fixedpoint-impl.c.inc" + #include "translate/fp-impl.c.inc" =20 #include "translate/vmx-impl.c.inc" @@ -7941,7 +7946,6 @@ static void ppc_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); CPUPPCState *env =3D cs->env_ptr; - int bound; =20 ctx->exception =3D POWERPC_EXCP_NONE; ctx->spr_cb =3D env->spr_cb; @@ -8022,9 +8026,6 @@ static void ppc_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) /* Single step trace mode */ msr_se =3D 1; #endif - - bound =3D -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4; - ctx->base.max_insns =3D MIN(ctx->base.max_insns, bound); } =20 static void ppc_tr_tb_start(DisasContextBase *db, CPUState *cs) @@ -8052,11 +8053,18 @@ static bool ppc_tr_breakpoint_check(DisasContextBas= e *dcbase, CPUState *cs, return true; } =20 +static bool is_prefix_insn(DisasContext *ctx, uint32_t insn) +{ + /* TODO: Check ctx->insns_flags* for whether prefixes are supported. */ + return opc1(insn) =3D=3D 1; +} + static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D cs->env_ptr; + target_ulong pc; uint32_t insn; bool ok; =20 @@ -8064,11 +8072,26 @@ static void ppc_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cs) LOG_DISAS("nip=3D" TARGET_FMT_lx " super=3D%d ir=3D%d\n", ctx->base.pc_next, ctx->mem_idx, (int)msr_ir); =20 - ctx->cia =3D ctx->base.pc_next; - insn =3D translator_ldl_swap(env, ctx->base.pc_next, need_byteswap(ctx= )); - ctx->base.pc_next +=3D 4; + ctx->cia =3D pc =3D ctx->base.pc_next; + insn =3D translator_ldl_swap(env, pc, need_byteswap(ctx)); + ctx->base.pc_next =3D pc +=3D 4; =20 - ok =3D decode_legacy(cpu, ctx, insn); + if (!is_prefix_insn(ctx, insn)) { + ok =3D (decode_insn32(ctx, insn) || + decode_legacy(cpu, ctx, insn)); + } else if ((pc & 63) =3D=3D 0) { + /* + * Power v3.1, section 1.9 Exceptions: + * attempt to execute a prefixed instruction that crosses a + * 64-byte address boundary (system alignment error). + */ + gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_INSN= ); + ok =3D true; + } else { + uint32_t insn2 =3D translator_ldl_swap(env, pc, need_byteswap(ctx)= ); + ctx->base.pc_next =3D pc +=3D 4; + ok =3D decode_insn64(ctx, deposit64(insn2, 32, 32, insn)); + } if (!ok) { gen_invalid(ctx); } @@ -8078,12 +8101,14 @@ static void ppc_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cs) #endif /* Check trace mode exceptions */ if (unlikely(ctx->singlestep_enabled & CPU_SINGLE_STEP && - (ctx->base.pc_next <=3D 0x100 || ctx->base.pc_next > 0xF0= 0) && + (pc <=3D 0x100 || pc > 0xF00) && ctx->exception !=3D POWERPC_SYSCALL && ctx->exception !=3D POWERPC_EXCP_TRAP && ctx->exception !=3D POWERPC_EXCP_BRANCH)) { uint32_t excp =3D gen_prep_dbgex(ctx); - gen_exception_nip(ctx, excp, ctx->base.pc_next); + gen_exception_nip(ctx, excp, pc); + } else if (ctx->base.is_jmp =3D=3D DISAS_NEXT && !(pc & ~TARGET_PAGE_M= ASK)) { + ctx->base.is_jmp =3D DISAS_TOO_MANY; } =20 translator_loop_temp_check(&ctx->base); diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc new file mode 100644 index 0000000000..b740083605 --- /dev/null +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -0,0 +1,18 @@ +/* + * Power ISA decode for Fixed-Point Facility instructions + * + * Copyright (c) 2021 Luis Pires + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619545376; cv=none; d=zohomail.com; s=zohoarc; b=cRom3aOodjI0+mtyc0j1Q9HtMr/DlIom4qgyy1qpc+fJ2yf9xFjatwFGSQXDsNAN2o0VIOAIqadKXcr2PJ/A0u8E2u9DaFIIhiHqqO2mx55MeWqH6PfUg4DPzswrXqPopsBRAguhn9TOgMB/vYQcEe7O8/vERvI81prBvOSXGsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619545376; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p36S/6pCGCc+tenfC43gzqYaJXmsp348ksCM1pDWYZE=; b=c1TmpIhGRTUhv7ZtGcjM7LHxdQ8rg/YPTr3m98GeFJPd6p8chAPWrfwAa4D8x9LupTQmOeGPHI5BMDe/TvvUcD/u7z1DPT7BDtVdZP2rmzPw+tCYI1NhjlPjboMZmpBzoRTWKSF7J+yC9N+6ahYALF/ublIFmut3H6ihBNmHe2g= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619545376747315.2032211074229; Tue, 27 Apr 2021 10:42:56 -0700 (PDT) Received: from localhost ([::1]:39540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRja-0006cc-CN for importer@patchew.org; Tue, 27 Apr 2021 13:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRM5-0001lJ-LM; Tue, 27 Apr 2021 13:18:39 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRM3-00023I-77; Tue, 27 Apr 2021 13:18:36 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:53 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 82C6E8013BA; Tue, 27 Apr 2021 14:16:53 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 09/15] target/ppc: Move ADDI, ADDIS to decodetree, implement PADDI Date: Tue, 27 Apr 2021 14:16:43 -0300 Message-Id: <20210427171649.364699-10-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:53.0746 (UTC) FILETIME=[1E68C520:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/insn32.decode | 8 +++++ target/ppc/insn64.decode | 14 ++++++++ target/ppc/translate.c | 29 --------------- target/ppc/translate/fixedpoint-impl.c.inc | 42 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 29 deletions(-) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index b175441209..878d2f2f66 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -16,3 +16,11 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, see . # + +&D rt ra si +@D ...... rt:5 ra:5 si:s16 &D + +### Fixed-Point Arithmetic Instructions + +ADDI 001110 ..... ..... ................ @D +ADDIS 001111 ..... ..... ................ @D diff --git a/target/ppc/insn64.decode b/target/ppc/insn64.decode index 9fc45d0614..68ed2cbff8 100644 --- a/target/ppc/insn64.decode +++ b/target/ppc/insn64.decode @@ -16,3 +16,17 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, see . # + +# Format MLS:D and 8LS:D +&PLS_D rt ra si r + +%pls_si 32:s18 0:16 + +@PLS_D ...... .. ... r:1 .. .................. \ + ...... rt:5 ra:5 ................ \ + &PLS_D si=3D%pls_si + +### Fixed-Point Arithmetic Instructions + +PADDI 000001 10 0--.-- .................. \ + 001110 ..... ..... ................ @PLS_D diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 83f08950b4..6edde6a53d 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -937,19 +937,6 @@ GEN_INT_ARITH_ADD(addex, 0x05, cpu_ov, 1, 1, 0); /* addze addze. addzeo addzeo.*/ GEN_INT_ARITH_ADD_CONST(addze, 0x06, 0, cpu_ca, 1, 1, 0) GEN_INT_ARITH_ADD_CONST(addzeo, 0x16, 0, cpu_ca, 1, 1, 1) -/* addi */ -static void gen_addi(DisasContext *ctx) -{ - target_long simm =3D SIMM(ctx->opcode); - - if (rA(ctx->opcode) =3D=3D 0) { - /* li case */ - tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], simm); - } else { - tcg_gen_addi_tl(cpu_gpr[rD(ctx->opcode)], - cpu_gpr[rA(ctx->opcode)], simm); - } -} /* addic addic.*/ static inline void gen_op_addic(DisasContext *ctx, bool compute_rc0) { @@ -969,20 +956,6 @@ static void gen_addic_(DisasContext *ctx) gen_op_addic(ctx, 1); } =20 -/* addis */ -static void gen_addis(DisasContext *ctx) -{ - target_long simm =3D SIMM(ctx->opcode); - - if (rA(ctx->opcode) =3D=3D 0) { - /* lis case */ - tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], simm << 16); - } else { - tcg_gen_addi_tl(cpu_gpr[rD(ctx->opcode)], - cpu_gpr[rA(ctx->opcode)], simm << 16); - } -} - /* addpcis */ static void gen_addpcis(DisasContext *ctx) { @@ -7034,10 +7007,8 @@ GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, = PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(cmpb, 0x1F, 0x1C, 0x0F, 0x00000001, PPC_NONE, PPC2_ISA205), GEN_HANDLER_E(cmprb, 0x1F, 0x00, 0x06, 0x00400001, PPC_NONE, PPC2_ISA300), GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL), -GEN_HANDLER(addi, 0x0E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(addic, 0x0C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER2(addic_, "addic.", 0x0D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), -GEN_HANDLER(addis, 0x0F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER_E(addpcis, 0x13, 0x2, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA300), GEN_HANDLER(mulhw, 0x1F, 0x0B, 0x02, 0x00000400, PPC_INTEGER), GEN_HANDLER(mulhwu, 0x1F, 0x0B, 0x00, 0x00000400, PPC_INTEGER), diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index b740083605..76e1832297 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -16,3 +16,45 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ + +/* + * Incorporate CIA into the constant when R=3D1. + * Validate that when R=3D1, RA=3D0. + */ +static bool resolve_PLS_D(DisasContext *ctx, arg_PLS_D *a) +{ + if (a->r) { + a->si +=3D ctx->cia; + return a->ra =3D=3D 0; + } + return true; +} + +static bool trans_ADDI(DisasContext *ctx, arg_D *a) +{ + if (a->ra) { + tcg_gen_addi_tl(cpu_gpr[a->rt], cpu_gpr[a->ra], a->si); + } else { + tcg_gen_movi_tl(cpu_gpr[a->rt], a->si); + } + return true; +} + +static bool trans_ADDIS(DisasContext *ctx, arg_D *a) +{ + a->si <<=3D 16; + return trans_ADDI(ctx, a); +} + +static bool trans_PADDI(DisasContext *ctx, arg_PLS_D *a) +{ + if (!resolve_PLS_D(ctx, a)) { + return false; + } + if (a->ra) { + tcg_gen_addi_tl(cpu_gpr[a->rt], cpu_gpr[a->ra], a->si); + } else { + tcg_gen_movi_tl(cpu_gpr[a->rt], a->si); + } + return true; +} --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619544859; cv=none; d=zohomail.com; s=zohoarc; b=aYpMXbCLP9OkHQozc8Jx4+QE5CZggRutrV3TDUxD65pcGKP4R2nhU/6Oa09VHRKj5idpDc92TP1ZHu0fcEsL8DDxZ4xWud4EDK/gUZj/maaryjvmlq0t0oYzw0kDKgtwaBhUveCMi+6oPin9moArSmsX6LA1eE31rcNroj+enxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544859; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Gacgq6ZNKRdd8w7WKIYTIjQGLPm2tEp4a8MEucN1LLE=; b=SlraIRflUcKBbGhHD0x9tjHdS7o5VeD/7/5y/NeVlvLPWCFnYJJiq81uadf9D5ynwbXetF/kuEkIOBMsH9m2rKd2MlHhrJybTi7cc95dKXp4HDoRDSSqkisAcod9DAKlscrGsM6iCYAaeWOyUlPi0N1RWgaWVOZ2AGJi377iPss= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619544859839977.2963033101956; Tue, 27 Apr 2021 10:34:19 -0700 (PDT) Received: from localhost ([::1]:60828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRbG-0003J9-Qm for importer@patchew.org; Tue, 27 Apr 2021 13:34:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRM8-0001oZ-Uk; Tue, 27 Apr 2021 13:18:40 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRM7-00023I-HI; Tue, 27 Apr 2021 13:18:40 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:53 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id B199980139F; Tue, 27 Apr 2021 14:16:53 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 10/15] target/ppc: Implement PNOP Date: Tue, 27 Apr 2021 14:16:44 -0300 Message-Id: <20210427171649.364699-11-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:53.0902 (UTC) FILETIME=[1E8092E0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/insn64.decode | 5 +++++ target/ppc/translate/fixedpoint-impl.c.inc | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/target/ppc/insn64.decode b/target/ppc/insn64.decode index 68ed2cbff8..9bef32a845 100644 --- a/target/ppc/insn64.decode +++ b/target/ppc/insn64.decode @@ -30,3 +30,8 @@ =20 PADDI 000001 10 0--.-- .................. \ 001110 ..... ..... ................ @PLS_D + +### Prefixed No-operation Instruction + +PNOP 000001 11 0000-- 000000000000000000 \ + -------------------------------- diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index 76e1832297..7d80e3c002 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -58,3 +58,15 @@ static bool trans_PADDI(DisasContext *ctx, arg_PLS_D *a) } return true; } + +static bool trans_PNOP(DisasContext *ctx, arg_PNOP *a) +{ + /* + * TODO: diagnose the set of patterns that are illegal: + * branches, rfebb, sync other than isync, or a + * service processor attention. + * The Engineering Note allows us to either diagnose + * these as illegal, or treat them all as no-op. + */ + return true; +} --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619545350; cv=none; d=zohomail.com; s=zohoarc; b=KU9Wc08qT+40GjtCgXulEreCOSfeEYKfbnWspEFnLheKYPjywfTjvCjHb3KiTMtXcuwMhHCyJN2ZwQkRjSMJdKYecg3aHdhUqrTK17n5ZSpumowsgatAml2R5dEsQONeGK1aCyyMLzXdwGfkTycA38FCZGFADNeoXTUOLINA0UY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619545350; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cC/zVEHCIt8tsvXB1LeSxj3/Q3rH+169clAclJcTekE=; b=nnsxpnoeEJY2Dm0WuN4YrwYRmpm4w30Zo3lmsqltZ2uGfmH4jISxDMt6dAEQVC0mKanEX2BvMWXUwP7eWiT5nyPwuPIHIRLg7aN0/YUr4FZdfJzCooyiAMDylY+qKUTBM6R7hUynTKAsvjWCpn6NjKS/8mEIuA46Qann5lpBKv4= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619545349925207.7937649907674; Tue, 27 Apr 2021 10:42:29 -0700 (PDT) Received: from localhost ([::1]:38890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRj9-0006FG-2I for importer@patchew.org; Tue, 27 Apr 2021 13:42:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRMC-0001uC-6g; Tue, 27 Apr 2021 13:18:44 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRMA-00023I-28; Tue, 27 Apr 2021 13:18:43 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:54 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id D94E68013BA; Tue, 27 Apr 2021 14:16:53 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 11/15] target/ppc: Move D/DS/X-form integer loads to decodetree Date: Tue, 27 Apr 2021 14:16:45 -0300 Message-Id: <20210427171649.364699-12-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:54.0090 (UTC) FILETIME=[1E9D42A0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson These are all connected by macros in the legacy decoding. Signed-off-by: Richard Henderson Signed-off-by: Matheus Ferst --- target/ppc/insn32.decode | 37 ++++ target/ppc/translate.c | 136 ++------------- target/ppc/translate/fixedpoint-impl.c.inc | 188 +++++++++++++++++++++ 3 files changed, 238 insertions(+), 123 deletions(-) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 878d2f2f66..bf39ce5c15 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -20,6 +20,43 @@ &D rt ra si @D ...... rt:5 ra:5 si:s16 &D =20 +%ds_si 2:s14 !function=3Dtimes_4 +@DS ...... rt:5 ra:5 .............. .. &D si=3D%ds_si + +&X rt ra rb +@X ...... rt:5 ra:5 rb:5 .......... . &X + +### Fixed-Point Load Instructions + +LBZ 100010 ..... ..... ................ @D +LBZU 100011 ..... ..... ................ @D +LBZX 011111 ..... ..... ..... 0001010111 - @X +LBZUX 011111 ..... ..... ..... 0001110111 - @X + +LHZ 101000 ..... ..... ................ @D +LHZU 101001 ..... ..... ................ @D +LHZX 011111 ..... ..... ..... 0100010111 - @X +LHZUX 011111 ..... ..... ..... 0100110111 - @X + +LHA 101010 ..... ..... ................ @D +LHAU 101011 ..... ..... ................ @D +LHAX 011111 ..... ..... ..... 0101010111 - @X +LHAXU 011111 ..... ..... ..... 0101110111 - @X + +LWZ 100000 ..... ..... ................ @D +LWZU 100001 ..... ..... ................ @D +LWZX 011111 ..... ..... ..... 0000010111 - @X +LWZUX 011111 ..... ..... ..... 0000110111 - @X + +LWA 111010 ..... ..... ..............10 @DS +LWAX 011111 ..... ..... ..... 0101010101 - @X +LWAUX 011111 ..... ..... ..... 0101110101 - @X + +LD 111010 ..... ..... ..............00 @DS +LDU 111010 ..... ..... ..............01 @DS +LDX 011111 ..... ..... ..... 0000010101 - @X +LDUX 011111 ..... ..... ..... 0000110101 - @X + ### Fixed-Point Arithmetic Instructions =20 ADDI 001110 ..... ..... ................ @D diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 6edde6a53d..a1f0e59afd 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -2505,54 +2505,6 @@ GEN_QEMU_STORE_64(st64, DEF_MEMOP(MO_Q)) GEN_QEMU_STORE_64(st64r, BSWAP_MEMOP(MO_Q)) #endif =20 -#define GEN_LD(name, ldop, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ -{ = \ - TCGv EA; = \ - gen_set_access_type(ctx, ACCESS_INT); = \ - EA =3D tcg_temp_new(); = \ - gen_addr_imm_index(ctx, EA, 0); = \ - gen_qemu_##ldop(ctx, cpu_gpr[rD(ctx->opcode)], EA); = \ - tcg_temp_free(EA); = \ -} - -#define GEN_LDU(name, ldop, opc, type) = \ -static void glue(gen_, name##u)(DisasContext *ctx) = \ -{ = \ - TCGv EA; = \ - if (unlikely(rA(ctx->opcode) =3D=3D 0 || = \ - rA(ctx->opcode) =3D=3D rD(ctx->opcode))) { = \ - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); = \ - return; = \ - } = \ - gen_set_access_type(ctx, ACCESS_INT); = \ - EA =3D tcg_temp_new(); = \ - if (type =3D=3D PPC_64B) = \ - gen_addr_imm_index(ctx, EA, 0x03); = \ - else = \ - gen_addr_imm_index(ctx, EA, 0); = \ - gen_qemu_##ldop(ctx, cpu_gpr[rD(ctx->opcode)], EA); = \ - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); = \ - tcg_temp_free(EA); = \ -} - -#define GEN_LDUX(name, ldop, opc2, opc3, type) = \ -static void glue(gen_, name##ux)(DisasContext *ctx) = \ -{ = \ - TCGv EA; = \ - if (unlikely(rA(ctx->opcode) =3D=3D 0 || = \ - rA(ctx->opcode) =3D=3D rD(ctx->opcode))) { = \ - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); = \ - return; = \ - } = \ - gen_set_access_type(ctx, ACCESS_INT); = \ - EA =3D tcg_temp_new(); = \ - gen_addr_reg_index(ctx, EA); = \ - gen_qemu_##ldop(ctx, cpu_gpr[rD(ctx->opcode)], EA); = \ - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); = \ - tcg_temp_free(EA); = \ -} - #define GEN_LDX_E(name, ldop, opc2, opc3, type, type2, chk) = \ static void glue(gen_, name##x)(DisasContext *ctx) = \ { = \ @@ -2571,21 +2523,6 @@ static void glue(gen_, name##x)(DisasContext *ctx) = \ #define GEN_LDX_HVRM(name, ldop, opc2, opc3, type) = \ GEN_LDX_E(name, ldop, opc2, opc3, type, PPC_NONE, CHK_HVRM) =20 -#define GEN_LDS(name, ldop, op, type) = \ -GEN_LD(name, ldop, op | 0x20, type); = \ -GEN_LDU(name, ldop, op | 0x21, type); = \ -GEN_LDUX(name, ldop, 0x17, op | 0x01, type); = \ -GEN_LDX(name, ldop, 0x17, op | 0x00, type) - -/* lbz lbzu lbzux lbzx */ -GEN_LDS(lbz, ld8u, 0x02, PPC_INTEGER); -/* lha lhau lhaux lhax */ -GEN_LDS(lha, ld16s, 0x0A, PPC_INTEGER); -/* lhz lhzu lhzux lhzx */ -GEN_LDS(lhz, ld16u, 0x08, PPC_INTEGER); -/* lwz lwzu lwzux lwzx */ -GEN_LDS(lwz, ld32u, 0x00, PPC_INTEGER); - #define GEN_LDEPX(name, ldop, opc2, opc3) = \ static void glue(gen_, name##epx)(DisasContext *ctx) = \ { = \ @@ -2606,47 +2543,12 @@ GEN_LDEPX(ld, DEF_MEMOP(MO_Q), 0x1D, 0x00) #endif =20 #if defined(TARGET_PPC64) -/* lwaux */ -GEN_LDUX(lwa, ld32s, 0x15, 0x0B, PPC_64B); -/* lwax */ -GEN_LDX(lwa, ld32s, 0x15, 0x0A, PPC_64B); -/* ldux */ -GEN_LDUX(ld, ld64_i64, 0x15, 0x01, PPC_64B); -/* ldx */ -GEN_LDX(ld, ld64_i64, 0x15, 0x00, PPC_64B); - /* CI load/store variants */ GEN_LDX_HVRM(ldcix, ld64_i64, 0x15, 0x1b, PPC_CILDST) GEN_LDX_HVRM(lwzcix, ld32u, 0x15, 0x15, PPC_CILDST) GEN_LDX_HVRM(lhzcix, ld16u, 0x15, 0x19, PPC_CILDST) GEN_LDX_HVRM(lbzcix, ld8u, 0x15, 0x1a, PPC_CILDST) =20 -static void gen_ld(DisasContext *ctx) -{ - TCGv EA; - if (Rc(ctx->opcode)) { - if (unlikely(rA(ctx->opcode) =3D=3D 0 || - rA(ctx->opcode) =3D=3D rD(ctx->opcode))) { - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); - return; - } - } - gen_set_access_type(ctx, ACCESS_INT); - EA =3D tcg_temp_new(); - gen_addr_imm_index(ctx, EA, 0x03); - if (ctx->opcode & 0x02) { - /* lwa (lwau is undefined) */ - gen_qemu_ld32s(ctx, cpu_gpr[rD(ctx->opcode)], EA); - } else { - /* ld - ldu */ - gen_qemu_ld64_i64(ctx, cpu_gpr[rD(ctx->opcode)], EA); - } - if (Rc(ctx->opcode)) { - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); - } - tcg_temp_free(EA); -} - /* lq */ static void gen_lq(DisasContext *ctx) { @@ -6879,6 +6781,18 @@ static inline void set_avr64(int regno, TCGv_i64 src= , bool high) tcg_gen_st_i64(src, cpu_env, avr64_offset(regno, high)); } =20 +static inline int times_4(DisasContext *ctx, int x) +{ + return x * 4; +} + +#define REQUIRE_INSNS_FLAGS(CTX, NAME) \ + do { \ + if (((CTX)->insns_flags & PPC_##NAME) =3D=3D 0) { \ + return false; \ + } \ + } while (0) + #include "decode-insn64.c.inc" #include "decode-insn32.c.inc" =20 @@ -7064,7 +6978,6 @@ GEN_HANDLER2_E(extswsli1, "extswsli", 0x1F, 0x1B, 0x1= B, 0x00000000, PPC_NONE, PPC2_ISA300), #endif #if defined(TARGET_PPC64) -GEN_HANDLER(ld, 0x3A, 0xFF, 0xFF, 0x00000000, PPC_64B), GEN_HANDLER(lq, 0x38, 0xFF, 0xFF, 0x00000000, PPC_64BX), GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64B), #endif @@ -7430,34 +7343,11 @@ GEN_PPC64_R2(rldcr, 0x1E, 0x09), GEN_PPC64_R4(rldimi, 0x1E, 0x06), #endif =20 -#undef GEN_LD -#undef GEN_LDU -#undef GEN_LDUX #undef GEN_LDX_E -#undef GEN_LDS -#define GEN_LD(name, ldop, opc, type) = \ -GEN_HANDLER(name, opc, 0xFF, 0xFF, 0x00000000, type), -#define GEN_LDU(name, ldop, opc, type) = \ -GEN_HANDLER(name##u, opc, 0xFF, 0xFF, 0x00000000, type), -#define GEN_LDUX(name, ldop, opc2, opc3, type) = \ -GEN_HANDLER(name##ux, 0x1F, opc2, opc3, 0x00000001, type), #define GEN_LDX_E(name, ldop, opc2, opc3, type, type2, chk) = \ GEN_HANDLER_E(name##x, 0x1F, opc2, opc3, 0x00000001, type, type2), -#define GEN_LDS(name, ldop, op, type) = \ -GEN_LD(name, ldop, op | 0x20, type) = \ -GEN_LDU(name, ldop, op | 0x21, type) = \ -GEN_LDUX(name, ldop, 0x17, op | 0x01, type) = \ -GEN_LDX(name, ldop, 0x17, op | 0x00, type) - -GEN_LDS(lbz, ld8u, 0x02, PPC_INTEGER) -GEN_LDS(lha, ld16s, 0x0A, PPC_INTEGER) -GEN_LDS(lhz, ld16u, 0x08, PPC_INTEGER) -GEN_LDS(lwz, ld32u, 0x00, PPC_INTEGER) + #if defined(TARGET_PPC64) -GEN_LDUX(lwa, ld32s, 0x15, 0x0B, PPC_64B) -GEN_LDX(lwa, ld32s, 0x15, 0x0A, PPC_64B) -GEN_LDUX(ld, ld64_i64, 0x15, 0x01, PPC_64B) -GEN_LDX(ld, ld64_i64, 0x15, 0x00, PPC_64B) GEN_LDX_E(ldbr, ld64ur_i64, 0x14, 0x10, PPC_NONE, PPC2_DBRX, CHK_NONE) =20 /* HV/P7 and later only */ diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index 7d80e3c002..e15e379931 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -30,6 +30,194 @@ static bool resolve_PLS_D(DisasContext *ctx, arg_PLS_D = *a) return true; } =20 +static bool do_ldst_D(DisasContext *ctx, arg_D *a, bool update, + bool store, MemOp mop) +{ + TCGv ea; + + if (update && (a->ra =3D=3D 0 || (!store && a->ra =3D=3D a->rt))) { + return false; + } + gen_set_access_type(ctx, ACCESS_INT); + + ea =3D tcg_temp_new(); + if (a->ra) { + tcg_gen_addi_tl(ea, cpu_gpr[a->ra], a->si); + } else { + tcg_gen_movi_tl(ea, a->si); + } + if (NARROW_MODE(ctx)) { + tcg_gen_ext32u_tl(ea, ea); + } + mop ^=3D ctx->default_tcg_memop_mask; + if (store) { + tcg_gen_qemu_st_tl(cpu_gpr[a->rt], ea, ctx->mem_idx, mop); + } else { + tcg_gen_qemu_ld_tl(cpu_gpr[a->rt], ea, ctx->mem_idx, mop); + } + if (update) { + tcg_gen_mov_tl(cpu_gpr[a->ra], ea); + } + tcg_temp_free(ea); + + return true; +} + +static bool trans_LBZ(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, false, MO_UB); +} + +static bool trans_LBZU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, false, MO_UB); +} + +static bool trans_LHZ(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, false, MO_UW); +} + +static bool trans_LHZU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, false, MO_UW); +} + +static bool trans_LHA(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, false, MO_SW); +} + +static bool trans_LHAU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, false, MO_SW); +} + +static bool trans_LWZ(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, false, MO_UL); +} + +static bool trans_LWZU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, false, MO_UL); +} + +static bool trans_LWA(DisasContext *ctx, arg_D *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_D(ctx, a, false, false, MO_SL); +} + +static bool trans_LD(DisasContext *ctx, arg_D *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_D(ctx, a, false, false, MO_Q); +} + +static bool trans_LDU(DisasContext *ctx, arg_D *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_D(ctx, a, true, false, MO_Q); +} + +static bool do_ldst_X(DisasContext *ctx, arg_X *a, bool update, + bool store, MemOp mop) +{ + TCGv ea; + + if (update && (a->ra =3D=3D 0 || (!store && a->ra =3D=3D a->rt))) { + return false; + } + gen_set_access_type(ctx, ACCESS_INT); + + ea =3D tcg_temp_new(); + if (a->ra) { + tcg_gen_add_tl(ea, cpu_gpr[a->ra], cpu_gpr[a->rb]); + } else { + tcg_gen_mov_tl(ea, cpu_gpr[a->rb]); + } + if (NARROW_MODE(ctx)) { + tcg_gen_ext32u_tl(ea, ea); + } + mop ^=3D ctx->default_tcg_memop_mask; + if (store) { + tcg_gen_qemu_st_tl(cpu_gpr[a->rt], ea, ctx->mem_idx, mop); + } else { + tcg_gen_qemu_ld_tl(cpu_gpr[a->rt], ea, ctx->mem_idx, mop); + } + if (update) { + tcg_gen_mov_tl(cpu_gpr[a->ra], ea); + } + tcg_temp_free(ea); + + return true; +} + +static bool trans_LBZX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, false, MO_UB); +} + +static bool trans_LBZUX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, false, MO_UB); +} + +static bool trans_LHZX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, false, MO_UW); +} + +static bool trans_LHZUX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, false, MO_UW); +} + +static bool trans_LHAX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, false, MO_SW); +} + +static bool trans_LHAXU(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, false, MO_SW); +} + +static bool trans_LWZX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, false, MO_UL); +} + +static bool trans_LWZUX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, false, MO_UL); +} + +static bool trans_LWAX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_X(ctx, a, false, false, MO_SL); +} + +static bool trans_LWAUX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_X(ctx, a, true, false, MO_SL); +} + +static bool trans_LDX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_X(ctx, a, false, false, MO_Q); +} + +static bool trans_LDUX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_X(ctx, a, true, false, MO_Q); +} + static bool trans_ADDI(DisasContext *ctx, arg_D *a) { if (a->ra) { --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619545773; cv=none; d=zohomail.com; s=zohoarc; b=mIb0CQHXfHql2YBNNAO0DbXyCp3zIwYdJjifgWPR6jlmV0Q3tgnkmmf7an6g7C0hJ5KgQq5+9jnSre2pe3f+cn4AkcVjyO7WACGQpmw7dHtRhv7BsHBsK8hrXzF1DpKbOdCuef30weL+IExhKxcbj0Tev8jgUeiLOpNIWn4YmJw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619545773; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nUOqYXuj+GitJ9XAk5zjmh+X2yXyuM0KJ22Vt0CZW1k=; b=iEsdZT2C+my6KwyaavsOgj0mNp2tmcYcm32g8+zUX7lxdC0aruMoOsWnOU9Xfs1YdZsCqUIkYhohMf35aAuDcPedvozwd1kipwP0X71M6b0E2LG9n5sHoAZOjaNnjvWAqa3Ob5pp2dS9i/NOt3JKcdw0Ik5wRpYpjIqe2mvktXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 161954577383352.163656266477346; Tue, 27 Apr 2021 10:49:33 -0700 (PDT) Received: from localhost ([::1]:48200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRq0-0001zN-BU for importer@patchew.org; Tue, 27 Apr 2021 13:49:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRME-0001yn-TC; Tue, 27 Apr 2021 13:18:46 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRMD-00023I-96; Tue, 27 Apr 2021 13:18:46 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:54 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 1302780139F; Tue, 27 Apr 2021 14:16:54 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 12/15] target/ppc: Implement prefixed integer load instructions Date: Tue, 27 Apr 2021 14:16:46 -0300 Message-Id: <20210427171649.364699-13-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:54.0293 (UTC) FILETIME=[1EBC3C50:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/insn64.decode | 15 ++++++ target/ppc/translate/fixedpoint-impl.c.inc | 60 ++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/target/ppc/insn64.decode b/target/ppc/insn64.decode index 9bef32a845..2e08d89e62 100644 --- a/target/ppc/insn64.decode +++ b/target/ppc/insn64.decode @@ -26,6 +26,21 @@ ...... rt:5 ra:5 ................ \ &PLS_D si=3D%pls_si =20 +### Fixed-Point Load Instructions + +PLBZ 000001 10 0--.-- .................. \ + 100010 ..... ..... ................ @PLS_D +PLHZ 000001 10 0--.-- .................. \ + 101000 ..... ..... ................ @PLS_D +PLHA 000001 10 0--.-- .................. \ + 101010 ..... ..... ................ @PLS_D +PLWZ 000001 10 0--.-- .................. \ + 100000 ..... ..... ................ @PLS_D +PLWA 000001 00 0--.-- .................. \ + 101001 ..... ..... ................ @PLS_D +PLD 000001 00 0--.-- .................. \ + 111001 ..... ..... ................ @PLS_D + ### Fixed-Point Arithmetic Instructions =20 PADDI 000001 10 0--.-- .................. \ diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index e15e379931..80f849fc4a 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -218,6 +218,66 @@ static bool trans_LDUX(DisasContext *ctx, arg_X *a) return do_ldst_X(ctx, a, true, false, MO_Q); } =20 +static bool do_ldst_PLS_D(DisasContext *ctx, arg_PLS_D *a, + bool store, MemOp mop) +{ + TCGv ea; + + if (!resolve_PLS_D(ctx, a)) { + return false; + } + gen_set_access_type(ctx, ACCESS_INT); + + ea =3D tcg_temp_new(); + if (a->ra) { + tcg_gen_addi_tl(ea, cpu_gpr[a->ra], a->si); + } else { + tcg_gen_movi_tl(ea, a->si); + } + if (NARROW_MODE(ctx)) { + tcg_gen_ext32u_tl(ea, ea); + } + mop ^=3D ctx->default_tcg_memop_mask; + if (store) { + tcg_gen_qemu_st_tl(cpu_gpr[a->rt], ea, ctx->mem_idx, mop); + } else { + tcg_gen_qemu_ld_tl(cpu_gpr[a->rt], ea, ctx->mem_idx, mop); + } + tcg_temp_free(ea); + + return true; +} + +static bool trans_PLBZ(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, false, MO_UB); +} + +static bool trans_PLHZ(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, false, MO_UW); +} + +static bool trans_PLHA(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, false, MO_SW); +} + +static bool trans_PLWZ(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, false, MO_UL); +} + +static bool trans_PLWA(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, false, MO_SL); +} + +static bool trans_PLD(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, false, MO_Q); +} + static bool trans_ADDI(DisasContext *ctx, arg_D *a) { if (a->ra) { --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619545846; cv=none; d=zohomail.com; s=zohoarc; b=QoK3WWVeXGKaQi4DiLAENEaV4Gln1MrmzI8N0Z+fqruqtSIlf6sGz/um+0wYLJKg8+ybbjzx9qA9Ej9GwuH1frfm5aUXdxEjA8GE0DJuCrTZVa7v4umVUkyrXBH5WaEU8T3eGb/Rymf3gNfSu5NemAD/bC1HfW9I1zIT3bN8zxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619545846; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tOWUxRzsSzsKKqfONWiopi8NzJXeaLHmc+FYqJoc0JA=; b=QEF0FZsL7ixoT93l+HKI1o0drBzU8sq2oBnL+A/+gjclfNT8jwEK4RIvvKJfJaaMMwuu+iH5N8ss4Mhp0ocnuV4bVLUX+FEhU0VNxwBJaqG/P/zGWpjI8AC9Iq3bJzdWcaXFbyjJOna5AkATK+1P3VWcvzUt/ml4Xtz4DErwme8= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619545846882566.6487847552573; Tue, 27 Apr 2021 10:50:46 -0700 (PDT) Received: from localhost ([::1]:50160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRrB-0002pk-NK for importer@patchew.org; Tue, 27 Apr 2021 13:50:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRMI-00023I-3a; Tue, 27 Apr 2021 13:18:50 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRMG-00023I-4S; Tue, 27 Apr 2021 13:18:49 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:54 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 4463E8013BA; Tue, 27 Apr 2021 14:16:54 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 13/15] target/ppc: Move D/DS/X-form integer stores to decodetree Date: Tue, 27 Apr 2021 14:16:47 -0300 Message-Id: <20210427171649.364699-14-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:54.0481 (UTC) FILETIME=[1ED8EC10:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson These are all connected by macros in the legacy decoding. Signed-off-by: Richard Henderson --- target/ppc/insn32.decode | 22 ++++++ target/ppc/translate.c | 85 +--------------------- target/ppc/translate/fixedpoint-impl.c.inc | 84 +++++++++++++++++++++ 3 files changed, 109 insertions(+), 82 deletions(-) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index bf39ce5c15..df92f11558 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -57,6 +57,28 @@ LDU 111010 ..... ..... ..............01 = @DS LDX 011111 ..... ..... ..... 0000010101 - @X LDUX 011111 ..... ..... ..... 0000110101 - @X =20 +### Fixed-Point Store Instructions + +STB 100110 ..... ..... ................ @D +STBU 100111 ..... ..... ................ @D +STBX 011111 ..... ..... ..... 0011010111 - @X +STBUX 011111 ..... ..... ..... 0011110111 - @X + +STH 101100 ..... ..... ................ @D +STHU 101101 ..... ..... ................ @D +STHX 011111 ..... ..... ..... 0110110111 - @X +STHUX 011111 ..... ..... ..... 0110010111 - @X + +STW 100100 ..... ..... ................ @D +STWU 100101 ..... ..... ................ @D +STWX 011111 ..... ..... ..... 0010010111 - @X +STWUX 011111 ..... ..... ..... 0010110111 - @X + +STD 111110 ..... ..... ..............00 @DS +STDU 111110 ..... ..... ..............01 @DS +STDX 011111 ..... ..... ..... 0010010101 - @X +STDUX 011111 ..... ..... ..... 0010110101 - @X + ### Fixed-Point Arithmetic Instructions =20 ADDI 001110 ..... ..... ................ @D diff --git a/target/ppc/translate.c b/target/ppc/translate.c index a1f0e59afd..7422ea4e13 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -2481,7 +2481,9 @@ static void glue(gen_qemu_, stop)(DisasContext *ctx, = \ tcg_gen_qemu_st_tl(val, addr, ctx->mem_idx, op); \ } =20 +#if defined(TARGET_PPC64) || !defined(CONFIG_USER_ONLY) GEN_QEMU_STORE_TL(st8, DEF_MEMOP(MO_UB)) +#endif GEN_QEMU_STORE_TL(st16, DEF_MEMOP(MO_UW)) GEN_QEMU_STORE_TL(st32, DEF_MEMOP(MO_UL)) =20 @@ -2614,52 +2616,6 @@ static void gen_lq(DisasContext *ctx) #endif =20 /*** Integer store = ***/ -#define GEN_ST(name, stop, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ -{ = \ - TCGv EA; = \ - gen_set_access_type(ctx, ACCESS_INT); = \ - EA =3D tcg_temp_new(); = \ - gen_addr_imm_index(ctx, EA, 0); = \ - gen_qemu_##stop(ctx, cpu_gpr[rS(ctx->opcode)], EA); = \ - tcg_temp_free(EA); = \ -} - -#define GEN_STU(name, stop, opc, type) = \ -static void glue(gen_, stop##u)(DisasContext *ctx) = \ -{ = \ - TCGv EA; = \ - if (unlikely(rA(ctx->opcode) =3D=3D 0)) { = \ - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); = \ - return; = \ - } = \ - gen_set_access_type(ctx, ACCESS_INT); = \ - EA =3D tcg_temp_new(); = \ - if (type =3D=3D PPC_64B) = \ - gen_addr_imm_index(ctx, EA, 0x03); = \ - else = \ - gen_addr_imm_index(ctx, EA, 0); = \ - gen_qemu_##stop(ctx, cpu_gpr[rS(ctx->opcode)], EA); = \ - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); = \ - tcg_temp_free(EA); = \ -} - -#define GEN_STUX(name, stop, opc2, opc3, type) = \ -static void glue(gen_, name##ux)(DisasContext *ctx) = \ -{ = \ - TCGv EA; = \ - if (unlikely(rA(ctx->opcode) =3D=3D 0)) { = \ - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); = \ - return; = \ - } = \ - gen_set_access_type(ctx, ACCESS_INT); = \ - EA =3D tcg_temp_new(); = \ - gen_addr_reg_index(ctx, EA); = \ - gen_qemu_##stop(ctx, cpu_gpr[rS(ctx->opcode)], EA); = \ - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); = \ - tcg_temp_free(EA); = \ -} - #define GEN_STX_E(name, stop, opc2, opc3, type, type2, chk) = \ static void glue(gen_, name##x)(DisasContext *ctx) = \ { = \ @@ -2677,19 +2633,6 @@ static void glue(gen_, name##x)(DisasContext *ctx) = \ #define GEN_STX_HVRM(name, stop, opc2, opc3, type) = \ GEN_STX_E(name, stop, opc2, opc3, type, PPC_NONE, CHK_HVRM) =20 -#define GEN_STS(name, stop, op, type) = \ -GEN_ST(name, stop, op | 0x20, type); = \ -GEN_STU(name, stop, op | 0x21, type); = \ -GEN_STUX(name, stop, 0x17, op | 0x01, type); = \ -GEN_STX(name, stop, 0x17, op | 0x00, type) - -/* stb stbu stbux stbx */ -GEN_STS(stb, st8, 0x06, PPC_INTEGER); -/* sth sthu sthux sthx */ -GEN_STS(sth, st16, 0x0C, PPC_INTEGER); -/* stw stwu stwux stwx */ -GEN_STS(stw, st32, 0x04, PPC_INTEGER); - #define GEN_STEPX(name, stop, opc2, opc3) = \ static void glue(gen_, name##epx)(DisasContext *ctx) = \ { = \ @@ -2711,8 +2654,6 @@ GEN_STEPX(std, DEF_MEMOP(MO_Q), 0x1d, 0x04) #endif =20 #if defined(TARGET_PPC64) -GEN_STUX(std, st64_i64, 0x15, 0x05, PPC_64B); -GEN_STX(std, st64_i64, 0x15, 0x04, PPC_64B); GEN_STX_HVRM(stdcix, st64_i64, 0x15, 0x1f, PPC_CILDST) GEN_STX_HVRM(stwcix, st32, 0x15, 0x1c, PPC_CILDST) GEN_STX_HVRM(sthcix, st16, 0x15, 0x1d, PPC_CILDST) @@ -7372,31 +7313,11 @@ GEN_LDEPX(lw, DEF_MEMOP(MO_UL), 0x1F, 0x00) GEN_LDEPX(ld, DEF_MEMOP(MO_Q), 0x1D, 0x00) #endif =20 -#undef GEN_ST -#undef GEN_STU -#undef GEN_STUX #undef GEN_STX_E -#undef GEN_STS -#define GEN_ST(name, stop, opc, type) = \ -GEN_HANDLER(name, opc, 0xFF, 0xFF, 0x00000000, type), -#define GEN_STU(name, stop, opc, type) = \ -GEN_HANDLER(stop##u, opc, 0xFF, 0xFF, 0x00000000, type), -#define GEN_STUX(name, stop, opc2, opc3, type) = \ -GEN_HANDLER(name##ux, 0x1F, opc2, opc3, 0x00000001, type), #define GEN_STX_E(name, stop, opc2, opc3, type, type2, chk) = \ GEN_HANDLER_E(name##x, 0x1F, opc2, opc3, 0x00000000, type, type2), -#define GEN_STS(name, stop, op, type) = \ -GEN_ST(name, stop, op | 0x20, type) = \ -GEN_STU(name, stop, op | 0x21, type) = \ -GEN_STUX(name, stop, 0x17, op | 0x01, type) = \ -GEN_STX(name, stop, 0x17, op | 0x00, type) - -GEN_STS(stb, st8, 0x06, PPC_INTEGER) -GEN_STS(sth, st16, 0x0C, PPC_INTEGER) -GEN_STS(stw, st32, 0x04, PPC_INTEGER) + #if defined(TARGET_PPC64) -GEN_STUX(std, st64_i64, 0x15, 0x05, PPC_64B) -GEN_STX(std, st64_i64, 0x15, 0x04, PPC_64B) GEN_STX_E(stdbr, st64r_i64, 0x14, 0x14, PPC_NONE, PPC2_DBRX, CHK_NONE) GEN_STX_HVRM(stdcix, st64_i64, 0x15, 0x1f, PPC_CILDST) GEN_STX_HVRM(stwcix, st32, 0x15, 0x1c, PPC_CILDST) diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index 80f849fc4a..b36011a539 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -121,6 +121,48 @@ static bool trans_LDU(DisasContext *ctx, arg_D *a) return do_ldst_D(ctx, a, true, false, MO_Q); } =20 +static bool trans_STB(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, true, MO_UB); +} + +static bool trans_STBU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, true, MO_UB); +} + +static bool trans_STH(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, true, MO_UW); +} + +static bool trans_STHU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, true, MO_UW); +} + +static bool trans_STW(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, false, true, MO_UL); +} + +static bool trans_STWU(DisasContext *ctx, arg_D *a) +{ + return do_ldst_D(ctx, a, true, true, MO_UL); +} + +static bool trans_STD(DisasContext *ctx, arg_D *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_D(ctx, a, false, true, MO_Q); +} + +static bool trans_STDU(DisasContext *ctx, arg_D *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_D(ctx, a, true, true, MO_Q); +} + static bool do_ldst_X(DisasContext *ctx, arg_X *a, bool update, bool store, MemOp mop) { @@ -218,6 +260,48 @@ static bool trans_LDUX(DisasContext *ctx, arg_X *a) return do_ldst_X(ctx, a, true, false, MO_Q); } =20 +static bool trans_STBX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, true, MO_UB); +} + +static bool trans_STBUX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, true, MO_UB); +} + +static bool trans_STHX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, true, MO_UW); +} + +static bool trans_STHUX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, true, MO_UW); +} + +static bool trans_STWX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, false, true, MO_UL); +} + +static bool trans_STWUX(DisasContext *ctx, arg_X *a) +{ + return do_ldst_X(ctx, a, true, true, MO_UL); +} + +static bool trans_STDX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_X(ctx, a, false, true, MO_Q); +} + +static bool trans_STDUX(DisasContext *ctx, arg_X *a) +{ + REQUIRE_INSNS_FLAGS(ctx, 64B); + return do_ldst_X(ctx, a, true, true, MO_Q); +} + static bool do_ldst_PLS_D(DisasContext *ctx, arg_PLS_D *a, bool store, MemOp mop) { --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619545416; cv=none; d=zohomail.com; s=zohoarc; b=CuA1tMSJuqjc0mV4RKD4Lin/TD/0M13rj9Jjn6ruBnFnrhbbhlGQvJ3MMg1H8Udm5EGH2BAyKKXyVbBKo6+KdmOn0TSqZ14SnQSzXCPRUAl0PdQNAj6lFqELMp2kvMBeXWEvFo5r5Ktwyxzz4GiU4M7OuWcCGiBEZrJKD6bQ+hw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619545416; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xgOESBy9P3dNcHZHFQbNDsE5cFGsSRj3GR0yEjyOfn4=; b=cp3P5KKK+j7roL3BgwQu4r+pfnSLX4gnK0TNSxu0sAQXbuhiKBIbvUF9aaNha5l8xM1zBJNVC3lr9VUNRgbNrWx1hTdM/CdgQgKXXyYA+Qjo1JDu8FVxbz9+eTpz2U9rrRkDUIAjtxJ3FijGGma+IUldnaAWXbwdXTw48ER6I58= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619545416789139.19755437537344; Tue, 27 Apr 2021 10:43:36 -0700 (PDT) Received: from localhost ([::1]:40788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRkF-0007AT-Kj for importer@patchew.org; Tue, 27 Apr 2021 13:43:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRMK-000285-OP; Tue, 27 Apr 2021 13:18:52 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRMJ-00023I-7t; Tue, 27 Apr 2021 13:18:52 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:54 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 76A4E80139F; Tue, 27 Apr 2021 14:16:54 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 14/15] target/ppc: Implement prefixed integer store instructions Date: Tue, 27 Apr 2021 14:16:48 -0300 Message-Id: <20210427171649.364699-15-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:54.0703 (UTC) FILETIME=[1EFACBF0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/insn64.decode | 12 ++++++++++++ target/ppc/translate/fixedpoint-impl.c.inc | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/target/ppc/insn64.decode b/target/ppc/insn64.decode index 2e08d89e62..0f3b0b2725 100644 --- a/target/ppc/insn64.decode +++ b/target/ppc/insn64.decode @@ -41,6 +41,18 @@ PLWA 000001 00 0--.-- .................. \ PLD 000001 00 0--.-- .................. \ 111001 ..... ..... ................ @PLS_D =20 +### Fixed-Point Store Instructions + +PSTW 000001 10 0--.-- .................. \ + 100100 ..... ..... ................ @PLS_D +PSTB 000001 10 0--.-- .................. \ + 100110 ..... ..... ................ @PLS_D +PSTH 000001 10 0--.-- .................. \ + 101100 ..... ..... ................ @PLS_D + +PSTD 000001 00 0--.-- .................. \ + 111101 ..... ..... ................ @PLS_D + ### Fixed-Point Arithmetic Instructions =20 PADDI 000001 10 0--.-- .................. \ diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/transl= ate/fixedpoint-impl.c.inc index b36011a539..4ba477eb93 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -362,6 +362,26 @@ static bool trans_PLD(DisasContext *ctx, arg_PLS_D *a) return do_ldst_PLS_D(ctx, a, false, MO_Q); } =20 +static bool trans_PSTB(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, true, MO_UB); +} + +static bool trans_PSTH(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, true, MO_UW); +} + +static bool trans_PSTW(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, true, MO_UL); +} + +static bool trans_PSTD(DisasContext *ctx, arg_PLS_D *a) +{ + return do_ldst_PLS_D(ctx, a, true, MO_Q); +} + static bool trans_ADDI(DisasContext *ctx, arg_D *a) { if (a->ra) { --=20 2.25.1 From nobody Mon May 20 15:12:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1619546160; cv=none; d=zohomail.com; s=zohoarc; b=InVE9lkRlCvUkq33L4EiwP2KA0p0mXX8t2kkwsmgkZinOgo13No3lBOoERKkz5XkMCZjqzzwl0AvxrOHcR7zl35UsfJ7p77hxqBAb4gnTEhT6oLRuKO785jBouvDZvfCioV/ktghUp8BQ0a13Bq9ZOZI5jzghDvmi+P+BuzKSpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619546160; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uhjR76F9lzreH6Ew5ZqBkCwaBMF5e29cisGnZ7B2Fb8=; b=NxMVLCuMLapwMks1CFMhPeEoNz5IMViRE+XD6MooTZzoIm5bpJ0sq4NsOKT38hdgaqvOb1nlHGFh2h64UlL4dLoXV/fZFz6vHoGxAT/thOBgRrpKjShWY2ZKVKWm0p1QU3UR2ICA2k9WMfLKdhbxsrBLDEjXrPpxuTZOBjEe7+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1619546160771356.2111423761985; Tue, 27 Apr 2021 10:56:00 -0700 (PDT) Received: from localhost ([::1]:33820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRwF-0007sG-H9 for importer@patchew.org; Tue, 27 Apr 2021 13:55:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbROO-0003a2-EI; Tue, 27 Apr 2021 13:21:00 -0400 Received: from [201.28.113.2] (port=30160 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbROM-0003hI-VJ; Tue, 27 Apr 2021 13:21:00 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:54 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id AAB148013BA; Tue, 27 Apr 2021 14:16:54 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 15/15] target/ppc: Check cpu flags for prefixed insn support Date: Tue, 27 Apr 2021 14:16:49 -0300 Message-Id: <20210427171649.364699-16-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:54.0876 (UTC) FILETIME=[1F1531C0:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (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=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, Luis Pires , lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Prefixed instructions were introduced in Power ISA 3.1 Signed-off-by: Luis Pires --- target/ppc/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 7422ea4e13..f4802a4f08 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -7837,7 +7837,11 @@ static bool ppc_tr_breakpoint_check(DisasContextBase= *dcbase, CPUState *cs, =20 static bool is_prefix_insn(DisasContext *ctx, uint32_t insn) { - /* TODO: Check ctx->insns_flags* for whether prefixes are supported. */ + if (!(ctx->insns_flags2 & PPC2_ISA310)) { + /* Prefixed instructions are not supported */ + return false; + } + return opc1(insn) =3D=3D 1; } =20 --=20 2.25.1