Hi,
I came across this issue a while back. My colleague Paulo Matos asked
and it was agreed that this is a bug. But he forgot to submit a patch.

default_add_stmt_cost should call target specific builtin_vectozriation_cost.
instead of default_builtin_vectorization_cost directly. So if the hook 
TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST is defined, it will use that cost.
Otherwise, it will fall back to default_builtin_vectorization_cost.

Bootstrapped and tested. OK for trunk?

Thanks,
Bingfeng Mei

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog       (revision 211281)
+++ gcc/ChangeLog       (working copy)
@@ -1,3 +1,8 @@
+2014-06-05  Bingfeng Mei  <b...@broadcom.com>
+
+       * targhooks.c (default_add_stmt_cost): Call target specific
+       hook instead of default one.
+
 2014-06-05  Ilya Enkovich  <ilya.enkov...@intel.com>
 
        * tree-inline.c (tree_function_versioning): Check DF info existence
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c     (revision 211281)
+++ gcc/targhooks.c     (working copy)
@@ -1073,8 +1073,8 @@ default_add_stmt_cost (void *data, int c
   unsigned retval = 0;
 
   tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
-  int stmt_cost = default_builtin_vectorization_cost (kind, vectype,
-                                                         misalign);
+  int stmt_cost = targetm.vectorize.builtin_vectorization_cost (kind, vectype,
+                                                               misalign);
    /* Statements in an inner loop relative to the loop being
       vectorized are weighted more heavily.  The value here is
       arbitrary and could potentially be improved with analysis.  */

Reply via email to