diff options
author | Richard Henderson <rth@redhat.com> | 2012-07-24 10:28:41 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2012-07-24 10:28:41 -0700 |
commit | 2225b9f2982775c7d89fcd7d04adbe4722ba59c3 (patch) | |
tree | 528f887d302a83c24849f9d2bb197affe426e5e5 /gcc | |
parent | 0c471ab87bdb5fc3ff87560f64f78375ae6d386e (diff) | |
download | gcc-2225b9f2982775c7d89fcd7d04adbe4722ba59c3.zip gcc-2225b9f2982775c7d89fcd7d04adbe4722ba59c3.tar.gz gcc-2225b9f2982775c7d89fcd7d04adbe4722ba59c3.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/builtins.c | 2 | ||||
-rw-r--r-- | gcc/dojump.c | 13 | ||||
-rw-r--r-- | gcc/optabs.c | 6 | ||||
-rw-r--r-- | gcc/optabs.h | 2 | ||||
-rw-r--r-- | gcc/tree-vect-generic.c | 30 | ||||
-rw-r--r-- | gcc/tree-vect-patterns.c | 2 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 2 |
8 files changed, 39 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3249f6b..e6479f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/builtins.c b/gcc/builtins.c index a8318e8..ba0655b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -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)) diff --git a/gcc/dojump.c b/gcc/dojump.c index 06b8d04..24eed63 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -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); diff --git a/gcc/optabs.c b/gcc/optabs.c index e1ecc65..f30a20d 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -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; diff --git a/gcc/optabs.h b/gcc/optabs.h index 816fc29..c502766 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -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]) diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index b0f41d1..9c8a70e 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -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); diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index d990c4f..aa731ca 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -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); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index bb42cbc..6b9d327 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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) |