public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386] Fix ix86_multiplication_cost for SKX
@ 2018-02-07 13:02 Shalnov, Sergey
  2018-02-07 13:16 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Shalnov, Sergey @ 2018-02-07 13:02 UTC (permalink / raw)
  To: gcc-patches
  Cc: Peryt, Sebastian, Ivchenko, Alexander, 'Uros Bizjak',
	Kirill Yukhin

Hi,
This patch is one of the set of patches to fix SKX costs.

I think multiplication costs calculation algorithm needs to be adjusted in gcc/config/i386/i386.c ix86_multiplication_cost() function.
For TARGET_AVX512DQ emulation is not used and single vpmullq instruction emitted.
I think we have to align costs calculation algorithm with sequence of emitted instructions.

I don't see visible regressions for this change. This patch helps to avoid a regressions with further changes.

Could you please merge the patch to the main trunk?

Thank you
Sergey

2018-02-06  Sergey Shalnov  <Sergey.Shalnov@intel.com>
	gcc/
	* config/i386/i386.c (ix86_multiplication_cost): Fix multiplication
	cost for TARGET_AVX512DQ since it uses vpmullq instead
	emulated sequence


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 70b6775..6f4ec5d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -40393,6 +40393,10 @@ ix86_multiplication_cost (const struct processor_costs *cost,
 			   ? cost->mulsd : cost->mulss, true);
   else if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
     {
+      /* vpmullq is used in this case. No emulation is needed.  */
+      if (TARGET_AVX512DQ)
+	return ix86_vec_cost (mode, cost->mulss, true);
+
       /* V*QImode is emulated with 7-13 insns.  */
       if (mode == V16QImode || mode == V32QImode)
 	{

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, i386] Fix ix86_multiplication_cost for SKX
  2018-02-07 13:02 [PATCH, i386] Fix ix86_multiplication_cost for SKX Shalnov, Sergey
@ 2018-02-07 13:16 ` Uros Bizjak
  2018-02-08 11:55   ` Shalnov, Sergey
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2018-02-07 13:16 UTC (permalink / raw)
  To: Shalnov, Sergey
  Cc: gcc-patches, Peryt, Sebastian, Ivchenko, Alexander, Kirill Yukhin

On Wed, Feb 7, 2018 at 2:02 PM, Shalnov, Sergey
<sergey.shalnov@intel.com> wrote:
> Hi,
> This patch is one of the set of patches to fix SKX costs.

Please post the whole series for review.

Thanks,
Uros.

> I think multiplication costs calculation algorithm needs to be adjusted in gcc/config/i386/i386.c ix86_multiplication_cost() function.
> For TARGET_AVX512DQ emulation is not used and single vpmullq instruction emitted.
> I think we have to align costs calculation algorithm with sequence of emitted instructions.
>
> I don't see visible regressions for this change. This patch helps to avoid a regressions with further changes.
>
> Could you please merge the patch to the main trunk?
>
> Thank you
> Sergey
>
> 2018-02-06  Sergey Shalnov  <Sergey.Shalnov@intel.com>
>         gcc/
>         * config/i386/i386.c (ix86_multiplication_cost): Fix multiplication
>         cost for TARGET_AVX512DQ since it uses vpmullq instead
>         emulated sequence
>
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 70b6775..6f4ec5d 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -40393,6 +40393,10 @@ ix86_multiplication_cost (const struct processor_costs *cost,
>                            ? cost->mulsd : cost->mulss, true);
>    else if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
>      {
> +      /* vpmullq is used in this case. No emulation is needed.  */
> +      if (TARGET_AVX512DQ)
> +       return ix86_vec_cost (mode, cost->mulss, true);
> +
>        /* V*QImode is emulated with 7-13 insns.  */
>        if (mode == V16QImode || mode == V32QImode)
>         {
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH, i386] Fix ix86_multiplication_cost for SKX
  2018-02-07 13:16 ` Uros Bizjak
@ 2018-02-08 11:55   ` Shalnov, Sergey
  0 siblings, 0 replies; 3+ messages in thread
From: Shalnov, Sergey @ 2018-02-08 11:55 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: gcc-patches, Peryt, Sebastian, Ivchenko, Alexander, Kirill Yukhin

Uros,
I provided a patch for cost model tuning here https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00405.html
Current patch fixes a regression in a test that caused my cost model tuning patch.
Sergey

-----Original Message-----
From: Uros Bizjak [mailto:ubizjak@gmail.com] 
Sent: Wednesday, February 7, 2018 2:15 PM
To: Shalnov, Sergey <sergey.shalnov@intel.com>
Cc: gcc-patches@gcc.gnu.org; Peryt, Sebastian <sebastian.peryt@intel.com>; Ivchenko, Alexander <alexander.ivchenko@intel.com>; Kirill Yukhin <kirill.yukhin@gmail.com>
Subject: Re: [PATCH, i386] Fix ix86_multiplication_cost for SKX

On Wed, Feb 7, 2018 at 2:02 PM, Shalnov, Sergey <sergey.shalnov@intel.com> wrote:
> Hi,
> This patch is one of the set of patches to fix SKX costs.

Please post the whole series for review.

Thanks,
Uros.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-08 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 13:02 [PATCH, i386] Fix ix86_multiplication_cost for SKX Shalnov, Sergey
2018-02-07 13:16 ` Uros Bizjak
2018-02-08 11:55   ` Shalnov, Sergey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).