public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386] Fix behavior for –mprefer-vector-width= option
@ 2017-11-22 15:14 Shalnov, Sergey
  2017-11-22 20:32 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Shalnov, Sergey @ 2017-11-22 15:14 UTC (permalink / raw)
  To: gcc-patches
  Cc: kirill.yukhin, Koval, Julia, Senkevich, Andrew, Peryt, Sebastian,
	Ivchenko, Alexander, Joseph Myers, Uros Bizjak

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

Hi,
This patch making –mprefer-vector-width= option inclusive. This means that 
if we use –mprefer-vector-width=128 it should switch TARGET_PREFER_AVX128=ON 
and TARGET_PREFER_AVX256=ON also.
It is minor change to generate “xmm” with –mprefer-vector-width=128 
on the platform with “zmm”.

Sergey

2017-11-22  Sergey Shalnov  <Sergey.Shalnov@intel.com>
gcc/
	* config/i386/i386.h (TARGET_PREFER_AVX256): Add inclusiveness of
	the TARGET_PREFER_AVX256 for TARGET_PREFER_AVX128



[-- Attachment #2: 0006-Fix-behavior-for-mprefer-vector-width-option.patch --]
[-- Type: application/octet-stream, Size: 979 bytes --]

From 1edd878e0e21579969b0d1bf0e5b2f13bcce3cde Mon Sep 17 00:00:00 2001
From: Sergey Shalnov <Sergey.Shalnov@intel.com>
Date: Wed, 22 Nov 2017 17:49:07 +0300
Subject: [PATCH 1/1] Fix behavior for -mprefer-vector-width= option

---
 gcc/config/i386/i386.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 6eadc03..293445c 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2681,7 +2681,8 @@ extern void debug_dispatch_window (int);
 /* Use 128-bit AVX instructions in the auto-vectorizer.  */
 #define TARGET_PREFER_AVX128	(prefer_vector_width_type == PVW_AVX128)
 /* Use 256-bit AVX instructions in the auto-vectorizer.  */
-#define TARGET_PREFER_AVX256	(prefer_vector_width_type == PVW_AVX256)
+#define TARGET_PREFER_AVX256	(TARGET_PREFER_AVX128 || \
+				 (prefer_vector_width_type == PVW_AVX256))
 
 #define IX86_HLE_ACQUIRE (1 << 16)
 #define IX86_HLE_RELEASE (1 << 17)
-- 
1.8.3.1


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

* Re: [PATCH, i386] Fix behavior for –mprefer-vector-width= option
  2017-11-22 15:14 [PATCH, i386] Fix behavior for –mprefer-vector-width= option Shalnov, Sergey
@ 2017-11-22 20:32 ` Uros Bizjak
  2017-11-23  9:45   ` Shalnov, Sergey
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2017-11-22 20:32 UTC (permalink / raw)
  To: Shalnov, Sergey
  Cc: gcc-patches, kirill.yukhin, Koval, Julia, Senkevich, Andrew,
	Peryt, Sebastian, Ivchenko, Alexander, Joseph Myers

On Wed, Nov 22, 2017 at 3:58 PM, Shalnov, Sergey
<sergey.shalnov@intel.com> wrote:
> Hi,
> This patch making –mprefer-vector-width= option inclusive. This means that
> if we use –mprefer-vector-width=128 it should switch TARGET_PREFER_AVX128=ON
> and TARGET_PREFER_AVX256=ON also.
> It is minor change to generate “xmm” with –mprefer-vector-width=128
> on the platform with “zmm”.
>
> Sergey
>
> 2017-11-22  Sergey Shalnov  <Sergey.Shalnov@intel.com>
> gcc/
>         * config/i386/i386.h (TARGET_PREFER_AVX256): Add inclusiveness of
>         the TARGET_PREFER_AVX256 for TARGET_PREFER_AVX128

You could just say:

        * config/i386/i386.h (TARGET_PREFER_AVX256): Also
        enable when TARGET_PREFER_AVX128 is set.

+#define TARGET_PREFER_AVX256    (TARGET_PREFER_AVX128 || \
+                 (prefer_vector_width_type == PVW_AVX256))

No need for extra parenthesis, and following the GNU coding standard,
the condition should start on the next line:

#define TARGET_PREFER_AVX256    (TARGET_PREFER_AVX128 \
                 || prefer_vector_width_type == PVW_AVX256)

Otherwise OK.

Uros.

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

