tree-vect-transform.c (vectorizable_conversion): Pass the integral type to vectorize.builtin_conversion.

2008-08-08  Dorit Nuzman  <dorit@il.ibm.com>

        * tree-vect-transform.c (vectorizable_conversion): Pass the integral
        type to vectorize.builtin_conversion.
        (vectorizable_conversion): Likewise.
        * config/i386/i386.c (ix86_vectorize_builtin_conversion): Always takes
        integral type as input.
        * config/rs6000/rs6000.c (rs6000_builtin_conversion): Add case for
        FIX_TRUNC_EXPR.
        (rs6000_expand_builtin): Add case for ALTIVEC_BUILTIN_VCTUXS
        and ALTIVEC_BUILTIN_VCTSXS.
        (rs6000_builtin_mul_widen_even. rs6000_builtin_mul_widen_odd): Fix
        formatting.

From-SVN: r138885
This commit is contained in:
Dorit Nuzman 2008-08-08 19:00:36 +00:00 committed by Dorit Nuzman
parent f6fad28ea1
commit 7910ae0cde
6 changed files with 67 additions and 23 deletions

View file

@ -1,3 +1,17 @@
2008-08-08 Dorit Nuzman <dorit@il.ibm.com>
* tree-vect-transform.c (vectorizable_conversion): Pass the integral
type to vectorize.builtin_conversion.
(vectorizable_conversion): Likewise.
* config/i386/i386.c (ix86_vectorize_builtin_conversion): Always takes
integral type as input.
* config/rs6000/rs6000.c (rs6000_builtin_conversion): Add case for
FIX_TRUNC_EXPR.
(rs6000_expand_builtin): Add case for ALTIVEC_BUILTIN_VCTUXS
and ALTIVEC_BUILTIN_VCTSXS.
(rs6000_builtin_mul_widen_even. rs6000_builtin_mul_widen_odd): Fix
formatting.
2008-08-08 Richard Guenther <rguenther@suse.de>
* tree-ssa-ccp.c (likely_value): Calls are not all varying.

View file

