tree-vect-transform.c (vectorizable_conversion): Pass the integral type to vectorize...
authorDorit Nuzman <dorit@il.ibm.com>
Fri, 8 Aug 2008 19:00:36 +0000 (19:00 +0000)
committerDorit Nuzman <dorit@gcc.gnu.org>
Fri, 8 Aug 2008 19:00:36 +0000 (19:00 +0000)
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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp
gcc/tree-vect-transform.c

index 5c6811c..1558f03 100644 (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.
index 73d1bb4..206ee41 100644 (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;
index 2494056..38fb43c 100644 (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),
index 4ff5fd8..0d9eb93 100644 (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.
index 570b43e..33c8c71 100644 (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
         }
index 9d3d40a..9e2814f 100644 (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.  */