From nobody Tue Feb 10 10:19:18 2026 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=1618349044; cv=none; d=zohomail.com; s=zohoarc; b=jDIb92yvtkl2NASn0xi/eFjs+0lD8VSFjwSbxr+5fhWMymDFqDQYjKqMAEYO4mBHTHVF8vFxO1NP1+Y2mCIkfkrHrpiNf98I9UHuaHoLZVadnHrKXAw9zTfE8lbfwXQBPLHn4VTkFDOBVlPsIZXk9AGWOv+DaaI8dbJtrdu4HSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618349044; 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=XDD5FJrC1J0kPFw0jLXDriglmMwfjDVN6w7UX7qkP84=; b=NYe8cs7g37zWRdYE48vVCD82ggC6KyAkUuzsrPUdKKceVsuq4Pgw0+ntEEQLH5sgAzviNoyNtsWTF+jNwTFVObRzzWefBu0uDhcj+CkVg4NoSvQGWXUKPQ4663y5g83jqqVjM01KS/AQZ0LS2de5vsBg2mBzgf/wuV6l2n6aESg= 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 1618349044601132.31205171052306; Tue, 13 Apr 2021 14:24:04 -0700 (PDT) Received: from localhost ([::1]:43352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWQVu-00065L-V2 for importer@patchew.org; Tue, 13 Apr 2021 17:24:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWQMC-0007ie-Oj; Tue, 13 Apr 2021 17:14:00 -0400 Received: from [201.28.113.2] (port=27024 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWQMB-0007YY-1N; Tue, 13 Apr 2021 17:14:00 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 13 Apr 2021 18:13:42 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 4C451801212; Tue, 13 Apr 2021 18:13:42 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH 5/5] target/ppc: Implement paddi and replace addi insns Date: Tue, 13 Apr 2021 18:11:29 -0300 Message-Id: <20210413211129.457272-6-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413211129.457272-1-luis.pires@eldorado.org.br> References: <20210413211129.457272-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 13 Apr 2021 21:13:42.0609 (UTC) FILETIME=[E1C4B410:01D730A9] 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" This implements the Power ISA 3.1 prefixed (64-bit) paddi instruction, while also replacing the legacy addi implementation. Both using the decode tree. Signed-off-by: Luis Pires Signed-off-by: Matheus Ferst --- target/ppc/ppc.decode | 8 +++++++ target/ppc/translate.c | 15 +------------ target/ppc/translate/fixedpoint-impl.c.inc | 26 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 target/ppc/translate/fixedpoint-impl.c.inc diff --git a/target/ppc/ppc.decode b/target/ppc/ppc.decode index 84bb73ac19..c87174dc20 100644 --- a/target/ppc/ppc.decode +++ b/target/ppc/ppc.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 . # + +%p_D8_SI 32:s18 0:16 + +# Fixed-Point Facility Instructions +&addi r rt ra si + +paddi 000001 10 0 -- r:1 -- .................. 001110 rt:5 ra:5 ........= ........ si=3D%p_D8_SI &addi +addi 001110 rt:5 ra:5 si:s16 &addi r=3D0 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 0f123f7b80..2ff192c9e5 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -945,19 +945,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) { @@ -6967,6 +6954,7 @@ static target_ulong ppc_peek_next_insn_size(DisasCont= ext *ctx) } =20 #include "decode-ppc.c.inc" +#include "translate/fixedpoint-impl.c.inc" =20 #include "translate/fp-impl.c.inc" =20 @@ -7091,7 +7079,6 @@ GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, P= PC_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), 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..8620954b57 --- /dev/null +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -0,0 +1,26 @@ +static bool trans_paddi(DisasContext *ctx, arg_paddi *a) +{ + if (a->r =3D=3D 0) { + if (a->ra =3D=3D 0) { + /* li case */ + tcg_gen_movi_tl(cpu_gpr[a->rt], a->si); + } else { + tcg_gen_addi_tl(cpu_gpr[a->rt], + cpu_gpr[a->ra], a->si); + } + } else { + if (a->ra =3D=3D 0) { + tcg_gen_addi_tl(cpu_gpr[a->rt], cpu_nip, a->si); + } else { + /* invalid form */ + gen_invalid(ctx); + } + } + + return true; +} + +static bool trans_addi(DisasContext *ctx, arg_addi *a) +{ + return trans_paddi(ctx, a); +} --=20 2.25.1