* RE: [PATCH, i386] Fix behavior for –mprefer-vector-width= option
  2017-11-22 20:32 ` Uros Bizjak
@ 2017-11-23  9:45   ` Shalnov, Sergey
  0 siblings, 0 replies; 3+ messages in thread
From: Shalnov, Sergey @ 2017-11-23  9:45 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: gcc-patches, kirill.yukhin, Koval, Julia, Senkevich, Andrew,
	Peryt, Sebastian, Ivchenko, Alexander, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]

Uros,
Thank you for review. New patch with addressed comments is attached.
Could you please merge it?

Thank you
Sergey

2017-11-23  Sergey Shalnov  <Sergey.Shalnov@intel.com>

gcc/
	* config/i386/i386.h (TARGET_PREFER_AVX256): Also
	enable when TARGET_PREFER_AVX128 is set.


-----Original Message-----
From: Uros Bizjak [mailto:ubizjak@gmail.com] 
Sent: Wednesday, November 22, 2017 9:18 PM
To: Shalnov, Sergey <sergey.shalnov@intel.com>
Cc: gcc-patches@gcc.gnu.org; kirill.yukhin@gmail.com; Koval, Julia <julia.koval@intel.com>; Senkevich, Andrew <andrew.senkevich@intel.com>; Peryt, Sebastian <sebastian.peryt@intel.com>; Ivchenko, Alexander <alexander.ivchenko@intel.com>; Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH, i386] Fix behavior for –mprefer-vector-width= option

On Wed, Nov 22, 2017 at 3:58 PM, Shalnov, Sergey <sergey.shalnov@intel.com> wrote:
> Hi,
> This patch making –mprefer-vector-width= option inclusive. This means 
> that if we use –mprefer-vector-width=128 it should switch 
> TARGET_PREFER_AVX128=ON and TARGET_PREFER_AVX256=ON also.
> It is minor change to generate “xmm” with –mprefer-vector-width=128 on 
> the platform with “zmm”.
>
> Sergey
>
> 2017-11-22  Sergey Shalnov  <Sergey.Shalnov@intel.com> gcc/
>         * config/i386/i386.h (TARGET_PREFER_AVX256): Add inclusiveness of
>         the TARGET_PREFER_AVX256 for TARGET_PREFER_AVX128

You could just say:

        * config/i386/i386.h (TARGET_PREFER_AVX256): Also
        enable when TARGET_PREFER_AVX128 is set.

+#define TARGET_PREFER_AVX256    (TARGET_PREFER_AVX128 || \
+                 (prefer_vector_width_type == PVW_AVX256))

No need for extra parenthesis, and following the GNU coding standard, the condition should start on the next line:

#define TARGET_PREFER_AVX256    (TARGET_PREFER_AVX128 \
                 || prefer_vector_width_type == PVW_AVX256)

Otherwise OK.

Uros.

[-- Attachment #2: 0006-Fix-behavior-for-mprefer-vector-width-option.patch --]
[-- Type: application/octet-stream, Size: 973 bytes --]

From 8ad29d7b7720138267d25ba9d5cc477489876606 Mon Sep 17 00:00:00 2001
From: Sergey Shalnov <Sergey.Shalnov@intel.com>
Date: Wed, 22 Nov 2017 17:49:07 +0300
Subject: [PATCH 1/1] Fix behavior for -mprefer-vector-width= option

---
 gcc/config/i386/i386.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 6eadc03..1a7240c 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2681,7 +2681,8 @@ extern void debug_dispatch_window (int);
 /* Use 128-bit AVX instructions in the auto-vectorizer.  */
 #define TARGET_PREFER_AVX128	(prefer_vector_width_type == PVW_AVX128)
 /* Use 256-bit AVX instructions in the auto-vectorizer.  */
-#define TARGET_PREFER_AVX256	(prefer_vector_width_type == PVW_AVX256)
+#define TARGET_PREFER_AVX256	(TARGET_PREFER_AVX128 \
+	|| prefer_vector_width_type == PVW_AVX256)
 
 #define IX86_HLE_ACQUIRE (1 << 16)
 #define IX86_HLE_RELEASE (1 << 17)
-- 
1.8.3.1


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

end of thread, other threads:[~2017-11-23  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 15:14 [PATCH, i386] Fix behavior for –mprefer-vector-width= option Shalnov, Sergey
2017-11-22 20:32 ` Uros Bizjak
2017-11-23  9:45   ` 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).