diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-16 09:47:09 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-16 09:47:09 +0000 |
commit | fadf62f4b9d615ed6a94be7cec091b02dd69cf8e (patch) | |
tree | 61b2d8308768796bdf3f7e0c34b84aa6cc0bae11 /gcc/config/sparc | |
parent | e55b581dfa231b70aa01ea2b85758369f98386be (diff) | |
download | gcc-fadf62f4b9d615ed6a94be7cec091b02dd69cf8e.tar.gz |
2012-03-16 Richard Guenther <rguenther@suse.de>
* tree.h (TREE_VECTOR_CST_ELTS): Remove.
(VECTOR_CST_NELTS, VECTOR_CST_ELTS, VECTOR_CST_ELT): New defines.
(struct tree_vector): Remove elements member, add variable size
elts array member.
(build_vector_stat): Declare.
(build_vector): Define in terms of build_vector_stat.
* tree.c (build_vector): Rename to ...
(build_vector_stat): ... this. Take array of trees as parameter.
(build_vector_from_ctor): Adjust.
(integer_zerop, integer_onep, integer_all_onesp, iterative_hash_expr,
initializer_zerop): Adjust.
* cfgexpand.c (expand_debug_expr): Likewise.
* expr.c (categorize_ctor_elements_1, expand_expr_real_1,
const_vector_from_tree): Likewise.
* fold-const.c (const_binop, operand_equal_p, native_encode_vector,
native_interpret_vector, fold_unary_loc, vec_cst_ctor_to_array,
fold_vec_perm, fold_binary_loc, fold_ternary_loc): Likewise.
* tree-streamer-in.c (streamer_alloc_tree): Handle TS_VECTOR.
(lto_input_ts_vector_tree_pointers): Adjust.
* tree-streamer-out.c (streamer_write_tree_header): Handle TS_VECTOR.
(write_ts_vector_tree_pointers): Adjust.
* varasm.c (const_hash_1, compare_constant, copy_constant,
output_constant): Adjust.
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Adjust.
* print-tree.c (print_node): Adjust.
* tree-pretty-print.c (dump_generic_node): Adjust.
* tree-vect-generic.c (uniform_vector_p, vector_element,
lower_vec_perm): Adjust.
* tree-vect-loop.c (get_initial_def_for_reduction): Adjust.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_transform_slp_perm_load): Adjust.
* tree-vect-stmts.c (vect_gen_perm_mask): Adjust.
* expmed.c (make_tree): Adjust.
* config/i386/i386.c (ix86_expand_builtin): Adjust.
* config/sparc/sparc.c (sparc_handle_vis_mul8x16): Adjust interface
and implementation.
(sparc_fold_builtin): Adjust.
c-family/
* c-pretty-print.c (pp_c_initializer_list): Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185458 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r-- | gcc/config/sparc/sparc.c | 108 |
1 files changed, 45 insertions, 63 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 134843d98a3..4048db0560a 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -514,7 +514,7 @@ static void sparc_vis_init_builtins (void); static rtx sparc_expand_builtin (tree, rtx, rtx, enum machine_mode, int); static tree sparc_fold_builtin (tree, int, tree *, bool); static int sparc_vis_mul8x16 (int, int); -static tree sparc_handle_vis_mul8x16 (int, tree, tree, tree); +static void sparc_handle_vis_mul8x16 (tree *, int, tree, tree, tree); static void sparc_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); static bool sparc_can_output_mi_thunk (const_tree, HOST_WIDE_INT, @@ -9897,67 +9897,57 @@ sparc_vis_mul8x16 (int e8, int e16) return (e8 * e16 + 128) / 256; } -/* Multiply the vector elements in ELTS0 to the elements in ELTS1 as specified - by FNCODE. All of the elements in ELTS0 and ELTS1 lists must be integer - constants. A tree list with the results of the multiplications is returned, - and each element in the list is of INNER_TYPE. */ +/* Multiply the VECTOR_CSTs CST0 and CST1 as specified by FNCODE and put + the result into the array N_ELTS, whose elements are of INNER_TYPE. */ -static tree -sparc_handle_vis_mul8x16 (int fncode, tree inner_type, tree elts0, tree elts1) +static void +sparc_handle_vis_mul8x16 (tree *n_elts, int fncode, tree inner_type, + tree cst0, tree cst1) { - tree n_elts = NULL_TREE; + unsigned i, num = VECTOR_CST_NELTS (cst0); int scale; switch (fncode) { case CODE_FOR_fmul8x16_vis: - for (; elts0 && elts1; - elts0 = TREE_CHAIN (elts0), elts1 = TREE_CHAIN (elts1)) + for (i = 0; i < num; ++i) { int val - = sparc_vis_mul8x16 (TREE_INT_CST_LOW (TREE_VALUE (elts0)), - TREE_INT_CST_LOW (TREE_VALUE (elts1))); - n_elts = tree_cons (NULL_TREE, - build_int_cst (inner_type, val), - n_elts); + = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)), + TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, i))); + n_elts[i] = build_int_cst (inner_type, val); } break; case CODE_FOR_fmul8x16au_vis: - scale = TREE_INT_CST_LOW (TREE_VALUE (elts1)); + scale = TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, 0)); - for (; elts0; elts0 = TREE_CHAIN (elts0)) + for (i = 0; i < num; ++i) { int val - = sparc_vis_mul8x16 (TREE_INT_CST_LOW (TREE_VALUE (elts0)), + = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)), scale); - n_elts = tree_cons (NULL_TREE, - build_int_cst (inner_type, val), - n_elts); + n_elts[i] = build_int_cst (inner_type, val); } break; case CODE_FOR_fmul8x16al_vis: - scale = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (elts1))); + scale = TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, 0)); - for (; elts0; elts0 = TREE_CHAIN (elts0)) + for (i = 0; i < num; ++i) { int val - = sparc_vis_mul8x16 (TREE_INT_CST_LOW (TREE_VALUE (elts0)), + = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)), scale); - n_elts = tree_cons (NULL_TREE, - build_int_cst (inner_type, val), - n_elts); + n_elts[i] = build_int_cst (inner_type, val); } break; default: gcc_unreachable (); } - - return nreverse (n_elts); - } + /* Handle TARGET_FOLD_BUILTIN target hook. Fold builtin functions for SPARC intrinsics. If IGNORE is true the result of the function call is ignored. NULL_TREE is returned if the @@ -10001,17 +9991,15 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, if (TREE_CODE (arg0) == VECTOR_CST) { tree inner_type = TREE_TYPE (rtype); - tree elts = TREE_VECTOR_CST_ELTS (arg0); - tree n_elts = NULL_TREE; - - for (; elts; elts = TREE_CHAIN (elts)) - { - unsigned int val = TREE_INT_CST_LOW (TREE_VALUE (elts)) << 4; - n_elts = tree_cons (NULL_TREE, - build_int_cst (inner_type, val), - n_elts); - } - return build_vector (rtype, nreverse (n_elts)); + tree *n_elts; + unsigned i; + + n_elts = XALLOCAVEC (tree, VECTOR_CST_NELTS (arg0)); + for (i = 0; i < VECTOR_CST_NELTS (arg0); ++i) + n_elts[i] = build_int_cst (inner_type, + TREE_INT_CST_LOW + (VECTOR_CST_ELT (arg0, i)) << 4); + return build_vector (rtype, n_elts); } break; @@ -10026,11 +10014,8 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, if (TREE_CODE (arg0) == VECTOR_CST && TREE_CODE (arg1) == VECTOR_CST) { tree inner_type = TREE_TYPE (rtype); - tree elts0 = TREE_VECTOR_CST_ELTS (arg0); - tree elts1 = TREE_VECTOR_CST_ELTS (arg1); - tree n_elts = sparc_handle_vis_mul8x16 (icode, inner_type, elts0, - elts1); - + tree *n_elts = XALLOCAVEC (tree, VECTOR_CST_NELTS (arg0)); + sparc_handle_vis_mul8x16 (n_elts, icode, inner_type, arg0, arg1); return build_vector (rtype, n_elts); } break; @@ -10043,18 +10028,15 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, if (TREE_CODE (arg0) == VECTOR_CST && TREE_CODE (arg1) == VECTOR_CST) { - tree elts0 = TREE_VECTOR_CST_ELTS (arg0); - tree elts1 = TREE_VECTOR_CST_ELTS (arg1); - tree n_elts = NULL_TREE; - - for (; elts0 && elts1; - elts0 = TREE_CHAIN (elts0), elts1 = TREE_CHAIN (elts1)) + tree *n_elts = XALLOCAVEC (tree, 2 * VECTOR_CST_NELTS (arg0)); + unsigned i; + for (i = 0; i < VECTOR_CST_NELTS (arg0); ++i) { - n_elts = tree_cons (NULL_TREE, TREE_VALUE (elts0), n_elts); - n_elts = tree_cons (NULL_TREE, TREE_VALUE (elts1), n_elts); + n_elts[2*i] = VECTOR_CST_ELT (arg0, i); + n_elts[2*i+1] = VECTOR_CST_ELT (arg1, i); } - return build_vector (rtype, nreverse (n_elts)); + return build_vector (rtype, n_elts); } break; @@ -10073,17 +10055,17 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, int overflow = 0; unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (arg2); HOST_WIDE_INT high = TREE_INT_CST_HIGH (arg2); - tree elts0 = TREE_VECTOR_CST_ELTS (arg0); - tree elts1 = TREE_VECTOR_CST_ELTS (arg1); + unsigned i; - for (; elts0 && elts1; - elts0 = TREE_CHAIN (elts0), elts1 = TREE_CHAIN (elts1)) + for (i = 0; i < VECTOR_CST_NELTS (arg0); ++i) { unsigned HOST_WIDE_INT - low0 = TREE_INT_CST_LOW (TREE_VALUE (elts0)), - low1 = TREE_INT_CST_LOW (TREE_VALUE (elts1)); - HOST_WIDE_INT high0 = TREE_INT_CST_HIGH (TREE_VALUE (elts0)); - HOST_WIDE_INT high1 = TREE_INT_CST_HIGH (TREE_VALUE (elts1)); + low0 = TREE_INT_CST_LOW (VECTOR_CST_ELT (arg0, i)), + low1 = TREE_INT_CST_LOW (VECTOR_CST_ELT (arg1, i)); + HOST_WIDE_INT + high0 = TREE_INT_CST_HIGH (VECTOR_CST_ELT (arg0, i)); + HOST_WIDE_INT + high1 = TREE_INT_CST_HIGH (VECTOR_CST_ELT (arg1, i)); unsigned HOST_WIDE_INT l; HOST_WIDE_INT h; |