From nobody Tue Feb 10 14:33:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) client-ip=209.85.221.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626037261; cv=none; d=zohomail.com; s=zohoarc; b=Ac6H5om6OlGVOlwDt0HQiYdya7W2/QRqbes++2qPzV4cZOBt54JpiggV92qarDgLdKKZDu8O022yLFV7/znrkVo1ed4xRKePOvS1x+cChU00EH6TKQdRU3wWe5Ecl9Rx01NHFfQEkeQQxAyFeYTGReLRfJOuYUcFr6U+KlwMyHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626037261; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gWVh4UrhDUncjcNNoap6OjkeUWx2lHe7S0zeQI7wmW0=; b=jR45Rp/f6jNLfJgAtN3XTgibb4/wErkEFF0ebadU680vMJ2cY40tmo7fJneNXx3WjL2yZgjK86GR17iJOxDoOtqH7K76f7Hk7hQBXv1P9wv3PRYgqga8Rb8ueheUDde14guD8YW8nR37UpN6PQUlr6+zG8wIWvh9enoq7ZePkqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.zohomail.com with SMTPS id 1626037261393188.44690928562136; Sun, 11 Jul 2021 14:01:01 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id r11so16821605wro.9 for ; Sun, 11 Jul 2021 14:01:00 -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 l22sm3697500wmp.41.2021.07.11.14.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 14:00:59 -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=gWVh4UrhDUncjcNNoap6OjkeUWx2lHe7S0zeQI7wmW0=; b=oO/WPOAFavjsDoEjsunZuN9GDc8dbmHXc2hlBXMa5RA3JC7RXULhC53yjZIAEFIBwz UMqmDSDDGt20HFKUX6aEnerzVgckXe7xhEWJpswkaMIStSpNjQiCNtBdcdmSLHdNOl9q gJSEL8lZz4RY6aLEZjocv6WeFToq9CJV1xodh3clSY4PBEg+LEaHN9XIluFPPt3fvqMm iplnZ4gGJrElLbKGwALGI14epPJkTwbYjI9GWwRWZRovqXM6qm5WgGATThUX+SkwjOlo Ovc4C79tzzlgqeNsKZpcK7WUvRH74b8ZAhYze1/0H19fbLyicV7Xh2yoeTIXxj566KYU vy9Q== 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=gWVh4UrhDUncjcNNoap6OjkeUWx2lHe7S0zeQI7wmW0=; b=gxowfoxeqAQreJLUPvTIoDjCItnCxu6x+klozuNiJWBvKKFulAsO4N90qoEIP8s0md HvM3+lm8kVEfueOjIF59Kime8YkcjBVMe1bnOY+76SwjpO4IcmA27Bx33sF6dZ3Kw3ng nNa/VgdsY7psIOegNkmScnfCPXyYhcXvu0XV7hqNn6vN01CNpysdsJVLV5d0B1VTZbc+ U1zCVz3MlWhs3ZfcxneilZ3y3wO1SVBRzxWcovCvbZX+hfsHKiBLinxJYpykNtwObB5j 36V7C99QYnoQou5DMUrz3hARfAlxmKY5GvK+Ue63H/w7iBY33cfGD9z5KwX7/Ntyjv6i rVSA== X-Gm-Message-State: AOAM531nKFnqqtAA5mhL7CQkzS+at6BcRFVcapW4eha4bq8Lwuu9aAoL nxYB7TwsK8/qDN74Qhn2eAs= X-Google-Smtp-Source: ABdhPJwui/r0W8c0Qt87PZu6wzfRcZR3MPf1GL9OAlRxxLKcYvIaWSwmMxsIqeliE2PzkYzkYHTOWA== X-Received: by 2002:adf:f50e:: with SMTP id q14mr30943349wro.183.1626037259667; Sun, 11 Jul 2021 14:00:59 -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 07/19] target/mips/tx79: Introduce PCEQ* opcodes (Parallel Compare for Equal) Date: Sun, 11 Jul 2021 23:00:04 +0200 Message-Id: <20210711210016.2710100-8-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: 1626037262054100003 Introduce the 'Parallel Compare for Equal' opcodes: - PCEQB (Parallel Compare for Equal Byte) - PCEQH (Parallel Compare for Equal Halfword) - PCEQW (Parallel Compare for Equal Word) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210309145653.743937-14-f4bug@amsat.org> --- target/mips/tcg/tx79.decode | 3 ++ target/mips/tcg/tx79_translate.c | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/target/mips/tcg/tx79.decode b/target/mips/tcg/tx79.decode index 98f21d33e3f..cfe721755ca 100644 --- a/target/mips/tcg/tx79.decode +++ b/target/mips/tcg/tx79.decode @@ -40,6 +40,9 @@ PEXTLB 011100 ..... ..... ..... 11010 001000 @= rs_rt_rd =20 # MMI1 =20 +PCEQW 011100 ..... ..... ..... 00010 101000 @rs_rt_rd +PCEQH 011100 ..... ..... ..... 00110 101000 @rs_rt_rd +PCEQB 011100 ..... ..... ..... 01010 101000 @rs_rt_rd PEXTUW 011100 ..... ..... ..... 10010 101000 @rs_rt_rd =20 # MMI2 diff --git a/target/mips/tcg/tx79_translate.c b/target/mips/tcg/tx79_transl= ate.c index c4656a4c21d..8dd510c2719 100644 --- a/target/mips/tcg/tx79_translate.c +++ b/target/mips/tcg/tx79_translate.c @@ -237,6 +237,72 @@ static bool trans_PNOR(DisasContext *ctx, arg_rtype *a) * PCEQW rd, rs, rt Parallel Compare for Equal Word */ =20 +static bool trans_parallel_compare(DisasContext *ctx, arg_rtype *a, + TCGCond cond, unsigned wlen) +{ + TCGv_i64 c0, c1, ax, bx, t0, t1, t2; + + if (a->rd =3D=3D 0) { + /* nop */ + return true; + } + + c0 =3D tcg_const_tl(0); + c1 =3D tcg_const_tl(0xffffffff); + ax =3D tcg_temp_new_i64(); + bx =3D tcg_temp_new_i64(); + t0 =3D tcg_temp_new_i64(); + t1 =3D tcg_temp_new_i64(); + t2 =3D tcg_temp_new_i64(); + + /* Lower half */ + gen_load_gpr(ax, a->rs); + gen_load_gpr(bx, a->rt); + for (int i =3D 0; i < (64 / wlen); i++) { + tcg_gen_sextract_i64(t0, ax, wlen * i, wlen); + tcg_gen_sextract_i64(t1, bx, wlen * i, wlen); + tcg_gen_movcond_i64(cond, t2, t1, t0, c1, c0); + tcg_gen_deposit_i64(cpu_gpr[a->rd], cpu_gpr[a->rd], t2, wlen * i, = wlen); + } + /* Upper half */ + gen_load_gpr_hi(ax, a->rs); + gen_load_gpr_hi(bx, a->rt); + for (int i =3D 0; i < (64 / wlen); i++) { + tcg_gen_sextract_i64(t0, ax, wlen * i, wlen); + tcg_gen_sextract_i64(t1, bx, wlen * i, wlen); + tcg_gen_movcond_i64(cond, t2, t1, t0, c1, c0); + tcg_gen_deposit_i64(cpu_gpr_hi[a->rd], cpu_gpr_hi[a->rd], t2, wlen= * i, wlen); + } + + tcg_temp_free(t2); + tcg_temp_free(t1); + tcg_temp_free(t0); + tcg_temp_free(bx); + tcg_temp_free(ax); + tcg_temp_free(c1); + tcg_temp_free(c0); + + return true; +} + +/* Parallel Compare for Equal Byte */ +static bool trans_PCEQB(DisasContext *ctx, arg_rtype *a) +{ + return trans_parallel_compare(ctx, a, TCG_COND_EQ, 8); +} + +/* Parallel Compare for Equal Halfword */ +static bool trans_PCEQH(DisasContext *ctx, arg_rtype *a) +{ + return trans_parallel_compare(ctx, a, TCG_COND_EQ, 16); +} + +/* Parallel Compare for Equal Word */ +static bool trans_PCEQW(DisasContext *ctx, arg_rtype *a) +{ + return trans_parallel_compare(ctx, a, TCG_COND_EQ, 32); +} + /* * LZC (1 instruction) * ------------------- --=20 2.31.1