Introduce and use unknown_optab

Prep for a later patch where this becomes an enum value.

        * optabs.h (unknown_optab): New.
        * builtins.c (interclass_mathfn_icode): Use it.
        * dojump.c (do_compare_rtx_and_jump): Likewise.
        * optabs.c (optab_for_tree_code, expand_binop): Likewise.
        * tree-vect-generic.c (add_rshift, expand_vector_divmod): Likewise.
        (expand_vector_operations_1): Likewise.
        * tree-vect-patterns.c (vect_recog_divmod_pattern): Likewise.
        * tree-vect-stmts.c (supportable_narrowing_operation): Likewise.

From-SVN: r189816
This commit is contained in:
Richard Henderson 2012-07-24 10:28:41 -07:00 committed by Richard Henderson
parent 0c471ab87b
commit 2225b9f298
8 changed files with 39 additions and 29 deletions

View File

@ -1,3 +1,14 @@
2012-07-24 Richard Henderson <rth@redhat.com>
* optabs.h (unknown_optab): New.
* builtins.c (interclass_mathfn_icode): Use it.
* dojump.c (do_compare_rtx_and_jump): Likewise.
* optabs.c (optab_for_tree_code, expand_binop): Likewise.
* tree-vect-generic.c (add_rshift, expand_vector_divmod): Likewise.
(expand_vector_operations_1): Likewise.
* tree-vect-patterns.c (vect_recog_divmod_pattern): Likewise.
* tree-vect-stmts.c (supportable_narrowing_operation): Likewise.
2012-07-24 Steven Bosscher <steven@gcc.gnu.org>
* alloc-pool.c (create_alloc_pool): Fix ENABLE_CHECKING check.

View File

