GCC Middle and Back End API Reference
tree-vect-generic.c File Reference

Typedefs

typedef tree(* elem_op_func )(gimple_stmt_iterator *, tree, tree, tree, tree, tree, enum tree_code)

Functions

static void expand_vector_operations_1 (gimple_stmt_iterator *)
static tree build_replicated_const ()
static tree build_word_mode_vector_type ()
static tree tree_vec_extract (gimple_stmt_iterator *gsi, tree type, tree t, tree bitsize, tree bitpos)
static tree do_unop (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b, tree bitpos, tree bitsize, enum tree_code code)
static tree do_binop (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b, tree bitpos, tree bitsize, enum tree_code code)
static tree do_compare (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b, tree bitpos, tree bitsize, enum tree_code code)
static tree do_plus_minus (gimple_stmt_iterator *gsi, tree word_type, tree a, tree b, tree bitpos, tree bitsize, enum tree_code code)
static tree do_negate (gimple_stmt_iterator *gsi, tree word_type, tree b, tree unused, tree bitpos, tree bitsize, enum tree_code code)
static tree expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f, tree type, tree inner_type, tree a, tree b, enum tree_code code)
static tree expand_vector_parallel (gimple_stmt_iterator *gsi, elem_op_func f, tree type, tree a, tree b, enum tree_code code)
static tree expand_vector_addition (gimple_stmt_iterator *gsi, elem_op_func f, elem_op_func f_parallel, tree type, tree a, tree b, enum tree_code code)
static tree expand_vector_comparison (gimple_stmt_iterator *gsi, tree type, tree op0, tree op1, enum tree_code code)
static tree add_rshift ()
static tree expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, tree op1, enum tree_code code)
static void expand_vector_condition ()
static tree expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type, gimple assign, enum tree_code code)
static tree type_for_widest_vector_mode ()
static tree vector_element ()
static void lower_vec_perm ()
static void expand_vector_operations_1 ()
static bool gate_expand_vector_operations_ssa ()
static unsigned int expand_vector_operations ()
gimple_opt_passmake_pass_lower_vector ()
gimple_opt_passmake_pass_lower_vector_ssa ()

Variables

static tree vector_inner_type
static tree vector_last_type
static int vector_last_nunits

Typedef Documentation

typedef tree(* elem_op_func)(gimple_stmt_iterator *, tree, tree, tree, tree, tree, enum tree_code)

Function Documentation

static tree add_rshift ( )
static
Helper function of expand_vector_divmod.  Gimplify a RSHIFT_EXPR in type
   of OP0 with shift counts in SHIFTCNTS array and return the temporary holding
   the result if successful, otherwise return NULL_TREE.   

References build_int_cst(), gimplify_build2(), optab_for_tree_code(), optab_handler(), optab_scalar, optab_vector, and unknown_optab.

Referenced by expand_vector_divmod().

static tree build_replicated_const ( )
static
Build a constant of type TYPE, made of VALUE's bits replicated
   every TYPE_SIZE (INNER_TYPE) bits to fit TYPE's precision.   

References build_int_cst_wide(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, and tree_low_cst().

Referenced by do_negate(), and do_plus_minus().

static tree build_word_mode_vector_type ( )
static
Return a suitable vector types made of SUBPARTS units each of mode
   "word_mode" (the global variable).   

References build_vector_type(), lang_hooks_for_types::type_for_mode, type_hash_canon(), lang_hooks::types, vector_last_type, and word_mode.

Referenced by expand_vector_parallel().

static tree do_binop ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  a,
tree  b,
tree  bitpos,
tree  bitsize,
enum tree_code  code 
)
static
static tree do_compare ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  a,
tree  b,
tree  bitpos,
tree  bitsize,
enum tree_code  code 
)
static
Construct expression (A[BITPOS] code B[BITPOS]) ? -1 : 0

   INNER_TYPE is the type of A and B elements

   returned expression is of signed integer type with the
   size equal to the size of INNER_TYPE.   

References build_int_cst(), build_nonstandard_integer_type(), gimplify_build3(), and tree_vec_extract().

Referenced by expand_vector_comparison().

static tree do_negate ( gimple_stmt_iterator gsi,
tree  word_type,
tree  b,
tree  unused,
tree  bitpos,
tree  bitsize,
enum tree_code  code 
)
static
static tree do_plus_minus ( gimple_stmt_iterator gsi,
tree  word_type,
tree  a,
tree  b,
tree  bitpos,
tree  bitsize,
enum tree_code  code 
)
static
Expand vector addition to scalars.  This does bit twiddling
   in order to increase parallelism:

   a + b = (((int) a & 0x7f7f7f7f) + ((int) b & 0x7f7f7f7f)) ^
           (a ^ b) & 0x80808080

   a - b =  (((int) a | 0x80808080) - ((int) b & 0x7f7f7f7f)) ^
            (a ^ ~b) & 0x80808080

   -b = (0x80808080 - ((int) b & 0x7f7f7f7f)) ^ (~b & 0x80808080)

   This optimization should be done only if 4 vector items or more
   fit into a word.   

References build_replicated_const(), gimplify_build1(), gimplify_build2(), HOST_WIDE_INT, and tree_vec_extract().

Referenced by expand_vector_operation().

