summaryrefslogtreecommitdiff
path: root/gcc/internal-fn.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-20 09:10:36 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-20 09:10:36 +0000
commit2572aaf3e934cae6ffd6e42c202b5eee541e4666 (patch)
treedda3c5a585b3cf1bf904b5356c244c4e59fb1c22 /gcc/internal-fn.c
parent63fd99dbecc129a9a3f39a6c026d2083c6cc402c (diff)
downloadgcc-2572aaf3e934cae6ffd6e42c202b5eee541e4666.tar.gz
gcc/
* doc/md.texi (vec_load_lanes, vec_store_lanes): Document. * optabs.h (COI_vec_load_lanes, COI_vec_store_lanes): New convert_optab_index values. (vec_load_lanes_optab, vec_store_lanes_optab): New convert optabs. * genopinit.c (optabs): Initialize the new optabs. * internal-fn.def (LOAD_LANES, STORE_LANES): New internal functions. * internal-fn.c (get_multi_vector_move, expand_LOAD_LANES) (expand_STORE_LANES): New functions. * tree.h (build_array_type_nelts): Declare. * tree.c (build_array_type_nelts): New function. * tree-vectorizer.h (vect_model_store_cost): Add a bool argument. (vect_model_load_cost): Likewise. (vect_store_lanes_supported, vect_load_lanes_supported) (vect_record_strided_load_vectors): Declare. * tree-vect-data-refs.c (vect_lanes_optab_supported_p) (vect_store_lanes_supported, vect_load_lanes_supported): New functions. (vect_transform_strided_load): Split out statement recording into... (vect_record_strided_load_vectors): ...this new function. * tree-vect-stmts.c (create_vector_array, read_vector_array) (write_vector_array, create_array_ref): New functions. (vect_model_store_cost): Add store_lanes_p argument. (vect_model_load_cost): Add load_lanes_p argument. (vectorizable_store): Try to use store-lanes functions for interleaved stores. (vectorizable_load): Likewise load-lanes and loads. * tree-vect-slp.c (vect_get_and_check_slp_defs) (vect_build_slp_tree): git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172760 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/internal-fn.c')
-rw-r--r--gcc/internal-fn.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 9f087b83105..ddf4157d25a 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -42,6 +42,73 @@ const int internal_fn_flags_array[] = {
0
};
+/* ARRAY_TYPE is an array of vector modes. Return the associated insn
+ for load-lanes-style optab OPTAB. The insn must exist. */
+
+static enum insn_code
+get_multi_vector_move (tree array_type, convert_optab optab)
+{
+ enum insn_code icode;
+ enum machine_mode imode;
+ enum machine_mode vmode;
+
+ gcc_assert (TREE_CODE (array_type) == ARRAY_TYPE);
+ imode = TYPE_MODE (array_type);
+ vmode = TYPE_MODE (TREE_TYPE (array_type));
+
+ icode = convert_optab_handler (optab, imode, vmode);
+ gcc_assert (icode != CODE_FOR_nothing);
+ return icode;
+}
+
+/* Expand LOAD_LANES call STMT. */
+
+static void
+expand_LOAD_LANES (gimple stmt)
+{
+ struct expand_operand ops[2];
+ tree type, lhs, rhs;
+ rtx target, mem;
+
+ lhs = gimple_call_lhs (stmt);
+ rhs = gimple_call_arg (stmt, 0);
+ type = TREE_TYPE (lhs);
+
+ target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
+ mem = expand_normal (rhs);
+
+ gcc_assert (MEM_P (mem));
+ PUT_MODE (mem, TYPE_MODE (type));
+
+ create_output_operand (&ops[0], target, TYPE_MODE (type));
+ create_fixed_operand (&ops[1], mem);
+ expand_insn (get_multi_vector_move (type, vec_load_lanes_optab), 2, ops);
+}
+
+/* Expand STORE_LANES call STMT. */
+
+static void
+expand_STORE_LANES (gimple stmt)
+{
+ struct expand_operand ops[2];
+ tree type, lhs, rhs;
+ rtx target, reg;
+
+ lhs = gimple_call_lhs (stmt);
+ rhs = gimple_call_arg (stmt, 0);
+ type = TREE_TYPE (rhs);
+
+ target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
+ reg = expand_normal (rhs);
+
+ gcc_assert (MEM_P (target));
+ PUT_MODE (target, TYPE_MODE (type));
+
+ create_fixed_operand (&ops[0], target);
+ create_input_operand (&ops[1], reg, TYPE_MODE (type));
+ expand_insn (get_multi_vector_move (type, vec_store_lanes_optab), 2, ops);
+}
+
/* Routines to expand each internal function, indexed by function number.
Each routine has the prototype: