Commit 2225b9f2 by Richard Henderson Committed by Richard Henderson

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
parent 0c471ab8
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> 2012-07-24 Steven Bosscher <steven@gcc.gnu.org>
* alloc-pool.c (create_alloc_pool): Fix ENABLE_CHECKING check. * alloc-pool.c (create_alloc_pool): Fix ENABLE_CHECKING check.
......
...@@ -2360,7 +2360,7 @@ static enum insn_code ...@@ -2360,7 +2360,7 @@ static enum insn_code
interclass_mathfn_icode (tree arg, tree fndecl) interclass_mathfn_icode (tree arg, tree fndecl)
{ {
bool errno_set = false; bool errno_set = false;
optab builtin_optab = 0; optab builtin_optab = unknown_optab;
enum machine_mode mode; enum machine_mode mode;
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
......
...@@ -1028,19 +1028,16 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp, ...@@ -1028,19 +1028,16 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
op0 = op1; op0 = op1;
op1 = tmp; op1 = tmp;
} }
else if (SCALAR_FLOAT_MODE_P (mode) else if (SCALAR_FLOAT_MODE_P (mode)
&& ! can_compare_p (code, mode, ccp_jump) && ! can_compare_p (code, mode, ccp_jump)
/* Never split ORDERED and UNORDERED.
/* Never split ORDERED and UNORDERED. These must be implemented. */ These must be implemented. */
&& (code != ORDERED && code != UNORDERED) && (code != ORDERED && code != UNORDERED)
/* Split a floating-point comparison if
/* Split a floating-point comparison if we can jump on other we can jump on other conditions... */
conditions... */
&& (have_insn_for (COMPARE, mode) && (have_insn_for (COMPARE, mode)
/* ... or if there is no libcall for it. */ /* ... or if there is no libcall for it. */
|| code_to_optab[code] == NULL)) || code_to_optab[code] == unknown_optab))
{ {
enum rtx_code first_code; enum rtx_code first_code;
bool and_them = split_comparison (code, mode, &first_code, &code); bool and_them = split_comparison (code, mode, &first_code, &code);
......
...@@ -390,7 +390,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, ...@@ -390,7 +390,7 @@ optab_for_tree_code (enum tree_code code, const_tree type,
if (TREE_CODE (type) == VECTOR_TYPE) if (TREE_CODE (type) == VECTOR_TYPE)
{ {
if (subtype == optab_vector) if (subtype == optab_vector)
return TYPE_SATURATING (type) ? NULL : vashl_optab; return TYPE_SATURATING (type) ? unknown_optab : vashl_optab;
gcc_assert (subtype == optab_scalar); gcc_assert (subtype == optab_scalar);
} }
...@@ -560,7 +560,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, ...@@ -560,7 +560,7 @@ optab_for_tree_code (enum tree_code code, const_tree type,
return trapv ? absv_optab : abs_optab; return trapv ? absv_optab : abs_optab;
default: default:
return NULL; return unknown_optab;
} }
} }
...@@ -1580,7 +1580,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1, ...@@ -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. */ shift by a vector. If so, broadcast the scalar into a vector. */
if (mclass == MODE_VECTOR_INT) if (mclass == MODE_VECTOR_INT)
{ {
optab otheroptab = NULL; optab otheroptab = unknown_optab;
if (binoptab == ashl_optab) if (binoptab == ashl_optab)
otheroptab = vashl_optab; otheroptab = vashl_optab;
......
...@@ -412,6 +412,8 @@ enum optab_index ...@@ -412,6 +412,8 @@ enum optab_index
OTI_MAX OTI_MAX
}; };
#define unknown_optab NULL
#define ssadd_optab (&optab_table[OTI_ssadd]) #define ssadd_optab (&optab_table[OTI_ssadd])
#define usadd_optab (&optab_table[OTI_usadd]) #define usadd_optab (&optab_table[OTI_usadd])
#define sssub_optab (&optab_table[OTI_sssub]) #define sssub_optab (&optab_table[OTI_sssub])
......
...@@ -414,14 +414,14 @@ add_rshift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts) ...@@ -414,14 +414,14 @@ add_rshift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts)
if (scalar_shift) if (scalar_shift)
{ {
op = optab_for_tree_code (RSHIFT_EXPR, type, optab_scalar); 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) && optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0, return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0,
build_int_cst (NULL_TREE, shiftcnts[0])); build_int_cst (NULL_TREE, shiftcnts[0]));
} }
op = optab_for_tree_code (RSHIFT_EXPR, type, optab_vector); 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) && optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{ {
tree *vec = XALLOCAVEC (tree, nunits); tree *vec = XALLOCAVEC (tree, nunits);
...@@ -462,7 +462,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, ...@@ -462,7 +462,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
return NULL_TREE; return NULL_TREE;
op = optab_for_tree_code (RSHIFT_EXPR, type, optab_vector); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
has_vector_shift = false; has_vector_shift = false;
...@@ -689,7 +689,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, ...@@ -689,7 +689,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
/* t1 = op0 + addend; /* t1 = op0 + addend;
q = t1 >> shift; */ q = t1 >> shift; */
op = optab_for_tree_code (PLUS_EXPR, type, optab_default); 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) && optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{ {
cur_op = gimplify_build2 (gsi, PLUS_EXPR, type, op0, addend); 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, ...@@ -708,7 +708,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
<< shifts[i]) - 1); << shifts[i]) - 1);
mask = build_vector (type, vec); mask = build_vector (type, vec);
op = optab_for_tree_code (BIT_AND_EXPR, type, optab_default); 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) && optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{ {
if (unsignedp) if (unsignedp)
...@@ -720,7 +720,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, ...@@ -720,7 +720,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
t2 = t1 & mask; t2 = t1 & mask;
r = t2 - addend; */ r = t2 - addend; */
op = optab_for_tree_code (PLUS_EXPR, type, optab_default); op = optab_for_tree_code (PLUS_EXPR, type, optab_default);
if (op != NULL if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) && optab_handler (op, TYPE_MODE (type))
!= CODE_FOR_nothing) != CODE_FOR_nothing)
{ {
...@@ -730,7 +730,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, ...@@ -730,7 +730,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
cur_op, mask); cur_op, mask);
op = optab_for_tree_code (MINUS_EXPR, type, op = optab_for_tree_code (MINUS_EXPR, type,
optab_default); optab_default);
if (op != NULL if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) && optab_handler (op, TYPE_MODE (type))
!= CODE_FOR_nothing) != CODE_FOR_nothing)
return gimplify_build2 (gsi, MINUS_EXPR, type, return gimplify_build2 (gsi, MINUS_EXPR, type,
...@@ -801,13 +801,13 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, ...@@ -801,13 +801,13 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
t4 = t1 + t3; t4 = t1 + t3;
q = t4 >> (post_shift - 1); */ q = t4 >> (post_shift - 1); */
op = optab_for_tree_code (MINUS_EXPR, type, optab_default); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE; return NULL_TREE;
tem = gimplify_build2 (gsi, MINUS_EXPR, type, op0, cur_op); tem = gimplify_build2 (gsi, MINUS_EXPR, type, op0, cur_op);
tem = add_rshift (gsi, type, tem, shift_temps); tem = add_rshift (gsi, type, tem, shift_temps);
op = optab_for_tree_code (PLUS_EXPR, type, optab_default); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE; return NULL_TREE;
tem = gimplify_build2 (gsi, PLUS_EXPR, type, cur_op, tem); 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, ...@@ -829,7 +829,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
if ((mode & 2) == 0) if ((mode & 2) == 0)
{ {
op = optab_for_tree_code (PLUS_EXPR, type, optab_default); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE; return NULL_TREE;
cur_op = gimplify_build2 (gsi, PLUS_EXPR, type, cur_op, op0); 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, ...@@ -841,7 +841,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
if (tem == NULL_TREE) if (tem == NULL_TREE)
return NULL_TREE; return NULL_TREE;
op = optab_for_tree_code (MINUS_EXPR, type, optab_default); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE; return NULL_TREE;
if ((mode & 1) == 0) if ((mode & 1) == 0)
...@@ -860,12 +860,12 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, ...@@ -860,12 +860,12 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
t1 = q * oprnd1; t1 = q * oprnd1;
r = oprnd0 - t1; */ r = oprnd0 - t1; */
op = optab_for_tree_code (MULT_EXPR, type, optab_default); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE; return NULL_TREE;
tem = gimplify_build2 (gsi, MULT_EXPR, type, cur_op, op1); tem = gimplify_build2 (gsi, MULT_EXPR, type, cur_op, op1);
op = optab_for_tree_code (MINUS_EXPR, type, optab_default); 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) || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
return NULL_TREE; return NULL_TREE;
return gimplify_build2 (gsi, MINUS_EXPR, type, op0, tem); return gimplify_build2 (gsi, MINUS_EXPR, type, op0, tem);
...@@ -1235,7 +1235,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) ...@@ -1235,7 +1235,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
tree lhs, rhs1, rhs2 = NULL, type, compute_type; tree lhs, rhs1, rhs2 = NULL, type, compute_type;
enum tree_code code; enum tree_code code;
enum machine_mode compute_mode; enum machine_mode compute_mode;
optab op = NULL; optab op = unknown_optab;
enum gimple_rhs_class rhs_class; enum gimple_rhs_class rhs_class;
tree new_rhs; tree new_rhs;
...@@ -1344,7 +1344,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) ...@@ -1344,7 +1344,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
/* Optabs will try converting a negation into a subtraction, so /* Optabs will try converting a negation into a subtraction, so
look for it as well. TODO: negation of floating-point vectors look for it as well. TODO: negation of floating-point vectors
might be turned into an exclusive OR toggling the sign bit. */ might be turned into an exclusive OR toggling the sign bit. */
if (op == NULL if (op == unknown_optab
&& code == NEGATE_EXPR && code == NEGATE_EXPR
&& INTEGRAL_TYPE_P (TREE_TYPE (type))) && INTEGRAL_TYPE_P (TREE_TYPE (type)))
op = optab_for_tree_code (MINUS_EXPR, type, optab_default); op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
......
...@@ -1675,7 +1675,7 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts, ...@@ -1675,7 +1675,7 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts,
/* If the target can handle vectorized division or modulo natively, /* If the target can handle vectorized division or modulo natively,
don't attempt to optimize this. */ don't attempt to optimize this. */
optab = optab_for_tree_code (rhs_code, vectype, optab_default); 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); enum machine_mode vec_mode = TYPE_MODE (vectype);
int icode = (int) optab_handler (optab, vec_mode); int icode = (int) optab_handler (optab, vec_mode);
......
...@@ -6545,7 +6545,7 @@ supportable_narrowing_operation (enum tree_code code, ...@@ -6545,7 +6545,7 @@ supportable_narrowing_operation (enum tree_code code,
= lang_hooks.types.type_for_mode (TYPE_MODE (vectype_out), 0); = lang_hooks.types.type_for_mode (TYPE_MODE (vectype_out), 0);
interm_optab interm_optab
= optab_for_tree_code (c1, intermediate_type, optab_default); = 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 && (icode2 = optab_handler (optab1, vec_mode)) != CODE_FOR_nothing
&& insn_data[icode1].operand[0].mode && insn_data[icode1].operand[0].mode
== insn_data[icode2].operand[0].mode) == insn_data[icode2].operand[0].mode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment