From nobody Wed Nov 19 10:11:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.42 as permitted sender) client-ip=209.85.218.42; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f42.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615301878; cv=none; d=zohomail.com; s=zohoarc; b=FiI54HvASVbnNiXpW735msbK1QKagoH1Zt4ZBthLmkXsirT6JZ/06ZL1XZPngmBjPr0ILOmPZ4WI5LdDHc5OngRYKXR70YXGPd8X1qPvI94gShSOVetXDitrgCW48+2J2Mti5TmydiXGaHgunClCbl+j/v234izTjek6u45pdQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615301878; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QOhpnrF1XVp829jjkXzuMvSRqzxbno4iUbDwXPyc+ek=; b=ISxslh5RhfTNHFL1/Qr0khZXVa/i3Vegh5acaNEXbxQcjg89bbsTAqn2ADisErrZx2hYfoYxuGphs467B6ob3WPmsQ2WwCc2fZX+SfBJsN/yi5ELJh1NuautRBD8AyVGlcEtbVqZMx22//1vAcVJXZXEo3JQ0whrmBYb0Midsa0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by mx.zohomail.com with SMTPS id 1615301878889563.5275019638747; Tue, 9 Mar 2021 06:57:58 -0800 (PST) Received: by mail-ej1-f42.google.com with SMTP id mm21so28413671ejb.12 for ; Tue, 09 Mar 2021 06:57:58 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id h13sm9439857edz.71.2021.03.09.06.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 06:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QOhpnrF1XVp829jjkXzuMvSRqzxbno4iUbDwXPyc+ek=; b=Shb2d8hHigh3WWhJYFupMaJyEc/gJhOFAwJBM95zIzFnq5ElK3hNkrXsnhcfmb5eky /oHYwVb6SmjUwV/ScC0ei+SF8Pt1coCZpLW9fkmbBZ3Ctu3TjSGiKV23Qma0vE5tFPCe qRywlV7OVuhMdy1yWtbnHAVExLlED7RI3h0gwnLFrC0b967CT3q72O2SwqngJwPxkUs9 dbmKyimXw+SaSBMPHzpQFVhMvo2JVXRRGv1GVUQ0rtL4MPL7cW8G14SlqsGmGgoR4BOz 23Me0TvUAKLjoZG+Isc5F0YPLo1r/sMbMUG1PNhe3Dk20S8QOykyTPwW+FqbXqppz2TE GFlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=QOhpnrF1XVp829jjkXzuMvSRqzxbno4iUbDwXPyc+ek=; b=RBvD3AIbGlVbO4mVub5AHJYE2UfTK7tWMm9c7jqiPSzxnbjE20wuY7yY+wj2sgVOog rYJkHPuqmfdVCahGM/+yMZ/zacsgso88iaOS60tYYXTs+2Zee0J2Mr9wFJ8fs9qp4Oc4 sZdws7qIPHyKNOWTsV6UPwiqKvpSJQIG2Ye3WfmrlbDAsF1429rNcWC8PiWp/cHAB7UY zpcEqy8f+lMY6GP0gsxTky7a9GNtYdiWf/Q9bExP9Jk7wPyf6auezKwYq1Msum58Dh7g IRJE3Sc7G06NQIlH/Y7byThgn3RXgvcBG4Y3VQcID+355noaGMP/oKivR8LJEXKau8ky ATWw== X-Gm-Message-State: AOAM530Hxf5+OZ0HtRy4P5iIz77NwQNOZ89LzUC0aJ61fkgydMvunoK3 OY2yuIB1emcpl4jmIOVdw6U= X-Google-Smtp-Source: ABdhPJx8ElgFvDx5JTD22RjDIhPfyrPzWW193uAHMGJGiVzOZdGTp8otaPdyty/nlwD2lirVWZJFGQ== X-Received: by 2002:a17:906:add7:: with SMTP id lb23mr20596390ejb.273.1615301876888; Tue, 09 Mar 2021 06:57:56 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Aleksandar Rikalo , Jiaxun Yang , Aurelien Jarno , Fredrik Noring , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH v2 12/22] target/mips/tx79: Introduce PEXTL[BHW] opcodes (Parallel Extend Lower) Date: Tue, 9 Mar 2021 15:56:43 +0100 Message-Id: <20210309145653.743937-13-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210309145653.743937-1-f4bug@amsat.org> References: <20210309145653.743937-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Introduce the 'Parallel Extend Lower' opcodes: - PEXTLB (Parallel Extend Upper from Byte) - PEXTLH (Parallel Extend Upper from Halfword) - PEXTLW (Parallel Extend Upper from Word) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- v2: Uses gen_pextw, still unoptimized, see: https://www.mail-archive.com/qemu-devel@nongnu.org/msg782796.html --- target/mips/tx79.decode | 3 ++ target/mips/tx79_translate.c | 75 ++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/target/mips/tx79.decode b/target/mips/tx79.decode index ead5f8281e5..98f21d33e3f 100644 --- a/target/mips/tx79.decode +++ b/target/mips/tx79.decode @@ -34,6 +34,9 @@ MTLO1 011100 ..... 0000000000 00000 010011 @= rs PSUBW 011100 ..... ..... ..... 00001 001000 @rs_rt_rd PSUBH 011100 ..... ..... ..... 00101 001000 @rs_rt_rd PSUBB 011100 ..... ..... ..... 01001 001000 @rs_rt_rd +PEXTLW 011100 ..... ..... ..... 10010 001000 @rs_rt_rd +PEXTLH 011100 ..... ..... ..... 10110 001000 @rs_rt_rd +PEXTLB 011100 ..... ..... ..... 11010 001000 @rs_rt_rd =20 # MMI1 =20 diff --git a/target/mips/tx79_translate.c b/target/mips/tx79_translate.c index 68c56affc4c..c4656a4c21d 100644 --- a/target/mips/tx79_translate.c +++ b/target/mips/tx79_translate.c @@ -297,6 +297,81 @@ static void gen_pextw(TCGv_i64 dl, TCGv_i64 dh, TCGv_i= 64 a, TCGv_i64 b) tcg_gen_deposit_i64(dh, a, b, 0, 32); } =20 +static bool trans_PEXTLx(DisasContext *ctx, arg_rtype *a, unsigned wlen) +{ + TCGv_i64 ax, bx; + + if (a->rd =3D=3D 0) { + /* nop */ + return true; + } + + ax =3D tcg_temp_new_i64(); + bx =3D tcg_temp_new_i64(); + + gen_load_gpr(ax, a->rs); + gen_load_gpr(bx, a->rt); + + /* Lower half */ + for (int i =3D 0; i < 64 / (2 * wlen); i++) { + tcg_gen_deposit_i64(cpu_gpr[a->rd], + cpu_gpr[a->rd], bx, 2 * wlen * i, wlen); + tcg_gen_deposit_i64(cpu_gpr[a->rd], + cpu_gpr[a->rd], ax, 2 * wlen * i + wlen, wlen); + tcg_gen_shri_i64(bx, bx, wlen); + tcg_gen_shri_i64(ax, ax, wlen); + } + /* Upper half */ + for (int i =3D 0; i < 64 / (2 * wlen); i++) { + tcg_gen_deposit_i64(cpu_gpr_hi[a->rd], + cpu_gpr_hi[a->rd], bx, 2 * wlen * i, wlen); + tcg_gen_deposit_i64(cpu_gpr_hi[a->rd], + cpu_gpr_hi[a->rd], ax, 2 * wlen * i + wlen, wl= en); + tcg_gen_shri_i64(bx, bx, wlen); + tcg_gen_shri_i64(ax, ax, wlen); + } + + tcg_temp_free(bx); + tcg_temp_free(ax); + + return true; +} + +/* Parallel Extend Lower from Byte */ +static bool trans_PEXTLB(DisasContext *ctx, arg_rtype *a) +{ + return trans_PEXTLx(ctx, a, 8); +} + +/* Parallel Extend Lower from Halfword */ +static bool trans_PEXTLH(DisasContext *ctx, arg_rtype *a) +{ + return trans_PEXTLx(ctx, a, 16); +} + +/* Parallel Extend Lower from Word */ +static bool trans_PEXTLW(DisasContext *ctx, arg_rtype *a) +{ + TCGv_i64 ax, bx; + + if (a->rd =3D=3D 0) { + /* nop */ + return true; + } + + ax =3D tcg_temp_new_i64(); + bx =3D tcg_temp_new_i64(); + + gen_load_gpr(ax, a->rs); + gen_load_gpr(bx, a->rt); + gen_pextw(cpu_gpr[a->rd], cpu_gpr_hi[a->rd], ax, bx); + + tcg_temp_free(bx); + tcg_temp_free(ax); + + return true; +} + /* Parallel Extend Upper from Word */ static bool trans_PEXTUW(DisasContext *ctx, arg_rtype *a) { --=20 2.26.2