diff mbox

default_add_stmt_cost should call target specific builitin_vectorization_cost.

Message ID B71DF1153024A14EABB94E39368E44A6042C803C@SJEXCHMB13.corp.ad.broadcom.com
State New
Headers show

Commit Message

Bingfeng Mei June 6, 2014, 8:52 a.m. UTC
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

Comments

Richard Biener June 6, 2014, 9:40 a.m. UTC | #1
On Fri, Jun 6, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com> wrote:
> 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?

Ok.  (though that target hook should be removed at some point)

Thanks,
Richard.

> Thanks,
> Bingfeng Mei
>
> Index: gcc/ChangeLog
> ===================================================================
> --- gcc/ChangeLog       (revision 211281)
> +++ gcc/ChangeLog       (working copy)
> @@ -1,3 +1,8 @@
> +2014-06-05  Bingfeng Mei  <bmei@broadcom.com>
> +
> +       * targhooks.c (default_add_stmt_cost): Call target specific
> +       hook instead of default one.
> +
>  2014-06-05  Ilya Enkovich  <ilya.enkovich@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.  */
Bingfeng Mei June 6, 2014, 9:53 a.m. UTC | #2
Thanks. Committed.

Bingfeng

-----Original Message-----
From: Richard Biener [mailto:richard.guenther@gmail.com] 

Sent: 06 June 2014 10:40
To: Bingfeng Mei
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] default_add_stmt_cost should call target specific builitin_vectorization_cost.

On Fri, Jun 6, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com> wrote:
> 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?


Ok.  (though that target hook should be removed at some point)

Thanks,
Richard.

> Thanks,

> Bingfeng Mei

>

> Index: gcc/ChangeLog

> ===================================================================

> --- gcc/ChangeLog       (revision 211281)

> +++ gcc/ChangeLog       (working copy)

> @@ -1,3 +1,8 @@

> +2014-06-05  Bingfeng Mei  <bmei@broadcom.com>

> +

> +       * targhooks.c (default_add_stmt_cost): Call target specific

> +       hook instead of default one.

> +

>  2014-06-05  Ilya Enkovich  <ilya.enkovich@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.  */
diff mbox

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 211281)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2014-06-05  Bingfeng Mei  <bmei@broadcom.com>
+
+	* targhooks.c (default_add_stmt_cost): Call target specific
+	hook instead of default one.
+
 2014-06-05  Ilya Enkovich  <ilya.enkovich@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.  */