aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorDmitry Plotnikov <dplotnikov@ispras.ru>2011-10-30 17:12:02 +0000
committerRichard Henderson <rth@gcc.gnu.org>2011-10-30 10:12:02 -0700
commit9db8f45d5d6cb5b6b66f241411f5a44cd72e3eac (patch)
treee44c3a45aa245b7294a083e14b64e2518eec620f /gcc/optabs.c
parent9814fdd6183efaa572a8cbd2a52e2abf30542413 (diff)
downloadgcc-9db8f45d5d6cb5b6b66f241411f5a44cd72e3eac.zip
gcc-9db8f45d5d6cb5b6b66f241411f5a44cd72e3eac.tar.gz
gcc-9db8f45d5d6cb5b6b66f241411f5a44cd72e3eac.tar.bz2
tree-cfg.c (verify_gimple_assign_unary): Allow vector conversions.
2011-10-30 Dmitry Plotnikov <dplotnikov@ispras.ru> * tree-cfg.c (verify_gimple_assign_unary): Allow vector conversions. * optabs.c (supportable_convert_operation): New function. * optabs.h (supportable_convert_operation): New prototype. * tree-vect-stmts.c (vectorizable_conversion): Change condition and behavior for NONE modifier case. * tree.h (VECTOR_INTEGER_TYPE_P): New macro. From-SVN: r180684
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 736d826..f07381c 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4824,6 +4824,60 @@ can_float_p (enum machine_mode fltmode, enum machine_mode fixmode,
tab = unsignedp ? ufloat_optab : sfloat_optab;
return convert_optab_handler (tab, fltmode, fixmode);
}
+
+/* Function supportable_convert_operation
+
+ Check whether an operation represented by the code CODE is a
+ convert operation that is supported by the target platform in
+ vector form (i.e., when operating on arguments of type VECTYPE_IN
+ producing a result of type VECTYPE_OUT).
+
+ Convert operations we currently support directly are FIX_TRUNC and FLOAT.
+ This function checks if these operations are supported
+ by the target platform either directly (via vector tree-codes), or via
+ target builtins.
+
+ Output:
+ - CODE1 is code of vector operation to be used when
+ vectorizing the operation, if available.
+ - DECL is decl of target builtin functions to be used
+ when vectorizing the operation, if available. In this case,
+ CODE1 is CALL_EXPR. */
+
+bool
+supportable_convert_operation (enum tree_code code,
+ tree vectype_out, tree vectype_in,
+ tree *decl, enum tree_code *code1)
+{
+ enum machine_mode m1,m2;
+ int truncp;
+
+ m1 = TYPE_MODE (vectype_out);
+ m2 = TYPE_MODE (vectype_in);
+
+ /* First check if we can done conversion directly. */
+ if ((code == FIX_TRUNC_EXPR
+ && can_fix_p (m1,m2,TYPE_UNSIGNED (vectype_out), &truncp)
+ != CODE_FOR_nothing)
+ || (code == FLOAT_EXPR
+ && can_float_p (m1,m2,TYPE_UNSIGNED (vectype_in))
+ != CODE_FOR_nothing))
+ {
+ *code1 = code;
+ return true;
+ }
+
+ /* Now check for builtin. */
+ if (targetm.vectorize.builtin_conversion
+ && targetm.vectorize.builtin_conversion (code, vectype_out, vectype_in))
+ {
+ *code1 = CALL_EXPR;
+ *decl = targetm.vectorize.builtin_conversion (code, vectype_out, vectype_in);
+ return true;
+ }
+ return false;
+}
+
/* Generate code to convert FROM to floating point
and store in TO. FROM must be fixed point and not VOIDmode.