All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Aleksandar Markovic <amarkovic@wavecomp.com>
Subject: [PULL 10/23] tcg/ppc: Add support for vector add/subtract
Date: Sun, 13 Oct 2019 15:25:31 -0700	[thread overview]
Message-ID: <20191013222544.3679-11-richard.henderson@linaro.org> (raw)
In-Reply-To: <20191013222544.3679-1-richard.henderson@linaro.org>

Add support for vector add/subtract using Altivec instructions:
VADDUBM, VADDUHM, VADDUWM, VSUBUBM, VSUBUHM, VSUBUWM.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 tcg/ppc/tcg-target.inc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c
index 6879be6f80..6cfc78bb59 100644
--- a/tcg/ppc/tcg-target.inc.c
+++ b/tcg/ppc/tcg-target.inc.c
@@ -471,6 +471,14 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type,
 #define STVX       XO31(231)
 #define STVEWX     XO31(199)
 
+#define VADDUBM    VX4(0)
+#define VADDUHM    VX4(64)
+#define VADDUWM    VX4(128)
+
+#define VSUBUBM    VX4(1024)
+#define VSUBUHM    VX4(1088)
+#define VSUBUWM    VX4(1152)
+
 #define VMAXSB     VX4(258)
 #define VMAXSH     VX4(322)
 #define VMAXSW     VX4(386)
@@ -2830,6 +2838,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece)
     case INDEX_op_andc_vec:
     case INDEX_op_not_vec:
         return 1;
+    case INDEX_op_add_vec:
+    case INDEX_op_sub_vec:
     case INDEX_op_smax_vec:
     case INDEX_op_smin_vec:
     case INDEX_op_umax_vec:
@@ -2930,6 +2940,8 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
                            const TCGArg *args, const int *const_args)
 {
     static const uint32_t
+        add_op[4] = { VADDUBM, VADDUHM, VADDUWM, 0 },
+        sub_op[4] = { VSUBUBM, VSUBUHM, VSUBUWM, 0 },
         eq_op[4]  = { VCMPEQUB, VCMPEQUH, VCMPEQUW, 0 },
         gts_op[4] = { VCMPGTSB, VCMPGTSH, VCMPGTSW, 0 },
         gtu_op[4] = { VCMPGTUB, VCMPGTUH, VCMPGTUW, 0 },
@@ -2953,6 +2965,12 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
         tcg_out_dupm_vec(s, type, vece, a0, a1, a2);
         return;
 
+    case INDEX_op_add_vec:
+        insn = add_op[vece];
+        break;
+    case INDEX_op_sub_vec:
+        insn = sub_op[vece];
+        break;
     case INDEX_op_smin_vec:
         insn = smin_op[vece];
         break;
@@ -3251,6 +3269,8 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
         return (TCG_TARGET_REG_BITS == 64 ? &S_S
                 : TARGET_LONG_BITS == 32 ? &S_S_S : &S_S_S_S);
 
+    case INDEX_op_add_vec:
+    case INDEX_op_sub_vec:
     case INDEX_op_and_vec:
     case INDEX_op_or_vec:
     case INDEX_op_xor_vec:
-- 
2.17.1



  parent reply	other threads:[~2019-10-13 22:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-13 22:25 [PULL 00/23] tcg patch queue Richard Henderson
2019-10-13 22:25 ` [PULL 01/23] tcg/ppc: Introduce Altivec registers Richard Henderson
2019-10-13 22:25 ` [PULL 02/23] tcg/ppc: Introduce macro VX4() Richard Henderson
2019-10-13 22:25 ` [PULL 03/23] tcg/ppc: Introduce macros VRT(), VRA(), VRB(), VRC() Richard Henderson
2019-10-13 22:25 ` [PULL 04/23] tcg/ppc: Create TCGPowerISA and have_isa Richard Henderson
2019-10-13 22:25 ` [PULL 05/23] tcg/ppc: Replace HAVE_ISA_2_06 Richard Henderson
2019-10-13 22:25 ` [PULL 06/23] tcg/ppc: Replace HAVE_ISEL macro with a variable Richard Henderson
2019-10-13 22:25 ` [PULL 07/23] tcg/ppc: Enable tcg backend vector compilation Richard Henderson
2019-10-13 22:25 ` [PULL 08/23] tcg/ppc: Add support for load/store/logic/comparison Richard Henderson
2019-10-13 22:25 ` [PULL 09/23] tcg/ppc: Add support for vector maximum/minimum Richard Henderson
2019-10-13 22:25 ` Richard Henderson [this message]
2019-10-13 22:25 ` [PULL 11/23] tcg/ppc: Add support for vector saturated add/subtract Richard Henderson
2019-10-13 22:25 ` [PULL 12/23] tcg/ppc: Support vector shift by immediate Richard Henderson
2019-10-13 22:25 ` [PULL 13/23] tcg/ppc: Support vector multiply Richard Henderson
2019-10-13 22:25 ` [PULL 14/23] tcg/ppc: Support vector dup2 Richard Henderson
2019-10-13 22:25 ` [PULL 15/23] tcg/ppc: Enable Altivec detection Richard Henderson
2019-10-13 22:25 ` [PULL 16/23] tcg/ppc: Update vector support for VSX Richard Henderson
2019-10-13 22:25 ` [PULL 17/23] tcg/ppc: Update vector support for v2.07 Altivec Richard Henderson
2019-10-13 22:25 ` [PULL 18/23] tcg/ppc: Update vector support for v2.07 VSX Richard Henderson
2019-10-13 22:25 ` [PULL 19/23] tcg/ppc: Update vector support for v2.07 FP Richard Henderson
2019-10-13 22:25 ` [PULL 20/23] tcg/ppc: Update vector support for v3.00 Altivec Richard Henderson
2019-10-13 22:25 ` [PULL 21/23] tcg/ppc: Update vector support for v3.00 load/store Richard Henderson
2019-10-13 22:25 ` [PULL 22/23] tcg/ppc: Update vector support for v3.00 dup/dupi Richard Henderson
2019-10-13 22:25 ` [PULL 23/23] cpus: kick all vCPUs when running thread=single Richard Henderson
2019-10-13 23:26 ` [PULL 00/23] tcg patch queue no-reply
2019-10-13 23:53 ` Aleksandar Markovic
2019-10-14  3:23   ` Richard Henderson
2019-10-14  4:41     ` Aleksandar Markovic
2019-10-17 14:55 ` Richard Henderson
2019-10-17 17:16   ` Peter Maydell

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=20191013222544.3679-11-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=amarkovic@wavecomp.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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.