summaryrefslogtreecommitdiff
path: root/gcc/internal-fn.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-11-17 18:37:45 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-11-17 18:37:45 +0000
commitab23f5d9742b8b1c7a80d8383a141f243f4198e6 (patch)
tree7992187ca8d4f9960f0586f1f0304b08fcb6e935 /gcc/internal-fn.h
parent00175cb22a6ec9029f64044a9665c7390d53e5f6 (diff)
Add basic support for direct_optab internal functions
This patch adds a concept of internal functions that map directly to an optab (here called "direct internal functions"). The function can only be used if the associated optab can be used. We currently have four functions like that: - LOAD_LANES - STORE_LANES - MASK_LOAD - MASK_STORE so the patch converts them to the new infrastructure. These four all need different types of optabs, but future patches will add regular unary and binary ones. In general we need one or two modes to decide whether an optab is supported, depending on whether it's a convert_optab or not. This in turn means that we need up to two types to decide whether an internal function is supported. The patch records which types are needed for each internal function, using -1 if the return type should be used and N>=0 if the type of argument N should be used. (LOAD_LANES and STORE_LANES are unusual in that both optab modes come from the same array type.) Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * coretypes.h (tree_pair): New type. * internal-fn.def (DEF_INTERNAL_OPTAB_FN): New macro. Use it for MASK_LOAD, LOAD_LANES, MASK_STORE and STORE_LANES. * internal-fn.h (direct_internal_fn_info): New structure. (direct_internal_fn_array): Declare. (direct_internal_fn_p, direct_internal_fn): New functions. (direct_internal_fn_types, direct_internal_fn_supported_p): Declare. * internal-fn.c (not_direct, mask_load_direct, load_lanes_direct) (mask_store_direct, store_lanes_direct): New macros. (direct_internal_fn_array) New array. (get_multi_vector_move): Return the optab handler without asserting that it is available. (expand_LOAD_LANES): Rename to... (expand_load_lanes_optab_fn): ...this and add an optab argument. (expand_STORE_LANES): Rename to... (expand_store_lanes_optab_fn): ...this and add an optab argument. (expand_MASK_LOAD): Rename to... (expand_mask_load_optab_fn): ...this and add an optab argument. (expand_MASK_STORE): Rename to... (expand_mask_store_optab_fn): ...this and add an optab argument. (direct_internal_fn_types, direct_optab_supported_p) (multi_vector_optab_supported_p, direct_internal_fn_supported_p) (direct_internal_fn_supported_p): New functions. (direct_mask_load_optab_supported_p): New macro. (direct_load_lanes_optab_supported_p): Likewise. (direct_mask_store_optab_supported_p): Likewise. (direct_store_lanes_optab_supported_p): Likewise. From-SVN: r230473
Diffstat (limited to 'gcc/internal-fn.h')
-rw-r--r--gcc/internal-fn.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h
index 20cbd13e4b6..31e895ecd34 100644
--- a/gcc/internal-fn.h
+++ b/gcc/internal-fn.h
@@ -123,6 +123,44 @@ internal_fn_fnspec (enum internal_fn fn)
return internal_fn_fnspec_array[(int) fn];
}
+/* Describes an internal function that maps directly to an optab. */
+struct direct_internal_fn_info
+{
+ /* optabs can be parameterized by one or two modes. These fields describe
+ how to select those modes from the types of the return value and
+ arguments. A value of -1 says that the mode is determined by the
+ return type while a value N >= 0 says that the mode is determined by
+ the type of argument N. A value of -2 says that this internal
+ function isn't directly mapped to an optab. */
+ signed int type0 : 8;
+ signed int type1 : 8;
+};
+
+extern const direct_internal_fn_info direct_internal_fn_array[IFN_LAST + 1];
+
+/* Return true if FN is mapped directly to an optab. */
+
+inline bool
+direct_internal_fn_p (internal_fn fn)
+{
+ return direct_internal_fn_array[fn].type0 >= -1;
+}
+
+/* Return optab information about internal function FN. Only meaningful
+ if direct_internal_fn_p (FN). */
+
+inline const direct_internal_fn_info &
+direct_internal_fn (internal_fn fn)
+{
+ gcc_checking_assert (direct_internal_fn_p (fn));
+ return direct_internal_fn_array[fn];
+}
+
+extern tree_pair direct_internal_fn_types (internal_fn, tree, tree *);
+extern tree_pair direct_internal_fn_types (internal_fn, gcall *);
+extern bool direct_internal_fn_supported_p (internal_fn, tree_pair);
+extern bool direct_internal_fn_supported_p (internal_fn, tree);
+
extern void expand_internal_call (gcall *);
#endif