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: [Qemu-devel] [PATCH v7 09/26] tcg: Add tcg_expand_vec_op and tcg-target.opc.h
Date: Mon, 18 Dec 2017 09:17:41 -0800	[thread overview]
Message-ID: <20171218171758.16964-10-richard.henderson@linaro.org> (raw)
In-Reply-To: <20171218171758.16964-1-richard.henderson@linaro.org>

These will be useful in the next few patches adding shifts,
permutes, and multiplication.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/i386/tcg-target.opc.h |  3 +++
 tcg/tcg-opc.h             |  6 ++++++
 tcg/tcg.h                 | 15 +++++++++++++++
 tcg/i386/tcg-target.inc.c | 21 +++++++++++++++++++++
 tcg/tcg.c                 | 13 ++++++++++---
 5 files changed, 55 insertions(+), 3 deletions(-)
 create mode 100644 tcg/i386/tcg-target.opc.h

diff --git a/tcg/i386/tcg-target.opc.h b/tcg/i386/tcg-target.opc.h
new file mode 100644
index 0000000000..4816a6c3d4
--- /dev/null
+++ b/tcg/i386/tcg-target.opc.h
@@ -0,0 +1,3 @@
+/* Target-specific opcodes for host vector expansion.  These will be
+   emitted by tcg_expand_vec_op.  For those familiar with GCC internals,
+   consider these to be UNSPEC with names.  */
diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
index 4e62eda14b..b4e16cfbc3 100644
--- a/tcg/tcg-opc.h
+++ b/tcg/tcg-opc.h
@@ -229,6 +229,12 @@ DEF(andc_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_andc_vec))
 DEF(orc_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_orc_vec))
 DEF(not_vec, 1, 1, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_not_vec))
 
+DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT)
+
+#if TCG_TARGET_MAYBE_vec
+#include "tcg-target.opc.h"
+#endif
+
 #undef TLADDR_ARGS
 #undef DATA64_ARGS
 #undef IMPL
diff --git a/tcg/tcg.h b/tcg/tcg.h
index dce483b0ee..0e9d79bdd4 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -1207,6 +1207,21 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr);
 
 void tcg_register_jit(void *buf, size_t buf_size);
 
+#if TCG_TARGET_MAYBE_vec
+/* Return zero if the tuple (opc, type, vece) is unsupportable;
+   return > 0 if it is directly supportable;
+   return < 0 if we must call tcg_expand_vec_op.  */
+int tcg_can_emit_vec_op(TCGOpcode, TCGType, unsigned);
+#else
+static inline int tcg_can_emit_vec_op(TCGOpcode o, TCGType t, unsigned ve)
+{
+    return 0;
+}
+#endif
+
+/* Expand the tuple (opc, type, vece) on the given arguments.  */
+void tcg_expand_vec_op(TCGOpcode, TCGType, unsigned, TCGArg, ...);
+
 /*
  * Memory helpers that will be used by TCG generated code.
  */
diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index e9a4d92598..062cf16607 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -2942,6 +2942,27 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
     return NULL;
 }
 
+int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece)
+{
+    switch (opc) {
+    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:
+    case INDEX_op_andc_vec:
+        return true;
+
+    default:
+        return false;
+    }
+}
+
+void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
+                       TCGArg a0, ...)
+{
+}
+
 static const int tcg_target_callee_save_regs[] = {
 #if TCG_TARGET_REG_BITS == 64
     TCG_REG_RBP,
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 16b8faf66f..b4f8938fb0 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1404,10 +1404,10 @@ bool tcg_op_supported(TCGOpcode op)
     case INDEX_op_orc_vec:
         return have_vec && TCG_TARGET_HAS_orc_vec;
 
-    case NB_OPS:
-        break;
+    default:
+        tcg_debug_assert(op > INDEX_op_last_generic && op < NB_OPS);
+        return true;
     }
-    g_assert_not_reached();
 }
 
 /* Note: we convert the 64 bit args to 32 bit and do some alignment
@@ -3737,3 +3737,10 @@ void tcg_register_jit(void *buf, size_t buf_size)
 {
 }
 #endif /* ELF_HOST_MACHINE */
+
+#if !TCG_TARGET_MAYBE_vec
+void tcg_expand_vec_op(TCGOpcode o, TCGType t, unsigned e, TCGArg a0, ...)
+{
+    g_assert_not_reached();
+}
+#endif
-- 
2.14.3

  parent reply	other threads:[~2017-12-18 17:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 17:17 [Qemu-devel] [PATCH v7 00/26] tcg: generic vector operations Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 01/26] tcg: Add types and basic operations for host vectors Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 02/26] tcg: Add generic vector expanders Richard Henderson
2017-12-27 15:20   ` Kirill Batuzov
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 03/26] tcg: Allow multiple word entries into the constant pool Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 04/26] target/arm: Align vector registers Richard Henderson
2017-12-18 20:32   ` Philippe Mathieu-Daudé
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 05/26] target/arm: Use vector infrastructure for aa64 add/sub/logic Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 06/26] target/arm: Use vector infrastructure for aa64 mov/not/neg Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 07/26] target/arm: Use vector infrastructure for aa64 dup/movi Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 08/26] tcg/i386: Add vector operations Richard Henderson
2017-12-27 15:31   ` Kirill Batuzov
2017-12-27 22:41     ` Richard Henderson
2017-12-18 17:17 ` Richard Henderson [this message]
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 10/26] tcg: Add generic vector ops for interleave Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 11/26] target/arm: Use vector infrastructure for aa64 zip/uzp/trn/xtn Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 12/26] tcg: Add generic vector ops for constant shifts Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 13/26] target/arm: Use vector infrastructure for aa64 " Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 14/26] tcg: Add generic vector ops for comparisons Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 15/26] target/arm: Use vector infrastructure for aa64 compares Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 16/26] tcg/i386: Add vector operations/expansions for shift/cmp/interleave Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 17/26] tcg: Add generic vector ops for multiplication Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 18/26] target/arm: Use vector infrastructure for aa64 multiplies Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 19/26] tcg: Add generic vector ops for extension Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 20/26] target/arm: Use vector infrastructure for aa64 widening shifts Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 21/26] tcg/i386: Add vector operations/expansions for mul/extend Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 22/26] tcg/aarch64: Add vector operations Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 23/26] tcg/optimize: Handle vector opcodes during optimize Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 24/26] tcg: Add support for 4 operand vector ops Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 25/26] tcg: Add support for 5 " Richard Henderson
2017-12-18 17:17 ` [Qemu-devel] [PATCH v7 26/26] tcg: Add generic helpers for saturating arithmetic Richard Henderson

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=20171218171758.16964-10-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).