aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm/arm-mve-builtins-functions.h
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@arm.com>2022-09-23 14:50:26 +0000
committerChristophe Lyon <christophe.lyon@arm.com>2023-05-03 16:58:28 +0200
commit55967d4a2392f2e0a873dca687c1b075c1184917 (patch)
treeb9ce4123b43e4995920ccd4c0ae62ab16b2db335 /gcc/config/arm/arm-mve-builtins-functions.h
parentf74588acf9727ff3fb4b552875604f8fe6130609 (diff)
downloadgcc-55967d4a2392f2e0a873dca687c1b075c1184917.zip
gcc-55967d4a2392f2e0a873dca687c1b075c1184917.tar.gz
gcc-55967d4a2392f2e0a873dca687c1b075c1184917.tar.bz2
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.
Diffstat (limited to 'gcc/config/arm/arm-mve-builtins-functions.h')
-rw-r--r--gcc/config/arm/arm-mve-builtins-functions.h151
1 files changed, 151 insertions, 0 deletions
diff --git a/gcc/config/arm/arm-mve-builtins-functions.h b/gcc/config/arm/arm-mve-builtins-functions.h
index 6d992b2..5abf913 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