@ -23148,8 +23148,10 @@ ix86_veclibabi_acml (enum built_in_function fn, tree type_out, tree type_in)
}
/* Returns a decl of a function that implements conversion of the
input vector of type TYPE, or NULL_TREE if it is not available. */
/* Returns a decl of a function that implements conversion of an integer vector
into a floating-point vector, or vice-versa. TYPE is the type of the integer
side of the conversion.
Return NULL_TREE if it is not available. */
static tree
ix86_vectorize_builtin_conversion (unsigned int code, tree type)
@ -23171,7 +23173,7 @@ ix86_vectorize_builtin_conversion (unsigned int code, tree type)
case FIX_TRUNC_EXPR:
switch (TYPE_MODE (type))
{
case V4SFmode:
case V4SImode:
return ix86_builtins[IX86_BUILTIN_CVTTPS2DQ];
default:
return NULL_TREE;

View file

@ -1960,7 +1960,11 @@ rs6000_builtin_mask_for_load (void)
return 0;
}
/* Implement targetm.vectorize.builtin_conversion. */
/* Implement targetm.vectorize.builtin_conversion.
Returns a decl of a function that implements conversion of an integer vector
into a floating-point vector, or vice-versa. TYPE is the type of the integer
side of the conversion.
Return NULL_TREE if it is not available. */
static tree
rs6000_builtin_conversion (enum tree_code code, tree type)
{
@ -1969,16 +1973,28 @@ rs6000_builtin_conversion (enum tree_code code, tree type)
switch (code)
{
case FIX_TRUNC_EXPR:
switch (TYPE_MODE (type))
{
case V4SImode:
return TYPE_UNSIGNED (type)
? rs6000_builtin_decls[ALTIVEC_BUILTIN_VCTUXS]
: rs6000_builtin_decls[ALTIVEC_BUILTIN_VCTSXS];
default:
return NULL_TREE;
}
case FLOAT_EXPR:
switch (TYPE_MODE (type))
{
case V4SImode:
return TYPE_UNSIGNED (type) ?
rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFUX] :
rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFSX];
return TYPE_UNSIGNED (type)
? rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFUX]
: rs6000_builtin_decls[ALTIVEC_BUILTIN_VCFSX];
default:
return NULL_TREE;
}
default:
return NULL_TREE;
}
@ -1994,14 +2010,14 @@ rs6000_builtin_mul_widen_even (tree type)
switch (TYPE_MODE (type))
{
case V8HImode:
return TYPE_UNSIGNED (type) ?
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUH] :
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESH];
return TYPE_UNSIGNED (type)
? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUH]
: rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESH];
case V16QImode:
return TYPE_UNSIGNED (type) ?
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUB] :
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESB];
return TYPE_UNSIGNED (type)
? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULEUB]
: rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULESB];
default:
return NULL_TREE;
}
@ -2017,14 +2033,14 @@ rs6000_builtin_mul_widen_odd (tree type)
switch (TYPE_MODE (type))
{
case V8HImode:
return TYPE_UNSIGNED (type) ?
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUH] :
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSH];
return TYPE_UNSIGNED (type)
? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUH]
: rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSH];
case V16QImode:
return TYPE_UNSIGNED (type) ?
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUB] :
rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSB];
return TYPE_UNSIGNED (type)
? rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOUB]
: rs6000_builtin_decls[ALTIVEC_BUILTIN_VMULOSB];
default:
return NULL_TREE;
}
@ -9102,7 +9118,9 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
/* FIXME: There's got to be a nicer way to handle this case than
constructing a new CALL_EXPR. */
if (fcode == ALTIVEC_BUILTIN_VCFUX
|| fcode == ALTIVEC_BUILTIN_VCFSX)
|| fcode == ALTIVEC_BUILTIN_VCFSX
|| fcode == ALTIVEC_BUILTIN_VCTUXS
|| fcode == ALTIVEC_BUILTIN_VCTSXS)
{
if (call_expr_nargs (exp) == 1)
exp = build_call_nary (TREE_TYPE (exp), CALL_EXPR_FN (exp),

View file

@ -1,3 +1,8 @@
2008-08-08 Dorit Nuzman <dorit@il.ibm.com>
* lib/target-supports.exp (check_effective_target_vect_floatint_cvt):
Add powerpc.
2008-08-08 Daniel Kraft <d@domob.eu>
* gfortran.dg/finalize_9.f03: New test.

View file

@ -1203,6 +1203,8 @@ proc check_effective_target_vect_floatint_cvt { } {
} else {
set et_vect_floatint_cvt_saved 0
if { [istarget i?86-*-*]
|| ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
|| [istarget x86_64-*-*] } {
set et_vect_floatint_cvt_saved 1
}

View file

@ -3456,6 +3456,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
int i;
VEC(tree,heap) *vec_oprnds0 = NULL;
tree vop0;
tree integral_type;
/* Is STMT a vectorizable conversion? */
@ -3508,6 +3509,8 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
|| (!INTEGRAL_TYPE_P (rhs_type) && !INTEGRAL_TYPE_P (lhs_type)))
return false;
integral_type = INTEGRAL_TYPE_P (rhs_type) ? vectype_in : vectype_out;
if (modifier == NARROW)
ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
else
@ -3540,7 +3543,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
/* Supportable by target? */
if ((modifier == NONE
&& !targetm.vectorize.builtin_conversion (code, vectype_in))
&& !targetm.vectorize.builtin_conversion (code, integral_type))
|| (modifier == WIDEN
&& !supportable_widening_operation (code, stmt, vectype_in,
&decl1, &decl2,
@ -3550,7 +3553,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
&code1)))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "op not supported by target.");
fprintf (vect_dump, "conversion not supported by target.");
return false;
}
@ -3593,7 +3596,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, NULL);
builtin_decl =
targetm.vectorize.builtin_conversion (code, vectype_in);
targetm.vectorize.builtin_conversion (code, integral_type);
for (i = 0; VEC_iterate (tree, vec_oprnds0, i, vop0); i++)
{
/* Arguments are ready. create the new vector stmt. */