@ -2360,7 +2360,7 @@ static enum insn_code
interclass_mathfn_icode (tree arg, tree fndecl)
{
bool errno_set = false;
optab builtin_optab = 0;
optab builtin_optab = unknown_optab;
enum machine_mode mode;
switch (DECL_FUNCTION_CODE (fndecl))

View File

@ -1028,19 +1028,16 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
op0 = op1;
op1 = tmp;
}
else if (SCALAR_FLOAT_MODE_P (mode)
&& ! can_compare_p (code, mode, ccp_jump)
/* Never split ORDERED and UNORDERED. These must be implemented. */
/* Never split ORDERED and UNORDERED.
These must be implemented. */
&& (code != ORDERED && code != UNORDERED)
/* Split a floating-point comparison if we can jump on other
conditions... */
/* Split a floating-point comparison if
we can jump on other conditions... */
&& (have_insn_for (COMPARE, mode)
/* ... or if there is no libcall for it. */
|| code_to_optab[code] == NULL))
|| code_to_optab[code] == unknown_optab))
{
enum rtx_code first_code;
bool and_them = split_comparison (code, mode, &first_code, &code);

View File

@ -390,7 +390,7 @@ optab_for_tree_code (enum tree_code code, const_tree type,
if (TREE_CODE (type) == VECTOR_TYPE)
{
if (subtype == optab_vector)
return TYPE_SATURATING (type) ? NULL : vashl_optab;
return TYPE_SATURATING (type) ? unknown_optab : vashl_optab;
gcc_assert (subtype == optab_scalar);
}
@ -560,7 +560,7 @@ optab_for_tree_code (enum tree_code code, const_tree type,
return trapv ? absv_optab : abs_optab;
default:
return NULL;
return unknown_optab;
}
}
@ -1580,7 +1580,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
shift by a vector. If so, broadcast the scalar into a vector. */
if (mclass == MODE_VECTOR_INT)
{
optab otheroptab = NULL;
optab otheroptab = unknown_optab;
if (binoptab == ashl_optab)
otheroptab = vashl_optab;

View File

@ -412,6 +412,8 @@ enum optab_index
OTI_MAX
};
#define unknown_optab NULL
#define ssadd_optab (&optab_table[OTI_ssadd])
#define usadd_optab (&optab_table[OTI_usadd])
#define sssub_optab (&optab_table[OTI_sssub])

View File

@ -414,14 +414,14 @@ add_rshift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts)
if (scalar_shift)
{
op = optab_for_tree_code (RSHIFT_EXPR, type, optab_scalar);
if (op != NULL
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0,
build_int_cst (NULL_TREE, shiftcnts[0]));
}
op = optab_for_tree_code (RSHIFT_EXPR, type, optab_vector);
if (op != NULL
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{
tree *vec = XALLOCAVEC (tree, nunits);
@ -462,7 +462,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
return NULL_TREE;
op = optab_for_tree_code (RSHIFT_EXPR, type, optab_vector);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
has_vector_shift = false;
@ -689,7 +689,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
/* t1 = op0 + addend;
q = t1 >> shift; */
op = optab_for_tree_code (PLUS_EXPR, type, optab_default);
if (op != NULL
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{
cur_op = gimplify_build2 (gsi, PLUS_EXPR, type, op0, addend);
@ -708,7 +708,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
<< shifts[i]) - 1);
mask = build_vector (type, vec);
op = optab_for_tree_code (BIT_AND_EXPR, type, optab_default);
if (op != NULL
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{
if (unsignedp)
@ -720,7 +720,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
t2 = t1 & mask;
r = t2 - addend; */
op = optab_for_tree_code (PLUS_EXPR, type, optab_default);
if (op != NULL
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type))
!= CODE_FOR_nothing)
{
@ -730,7 +730,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
cur_op, mask);
op = optab_for_tree_code (MINUS_EXPR, type,
optab_default);
if (op != NULL
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type))
!= CODE_FOR_nothing)
return gimplify_build2 (gsi, MINUS_EXPR, type,
@ -801,13 +801,13 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
t4 = t1 + t3;
q = t4 >> (post_shift - 1); */
op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE;
tem = gimplify_build2 (gsi, MINUS_EXPR, type, op0, cur_op);
tem = add_rshift (gsi, type, tem, shift_temps);
op = optab_for_tree_code (PLUS_EXPR, type, optab_default);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE;
tem = gimplify_build2 (gsi, PLUS_EXPR, type, cur_op, tem);
@ -829,7 +829,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
if ((mode & 2) == 0)
{
op = optab_for_tree_code (PLUS_EXPR, type, optab_default);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE;
cur_op = gimplify_build2 (gsi, PLUS_EXPR, type, cur_op, op0);
@ -841,7 +841,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
if (tem == NULL_TREE)
return NULL_TREE;
op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE;
if ((mode & 1) == 0)
@ -860,12 +860,12 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
t1 = q * oprnd1;
r = oprnd0 - t1; */
op = optab_for_tree_code (MULT_EXPR, type, optab_default);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE;
tem = gimplify_build2 (gsi, MULT_EXPR, type, cur_op, op1);
op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
if (op == NULL
if (op == unknown_optab
|| optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE;
return gimplify_build2 (gsi, MINUS_EXPR, type, op0, tem);
@ -1235,7 +1235,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
tree lhs, rhs1, rhs2 = NULL, type, compute_type;
enum tree_code code;
enum machine_mode compute_mode;
optab op = NULL;
optab op = unknown_optab;
enum gimple_rhs_class rhs_class;
tree new_rhs;
@ -1344,7 +1344,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
/* Optabs will try converting a negation into a subtraction, so
look for it as well. TODO: negation of floating-point vectors
might be turned into an exclusive OR toggling the sign bit. */
if (op == NULL
if (op == unknown_optab
&& code == NEGATE_EXPR
&& INTEGRAL_TYPE_P (TREE_TYPE (type)))
op = optab_for_tree_code (MINUS_EXPR, type, optab_default);

View File

@ -1675,7 +1675,7 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts,
/* If the target can handle vectorized division or modulo natively,
don't attempt to optimize this. */
optab = optab_for_tree_code (rhs_code, vectype, optab_default);
if (optab != NULL)
if (optab != unknown_optab)
{
enum machine_mode vec_mode = TYPE_MODE (vectype);
int icode = (int) optab_handler (optab, vec_mode);

View File

@ -6545,7 +6545,7 @@ supportable_narrowing_operation (enum tree_code code,
= lang_hooks.types.type_for_mode (TYPE_MODE (vectype_out), 0);
interm_optab
= optab_for_tree_code (c1, intermediate_type, optab_default);
if (interm_optab != NULL
if (interm_optab != unknown_optab
&& (icode2 = optab_handler (optab1, vec_mode)) != CODE_FOR_nothing
&& insn_data[icode1].operand[0].mode
== insn_data[icode2].operand[0].mode)