All of lore.kernel.org
 help / color / mirror / Atom feed
From: matheus.ferst@eldorado.org.br
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: danielhb413@gmail.com, richard.henderson@linaro.org,
	groug@kaod.org, "Víctor Colombo" <victor.colombo@eldorado.org.br>,
	clg@kaod.org, "Matheus Ferst" <matheus.ferst@eldorado.org.br>,
	david@gibson.dropbear.id.au
Subject: [PATCH v3 05/37] target/ppc: Implement vmsumcud instruction
Date: Thu, 10 Feb 2022 09:34:15 -0300	[thread overview]
Message-ID: <20220210123447.3933301-6-matheus.ferst@eldorado.org.br> (raw)
In-Reply-To: <20220210123447.3933301-1-matheus.ferst@eldorado.org.br>

From: Víctor Colombo <victor.colombo@eldorado.org.br>

Based on [1] by Lijun Pan <ljp@linux.ibm.com>, which was never merged
into master.

[1]: https://lists.gnu.org/archive/html/qemu-ppc/2020-07/msg00419.html

Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 target/ppc/insn32.decode            |  4 +++
 target/ppc/translate/vmx-impl.c.inc | 53 +++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode
index 4774548b3d..0ec64cb4f4 100644
--- a/target/ppc/insn32.decode
+++ b/target/ppc/insn32.decode
@@ -440,6 +440,10 @@ VEXTRACTWM      000100 ..... 01010 ..... 11001000010    @VX_tb
 VEXTRACTDM      000100 ..... 01011 ..... 11001000010    @VX_tb
 VEXTRACTQM      000100 ..... 01100 ..... 11001000010    @VX_tb
 
+## Vector Multiply-Sum Instructions
+
+VMSUMCUD        000100 ..... ..... ..... ..... 010111   @VA
+
 # VSX Load/Store Instructions
 
 LXV             111101 ..... ..... ............ . 001   @DQ_TSX
diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx-impl.c.inc
index bed8df81c4..694da75448 100644
--- a/target/ppc/translate/vmx-impl.c.inc
+++ b/target/ppc/translate/vmx-impl.c.inc
@@ -2081,6 +2081,59 @@ static bool trans_VPEXTD(DisasContext *ctx, arg_VX *a)
     return true;
 }
 