static tree do_unop ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  a,
tree  b,
tree  bitpos,
tree  bitsize,
enum tree_code  code 
)
static
static tree expand_vector_addition ( gimple_stmt_iterator gsi,
elem_op_func  f,
elem_op_func  f_parallel,
tree  type,
tree  a,
tree  b,
enum tree_code  code 
)
static
Expand a vector operation to scalars; for integer types we can use
   special bit twiddling tricks to do the sums a word at a time, using
   function F_PARALLEL instead of F.  These tricks are done only if
   they can process at least four items, that is, only if the vector
   holds at least four items and if a word can hold four items.   

References expand_vector_parallel(), expand_vector_piecewise(), and tree_low_cst().

Referenced by expand_vector_operation().

static tree expand_vector_comparison ( gimple_stmt_iterator gsi,
tree  type,
tree  op0,
tree  op1,
enum tree_code  code 
)
static
Try to expand vector comparison expression OP0 CODE OP1 by
   querying optab if the following expression:
        VEC_COND_EXPR< OP0 CODE OP1, {-1,...}, {0,...}>
   can be expanded.   

References do_compare(), expand_vec_cond_expr_p(), and expand_vector_piecewise().

Referenced by expand_vector_operation().

static void expand_vector_operations_1 ( gimple_stmt_iterator )
static
@verbatim Lower vector operations to scalar operations.

Copyright (C) 2004-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

Need to include rtl.h, expr.h, etc. for optabs.   

Referenced by expand_vector_operations().

static tree expand_vector_parallel ( gimple_stmt_iterator gsi,
elem_op_func  f,
tree  type,
tree  a,
tree  b,
enum tree_code  code 
)
static
Expand a vector operation to scalars with the freedom to use
   a scalar integer type, or to use a different size for the items
   in the vector type.   

References build_word_mode_vector_type(), expand_vector_piecewise(), force_gimple_operand_gsi(), gimple_location(), GSI_SAME_STMT, gsi_stmt(), mode_for_size(), tree_low_cst(), lang_hooks_for_types::type_for_mode, lang_hooks::types, warning_at(), and word_mode.

Referenced by expand_vector_addition(), and expand_vector_operation().

static tree expand_vector_piecewise ( gimple_stmt_iterator gsi,
elem_op_func  f,
tree  type,
tree  inner_type,
tree  a,
tree  b,
enum tree_code  code 
)
static
Expand a vector operation to scalars, by using many operations
   whose type is the vector type's inner type.   

References build_constructor(), gimple_expr_type(), gimple_location(), gsi_stmt(), int_const_binop(), tree_low_cst(), types_compatible_p(), vec_alloc(), and warning_at().

Referenced by expand_vector_addition(), expand_vector_comparison(), expand_vector_operation(), and expand_vector_parallel().

static bool gate_expand_vector_operations_ssa ( )
static
Use this to lower vector operations introduced by the vectorizer,
   if it may need the bit-twiddling tricks implemented in this file.   

References cfun, and function::curr_properties.

static void lower_vec_perm ( )
static
Check if VEC_PERM_EXPR within the given setting is supported
   by hardware, or lower it piecewise.

   When VEC_PERM_EXPR has the same first and second operands:
   VEC_PERM_EXPR <v0, v0, mask> the lowered version would be
   {v0[mask[0]], v0[mask[1]], ...}
   MASK and V0 must have the same number of elements.

   Otherwise VEC_PERM_EXPR <v0, v1, mask> is lowered to
   {mask[0] < len(v0) ? v0[mask[0]] : v1[mask[0]], ...}
   V0 and V1 must have the same type.  MASK, V0, V1 must have the
   same number of arguments.   

References build_constructor(), build_int_cst(), build_zero_cst(), can_vec_perm_p(), force_gimple_operand_gsi(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), gimple_assign_set_rhs3(), gimple_assign_set_rhs_from_tree(), gimple_location(), GSI_SAME_STMT, gsi_stmt(), host_integerp(), HOST_WIDE_INT, is_gimple_assign(), operand_equal_p(), si, update_stmt(), vec_alloc(), vector_element(), and warning_at().

Referenced by expand_vector_operations_1().

gimple_opt_pass* make_pass_lower_vector ( )
gimple_opt_pass* make_pass_lower_vector_ssa ( )
static tree tree_vec_extract ( gimple_stmt_iterator gsi,
tree  type,
tree  t,
tree  bitsize,
tree  bitpos 
)
inlinestatic
static tree type_for_widest_vector_mode ( )
static
Return a type for the widest vector mode whose components are of type
   TYPE, or NULL_TREE if none is found.   

References build_vector_type_for_mode(), and optab_handler().

Referenced by expand_vector_operations_1().

static tree vector_element ( )
static
Build a reference to the element of the vector VECT.  Function
   returns either the element itself, either BIT_FIELD_REF, or an
   ARRAY_REF expression.

   GSI is required to insert temporary variables while building a
   refernece to the element of the vector VECT.

   PTMPVEC is a pointer to the temporary variable for caching
   purposes.  In case when PTMPVEC is NULL new temporary variable
   will be created.   

References build_array_type_nelts(), build_int_cst(), build_zero_cst(), create_tmp_var(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gsi_insert_before(), GSI_SAME_STMT, host_integerp(), HOST_WIDE_INT, and is_gimple_assign().

Referenced by lower_vec_perm().


Variable Documentation

tree vector_inner_type
static
int vector_last_nunits
static
tree vector_last_type
static