qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [PULL 19/23] tcg/ppc: Update vector support for v2.07 FP
Date: Sun, 13 Oct 2019 15:25:40 -0700	[thread overview]
Message-ID: <20191013222544.3679-20-richard.henderson@linaro.org> (raw)
In-Reply-To: <20191013222544.3679-1-richard.henderson@linaro.org>

These new instructions are conditional on MSR.FP when TX=0 and
MSR.VEC when TX=1.  Since we only care about the Altivec registers,
and force TX=1, we can consider these to be Altivec instructions.
Since Altivec is true for any use of vector types, we only need
test have_isa_2_07.

This includes moves to and from the integer registers.

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

diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c
index 6321e0767f..840464aab5 100644
--- a/tcg/ppc/tcg-target.inc.c
+++ b/tcg/ppc/tcg-target.inc.c
@@ -586,6 +586,11 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type,
 #define XXPERMDI   (OPCD(60) | (10 << 3) | 7)  /* v2.06, force ax=bx=tx=1 */
 #define XXSEL      (OPCD(60) | (3 << 4) | 0xf) /* v2.06, force ax=bx=cx=tx=1 */
 
+#define MFVSRD     (XO31(51) | 1)   /* v2.07, force sx=1 */
+#define MFVSRWZ    (XO31(115) | 1)  /* v2.07, force sx=1 */
+#define MTVSRD     (XO31(179) | 1)  /* v2.07, force tx=1 */
+#define MTVSRWZ    (XO31(243) | 1)  /* v2.07, force tx=1 */
+
 #define RT(r) ((r)<<21)
 #define RS(r) ((r)<<21)
 #define RA(r) ((r)<<16)
@@ -715,12 +720,27 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
         tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
         /* fallthru */
     case TCG_TYPE_I32:
-        if (ret < TCG_REG_V0 && arg < TCG_REG_V0) {
-            tcg_out32(s, OR | SAB(arg, ret, arg));
-            break;
-        } else if (ret < TCG_REG_V0 || arg < TCG_REG_V0) {
-            /* Altivec does not support vector/integer moves.  */
-            return false;
+        if (ret < TCG_REG_V0) {
+            if (arg < TCG_REG_V0) {
+                tcg_out32(s, OR | SAB(arg, ret, arg));
+                break;
+            } else if (have_isa_2_07) {
+                tcg_out32(s, (type == TCG_TYPE_I32 ? MFVSRWZ : MFVSRD)
+                          | VRT(arg) | RA(ret));
+                break;
+            } else {
+                /* Altivec does not support vector->integer moves.  */
+                return false;
+            }
+        } else if (arg < TCG_REG_V0) {
+            if (have_isa_2_07) {
+                tcg_out32(s, (type == TCG_TYPE_I32 ? MTVSRWZ : MTVSRD)
+                          | VRT(ret) | RA(arg));
+                break;
+            } else {
+                /* Altivec does not support integer->vector moves.  */
+                return false;
+            }
         }
         /* fallthru */
     case TCG_TYPE_V64:
-- 
2.17.1



  parent reply	other threads:[~2019-10-13 22:41 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 ` [PULL 10/23] tcg/ppc: Add support for vector add/subtract Richard Henderson
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 ` Richard Henderson [this message]
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-20-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --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 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).