qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: mark.cave-ayland@ilande.co.uk, amarkovic@wavecomp.com,
	hsp.cat7@gmail.com
Subject: [Qemu-devel] [PATCH v6 07/16] tcg/ppc: Add support for vector add/subtract
Date: Sat, 29 Jun 2019 15:00:08 +0200	[thread overview]
Message-ID: <20190629130017.2973-8-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190629130017.2973-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 9c5630dc8a..c31694cc78 100644
--- a/tcg/ppc/tcg-target.inc.c
+++ b/tcg/ppc/tcg-target.inc.c
@@ -474,6 +474,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)
@@ -2833,6 +2841,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:
@@ -2933,6 +2943,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 },
@@ -2956,6 +2968,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;
@@ -3254,6 +3272,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-06-29 13:13 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-29 13:00 [Qemu-devel] [PATCH v6 00/16] tcg/ppc: Add vector opcodes Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 01/16] tcg/ppc: Introduce Altivec registers Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 02/16] tcg/ppc: Introduce macro VX4() Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 03/16] tcg/ppc: Introduce macros VRT(), VRA(), VRB(), VRC() Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 04/16] tcg/ppc: Enable tcg backend vector compilation Richard Henderson
2019-06-30  9:46   ` Aleksandar Markovic
2019-06-30 10:48     ` Richard Henderson
2019-06-30 11:45       ` Aleksandar Markovic
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 05/16] tcg/ppc: Add support for load/store/logic/comparison Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 06/16] tcg/ppc: Add support for vector maximum/minimum Richard Henderson
2019-06-29 13:00 ` Richard Henderson [this message]
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 08/16] tcg/ppc: Add support for vector saturated add/subtract Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 09/16] tcg/ppc: Prepare case for vector multiply Richard Henderson
2019-06-30  9:52   ` Aleksandar Markovic
2019-06-30 10:49     ` Richard Henderson
2019-06-30 11:35       ` Aleksandar Markovic
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 10/16] tcg/ppc: Support vector shift by immediate Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 11/16] tcg/ppc: Support vector multiply Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 12/16] tcg/ppc: Support vector dup2 Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 13/16] tcg/ppc: Enable Altivec detection Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 14/16] tcg/ppc: Update vector support to v2.06 Richard Henderson
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 15/16] tcg/ppc: Update vector support to v2.07 Richard Henderson
2019-06-30 11:50   ` Aleksandar Markovic
2019-06-30 13:37   ` Aleksandar Markovic
2019-06-30 15:12     ` Richard Henderson
2019-07-01  3:57       ` Aleksandar Markovic
2019-07-01 10:29         ` Richard Henderson
2019-07-01 11:41           ` Aleksandar Markovic
2019-07-02 14:25             ` Richard Henderson
2019-07-10 10:52               ` Aleksandar Markovic
2019-06-29 13:00 ` [Qemu-devel] [PATCH v6 16/16] tcg/ppc: Update vector support to v3.00 Richard Henderson
2019-06-29 13:37 ` [Qemu-devel] [PATCH v6 00/16] tcg/ppc: Add vector opcodes no-reply
2019-06-30 17:58 ` Mark Cave-Ayland
2019-07-01 10:30   ` Richard Henderson
2019-07-01 18:34     ` Howard Spoelstra
2019-09-03 17:02       ` Mark Cave-Ayland
2019-09-03 17:37         ` Aleksandar Markovic
2019-09-03 18:32           ` Mark Cave-Ayland
2019-09-05 11:43             ` Aleksandar Markovic
2019-09-27 12:13               ` Aleksandar Markovic

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=20190629130017.2973-8-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=amarkovic@wavecomp.com \
    --cc=hsp.cat7@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).