+static bool trans_VMSUMCUD(DisasContext *ctx, arg_VA *a)
+{
+    TCGv_i64 tmp0, tmp1, prod1h, prod1l, prod0h, prod0l, zero;
+
+    REQUIRE_INSNS_FLAGS2(ctx, ISA310);
+    REQUIRE_VECTOR(ctx);
+
+    tmp0 = tcg_temp_new_i64();
+    tmp1 = tcg_temp_new_i64();
+    prod1h = tcg_temp_new_i64();
+    prod1l = tcg_temp_new_i64();
+    prod0h = tcg_temp_new_i64();
+    prod0l = tcg_temp_new_i64();
+    zero = tcg_constant_i64(0);
+
+    /* prod1 = vsr[vra+32].dw[1] * vsr[vrb+32].dw[1] */
+    get_avr64(tmp0, a->vra, false);
+    get_avr64(tmp1, a->vrb, false);
+    tcg_gen_mulu2_i64(prod1l, prod1h, tmp0, tmp1);
+
+    /* prod0 = vsr[vra+32].dw[0] * vsr[vrb+32].dw[0] */
+    get_avr64(tmp0, a->vra, true);
+    get_avr64(tmp1, a->vrb, true);
+    tcg_gen_mulu2_i64(prod0l, prod0h, tmp0, tmp1);
+
+    /* Sum lower 64-bits elements */
+    get_avr64(tmp1, a->rc, false);
+    tcg_gen_add2_i64(tmp1, tmp0, tmp1, zero, prod1l, zero);
+    tcg_gen_add2_i64(tmp1, tmp0, tmp1, tmp0, prod0l, zero);
+
+    /*
+     * Discard lower 64-bits, leaving the carry into bit 64.
+     * Then sum the higher 64-bit elements.
+     */
+    tcg_gen_mov_i64(tmp1, tmp0);
+    get_avr64(tmp0, a->rc, true);
+    tcg_gen_add2_i64(tmp1, tmp0, tmp0, zero, prod1h, zero);
+    tcg_gen_add2_i64(tmp1, tmp0, tmp1, tmp0, prod0h, zero);
+
+    /* Discard 64 more bits to complete the CHOP128(temp >> 128) */
+    set_avr64(a->vrt, tmp0, false);
+    set_avr64(a->vrt, zero, true);
+
+    tcg_temp_free_i64(tmp0);
+    tcg_temp_free_i64(tmp1);
+    tcg_temp_free_i64(prod1h);
+    tcg_temp_free_i64(prod1l);
+    tcg_temp_free_i64(prod0h);
+    tcg_temp_free_i64(prod0l);
+
+    return true;
+}
+
 static bool do_vx_helper(DisasContext *ctx, arg_VX *a,
                          void (*gen_helper) (TCGv_ptr, TCGv_ptr, TCGv_ptr))
 {
-- 
2.31.1



  parent reply	other threads:[~2022-02-10 13:27 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 12:34 [PATCH v3 00/37] target/ppc: PowerISA Vector/VSX instruction batch matheus.ferst
2022-02-10 12:34 ` [PATCH v3 01/37] target/ppc: Introduce TRANS*FLAGS macros matheus.ferst
2022-02-10 12:34 ` [PATCH v3 02/37] target/ppc: moved vector even and odd multiplication to decodetree matheus.ferst
2022-02-11  3:39   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 03/37] target/ppc: Moved vector multiply high and low " matheus.ferst
2022-02-11  3:41   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 04/37] target/ppc: vmulh* instructions use gvec matheus.ferst
2022-02-11  3:51   ` Richard Henderson
2022-02-10 12:34 ` matheus.ferst [this message]
2022-02-11  4:05   ` [PATCH v3 05/37] target/ppc: Implement vmsumcud instruction Richard Henderson
2022-02-10 12:34 ` [PATCH v3 06/37] target/ppc: Implement vmsumudm instruction matheus.ferst
2022-02-11  4:07   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 07/37] target/ppc: Move vexts[bhw]2[wd] to decodetree matheus.ferst
2022-02-11  4:14   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 08/37] target/ppc: Implement vextsd2q matheus.ferst
2022-02-11  4:15   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 09/37] target/ppc: Move Vector Compare Equal/Not Equal/Greater Than to decodetree matheus.ferst
2022-02-11  4:27   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 10/37] target/ppc: Move Vector Compare Not Equal or Zero " matheus.ferst
2022-02-11  4:41   ` Richard Henderson
2022-02-17 12:45     ` Matheus K. Ferst
2022-02-10 12:34 ` [PATCH v3 11/37] target/ppc: Implement Vector Compare Equal Quadword matheus.ferst
2022-02-11  4:51   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 12/37] target/ppc: Implement Vector Compare Greater Than Quadword matheus.ferst
2022-02-11  4:53   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 13/37] target/ppc: Implement Vector Compare Quadword matheus.ferst
2022-02-11  4:55   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 14/37] target/ppc: implement vstri[bh][lr] matheus.ferst
2022-02-11  5:00   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 15/37] target/ppc: implement vclrlb matheus.ferst
2022-02-11  5:20   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 16/37] target/ppc: implement vclrrb matheus.ferst
2022-02-10 12:34 ` [PATCH v3 17/37] target/ppc: implement vcntmb[bhwd] matheus.ferst
2022-02-11  5:28   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 18/37] target/ppc: implement vgnb matheus.ferst
2022-02-11  6:15   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 19/37] target/ppc: Move vsel and vperm/vpermr to decodetree matheus.ferst
2022-02-10 12:34 ` [PATCH v3 20/37] target/ppc: Move xxsel " matheus.ferst
2022-02-10 12:34 ` [PATCH v3 21/37] target/ppc: move xxperm/xxpermr " matheus.ferst
2022-02-10 12:34 ` [PATCH v3 22/37] target/ppc: Move xxpermdi " matheus.ferst
2022-02-10 12:34 ` [PATCH v3 23/37] target/ppc: Implement xxpermx instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 24/37] tcg/tcg-op-gvec.c: Introduce tcg_gen_gvec_4i matheus.ferst
2022-02-10 12:34 ` [PATCH v3 25/37] target/ppc: Implement xxeval matheus.ferst
2022-02-10 12:34 ` [PATCH v3 26/37] target/ppc: Implement xxgenpcv[bhwd]m instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 27/37] target/ppc: move xs[n]madd[am][ds]p/xs[n]msub[am][ds]p to decodetree matheus.ferst
2022-02-10 12:34 ` [PATCH v3 28/37] target/ppc: implement xs[n]maddqp[o]/xs[n]msubqp[o] matheus.ferst
2022-02-10 12:34 ` [PATCH v3 29/37] target/ppc: Implement xvtlsbb instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 30/37] target/ppc: Remove xscmpnedp instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 31/37] target/ppc: Refactor VSX_SCALAR_CMP_DP matheus.ferst
2022-02-10 12:34 ` [PATCH v3 32/37] target/ppc: Implement xscmp{eq,ge,gt}qp matheus.ferst
2022-02-10 12:34 ` [PATCH v3 33/37] target/ppc: Move xscmp{eq,ge,gt}dp to decodetree matheus.ferst
2022-02-10 12:34 ` [PATCH v3 34/37] target/ppc: Move xs{max, min}[cj]dp to use do_helper_XX3 matheus.ferst
2022-02-10 12:34 ` [PATCH v3 35/37] target/ppc: Refactor VSX_MAX_MINC helper matheus.ferst
2022-02-10 12:34 ` [PATCH v3 36/37] target/ppc: Implement xs{max,min}cqp matheus.ferst
2022-02-10 12:34 ` [PATCH v3 37/37] target/ppc: Implement xvcvbf16spn and xvcvspbf16 instructions matheus.ferst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210123447.3933301-6-matheus.ferst@eldorado.org.br \
    --to=matheus.ferst@eldorado.org.br \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=victor.colombo@eldorado.org.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.