From nobody Tue Feb 10 20:07:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.43 as permitted sender) client-ip=209.85.128.43; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f43.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626037256; cv=none; d=zohomail.com; s=zohoarc; b=Aou3hBZyBMkGVMMzudAl7y3uPJh6uOAjATb4FSPwCm+Ach6f2220rNLW7ccTdfmv8QKgBgPXMG52zlEA9ZN/4fpjn1DesEezWPxvwkDbadH/63FrZtpgQImKnI7bANV8EUERORq6AyZA5u31NCdwD9Eo6jzyH57GSeotVI8zvOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626037256; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5XKU4Tkdv/SSZ1Urbjy7D1rDO0a00fPrTd38NNFwCE8=; b=YJsqh4yEHhNKvzipFCKnCV9FrMjtfCJrnvQkU6UtVZnozqbNBImtpC9tgZi9TIEneUmjVzys/kDnwY8SSqX+maSVpj0VWKnHTDU0jGmsLnZnlvKl8yQRNemrb8xAtYAozONv6qfW90bb8hPi+guotCRWOu5XTbAZg/LBJbRiFdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.zohomail.com with SMTPS id 1626037256675462.3330492582131; Sun, 11 Jul 2021 14:00:56 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso12891729wmh.4 for ; Sun, 11 Jul 2021 14:00:56 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (abayonne-654-1-142-116.w86-222.abo.wanadoo.fr. [86.222.93.116]) by smtp.gmail.com with ESMTPSA id x19sm10899259wmi.10.2021.07.11.14.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 14:00:54 -0700 (PDT) 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=5XKU4Tkdv/SSZ1Urbjy7D1rDO0a00fPrTd38NNFwCE8=; b=aZ/eE8GIIQNHi7+Ql+nI5eDmsET0LtOD6AbcmtjFRBtALCzEPQlesDwp9zSslK98xw LCDb9UzMeC6nfj0gDVf8BRcC7HYwbfviLU3UB/KZ1Yid6sgh+xcecwc7vZNYVYDLvU6G gGMw1qms3EgipkLub8/Bd3JN59SOR3WP4dn2D7hEgtkJtCVaDVA320TjiOYOSuXU5ftt g0e2BZcueIAg3CiLsDgM4yOC5ei3zVYSjc01m8V89kimaltMjsNmkgV5YMHo2jUNsAzo Ipsu4ImEHYnb4NPNOW9/s65PYelMS8OUWN0Q2rv0ujcrVI9Hl5QGXHCOfKONL6TN1LLv ue+g== 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=5XKU4Tkdv/SSZ1Urbjy7D1rDO0a00fPrTd38NNFwCE8=; b=EaE7/S0Vf+g4qWGbktP2d3pDlKyy4aHKRh6pSOyecxAXXeinOFn2eagFCMeiehCNre E47m+HgWYeQu09ZnmQvbWZWGQaCI5+UAVPInNWKyChaSuc6b+gH2D0tLU0co9EIQl4EY cyJzAN1Y1K1VRJRQsmB4zBiDTyRDXbxbihTaQdqB9UZQ/JtCrXkmmKpEciDFn77m+uaD crvsA1MQkrF1Uub7r1ECT9N0PTLNchse7HnI8tvLXTw7UckYaIXGXePptMjD4YGT9bvH 9oe6pQ8UccnEc3tY7YjyMmwWEyChlG63KGkWGgEoQTLHHfFjwWn+MajlISSjg1clY3PR hV5Q== X-Gm-Message-State: AOAM533m2LXJFjKtCagOnC4grS2/YhtAYL5AQr5yT3EnezVMwI99TDdY fd25hMLcCR06DfvPUbbW+Cf+a5eucDdyMCNL X-Google-Smtp-Source: ABdhPJzU1xwEdzki7aTxLcuHhUWEIHxNClpOcTu0YZLij98gG5yn2+jnOPGPVLDCk/qAunEI3wEQew== X-Received: by 2002:a1c:25c6:: with SMTP id l189mr11028790wml.49.1626037254939; Sun, 11 Jul 2021 14:00:54 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Fredrik Noring , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 06/19] target/mips/tx79: Introduce PEXTL[BHW] opcodes (Parallel Extend Lower) Date: Sun, 11 Jul 2021 23:00:03 +0200 Message-Id: <20210711210016.2710100-7-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210711210016.2710100-1-f4bug@amsat.org> References: <20210711210016.2710100-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) X-ZM-MESSAGEID: 1626037257696100001 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 Message-Id: <20210309145653.743937-13-f4bug@amsat.org> --- target/mips/tcg/tx79.decode | 3 ++ target/mips/tcg/tx79_translate.c | 75 ++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/target/mips/tcg/tx79.decode b/target/mips/tcg/tx79.decode index ead5f8281e5..98f21d33e3f 100644 --- a/target/mips/tcg/tx79.decode +++ b/target/mips/tcg/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/tcg/tx79_translate.c b/target/mips/tcg/tx79_transl= ate.c index 68c56affc4c..c4656a4c21d 100644 --- a/target/mips/tcg/tx79_translate.c +++ b/target/mips/tcg/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.31.1