aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDorit Nuzman <dorit@il.ibm.com>2008-08-08 19:00:36 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2008-08-08 19:00:36 +0000
commit7910ae0cde83554100eefaca68a506bb25655498 (patch)
treeaa8655be46a1806b9692a464a4fabff43b1eb1b9 /gcc
parentf6fad28ea1317a6aa30869b40c427ad56c6950c5 (diff)
downloadgcc-7910ae0cde83554100eefaca68a506bb25655498.zip
gcc-7910ae0cde83554100eefaca68a506bb25655498.tar.gz
gcc-7910ae0cde83554100eefaca68a506bb25655498.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/i386/i386.c8
-rw-r--r--gcc/config/rs6000/rs6000.c52
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/lib/target-supports.exp2
-rw-r--r--gcc/tree-vect-transform.c9
6 files changed, 67 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c6811c..1558f03 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 73d1bb4..206ee41 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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;
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 2494056..38fb43c 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -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),
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4ff5fd8..0d9eb93 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 570b43e..33c8c71 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -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
}
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 9d3d40a..9e2814f 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -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. */