public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-446] arm: [MVE intrinsics] add unspec_mve_function_exact_insn
@ 2023-05-03 15:00 Christophe Lyon
  0 siblings, 0 replies; only message in thread
From: Christophe Lyon @ 2023-05-03 15:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:55967d4a2392f2e0a873dca687c1b075c1184917

commit r14-446-g55967d4a2392f2e0a873dca687c1b075c1184917
Author: Christophe Lyon <christophe.lyon@arm.com>
Date:   Fri Sep 23 14:50:26 2022 +0000

    arm: [MVE intrinsics] add unspec_mve_function_exact_insn
    
    Introduce a function that will be used to build intrinsics which use
    UNSPECS for the versions.
    
    2022-09-08  Christophe Lyon <christophe.lyon@arm.com>
    
            gcc/
            * config/arm/arm-mve-builtins-functions.h (class
            unspec_mve_function_exact_insn): New.

Diff:
---
 gcc/config/arm/arm-mve-builtins-functions.h | 151 ++++++++++++++++++++++++++++
 1 file changed, 151 insertions(+)

diff --git a/gcc/config/arm/arm-mve-builtins-functions.h b/gcc/config/arm/arm-mve-builtins-functions.h
index 6d992b270b0..5abf913d182 100644
--- a/gcc/config/arm/arm-mve-builtins-functions.h
+++ b/gcc/config/arm/arm-mve-builtins-functions.h
@@ -225,6 +225,157 @@ public:
   }
 };
 
+/* Map the function directly to CODE (UNSPEC, M) where M is the vector
+   mode associated with type suffix 0.  */
+class unspec_mve_function_exact_insn : public function_base
+{
+public:
+  CONSTEXPR unspec_mve_function_exact_insn (int unspec_for_sint,
+					    int unspec_for_uint,
+					    int unspec_for_fp,
+					    int unspec_for_n_sint,
+					    int unspec_for_n_uint,
+					    int unspec_for_n_fp,
+					    int unspec_for_m_sint,
+					    int unspec_for_m_uint,
+					    int unspec_for_m_fp,
+					    int unspec_for_m_n_sint,
+					    int unspec_for_m_n_uint,
+					    int unspec_for_m_n_fp)
+    : m_unspec_for_sint (unspec_for_sint),
+      m_unspec_for_uint (unspec_for_uint),
+      m_unspec_for_fp (unspec_for_fp),
+      m_unspec_for_n_sint (unspec_for_n_sint),
+      m_unspec_for_n_uint (unspec_for_n_uint),
+      m_unspec_for_n_fp (unspec_for_n_fp),
+      m_unspec_for_m_sint (unspec_for_m_sint),
+      m_unspec_for_m_uint (unspec_for_m_uint),
+      m_unspec_for_m_fp (unspec_for_m_fp),
+      m_unspec_for_m_n_sint (unspec_for_m_n_sint),
+      m_unspec_for_m_n_uint (unspec_for_m_n_uint),
+      m_unspec_for_m_n_fp (unspec_for_m_n_fp)
+  {}
+
+  /* The unspec code associated with signed-integer, unsigned-integer
+     and floating-point operations respectively.  It covers the cases
+     with the _n suffix, and/or the _m predicate.  */
+  int m_unspec_for_sint;
+  int m_unspec_for_uint;
+  int m_unspec_for_fp;
+  int m_unspec_for_n_sint;
+  int m_unspec_for_n_uint;
+  int m_unspec_for_n_fp;
+  int m_unspec_for_m_sint;
+  int m_unspec_for_m_uint;
+  int m_unspec_for_m_fp;
+  int m_unspec_for_m_n_sint;
+  int m_unspec_for_m_n_uint;
+  int m_unspec_for_m_n_fp;
+
+  rtx
+  expand (function_expander &e) const override
+  {
+    insn_code code;
+    switch (e.pred)
+      {
+      case PRED_none:
+	switch (e.mode_suffix_id)
+	  {
+	  case MODE_none:
+	    /* No predicate, no suffix.  */
+	    if (e.type_suffix (0).integer_p)
+	      if (e.type_suffix (0).unsigned_p)
+		code = code_for_mve_q (m_unspec_for_uint, m_unspec_for_uint, e.vector_mode (0));
+	      else
+		code = code_for_mve_q (m_unspec_for_sint, m_unspec_for_sint, e.vector_mode (0));
+	    else
+	      code = code_for_mve_q_f (m_unspec_for_fp, e.vector_mode (0));
+	    break;
+
+	  case MODE_n:
+	    /* No predicate, _n suffix.  */
+	    if (e.type_suffix (0).integer_p)
+	      if (e.type_suffix (0).unsigned_p)
+		code = code_for_mve_q_n (m_unspec_for_n_uint, m_unspec_for_n_uint, e.vector_mode (0));
+	      else
+		code = code_for_mve_q_n (m_unspec_for_n_sint, m_unspec_for_n_sint, e.vector_mode (0));
+	    else
+	      code = code_for_mve_q_n_f (m_unspec_for_n_fp, e.vector_mode (0));
+	    break;
+
+	  default:
+	    gcc_unreachable ();
+	  }
+	return e.use_exact_insn (code);
+
+      case PRED_m:
+	switch (e.mode_suffix_id)
+	  {
+	  case MODE_none:
+	    /* No suffix, "m" predicate.  */
+	    if (e.type_suffix (0).integer_p)
+	      if (e.type_suffix (0).unsigned_p)
+		code = code_for_mve_q_m (m_unspec_for_m_uint, m_unspec_for_m_uint, e.vector_mode (0));
+	      else
+		code = code_for_mve_q_m (m_unspec_for_m_sint, m_unspec_for_m_sint, e.vector_mode (0));
+	    else
+	      code = code_for_mve_q_m_f (m_unspec_for_m_fp, e.vector_mode (0));
+	    break;
+
+	  case MODE_n:
+	    /* _n suffix, "m" predicate.  */
+	    if (e.type_suffix (0).integer_p)
+	      if (e.type_suffix (0).unsigned_p)
+		code = code_for_mve_q_m_n (m_unspec_for_m_n_uint, m_unspec_for_m_n_uint, e.vector_mode (0));
+	      else
+		code = code_for_mve_q_m_n (m_unspec_for_m_n_sint, m_unspec_for_m_n_sint, e.vector_mode (0));
+	    else
+	      code = code_for_mve_q_m_n_f (m_unspec_for_m_n_fp, e.vector_mode (0));
+	    break;
+
+	  default:
+	    gcc_unreachable ();
+	  }
+	return e.use_cond_insn (code, 0);
+
+      case PRED_x:
+	switch (e.mode_suffix_id)
+	  {
+	  case MODE_none:
+	    /* No suffix, "x" predicate.  */
+	    if (e.type_suffix (0).integer_p)
+	      if (e.type_suffix (0).unsigned_p)
+		code = code_for_mve_q_m (m_unspec_for_m_uint, m_unspec_for_m_uint, e.vector_mode (0));
+	      else
+		code = code_for_mve_q_m (m_unspec_for_m_sint, m_unspec_for_m_sint, e.vector_mode (0));
+	    else
+	      code = code_for_mve_q_m_f (m_unspec_for_m_fp, e.vector_mode (0));
+	    break;
+
+	  case MODE_n:
+	    /* _n suffix, "x" predicate.  */
+	    if (e.type_suffix (0).integer_p)
+	      if (e.type_suffix (0).unsigned_p)
+		code = code_for_mve_q_m_n (m_unspec_for_m_n_uint, m_unspec_for_m_n_uint, e.vector_mode (0));
+	      else
+		code = code_for_mve_q_m_n (m_unspec_for_m_n_sint, m_unspec_for_m_n_sint, e.vector_mode (0));
+	    else
+	      code = code_for_mve_q_m_n_f (m_unspec_for_m_n_fp, e.vector_mode (0));
+	    break;
+
+	  default:
+	    gcc_unreachable ();
+	  }
+	return e.use_pred_x_insn (code);
+
+      default:
+	gcc_unreachable ();
+      }
+
+    gcc_unreachable ();
+  }
+};
+
 } /* end namespace arm_mve */
 
 /* Declare the global function base NAME, creating it from an instance

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-03 15:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 15:00 [gcc r14-446] arm: [MVE intrinsics] add unspec_mve_function_exact_insn Christophe Lyon

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 read-only IMAP folder(s) and NNTP newsgroup(s).